From d032ff63885bd7faa7ec3a6066024fdb08248ffc Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Wed, 16 Apr 2014 19:20:16 +0200 Subject: QNX: Don't create a platform window for a desktop widget As I understand it the QDesktopWidget does only serve the purpose of returning the screen size and number. It does not need a real platform window. This removes some overhead, because a desktop widget is always created. Change-Id: I8c0d86bbb46b1f32094fda1592df795af6bb423f Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxrasterwindow.cpp | 5 ++++- src/plugins/platforms/qnx/qqnxwindow.cpp | 15 +++++++++++---- src/plugins/platforms/qnx/qqnxwindow.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index eb9fac540f..ead6e73a87 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -64,10 +64,13 @@ QQnxRasterWindow::QQnxRasterWindow(QWindow *window, screen_context_t context, bo initWindow(); // Set window usage + if (window->type() == Qt::Desktop) + return; + const int val = SCREEN_USAGE_NATIVE | SCREEN_USAGE_READ | SCREEN_USAGE_WRITE; const int result = screen_set_window_property_iv(nativeHandle(), SCREEN_PROPERTY_USAGE, &val); if (result != 0) - qFatal("QQnxEglWindow: failed to set window alpha usage, errno=%d", errno); + qFatal("QQnxRasterWindow: failed to set window alpha usage, errno=%d", errno); } void QQnxRasterWindow::post(const QRegion &dirty) diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index d7256b08aa..5a405f9577 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -174,7 +174,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW // indication that we want to create a child window and join that window group. const QVariant windowGroup = window->property("qnxInitialWindowGroup"); - if (window->type() == Qt::CoverWindow || window->type() == Qt::Desktop) { + if (window->type() == Qt::CoverWindow) { // Cover windows have to be top level to be accessible to window delegate (i.e. navigator) // Desktop windows also need to be toplevel because they are not // supposed to be part of the window hierarchy tree @@ -189,10 +189,13 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW m_isTopLevel = !needRootWindow || !platformScreen->rootWindow(); } + if (window->type() == Qt::Desktop) // A desktop widget does not need a libscreen window + return; + if (m_isTopLevel) { Q_SCREEN_CRITICALERROR(screen_create_window(&m_window, m_screenContext), "Could not create top level window"); // Creates an application window - if (window->type() != Qt::CoverWindow && window->type() != Qt::Desktop) { + if (window->type() != Qt::CoverWindow) { if (needRootWindow) platformScreen->setRootWindow(this); } @@ -245,7 +248,8 @@ void QQnxWindow::setGeometry(const QRect &rect) if (shouldMakeFullScreen()) newGeometry = screen()->geometry(); - setGeometryHelper(newGeometry); + if (window()->type() != Qt::Desktop) + setGeometryHelper(newGeometry); if (isExposed()) QWindowSystemInterface::handleExposeEvent(window(), newGeometry); @@ -285,7 +289,7 @@ void QQnxWindow::setVisible(bool visible) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; - if (m_visible == visible) + if (m_visible == visible || window()->type() == Qt::Desktop) return; // The first time through we join a window group if appropriate. @@ -668,6 +672,9 @@ void QQnxWindow::setRotation(int rotation) void QQnxWindow::initWindow() { + if (window()->type() == Qt::Desktop) + return; + // Alpha channel is always pre-multiplied if present int val = SCREEN_PRE_MULTIPLIED_ALPHA; Q_SCREEN_CHECKERROR(screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ALPHA_MODE, &val), diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 9a2006396f..94df903336 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -75,7 +75,7 @@ public: bool isExposed() const; - WId winId() const { return (WId)m_window; } + WId winId() const { return window()->type() == Qt::Desktop ? -1 : (WId)m_window; } screen_window_t nativeHandle() const { return m_window; } void setBufferSize(const QSize &size); -- cgit v1.2.3