From 2438bf079db1230f5407f455d1d306cd6323939d Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Mon, 2 Apr 2012 12:04:53 +0200 Subject: Fix adding and removing of windows to their screen Change-Id: I5e0edf1515db60689c86b16b978863ae9e49bfdb Reviewed-by: Kevin Krammer Reviewed-by: Sean Harmer Reviewed-by: Robin Burchell --- src/plugins/platforms/qnx/qqnxscreen.cpp | 5 +++-- src/plugins/platforms/qnx/qqnxwindow.cpp | 9 ++------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 7ae1988bff..7ddef321ae 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -223,8 +223,9 @@ void QQnxScreen::removeWindow(QQnxWindow *window) qDebug() << Q_FUNC_INFO << "window =" << window; #endif - m_childWindows.removeAll(window); - updateHierarchy(); + const int numWindowsRemoved = m_childWindows.removeAll(window); + if (numWindowsRemoved > 0) + updateHierarchy(); } void QQnxScreen::raiseWindow(QQnxWindow *window) diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 66eb1cf777..4ca084fa8f 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -123,9 +123,6 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) setScreen(static_cast(window->screen()->handle())); - // Add the window to the root of the hierarchy - m_screen->addWindow(this); - // Add window to plugin's window mapper QQnxIntegration::addWindow(m_window, window); } @@ -415,11 +412,9 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) if (m_screen == platformScreen) return; - if (m_screen && m_screen->findWindow(m_window)) { + if (m_screen) m_screen->removeWindow(this); - platformScreen->addWindow(this); - } - + platformScreen->addWindow(this); m_screen = platformScreen; // Move window to proper screen/display -- cgit v1.2.3