summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-11-21 16:06:02 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-11-22 21:27:43 +0000
commitfb2e795c6e61b3c5fb699aefdb2662769c12f76b (patch)
tree7a3d3858443722724626ae570ec1ae7d39b092c2
parenta6d7f38791bd4627314be2c93d0989116413830e (diff)
iOS: Take UIWindow bounds into account when making window fullscreen
When an app is in split-view mode, the app can't use the full bounds of the screen, but should limit its area to that of its UIWindow. Task-number: QTBUG-48225 Change-Id: Ia66ad6bba24d9d73a8263ad3f65b9dee9b8a1b37 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 8ff0dfbd5f..fb161febda 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -244,12 +244,25 @@ void QIOSWindow::setWindowState(Qt::WindowState state)
applyGeometry(m_normalGeometry);
break;
case Qt::WindowMaximized:
- applyGeometry(window()->flags() & Qt::MaximizeUsingFullscreenGeometryHint ?
- screen()->geometry() : screen()->availableGeometry());
- break;
- case Qt::WindowFullScreen:
- applyGeometry(screen()->geometry());
+ case Qt::WindowFullScreen: {
+ // When an application is in split-view mode, the UIScreen still has the
+ // same geometry, but the UIWindow is resized to the area reserved for the
+ // application. We use this to constrain the geometry used when applying the
+ // fullscreen or maximized window states. Note that we do not do this
+ // in applyGeometry(), as we don't want to artificially limit window
+ // placement "outside" of the screen bounds if that's what the user wants.
+
+ QRect uiWindowBounds = QRectF::fromCGRect(m_view.window.bounds).toRect();
+ QRect fullscreenGeometry = screen()->geometry().intersected(uiWindowBounds);
+ QRect maximizedGeometry = window()->flags() & Qt::MaximizeUsingFullscreenGeometryHint ?
+ fullscreenGeometry : screen()->availableGeometry().intersected(uiWindowBounds);
+
+ if (state & Qt::WindowFullScreen)
+ applyGeometry(fullscreenGeometry);
+ else
+ applyGeometry(maximizedGeometry);
break;
+ }
case Qt::WindowMinimized:
applyGeometry(QRect());
break;