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 <rafael.roquetto@kdab.com>
This commit is contained in:
Fabian Bumberger 2014-04-16 19:20:16 +02:00 committed by The Qt Project
parent c7ed644fd1
commit d032ff6388
3 changed files with 16 additions and 6 deletions

View File

@ -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)

View File

@ -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),

View File

@ -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);