Windows QPA: Fix restoring from fullscreen in High DPI setups

The logic for checking whether the saved geometry (native pixels)
is still within a screen compared them against logical coordinates.
Work with the platform screen geometry instead.

Fixes: QTBUG-83448
Change-Id: Ib68f967d1a33a490f88a7bec6dcc788788a10389
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Friedemann Kleint 2020-04-14 08:09:04 +02:00
parent 5e3b32b608
commit c92fedd761

View File

@ -2287,8 +2287,10 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowStates newState)
if (!screen) if (!screen)
screen = QGuiApplication::primaryScreen(); screen = QGuiApplication::primaryScreen();
// That area of the virtual desktop might not be covered by a screen anymore. // That area of the virtual desktop might not be covered by a screen anymore.
if (!screen->geometry().intersects(m_savedFrameGeometry)) if (const auto platformScreen = screen->handle()) {
m_savedFrameGeometry.moveTo(screen->geometry().topLeft()); if (!platformScreen->geometry().intersects(m_savedFrameGeometry))
m_savedFrameGeometry.moveTo(platformScreen->geometry().topLeft());
}
if (newState & Qt::WindowMinimized) { if (newState & Qt::WindowMinimized) {
setMinimizedGeometry(m_data.hwnd, m_savedFrameGeometry); setMinimizedGeometry(m_data.hwnd, m_savedFrameGeometry);