summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosscreen.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-12-10 18:30:07 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-09-24 11:52:40 +0200
commit4f0cd0693a3aadbf3277dba0eb902db2c78f60cd (patch)
treea4326ce065749092374531200f8acf4801eaf227 /src/plugins/platforms/ios/qiosscreen.mm
parentd2c925b9774ef63c008e1a0ffb992b805e8cc3ab (diff)
iOS: Calculate screen (available) geometry using [UIView convertRect]
Instead of custom logic to detect portrait/landscape and the height of the status bar. The latter would fail when the statusbar/orientation was set explicitly through [UIApplication setStatusBarOrientation], as the statusbar would not follow the normal behavior of covering the top part of the screen. The new code also handles upside-down portrait mode, as well as iOS8's behavior of reporting screen bounds and application frame in interface orientation instead of device orientation. Change-Id: I54e3b99246a32e17aaba13960f456fa823768fd8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosscreen.mm')
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index eb3b7e3c44..86ef71c914 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -241,17 +241,10 @@ void QIOSScreen::updateProperties()
QRect previousGeometry = m_geometry;
QRect previousAvailableGeometry = m_availableGeometry;
- bool inPortrait = UIInterfaceOrientationIsPortrait(m_uiWindow.rootViewController.interfaceOrientation);
- m_geometry = inPortrait ? fromCGRect(m_uiScreen.bounds).toRect()
- : QRect(m_uiScreen.bounds.origin.x, m_uiScreen.bounds.origin.y,
- m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width);
+ UIView *rootView = m_uiWindow.rootViewController.view;
- m_availableGeometry = m_geometry;
-
- CGSize applicationFrameSize = m_uiScreen.applicationFrame.size;
- int statusBarHeight = m_geometry.height() - (inPortrait ? applicationFrameSize.height : applicationFrameSize.width);
-
- m_availableGeometry.adjust(0, statusBarHeight, 0, 0);
+ m_geometry = fromCGRect([rootView convertRect:m_uiScreen.bounds fromView:m_uiWindow]).toRect();
+ m_availableGeometry = fromCGRect([rootView convertRect:m_uiScreen.applicationFrame fromView:m_uiWindow]).toRect();
if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry) {
const qreal millimetersPerInch = 25.4;