src/events/SDL_mouse.c
changeset 12886 6f8f744a09dc
parent 12855 ac0c65535817
child 12929 d6c5eb7a0afb
     1.1 --- a/src/events/SDL_mouse.c	Tue Jun 18 14:24:24 2019 -0700
     1.2 +++ b/src/events/SDL_mouse.c	Tue Jun 18 14:24:26 2019 -0700
     1.3 @@ -785,14 +785,6 @@
     1.4          return 0;
     1.5      }
     1.6  
     1.7 -    if (enabled && focusWindow) {
     1.8 -        /* Center it in the focused window to prevent clicks from going through
     1.9 -         * to background windows.
    1.10 -         */
    1.11 -        SDL_SetMouseFocus(focusWindow);
    1.12 -        SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2);
    1.13 -    }
    1.14 -
    1.15      /* Set the relative mode */
    1.16      if (!enabled && mouse->relative_mode_warp) {
    1.17          mouse->relative_mode_warp = SDL_FALSE;
    1.18 @@ -811,6 +803,14 @@
    1.19      mouse->scale_accum_x = 0.0f;
    1.20      mouse->scale_accum_y = 0.0f;
    1.21  
    1.22 +    if (enabled && focusWindow) {
    1.23 +        /* Center it in the focused window to prevent clicks from going through
    1.24 +         * to background windows.
    1.25 +         */
    1.26 +        SDL_SetMouseFocus(focusWindow);
    1.27 +        SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2);
    1.28 +    }
    1.29 +
    1.30      if (mouse->focus) {
    1.31          SDL_UpdateWindowGrab(mouse->focus);
    1.32