Kaynağa Gözat

Don't send a mouse leave event if the mouse is outside the window when gaining focus and in relative mode.

Sam Lantinga 3 yıl önce
ebeveyn
işleme
a70a94e0b3
1 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. 6 3
      src/video/windows/SDL_windowsevents.c

+ 6 - 3
src/video/windows/SDL_windowsevents.c

@@ -403,9 +403,12 @@ WIN_UpdateFocus(SDL_Window *window)
 
         SDL_SetKeyboardFocus(window);
 
-        GetCursorPos(&cursorPos);
-        ScreenToClient(hwnd, &cursorPos);
-        SDL_SendMouseMotion(window, 0, 0, cursorPos.x, cursorPos.y);
+        /* In relative mode we are guaranteed to have mouse focus if we have keyboard focus */
+        if (!SDL_GetMouse()->relative_mode) {
+            GetCursorPos(&cursorPos);
+            ScreenToClient(hwnd, &cursorPos);
+            SDL_SendMouseMotion(window, 0, 0, cursorPos.x, cursorPos.y);
+        }
 
         WIN_CheckAsyncMouseRelease(data);
         WIN_UpdateClipCursor(window);