summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2012-12-07 13:34:51 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:48 +0100
commit3a59fc4c97a3658b9712fa214778008bbf914cf9 (patch)
tree7b0c2f16cdfedff1cb2d2b5e5b1beb50b60d2e92 /src/plugins/platforms/ios
parent189503933a9e59da22d6415e588a44c87d67c2bd (diff)
iOS: when in fullscreen, dont respond to geometry changes
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ø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/qioswindow.h1
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm34
2 files changed, 14 insertions, 21 deletions
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;
}
}