summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer.qnx@kdab.com>2012-05-21 11:49:54 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-21 16:02:06 +0200
commit0b97f5553097f296e1de3ac88921dbba140ae0d5 (patch)
treef5f62d139dcc0d9e6f4b1928951f31a73c17f1f0 /src/plugins
parent9be17aa4686e208fe03debd2595d6da86b42aef8 (diff)
QNX: Take orientation into account when reporting physical size
Previously landscape orientation was assumed in the QQnxScreen ctor. We now calculate the initial physical dimensions correctly. Change-Id: I6c434eaba1f931c769f343671fb80052287b51e5 Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 8bdc4974f1..e788ce94a2 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -82,14 +82,19 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
m_currentGeometry = m_initialGeometry = QRect(0, 0, val[0], val[1]);
- // Cache size of this display in millimeters
+ // Cache size of this display in millimeters. We have to take care of the orientation.
+ // libscreen always reports the physical size dimensions as width and height in the
+ // landscape orientation. Contrary to this, QPlatformScreen::physicalSize() expects the
+ // returned dimensions to follow the current orientation.
errno = 0;
result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_PHYSICAL_SIZE, val);
if (result != 0) {
qFatal("QQnxScreen: failed to query display physical size, errno=%d", errno);
}
-
- m_currentPhysicalSize = m_initialPhysicalSize = QSize(val[0], val[1]);
+ if (m_currentRotation == 0 || m_currentRotation == 180)
+ m_currentPhysicalSize = m_initialPhysicalSize = QSize(val[0], val[1]);
+ else
+ m_currentPhysicalSize = m_initialPhysicalSize = QSize(val[1], val[0]);
// We only create the root window if we are the primary display.
if (primaryScreen)