Warp mode for relative mouse on OSX SDL 2.0.4

Fixes #1232
This commit is contained in:
Brad Hughes 2016-08-27 14:23:34 -04:00
parent 7df8323c2d
commit 9af893666a

View File

@ -64,6 +64,8 @@
#define WMSZ_RIGHT (7)
#endif
#define SDL_VERSION_EQUALS(v1, vnum2) (SDL_VERSIONNUM(v1.major, v1.minor, v1.patch) == vnum2)
class SDL_DM_Wrapper
{
public:
@ -714,6 +716,24 @@ int sdl_window_info::complete_create()
*/
#endif
// We need to workaround an issue in SDL 2.0.4 for OS X where setting the
// relative mode on the mouse in fullscreen mode makes mouse events stop
// It is fixed in the latest revisions so we'll assume it'll be fixed
// in the next public SDL release as well
#if defined(SDLMAME_MACOSX) && SDL_VERSION_ATLEAST(2, 0, 2) // SDL_HINT_MOUSE_RELATIVE_MODE_WARP is introduced in 2.0.2
SDL_version linked;
SDL_GetVersion(&linked);
int revision = SDL_GetRevisionNumber();
// If we're running the exact version of SDL 2.0.4 (revision 10001) from the
// SDL web site, we need to work around this issue and send the warp mode hint
if (SDL_VERSION_EQUALS(linked, SDL_VERSIONNUM(2, 0, 4)) && revision == 10001)
{
osd_printf_verbose("Using warp mode for relative mouse in OS X SDL 2.0.4\n");
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1");
}
#endif
// create the SDL window
// soft driver also used | SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_MOUSE_FOCUS
m_extra_flags |= (fullscreen() ?