Просмотр исходного кода

Don't center the mouse when gaining focus unless we're using relative mode warping

This is necessary now that we actually change the mouse position when calling SDL_WarpMouseInWindow() in relative mode.
Sam Lantinga 3 лет назад
Родитель
Сommit
1c5b3e0e16
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/video/SDL_video.c

+ 3 - 1
src/video/SDL_video.c

@@ -2897,7 +2897,9 @@ SDL_OnWindowFocusGained(SDL_Window * window)
 
     if (mouse && mouse->relative_mode) {
         SDL_SetMouseFocus(window);
-        SDL_WarpMouseInWindow(window, window->w/2, window->h/2);
+        if (mouse->relative_mode_warp) {
+            SDL_WarpMouseInWindow(window, window->w/2, window->h/2);
+        }
     }
 
     SDL_UpdateWindowGrab(window);