From e86fcae22144236258ad5d82eeb6b20b557e3981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Keller?= Date: Tue, 7 Feb 2023 16:54:59 +0100 Subject: [PATCH] Windows QPA: Handle DPI induced geometry change for frameless windows Make a manual call to the geometry change handling function after a WM_DPICHANGED event if the window is frameless, since WM_SIZE and WM_MOVE will not be called. Fixes: QTBUG-109429 Pick-to: 6.5 Change-Id: I79b9f386fe120ee3d06d6490d3f31a7a5d7121b0 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowswindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 323456bcc4..120c50249a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2009,6 +2009,11 @@ void QWindowsWindow::handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam) SetWindowPos(hwnd, nullptr, prcNewWindow->left, prcNewWindow->top, prcNewWindow->right - prcNewWindow->left, prcNewWindow->bottom - prcNewWindow->top, SWP_NOZORDER | SWP_NOACTIVATE); + // If the window does not have a frame, WM_MOVE and WM_SIZE won't be + // called which prevents the content from being scaled appropriately + // after a DPI change. + if (m_data.flags & Qt::FramelessWindowHint) + handleGeometryChange(); } // Re-apply mask now that we have a new DPI, which have resulted in