summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2017-04-25 15:19:46 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2017-04-27 13:01:07 +0000
commit751f015b67d373e4e44ee12b14088970eca67a43 (patch)
treec8df1e0e87e84a1e0fa80f9d857b2878822ac6ea
parent32e8595d494ce3313944bb949aaf935bc1bd03dd (diff)
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>
-rw-r--r--src/client/qwaylandwindow.cpp79
1 files changed, 40 insertions, 39 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 00fbb00de..3a216e127 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);
}