소스 검색

If the client rect is empty, use the last known window size

This happens on Windows 11 with fullscreen desktop windows when the desktop is brought up with the Windows+D shortcut.

Fixes https://github.com/libsdl-org/SDL/issues/7419
Sam Lantinga 3 년 전
부모
커밋
2ca727aec6
2개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 2
      src/video/windows/SDL_windowsevents.c
  2. 3 3
      src/video/windows/SDL_windowswindow.c

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

@@ -1395,8 +1395,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                 RECT rect;
                 RECT rect;
                 float x, y;
                 float x, y;
 
 
-                if (!GetClientRect(hwnd, &rect) ||
-                    (rect.right == rect.left && rect.bottom == rect.top)) {
+                if (!GetClientRect(hwnd, &rect) || IsRectEmpty(&rect)) {
                     if (inputs) {
                     if (inputs) {
                         SDL_small_free(inputs, isstack);
                         SDL_small_free(inputs, isstack);
                     }
                     }

+ 3 - 3
src/video/windows/SDL_windowswindow.c

@@ -792,12 +792,12 @@ void WIN_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h)
     HWND hwnd = data->hwnd;
     HWND hwnd = data->hwnd;
     RECT rect;
     RECT rect;
 
 
-    if (GetClientRect(hwnd, &rect)) {
+    if (GetClientRect(hwnd, &rect) && !IsRectEmpty(&rect)) {
         *w = rect.right;
         *w = rect.right;
         *h = rect.bottom;
         *h = rect.bottom;
     } else {
     } else {
-        *w = 0;
-        *h = 0;
+        *w = window->last_pixel_w;
+        *h = window->last_pixel_h;
     }
     }
 }
 }