QNX: Register for navigator events before any window creation

This prevents a possible race condition in which the nvaigator service
notices that we have created a window and starts sending us messages
possibly before we have registered with bps for navigator messages.

This resulted in applications sometimes missing navigator messages at
startup.

Change-Id: I362fd782d7798990bc196f23e07b58293b13275d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
bb10
Sean Harmer 2012-05-21 16:08:15 +01:00 committed by Qt by Nokia
parent 3a14f0301c
commit 03392e1edf
1 changed files with 14 additions and 6 deletions

View File

@ -146,9 +146,6 @@ QQnxIntegration::QQnxIntegration()
QMetaObject::invokeMethod(m_navigatorEventNotifier, "start", Qt::QueuedConnection);
#endif
// Create displays for all possible screens (which may not be attached)
createDisplays();
#if !defined(QT_NO_OPENGL)
// Initialize global OpenGL resources
QQnxGLContext::initialize();
@ -184,14 +181,25 @@ QQnxIntegration::QQnxIntegration()
#if defined(Q_OS_BLACKBERRY)
QQnxVirtualKeyboardBps* virtualKeyboardBps = new QQnxVirtualKeyboardBps;
m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler, m_screenEventHandler, virtualKeyboardBps);
Q_FOREACH (QQnxScreen *screen, m_screens)
m_bpsEventFilter->registerForScreenEvents(screen);
m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher);
m_virtualKeyboard = virtualKeyboardBps;
#endif
// Create displays for all possible screens (which may not be attached). We have to do this
// *after* the call to m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher). The
// reason for this is that we have to be registered for NAVIGATOR events before we create the
// QQnxScreen objects, and hence the QQnxRootWindow's. It is when the NAVIGATOR service sees
// the window creation that it starts sending us messages which results in a race if we
// create the displays first.
createDisplays();
#if defined(Q_OS_BLACKBERRY)
// Register for screen domain events with bps
Q_FOREACH (QQnxScreen *screen, m_screens)
m_bpsEventFilter->registerForScreenEvents(screen);
#endif
if (m_virtualKeyboard) {
// TODO check if we need to do this for all screens or only the primary one
QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),