diff options
Diffstat (limited to 'src/osd/sdl/window.cpp')
-rw-r--r-- | src/osd/sdl/window.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index f878a283748..450b4b59550 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -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() ? |