From d2fd9b1b9818b3ec88487967e010f66e92952f55 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 6 May 2019 15:06:52 +0200 Subject: Windows QPA: Fix window frame calculation in multi-monitor setups When introducing EnableNonClientDpiScaling() for QTBUG-53255, the window frame calculation was not adapted. That is, window frames were calculated from the style for the primary screen only, causing - minimum size constraints not being calculated correctly for applications on secondary screens when populating the MINMAXINFO structure. - warnings about not being able to apply a geometry when moving fixed size windows across screens. The calculation of the frames for propagating size hints is also no longer required after 3035400f36731c400adb9204b94e9afe346a71b7, which retrieves them from the WM_NCCALCSIZE message; QWindowsWindow::fullFrameMargins() can be used instead. For newly created windows, use the newly added AdjustWindowRectExForDpi() function to calculate the initial frame size. Change QWindowsGeometryHint from a class to a collection of static functions and add overloads to calculate the frame. In checkForScreenChanged(), update the margins until WM_NCCALCSIZE is received. Task-number: QTBUG-67777 Task-number: QTBUG-65580 Task-number: QTBUG-53255 Change-Id: Iff2d382b2b316adec6c1a0622ae8015dba6de371 Reviewed-by: Oliver Wolff Reviewed-by: Andre de la Rocha --- src/plugins/platforms/windows/qwindowsintegration.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/platforms/windows/qwindowsintegration.cpp') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 2c90b0484e..5c1fa00088 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -353,6 +353,9 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons QWindowsWindow *result = createPlatformWindowHelper(window, obtained); Q_ASSERT(result); + if (window->isTopLevel() && !QWindowsContext::shouldHaveNonClientDpiScaling(window)) + result->setFlag(QWindowsWindow::DisableNonClientScaling); + if (QWindowsMenuBar *menuBarToBeInstalled = QWindowsMenuBar::menuBarOf(window)) menuBarToBeInstalled->install(result); -- cgit v1.2.3