summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qioscontext.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-04-16 15:32:30 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-04-18 11:32:11 +0000
commite0e1c7ec2da121fa2b3acc8e76eb96e959954608 (patch)
tree83af971e85a1ecbc7b0ea60b2ce8bba60218d585 /src/plugins/platforms/ios/qioscontext.mm
parenta75f25a43fd4bc5dab659dfc8d79a120258cec5f (diff)
iOS: Trigger manual layout of root view controller when coming out of background
When rotating the device when the application is in the background iOS will ask the root view controller to layout its views when then foregrounding the application, but at that point the application state is still in the suspended state, meaning we block any view resizing or rendering. To ensure the views are resized correctly, we trigger a manual layout after the application comes out of the suspended state. Task-number: QTBUG-67719 Change-Id: I1ef0a4133d4b94edaac7b0f3cb4e49e367eb76d4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios/qioscontext.mm')
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm47
1 files changed, 26 insertions, 21 deletions
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index 03643c19a9..fff66049ff 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -301,29 +301,34 @@ bool QIOSContext::verifyGraphicsHardwareAvailability()
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
QIOSApplicationState *applicationState = &QIOSIntegration::instance()->applicationState;
- connect(applicationState, &QIOSApplicationState::applicationStateWillChange, [](Qt::ApplicationState state) {
- if (applicationBackgrounded && state != Qt::ApplicationSuspended) {
- qCDebug(lcQpaGLContext) << "app no longer backgrounded, rendering enabled";
- applicationBackgrounded = false;
+ connect(applicationState, &QIOSApplicationState::applicationStateWillChange,
+ [](Qt::ApplicationState oldState, Qt::ApplicationState newState) {
+ Q_UNUSED(oldState);
+ if (applicationBackgrounded && newState != Qt::ApplicationSuspended) {
+ qCDebug(lcQpaGLContext) << "app no longer backgrounded, rendering enabled";
+ applicationBackgrounded = true;
+ }
}
- });
- connect(applicationState, &QIOSApplicationState::applicationStateDidChange, [](Qt::ApplicationState state) {
- if (state != Qt::ApplicationSuspended)
- return;
-
- qCDebug(lcQpaGLContext) << "app backgrounded, rendering disabled";
- applicationBackgrounded = true;
-
- // By the time we receive this signal the application has moved into
- // Qt::ApplactionStateSuspended, and all windows have been obscured,
- // which should stop all rendering. If there's still an active GL context,
- // we follow Apple's advice and call glFinish before making it inactive.
- if (QOpenGLContext *currentContext = QOpenGLContext::currentContext()) {
- qCWarning(lcQpaGLContext) << "explicitly glFinishing and deactivating" << currentContext;
- glFinish();
- currentContext->doneCurrent();
+ );
+ connect(applicationState, &QIOSApplicationState::applicationStateDidChange,
+ [](Qt::ApplicationState oldState, Qt::ApplicationState newState) {
+ Q_UNUSED(oldState);
+ if (newState != Qt::ApplicationSuspended)
+ return;
+
+ qCDebug(lcQpaGLContext) << "app backgrounded, rendering disabled";
+
+ // By the time we receive this signal the application has moved into
+ // Qt::ApplactionStateSuspended, and all windows have been obscured,
+ // which should stop all rendering. If there's still an active GL context,
+ // we follow Apple's advice and call glFinish before making it inactive.
+ if (QOpenGLContext *currentContext = QOpenGLContext::currentContext()) {
+ qCWarning(lcQpaGLContext) << "explicitly glFinishing and deactivating" << currentContext;
+ glFinish();
+ currentContext->doneCurrent();
+ }
}
- });
+ );
});
if (applicationBackgrounded) {