From 3a59fc4c97a3658b9712fa214778008bbf914cf9 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 7 Dec 2012 13:34:51 +0100 Subject: iOS: when in fullscreen, dont respond to geometry changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QWindow is told to be in fullscreen, we should not respond to geometry changes. Instead we should bookkeep the requested geometry and set it when/if the window enters Qt::WindowNoState later. Change-Id: Ieaf4756b2a966212c8e1738af9df175a58786a75 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.h | 1 - src/plugins/platforms/ios/qioswindow.mm | 34 ++++++++++++++------------------- 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index b20c1c4fc5..df632e672e 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -83,7 +83,6 @@ public: ~QIOSWindow(); void setGeometry(const QRect &rect); - void updateGeometry(const QRect &rect); void setWindowState(Qt::WindowState state); void handleContentOrientationChange(Qt::ScreenOrientation orientation); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index daeb86fb62..c91c0b2f35 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -109,13 +109,11 @@ static QRect fromCGRect(const CGRect &rect) // the position of our QWindow (and platform window) will only get updated // when the size is also changed. - if (CGAffineTransformIsIdentity(self.transform)) { - // Reflect the new size (and possibly also position) in the QWindow - m_qioswindow->updateGeometry(fromCGRect(self.frame)); - } else { - qWarning() << "QIOSPlatformWindow's UIView has transform set, ignoring geometry updates"; - } + if (!CGAffineTransformIsIdentity(self.transform)) + qWarning() << m_qioswindow->window() + << "is backed by a UIView that has a transform set. This is not supported."; + QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), fromCGRect(self.frame)); [super layoutSubviews]; } @@ -218,22 +216,17 @@ void QIOSWindow::setGeometry(const QRect &rect) return; } + // If the window is in fullscreen, just bookkeep the requested + // geometry in case the window goes into Qt::WindowNoState later: + QPlatformWindow::setGeometry(rect); + if (window()->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) + return; + // Since we don't support transformations on the UIView, we can set the frame // directly and let UIKit deal with translating that into bounds and center. + // Changing the size of the view will end up in a call to -[EAGLView layoutSubviews] + // which will update QWindowSystemInterface with the new size. m_view.frame = toCGRect(rect); - - updateGeometry(rect); -} - -void QIOSWindow::updateGeometry(const QRect &rect) -{ - // The baseclass implementation will store the geometry, and allows use to - // re-use the baseclass geometry() implementation, which just returns rect. - QPlatformWindow::setGeometry(rect); - - // We inform Qt about new geometry, which will trigger resize and - // expose events for the application. - QWindowSystemInterface::handleGeometryChange(window(), rect); } void QIOSWindow::setWindowState(Qt::WindowState state) @@ -245,9 +238,10 @@ void QIOSWindow::setWindowState(Qt::WindowState state) switch (state) { case Qt::WindowMaximized: case Qt::WindowFullScreen: - setGeometry(QRect(QPoint(0, 0), window()->screen()->availableSize())); + m_view.frame = toCGRect(QRect(QPoint(0, 0), window()->screen()->availableSize())); break; default: + m_view.frame = toCGRect(geometry()); break; } } -- cgit v1.2.3