diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-28 13:56:47 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-07-07 18:09:43 +0000 |
commit | 3a31c708790ba2bb3cf3dab32a17a83659a1acde (patch) | |
tree | f0c58fbedbabfd83ab94ce30cfe1bd8daae10530 /src/plugins/platforms/eglfs | |
parent | 9381ca77b2e7b3224c7872828dbeb802e717e263 (diff) |
Ensure all platforms send geometry events if request was not fulfilled
The logic of deciding whether or not to send resize and move events
has been centralized in QGuiApplication. This ensures that if a
window with geometry 100,100+200x200 is moved and resized to e.g.
0,0+100x100, but the window manager denies the request (because the
window would e.g. overlap with system UI), and issues a geometry
update with the original geometry, 100,100+200x200, we will still
treat that as warrant of a move/resize event to the application,
so the application knows that its position and size is as before.
[ChangeLog][Qt Gui][QPA] QWindowSystemInterfacePrivate::handleGeometryChange
no longer takes the old geometry as an argument.
Task-number: QTBUG-57608
Change-Id: I1d471cc7a257fef958bdb1e56184fa95489403a3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs')
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 69582a91d3..6aaf0d6d6d 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -41,6 +41,7 @@ #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> +#include <private/qwindow_p.h> #ifndef QT_NO_OPENGL # include <QtGui/private/qopenglcontext_p.h> # include <QtGui/QOpenGLContext> @@ -234,21 +235,19 @@ void QEglFSWindow::setVisible(bool visible) void QEglFSWindow::setGeometry(const QRect &r) { - QRect rect; - bool forceFullscreen = m_flags.testFlag(HasNativeWindow); - if (forceFullscreen) - rect = screen()->availableGeometry(); - else - rect = r; + // Persist the requested rect, like a normal setGeometry call + QPlatformWindow::setGeometry(r); - const bool changed = rect != QPlatformWindow::geometry(); - QPlatformWindow::setGeometry(rect); + // Take care of WM behavior, constrain/modify geometry + QRect rect = r; + if (m_flags.testFlag(HasNativeWindow)) + rect = screen()->availableGeometry(); - // if we corrected the size, trigger a resize event - if (rect != r) - QWindowSystemInterface::handleGeometryChange(window(), rect, r); + // React to the setGeometry, as if from a WM callback + QRect lastReportedGeometry = qt_window_private(window())->geometry; + QWindowSystemInterface::handleGeometryChange(window(), rect); - if (changed) + if (rect != lastReportedGeometry) QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), rect.size())); } |