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>
This commit is contained in:
Paul Olav Tvete 2017-04-25 15:19:46 +02:00
parent b0f57f5e31
commit 13a861ede8

View File

@ -145,47 +145,48 @@ void QWaylandWindow::initWindow()
Q_ASSERT(!mShellSurface);
mShellSurface = mDisplay->createShellSurface(this);
if (!mShellSurface)
qFatal("Could not create a shell surface object.");
if (mShellSurface) {
mShellSurface->setType(window()->type(), transientParent());
mShellSurface->setType(window()->type(), transientParent());
// Set initial surface title
setWindowTitle(window()->title());
// 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());
// 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);
}