qwindowswindow: Fix screen changes between different DPI screens for native windows

When asynchronous events are used for notifications about screen changes
it is possible that we run into a race condition where the scale factor
has not yet been updated for the new screen. This results in a wrong
geometry being set for the window that is moved between the screens.
We do not have that problem with synchronous events.

Change-Id: I4eb6d2a7cb49517d271901b479f973e273a0926a
Amends: 7eed1e40d4
Task-number: QTBUG-65580
Fixes: QTBUG-82312
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Oliver Wolff 2020-02-21 09:10:28 +01:00
parent 6324873543
commit 529cfe4e22

View File

@ -1943,10 +1943,8 @@ void QWindowsWindow::checkForScreenChanged(ScreenChangeMode mode)
qCDebug(lcQpaWindows).noquote().nospace() << __FUNCTION__
<< ' ' << window() << " \"" << (currentScreen ? currentScreen->name() : QString())
<< "\"->\"" << newScreen->name() << '"';
if (mode == FromGeometryChange)
setFlag(SynchronousGeometryChangeEvent);
updateFullFrameMargins();
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(window(), newScreen->screen());
}
void QWindowsWindow::handleGeometryChange()