summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-06 15:20:10 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-15 14:37:03 +0000
commit54e4735f89489da9f1cf71b85561a4939e8a42e3 (patch)
tree3e7988d3d2b7c4130f4355b17a7f44eeddd0d24d /src/gui/kernel/qwindowsysteminterface.cpp
parent1037eebc0b481678a40f034284d489e278be557a (diff)
qpa: Let platform plugins report old state for window state changes
The previous logic relied on QPlatformWindow::setWindowState() being synchronous and delivering the QPA event before returning to QWindow, in which case window->windowState() would still refer to the old state. Async platforms can now report the previous state correctly. Change-Id: Ib9148fe23fb62be55b7e3a0ccf63d32c71dc2ad3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.cpp')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 2fc713f708..7ad4f57198 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -241,10 +241,14 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowActivated, QWindow *window, Qt::Fo
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt::WindowState newState)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt::WindowState newState, int oldState)
{
+ Q_ASSERT(window);
+ if (oldState < Qt::WindowNoState)
+ oldState = window->windowState();
+
QWindowSystemInterfacePrivate::WindowStateChangedEvent *e =
- new QWindowSystemInterfacePrivate::WindowStateChangedEvent(window, newState);
+ new QWindowSystemInterfacePrivate::WindowStateChangedEvent(window, newState, Qt::WindowState(oldState));
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}