QNX: Allow app to run when spurious 2nd screen is reported

On the PlayBook, libscreen always seems to report the presence of a 2nd
display even when none is connected. This of course leads to the failure
to query this display for its physical size.

This patch relaxes the demand for a physical size to being for the
primary screen only.

Change-Id: If30b1fd704e7a194a426a0a9f0b85557478105f7
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Frank Osterfeld <frank.osterfeld@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Sean Harmer 2012-08-16 11:21:06 +01:00 committed by Qt by Nokia
parent 525ec093b4
commit c7b6a666a8

View File

@ -63,7 +63,7 @@
QT_BEGIN_NAMESPACE
static QSize determineScreenSize(screen_display_t display) {
static QSize determineScreenSize(screen_display_t display, bool primaryScreen) {
int val[2];
errno = 0;
@ -96,9 +96,9 @@ static QSize determineScreenSize(screen_display_t display) {
const QSize defSize(QQNX_PHYSICAL_SCREEN_WIDTH, QQNX_PHYSICAL_SCREEN_HEIGHT);
qWarning("QQnxScreen: QQNX_PHYSICAL_SCREEN_SIZE variable not set. Falling back to defines QQNX_PHYSICAL_SCREEN_WIDTH/QQNX_PHYSICAL_SCREEN_HEIGHT (%dx%d)", defSize.width(), defSize.height());
return defSize;
#else
qFatal("QQnxScreen: QQNX_PHYSICAL_SCREEN_SIZE variable not set. Could not determine physical screen size.");
if (primaryScreen)
qFatal("QQnxScreen: QQNX_PHYSICAL_SCREEN_SIZE variable not set. Could not determine physical screen size.");
return QSize(150, 90);
#endif
}
@ -136,7 +136,7 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
// libscreen always reports the physical size dimensions as width and height in the
// native orientation. Contrary to this, QPlatformScreen::physicalSize() expects the
// returned dimensions to follow the current orientation.
const QSize screenSize = determineScreenSize(m_display);
const QSize screenSize = determineScreenSize(m_display, primaryScreen);
m_nativeOrientation = screenSize.width() >= screenSize.height() ? Qt::LandscapeOrientation : Qt::PortraitOrientation;