From b8103a4e8174446584caf80c0bf1a006b25d9905 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Fri, 17 Jan 2014 20:45:57 +0100 Subject: [QNX] Introduce proper screen error handling This patch adds a new function which does the error handling for libscreen calls. The patch introduces following changes: - Libscreen errors will not crash (qFatal)the application any more but rather post a warning message. -With the "flush-screen-context" option the screen_context is always flushed when a screen function is called. This enables better correlation between the time an error happens and the time it is logged. Change-Id: Ie2456e5b746dcf917d786f3b832847d2ebbe5f1e Reviewed-by: Kevin Krammer Reviewed-by: Roger Maclean Reviewed-by: Bernd Weimer Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxscreen.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/plugins/platforms/qnx/qqnxscreen.cpp') diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 8461e37e4d..8d35362b34 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#include "qqnxglobal.h" + #include "qqnxscreen.h" #include "qqnxwindow.h" #include "qqnxcursor.h" @@ -75,10 +77,9 @@ QT_BEGIN_NAMESPACE static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { int val[2]; - errno = 0; const int result = screen_get_display_property_iv(display, SCREEN_PROPERTY_PHYSICAL_SIZE, val); + Q_SCREEN_CHECKERROR(result, "Failed to query display physical size"); if (result != 0) { - qFatal("QQnxScreen: failed to query display physical size, errno=%d", errno); return QSize(150, 90); } @@ -163,19 +164,16 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, { qScreenDebug() << Q_FUNC_INFO; // Cache initial orientation of this display - errno = 0; - int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation); - if (result != 0) - qFatal("QQnxScreen: failed to query display rotation, errno=%d", errno); + int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, + &m_initialRotation); + Q_SCREEN_CHECKERROR(result, "Failed to query display rotation"); m_currentRotation = m_initialRotation; // Cache size of this display in pixels - errno = 0; int val[2]; - result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_SIZE, val); - if (result != 0) - qFatal("QQnxScreen: failed to query display size, errno=%d", errno); + Q_SCREEN_CRITICALERROR(screen_get_display_property_iv(m_display, SCREEN_PROPERTY_SIZE, val), + "Failed to query display size"); m_currentGeometry = m_initialGeometry = QRect(0, 0, val[0], val[1]); -- cgit v1.2.3