diff options
author | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-04-15 14:00:10 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-04-16 09:32:19 +0000 |
commit | d4bc56cb4218f6f8378f04c23865156b349b037d (patch) | |
tree | 16b877f7dfdbeab8206799f7b30f63d7629b0c49 /src/plugins/platforms | |
parent | 090002618ff4889f1953642ab9d73bceaa1c962a (diff) |
Fix screen detection on configureNotify
If we got two rapid screen changes in a row, we would disregard
the second change. This happens because QPlatformScreen::screen()
is updated asynchronously, so if we got a screen change A --> B
immediately followed by B --> A, before the first screen change
event had been processed, we would compare with the old value
and conclude nothing had changed. This can happen on creation: if
the initial geometry of the window is outside all physical screens,
the window manager will immediately move it.
The solution is to compare the new screen to the locally cached
value.
Change-Id: I5440dc035cac4fba4f29ac563e36dfe3e2f82aea
Task-number: QTBUG-45076
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 77c431edb2..3188a7f19d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2005,6 +2005,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); QXcbScreen *newScreen = parent() ? parentScreen() : screenForNativeGeometry(nativeRect); + QXcbScreen *currentScreen = m_xcbScreen; m_xcbScreen = newScreen; if (!newScreen) return; @@ -2012,7 +2013,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); - if (newScreen != screen()) + if (newScreen != currentScreen) QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); m_configureNotifyPending = false; |