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>
This commit is contained in:
parent
a6d7f38791
commit
fb2e795c6e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user