Relative mouse mode is tied to the window with keyboard focus

This isn't obvious, but makes sense when thinking about how games actually use it. This is also in line with how Windows mouse relative mode is implemented.

Fixes https://github.com/libsdl-org/SDL/issues/5340
main
Sam Lantinga 2022-03-19 11:00:00 -07:00
parent b559a4accc
commit 0517b61ed6
1 changed files with 2 additions and 2 deletions

View File

@ -262,7 +262,7 @@ Cocoa_SetRelativeMouseMode(SDL_bool enabled)
/* We will re-apply the relative mode when the window gets focus, if it
* doesn't have focus right now.
*/
SDL_Window *window = SDL_GetMouseFocus();
SDL_Window *window = SDL_GetKeyboardFocus();
if (!window) {
return 0;
}