mirror of https://github.com/encounter/SDL.git
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 (cherry picked from commit 2ca727aec6f5f264620f80999beb5ef77eefec4a) (cherry picked from commit 46d143376a55817c240a58f226ca944581d414cf)
This commit is contained in:
parent
69875ad80f
commit
596a594714
|
@ -1317,8 +1317,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) ||
|
if (!GetClientRect(hwnd, &rect) || IsRectEmpty(&rect)) {
|
||||||
(rect.right == rect.left && rect.bottom == rect.top)) {
|
|
||||||
if (inputs) {
|
if (inputs) {
|
||||||
SDL_small_free(inputs, isstack);
|
SDL_small_free(inputs, isstack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -790,12 +790,12 @@ 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;
|
*w = window->w;
|
||||||
*h = 0;
|
*h = window->h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue