From 8201def97fcc1092461c7273dfe0766100ce7331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 11 Oct 2016 16:32:47 +0200 Subject: [PATCH] Set icon to wayland if desktop file is not found Summary: For X windows KWin uses the generic X icon if no icon is found. Thus KWin should use the generic Wayland icon if no icon is found for a Wayland client. With this change applications with incorrect desktop file name at least get a generic icon instead of no icon. Test Plan: Started Qt assistant on Wayland and it had icon. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D3023 --- shell_client.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell_client.cpp b/shell_client.cpp index 28201f4b2c..104e9efabe 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -1155,18 +1155,20 @@ bool ShellClient::hasStrut() const void ShellClient::updateIcon() { + const QString waylandIconName = QStringLiteral("wayland"); QString desktopFile; if (m_shellSurface) { desktopFile = QString::fromUtf8(m_shellSurface->windowClass()); } if (desktopFile.isEmpty()) { - setIcon(QIcon()); + setIcon(QIcon::fromTheme(waylandIconName)); } if (!desktopFile.endsWith(QLatin1String(".desktop"))) { desktopFile.append(QLatin1String(".desktop")); } KDesktopFile df(desktopFile); - setIcon(QIcon::fromTheme(df.readIcon())); + const QString iconName = df.readIcon(); + setIcon(QIcon::fromTheme(iconName.isEmpty() ? waylandIconName : iconName)); } bool ShellClient::isTransient() const