mirror of https://github.com/encounter/SDL.git
Cocoa: Fixed relative mouse mode when app loses/regains focus (thanks, Eric!).
Fixes Bugzilla #2718.
This commit is contained in:
parent
d074a532e2
commit
80916e01f3
|
@ -531,13 +531,15 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
|||
{
|
||||
SDL_Window *window = _data->window;
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
/* We're going to get keyboard events, since we're key. */
|
||||
/* This needs to be done before restoring the relative mouse mode. */
|
||||
SDL_SetKeyboardFocus(window);
|
||||
|
||||
if (mouse->relative_mode && !mouse->relative_mode_warp && ![self isMoving]) {
|
||||
mouse->SetRelativeMouseMode(SDL_TRUE);
|
||||
}
|
||||
|
||||
/* We're going to get keyboard events, since we're key. */
|
||||
SDL_SetKeyboardFocus(window);
|
||||
|
||||
/* If we just gained focus we need the updated mouse position */
|
||||
if (!mouse->relative_mode) {
|
||||
NSPoint point;
|
||||
|
|
Loading…
Reference in New Issue