summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-12-12 15:14:04 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-01-07 21:32:04 +0100
commit8f9ced985727136dc7d1502b7212a54f65b8b113 (patch)
treef311e64c79920c06b9e93bef0cd1bf1667a3184b /src
parent83bd9393e5564ea9168fda90c0f44456633a483a (diff)
iOS: Raise window level instead of hiding statusbar during VKB scroll
Hiding the statusbar using the normal iOS APIs result in QScreen reporting new availableGeometry, which is not what we want. The scroll of the screen is a purely visual effect, and shouldn't have any effect on observable Qt APIs besides the keyboard rect changing. Instead of actually hiding the statusbar, we achieve the same effect by raising the key window (and any other application windows, including the keyboard) to the level of the statusbar, effectively putting them above the statusbar. This still leaves popups and alert windows above the key window, as normal. Change-Id: Ib7694240ca86cfb9000de35bf0c49343ffb37e32 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm17
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm8
2 files changed, 17 insertions, 8 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index bbfc03667e..6e56f47954 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -503,7 +503,22 @@ void QIOSInputContext::scroll(int y)
[rootView.layer addAnimation:animation forKey:@"AnimateSubLayerTransform"];
rootView.layer.sublayerTransform = translationTransform;
- [rootView.qtViewController updateProperties];
+ bool keyboardScrollIsActive = y != 0;
+
+ // Raise all known windows to above the status-bar if we're scrolling the screen,
+ // while keeping the relative window level between the windows the same.
+ NSArray *applicationWindows = [[UIApplication sharedApplication] windows];
+ static QHash<UIWindow *, UIWindowLevel> originalWindowLevels;
+ for (UIWindow *window in applicationWindows) {
+ if (keyboardScrollIsActive && !originalWindowLevels.contains(window))
+ originalWindowLevels.insert(window, window.windowLevel);
+
+ UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0;
+ window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment;
+
+ if (!keyboardScrollIsActive)
+ originalWindowLevels.remove(window);
+ }
}
completion:^(BOOL){
if (self) {
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index a2d81e3b6c..f678f7e807 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -281,14 +281,8 @@
// All decisions are based on the the top level window
focusWindow = qt_window_private(focusWindow)->topLevelWindow();
- bool hasScrolledRootViewDueToVirtualKeyboard =
- !CATransform3DIsIdentity(self.view.layer.sublayerTransform);
-
bool currentStatusBarVisibility = self.prefersStatusBarHidden;
- self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen
- || hasScrolledRootViewDueToVirtualKeyboard;
- self.preferredStatusBarUpdateAnimation = hasScrolledRootViewDueToVirtualKeyboard ?
- UIStatusBarAnimationFade : UIStatusBarAnimationNone;
+ self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen;
if (self.prefersStatusBarHidden != currentStatusBarVisibility) {
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)