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 <giulio.camuffo@jollamobile.com>
This commit is contained in:
parent
f9ad726e65
commit
be73094e6e
@ -107,10 +107,24 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
|
|||||||
// Set initial surface title
|
// Set initial surface title
|
||||||
mShellSurface->setTitle(window->title());
|
mShellSurface->setTitle(window->title());
|
||||||
|
|
||||||
// Set surface class to the .desktop file name (obtained from executable name)
|
// The appId is the desktop entry identifier that should follow the
|
||||||
QFileInfo exeFileInfo(qApp->applicationFilePath());
|
// reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html),
|
||||||
QString className = exeFileInfo.baseName() + QLatin1String(".desktop");
|
// use the application domain if available, otherwise the executable base name.
|
||||||
mShellSurface->setAppId(className);
|
// 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) {
|
if (QPlatformWindow::parent() && mSubSurfaceWindow) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user