summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qioswindow.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-06-20 14:43:13 +0200
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-06-21 12:52:44 +0000
commit1a7e57766937ba7f00567d82fa482d651bed1560 (patch)
tree60a7f8ab6e1596cb94ab49a67b9d527cc20e0ee4 /src/plugins/platforms/ios/qioswindow.mm
parentbf8014a26903cd94b5693e61bec33dc6864ef0f1 (diff)
UIKit: Treat windows as exposed only during Qt::ApplicationStateActive
We previously treated Qt::ApplicationStateInactive as a valid state to expose windows in, to prevent a visible flash of black screen at app startup between iOS hiding the launch screen and Qt drawing it's first frame, but this lag is no longer an issue, so we can apply the best practice of only rendering during Qt::ApplicationStateActive. This may prevent crashes during application suspension. Task-number: QTBUG-52493 Change-Id: I271281ed6fb857e6849cdb88cc2d8251d1bba1df Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios/qioswindow.mm')
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 6723181c34..a1576eba8e 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -217,26 +217,7 @@ void QIOSWindow::applyGeometry(const QRect &rect)
bool QIOSWindow::isExposed() const
{
- // Note: At startup of an iOS app it will enter UIApplicationStateInactive
- // while showing the launch screen, and once the application returns from
- // applicationDidFinishLaunching it will hide the launch screen and enter
- // UIApplicationStateActive. Technically, a window is not exposed until
- // it's actually visible on screen, and Apple also documents that "Apps
- // that use OpenGL ES for drawing must not use didFinishLaunching to
- // prepare their drawing environment. Instead, defer any OpenGL ES
- // drawing calls to applicationDidBecomeActive". Unfortunately, if we
- // wait until the applicationState reaches ApplicationActive to signal
- // that the window is exposed, we get a lag between hiding the launch
- // screen and blitting the first pixels of the application, as Qt
- // spends some time drawing those pixels in response to the expose.
- // In practice there doesn't seem to be any issues starting GL setup
- // and drawing from within applicationDidFinishLaunching, and this is
- // also the recommended approach for other 3rd party GL toolkits on iOS,
- // so we 'cheat', and report that a window is exposed even if the app
- // is in UIApplicationStateInactive, so that the startup transition
- // between the launch screen and the application content is smooth.
-
- return qApp->applicationState() > Qt::ApplicationHidden
+ return qApp->applicationState() >= Qt::ApplicationActive
&& window()->isVisible() && !window()->geometry().isEmpty();
}