Avoid a warning from the QNX QPA plugin.
authorJames Turner <james.turner.qnx@kdab.com>
Thu, 30 Aug 2012 10:02:25 +0000 (11:02 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 30 Aug 2012 11:51:22 +0000 (13:51 +0200)
The HDMI display on the Playbook is listed, but (normally) unattached,
and hence generates an error if we attempt to register for events. This
patch avoids the warning; a future change will actually watch for screens
being attached / detached and update the QPlatformScreens and event
registration correctly.

Change-Id: I5a9cc773648d50f657fe1b3611fd42495ca7e836
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
src/plugins/platforms/qnx/qqnxbpseventfilter.cpp

index 4ce38b9..2e45831 100644 (file)
@@ -100,6 +100,17 @@ void QQnxBpsEventFilter::registerForScreenEvents(QQnxScreen *screen)
         return;
     }
 
+    int attached;
+    if (screen_get_display_property_iv(screen->nativeDisplay(), SCREEN_PROPERTY_ATTACHED, &attached) != BPS_SUCCESS) {
+        qWarning() << "QQNX: unable to query display attachment";
+        return;
+    }
+
+    if (!attached) {
+        qBpsEventFilterDebug() << "skipping event registration for non-attached screen";
+        return;
+    }
+
     if (screen_request_events(screen->nativeContext()) != BPS_SUCCESS)
         qWarning("QQNX: failed to register for screen events on screen %p", screen->nativeContext());
 }