xcb: Propagate size hints when window changes its scaling factor

Properly scale size hints to the new scaling factor.

Fixes: QTBUG-80476
Change-Id: I1081c9b01560f7e434f0f1de0199ef3d3cae787c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Błażej Szczygieł 2019-12-02 18:17:35 +01:00
parent f3b3c971cf
commit f2a61f2ce2
2 changed files with 7 additions and 0 deletions

View File

@ -1398,6 +1398,8 @@ void QXcbWindow::propagateSizeHints()
} }
xcb_icccm_set_wm_normal_hints(xcb_connection(), m_window, &hints); xcb_icccm_set_wm_normal_hints(xcb_connection(), m_window, &hints);
m_sizeHintsScaleFactor = QHighDpiScaling::scaleAndOrigin(screen()).factor;
} }
void QXcbWindow::requestActivateWindow() void QXcbWindow::requestActivateWindow()
@ -1789,6 +1791,9 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
// will make the comparison later. // will make the comparison later.
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
if (!qFuzzyCompare(QHighDpiScaling::scaleAndOrigin(newScreen).factor, m_sizeHintsScaleFactor))
propagateSizeHints();
// Send the synthetic expose event on resize only when the window is shrinked, // Send the synthetic expose event on resize only when the window is shrinked,
// because the "XCB_GRAVITY_NORTH_WEST" flag doesn't send it automatically. // because the "XCB_GRAVITY_NORTH_WEST" flag doesn't send it automatically.
if (!m_oldWindowSize.isEmpty() if (!m_oldWindowSize.isEmpty()

View File

@ -280,6 +280,8 @@ protected:
QXcbSyncWindowRequest *m_pendingSyncRequest = nullptr; QXcbSyncWindowRequest *m_pendingSyncRequest = nullptr;
int m_swapInterval = -1; int m_swapInterval = -1;
qreal m_sizeHintsScaleFactor = 1.0;
}; };
class QXcbForeignWindow : public QXcbWindow class QXcbForeignWindow : public QXcbWindow