From 1e206558130afafca3fa3d31d2d18eeb7a9f88bc Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jul 2021 17:52:22 +0200 Subject: [PATCH] Fixes window resizing in DPI scaled mode, fixes #1524. --- src/win/win_ui.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 0c74499a9..3773d369c 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -1032,10 +1032,21 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom - sbar_height, TRUE); GetClientRect(hwndRender, &rect); - if (rect.right != scrnsz_x || rect.bottom != scrnsz_y) { - scrnsz_x = rect.right; - scrnsz_y = rect.bottom; - doresize = 1; + if (dpi_scale) { + temp_x = MulDiv(rect.right, 96, dpi); + temp_y = MulDiv(rect.bottom, 96, dpi); + + if (temp_x != scrnsz_x || temp_y != scrnsz_y) { + scrnsz_x = temp_x; + scrnsz_y = temp_y; + doresize = 1; + } + } else { + if (rect.right != scrnsz_x || rect.bottom != scrnsz_y) { + scrnsz_x = rect.right; + scrnsz_y = rect.bottom; + doresize = 1; + } } plat_vidsize(rect.right, rect.bottom);