From 72aa34dc2aebbea715a5915f26cb6f0f67e164d1 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Thu, 22 Jan 2015 08:13:08 +0100 Subject: Remove .desktop suffix to appId The appId is the desktop entry identifier. According to the desktop entry specifications [1], for applications the part of the name should follow the reverse DNS convention (see [2]). To do this we use the application domain if available, otherwise for lack of information we fall back to the executable base name like other toolkits such as Gtk+ do. [1] http://standards.freedesktop.org/desktop-entry-spec/latest/ [2] http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html Change-Id: I181ad23a9736844e07e8060d78e756a943c27f67 Reviewed-by: Giulio Camuffo --- src/client/qwaylandwindow.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index ca0fa5139..83c44c25d 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -107,10 +107,24 @@ QWaylandWindow::QWaylandWindow(QWindow *window) // Set initial surface title mShellSurface->setTitle(window->title()); - // Set surface class to the .desktop file name (obtained from executable name) - QFileInfo exeFileInfo(qApp->applicationFilePath()); - QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); - mShellSurface->setAppId(className); + // 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), + // use the application domain if available, otherwise the executable base name. + // According to xdg-shell the appId is only the name, without the .desktop suffix. + 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); + } } if (QPlatformWindow::parent() && mSubSurfaceWindow) { -- cgit v1.2.3