From d8f7a2ddf4e098786a5dec27e11786f5ff4e0433 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 6 Nov 2013 12:43:51 +0100 Subject: EglFS: make sure resize events are delivered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure that resize events are delivered when the platform plugin overrides the geometry set in setGeometry(). This fixes a race condition where a widget was resized to its sizeHint() while the window was maximized, and the content was shown scaled on the screen. The problem is that the widget gets the wrong size from QWidget::setWindowState() (which calls adjustSize() in order to support normalGeometry). This size is used to resize the backingStore. When the QWindow is resized, it calls QEglFSWindow::setGeometry() which corrects the size to screen()->availableGeometry(), and triggers a GeometryChangeEvent since the size was corrected. This ends up in QGuiApplicationPrivate::processGeometryChangeEvent() which will not send a resize event, since the size has not changed (it is always availableGeometry()). Therefore the widget is never resized, and the backingStore remains the wrong size. Task-number: QTBUG-34421 Change-Id: Iee49c53cc529de36010db2695d838d8c2284edd4 Reviewed-by: Tor Arne Vestbø Reviewed-by: Laszlo Agocs --- src/plugins/platforms/eglfs/qeglfswindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/eglfs/qeglfswindow.cpp') diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index 70f0e437b2..bba00da128 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -210,15 +210,17 @@ void QEglFSWindow::setVisible(bool visible) void QEglFSWindow::setGeometry(const QRect &r) { QRect rect; - if (m_flags.testFlag(HasNativeWindow)) + bool forceFullscreen = m_flags.testFlag(HasNativeWindow); + if (forceFullscreen) rect = screen()->availableGeometry(); else rect = r; QPlatformWindow::setGeometry(rect); + // if we corrected the size, trigger a resize event if (rect != r) - QWindowSystemInterface::handleGeometryChange(window(), rect); + QWindowSystemInterface::handleGeometryChange(window(), rect, r); } QRect QEglFSWindow::geometry() const -- cgit v1.2.3