summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowswindow.cpp
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2022-05-03 22:45:10 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2022-05-10 13:51:04 +0000
commit83779c858b7ba258516685827dd53dc3f59308da (patch)
treea70328b2c3ec0166cf7815f439d1e74ec66cfbce /src/plugins/platforms/windows/qwindowswindow.cpp
parent3bc80195dfc683387ae438ad0bdfdd19b3adb037 (diff)
Windows QPA: Send screen change before geometry change
Fix bug where the device independent QWindow size was set incorrectly, due to usage of incorrect screen and scale factor. This could happen when a window's screen was set to QGuiApplication::primaryScreen() as a fallback, before QWindowsWindow::initialize() would determine the correct screen. By sending the screen change first we make sure that that QWindowSystemInterface::handleGeeometryChange() uses the correct screen for the window. Change-Id: I5520ae67a4db60903d38db856fc314c75a3c0219 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 389c2249e1..5cb0607819 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1560,13 +1560,13 @@ void QWindowsWindow::initialize()
if (w->type() != Qt::Desktop) {
const Qt::WindowState state = w->windowState();
const QRect obtainedGeometry(creationContext->obtainedPos, creationContext->obtainedSize);
+ QPlatformScreen *obtainedScreen = screenForGeometry(obtainedGeometry);
+ if (obtainedScreen && screen() != obtainedScreen)
+ QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(w, obtainedScreen->screen());
if (state != Qt::WindowMaximized && state != Qt::WindowFullScreen
&& creationContext->requestedGeometryIn != obtainedGeometry) {
QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(w, obtainedGeometry);
}
- QPlatformScreen *obtainedScreen = screenForGeometry(obtainedGeometry);
- if (obtainedScreen && screen() != obtainedScreen)
- QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(w, obtainedScreen->screen());
}
QWindowsWindow::setSavedDpi(GetDpiForWindow(handle()));
}