QNX: Special case z-ordering of the QDesktopWidget window
authorSean Harmer <sean.harmer.qnx@kdab.com>
Fri, 18 May 2012 10:13:03 +0000 (11:13 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 18 May 2012 23:45:04 +0000 (01:45 +0200)
The assumption that window creation order implies correct initial
z-ordering is broken when dealing with certain window types. In this
commit we special case the QDesktopWidget's window which maybe created
after normal application windows yet still need to be layered below
them.

Without this fix we may accidentaly activate the Desktop window when the
blackberry navigator service sends an event to activate the window
group. That results in broken focus handling.

Change-Id: I42dfde2efb4a0011e37e7bd2e7c5442590606a24
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
src/plugins/platforms/qnx/qqnxscreen.cpp

index 25a1204..ac0d552 100644 (file)
@@ -210,7 +210,17 @@ void QQnxScreen::addWindow(QQnxWindow *window)
     if (m_childWindows.contains(window))
         return;
 
-    m_childWindows.push_back(window);
+    // Ensure that the desktop window is at the bottom of the zorder.
+    // If we do not do this then we may end up activating the desktop
+    // when the navigator service gets an event that our window group
+    // has been activated (see QQnxScreen::activateWindowGroup()).
+    // Such a situation would strangely break focus handling due to the
+    // invisible desktop widget window being layered on top of normal
+    // windows
+    if (window->window()->windowType() == Qt::Desktop)
+        m_childWindows.push_front(window);
+    else
+        m_childWindows.push_back(window);
     updateHierarchy();
 }