diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2017-04-25 15:19:46 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2017-04-27 13:01:07 +0000 |
commit | 751f015b67d373e4e44ee12b14088970eca67a43 (patch) | |
tree | c8df1e0e87e84a1e0fa80f9d857b2878822ac6ea /src | |
parent | 32e8595d494ce3313944bb949aaf935bc1bd03dd (diff) | |
download | qtwayland-751f015b67d373e4e44ee12b14088970eca67a43.tar.gz |
Don't depend on shell extension
The mininimal-cpp compositor example does not have any shell extensions.
Change-Id: I925450a75ab6f93245ca9897bbc6f092d93364b6
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 00fbb00d..3a216e12 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -145,47 +145,48 @@ void QWaylandWindow::initWindow() Q_ASSERT(!mShellSurface); mShellSurface = mDisplay->createShellSurface(this); - if (!mShellSurface) - qFatal("Could not create a shell surface object."); - - mShellSurface->setType(window()->type(), transientParent()); - - // Set initial surface title - setWindowTitle(window()->title()); - - // The appId is the desktop entry identifier that should follow the - // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). - // According to xdg-shell the appId is only the name, without - // the .desktop suffix. - // - // If the application specifies the desktop file name use that - // removing the ".desktop" suffix, otherwise fall back to the - // executable name and prepend the reversed organization domain - // when available. - if (!QGuiApplication::desktopFileName().isEmpty()) { - QString name = QGuiApplication::desktopFileName(); - if (name.endsWith(QLatin1String(".desktop"))) - name.chop(8); - mShellSurface->setAppId(name); - } else { - QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); - QStringList domainName = - QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), - QString::SkipEmptyParts); - - if (domainName.isEmpty()) { - mShellSurface->setAppId(fi.baseName()); + if (mShellSurface) { + mShellSurface->setType(window()->type(), transientParent()); + + // Set initial surface title + setWindowTitle(window()->title()); + + // The appId is the desktop entry identifier that should follow the + // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). + // According to xdg-shell the appId is only the name, without + // the .desktop suffix. + // + // If the application specifies the desktop file name use that + // removing the ".desktop" suffix, otherwise fall back to the + // executable name and prepend the reversed organization domain + // when available. + if (!QGuiApplication::desktopFileName().isEmpty()) { + QString name = QGuiApplication::desktopFileName(); + if (name.endsWith(QLatin1String(".desktop"))) + name.chop(8); + mShellSurface->setAppId(name); } else { - QString appId; - for (int i = 0; i < domainName.count(); ++i) - appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); - appId.append(fi.baseName()); - mShellSurface->setAppId(appId); + QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + + if (domainName.isEmpty()) { + mShellSurface->setAppId(fi.baseName()); + } else { + QString appId; + for (int i = 0; i < domainName.count(); ++i) + appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + appId.append(fi.baseName()); + mShellSurface->setAppId(appId); + } } + // the user may have already set some window properties, so make sure to send them out + for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it) + mShellSurface->sendProperty(it.key(), it.value()); + } else { + qWarning("Could not create a shell surface object."); } - // the user may have already set some window properties, so make sure to send them out - for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it) - mShellSurface->sendProperty(it.key(), it.value()); } // Enable high-dpi rendering. Scale() returns the screen scale factor and will @@ -327,7 +328,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::sendExposeEvent(const QRect &rect) { - if (mShellSurface && !mShellSurface->handleExpose(rect)) + if (!(mShellSurface && mShellSurface->handleExpose(rect))) QWindowSystemInterface::handleExposeEvent(window(), rect); } |