diff options
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 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); } |