diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-28 10:20:35 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-07-07 02:01:22 +0000 |
commit | a4c8129d099840b366a27e4342a65d7cae5890e9 (patch) | |
tree | 8e88e295f9356f37c2e3c4dc396b13141cc8cfb5 /src/gui/kernel/qwindowsysteminterface.cpp | |
parent | 06904a7a772357479a1b78b8345716f8d0711b4c (diff) |
Relieve platform plugins of having to persist geometry on WM callbacks
We can offload this to QGuiApplication, just like the geometry of the
QWindow is set. This ensures that all platforms behave the same, and
that the documentation of QPlatformWindow::setGeometry is adhered.
Change-Id: I19dbc32cb4fb146d716ec289c28030a547d3afaa
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.cpp')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index fd9c627506..0be130a40d 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -278,7 +278,15 @@ void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState */ QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *window, const QRect &newRect, const QRect &oldRect) { + Q_ASSERT(window); QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(window, QHighDpi::fromNativePixels(newRect, window), QHighDpi::fromNativePixels(oldRect, window)); + if (window->handle()) { + // Persist the new geometry so that QWindow::geometry() can be queried in the resize event + window->handle()->QPlatformWindow::setGeometry(newRect); + // FIXME: This does not work during platform window creation, where the QWindow does not + // have its handle set up yet. Platforms that deliver events during window creation need + // to handle the persistence manually, e.g. by overriding geometry(). + } QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); } |