From 5b319fe1b4890622ea815445f07e29acada2e3c7 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Tue, 3 Nov 2026 10:33:48 -0500
Subject: [PATCH] win32: Use the suggested size rect when handling DPI changes
Use the suggested rect for resizable windows when handling DPI changes, as maximized and arranged windows need their size adjusted to fit the new layout after the decorations and taskbar change size.
---
src/video/windows/SDL_windowsevents.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 66f43ce71292e..3fa887da7e81b 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -2460,9 +2460,12 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
}
// Interactive user-initiated resizing/movement
- {
- /* Calculate the new frame w/h such that
- the client area size is maintained. */
+ if (data->window->flags & SDL_WINDOW_RESIZABLE) {
+ // The desktop dictates the size, particularly to maintain a maximized or arranged layout.
+ w = suggestedRect->right - suggestedRect->left;
+ h = suggestedRect->bottom - suggestedRect->top;
+ } else {
+ // Calculate the new frame w/h such that the fixed client area size is maintained.
RECT rect = { 0 };
rect.right = data->window->w;
rect.bottom = data->window->h;