Capture mouse properly on macOS when outside of window, fixes issue #584

This commit is contained in:
Stephen Saunders 2021-06-15 01:53:35 -04:00
parent 3b3e08510d
commit 041db6b348
2 changed files with 10 additions and 0 deletions

View file

@ -366,6 +366,11 @@ bool GLimp_Init( glimpParms_t parms )
{
common->Printf( "Using GLEW %s\n", glewGetString( GLEW_VERSION ) );
}
#if defined(__APPLE__) && SDL_VERSION_ATLEAST(2, 0, 2)
// SRS - On OSX enable SDL2 relative mouse mode warping to capture mouse properly if outside of window
SDL_SetHintWithPriority( SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE );
#endif
// DG: disable cursor, we have two cursors in menu (because mouse isn't grabbed in menu)
SDL_ShowCursor( SDL_DISABLE );

View file

@ -317,6 +317,11 @@ bool VKimp_Init( glimpParms_t parms )
common->Printf( "No usable VK mode found: %s", SDL_GetError() );
return false;
}
#if defined(__APPLE__) && SDL_VERSION_ATLEAST(2, 0, 2)
// SRS - On OSX enable SDL2 relative mouse mode warping to capture mouse properly if outside of window
SDL_SetHintWithPriority( SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE );
#endif
// DG: disable cursor, we have two cursors in menu (because mouse isn't grabbed in menu)
SDL_ShowCursor( SDL_DISABLE );