瀏覽代碼

Fix mouse focus being set to null when a captured mouse cursor leaves the window.

Rémy Tassoux 3 年之前
父節點
當前提交
6e356e20ad
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/video/windows/SDL_windowsevents.c

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

@@ -979,7 +979,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
            being lost. This then causes a cascading failure where SDL_WINDOWEVENT_ENTER / SDL_WINDOWEVENT_LEAVE
            being lost. This then causes a cascading failure where SDL_WINDOWEVENT_ENTER / SDL_WINDOWEVENT_LEAVE
            can stop firing permanently, due to the focus being in the wrong state and TrackMouseEvent never
            can stop firing permanently, due to the focus being in the wrong state and TrackMouseEvent never
            resubscribing. */
            resubscribing. */
-        SDL_SetMouseFocus(NULL);
+        const SDL_bool isCapture = ((data->window->flags & SDL_WINDOW_MOUSE_CAPTURE) != 0);
+        if (!isCapture)
+            SDL_SetMouseFocus(NULL);
 
 
         returnCode = 0;
         returnCode = 0;
         break;
         break;