diff options
author | Morten Sørvig <morten.sorvig@qt.io> | 2022-05-03 22:45:10 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2022-05-10 13:51:04 +0000 |
commit | 83779c858b7ba258516685827dd53dc3f59308da (patch) | |
tree | a70328b2c3ec0166cf7815f439d1e74ec66cfbce /src | |
parent | 3bc80195dfc683387ae438ad0bdfdd19b3adb037 (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')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 6 |
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())); } |