summaryrefslogtreecommitdiffstats
path: root/kde
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2017-01-27 11:03:38 +0100
committer Eric Hameleers <alien@slackware.com>2017-01-27 11:03:38 +0100
commit34eaef58d59c97fef278f797f1875e5d39fe0797 (patch)
treef9139f4fab4ec96b6283737210bbdb3c85c14105 /kde
parentacb5679384b30a28dc968b13211ff41db9bf0e1d (diff)
downloadktown-34eaef58d59c97fef278f797f1875e5d39fe0797.tar.gz
ktown-34eaef58d59c97fef278f797f1875e5d39fe0797.tar.xz
plasma-workspace: address high CPU useage bug in system tray animations.
Diffstat (limited to 'kde')
-rw-r--r--kde/patch/plasma-workspace.patch4
-rw-r--r--kde/patch/plasma-workspace/plasma-workspace.systray_cpubug.patch152
2 files changed, 156 insertions, 0 deletions
diff --git a/kde/patch/plasma-workspace.patch b/kde/patch/plasma-workspace.patch
index 30e54f0..f5c320d 100644
--- a/kde/patch/plasma-workspace.patch
+++ b/kde/patch/plasma-workspace.patch
@@ -6,3 +6,7 @@
# Apply commit that fixes compilation of 5.6.5:
#cat $CWD/patch/plasma-workspace/plasma-workspace_apply_767aa57.patch | patch -p1 --verbose || { touch ${SLACK_KDE_BUILD_DIR}/${PKGNAME}.failed ; continue ; }
+# Systray: Move all icon resolution to dataengine, preventing high CPU usage,
+# see https://phabricator.kde.org/D2986 :
+cat $CWD/patch/plasma-workspace/plasma-workspace.systray_cpubug.patch | patch -p1 --verbose || { touch ${SLACK_KDE_BUILD_DIR}/${PKGNAME}.failed ; continue ; }
+
diff --git a/kde/patch/plasma-workspace/plasma-workspace.systray_cpubug.patch b/kde/patch/plasma-workspace/plasma-workspace.systray_cpubug.patch
new file mode 100644
index 0000000..4ad3c07
--- /dev/null
+++ b/kde/patch/plasma-workspace/plasma-workspace.systray_cpubug.patch
@@ -0,0 +1,152 @@
+https://phabricator.kde.org/D2986
+Systray: Move all icon resolution to dataengine
+
+diff --git a/applets/systemtray/package/contents/ui/ConfigEntries.qml b/applets/systemtray/package/contents/ui/ConfigEntries.qml
+--- a/applets/systemtray/package/contents/ui/ConfigEntries.qml
++++ b/applets/systemtray/package/contents/ui/ConfigEntries.qml
+@@ -75,7 +75,7 @@
+ "index": i,
+ "taskId": item.Id,
+ "name": item.Title,
+- "iconName": plasmoid.nativeInterface.resolveIcon(item.IconName, item.IconThemePath),
++ "iconName": item.IconName,
+ "icon": item.Icon
+ });
+ }
+diff --git a/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml b/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
+--- a/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
++++ b/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
+@@ -28,7 +28,7 @@
+ text: Title
+ mainText: ToolTipTitle != "" ? ToolTipTitle : Title
+ subText: ToolTipSubTitle
+- icon: ToolTipIcon != "" ? ToolTipIcon : plasmoid.nativeInterface.resolveIcon(IconName != "" ? IconName : Icon, IconThemePath)
++ icon: ToolTipIcon != "" ? ToolTipIcon : Icon ? Icon : IconName
+ textFormat: Text.AutoText
+ category: Category
+
+@@ -48,7 +48,7 @@
+
+ PlasmaCore.IconItem {
+ id: iconItem
+- source: plasmoid.nativeInterface.resolveIcon(IconName != "" ? IconName : Icon, IconThemePath)
++ source: Icon ? Icon : IconName
+ width: Math.min(parent.width, parent.height)
+ height: width
+ active: taskIcon.containsMouse
+diff --git a/applets/systemtray/systemtray.h b/applets/systemtray/systemtray.h
+--- a/applets/systemtray/systemtray.h
++++ b/applets/systemtray/systemtray.h
+@@ -60,12 +60,6 @@
+
+ //Invokable utilities
+ /**
+- * returns either a simple icon name or a custom path if the app is
+- * using a custom theme
+- */
+- Q_INVOKABLE QVariant resolveIcon(const QVariant &variant, const QString &iconThemePath);
+-
+- /**
+ * Given an AppletInterface pointer, shows a proper context menu for it
+ */
+ Q_INVOKABLE void showPlasmoidMenu(QQuickItem *appletInterface, int x, int y);
+diff --git a/applets/systemtray/systemtray.cpp b/applets/systemtray/systemtray.cpp
+--- a/applets/systemtray/systemtray.cpp
++++ b/applets/systemtray/systemtray.cpp
+@@ -37,37 +37,11 @@
+ #include <Plasma/PluginLoader>
+ #include <Plasma/ServiceJob>
+
+-#include <KIconLoader>
+-#include <KIconEngine>
+ #include <KActionCollection>
+ #include <KLocalizedString>
+
+ #include <plasma_version.h>
+
+-/*
+- * An app may also load icons from their own directories, so we need a new iconloader that takes this into account
+- * This is wrapped into a subclass of iconengine so the iconloader lifespan matches the icon object
+- */
+-class AppIconEngine : public KIconEngine
+-{
+-public:
+- AppIconEngine(const QString &variant, const QString &path, const QString &appName);
+- ~AppIconEngine();
+-private:
+- KIconLoader* m_loader;
+-};
+-
+-AppIconEngine::AppIconEngine(const QString &variant, const QString &path, const QString &appName) :
+- KIconEngine(variant, m_loader = new KIconLoader(appName, QStringList()))
+-{
+- m_loader->addAppDir(appName, path);
+-}
+-
+-AppIconEngine::~AppIconEngine()
+-{
+- delete m_loader;
+-}
+-
+ class PlasmoidModel: public QStandardItemModel
+ {
+ public:
+@@ -169,32 +143,6 @@
+ }
+ }
+
+-QVariant SystemTray::resolveIcon(const QVariant &variant, const QString &iconThemePath)
+-{
+- if (variant.canConvert<QString>()) {
+- if (!iconThemePath.isEmpty()) {
+- const QString path = iconThemePath;
+- if (!path.isEmpty()) {
+- // FIXME: If last part of path is not "icons", this won't work!
+- auto tokens = path.splitRef('/', QString::SkipEmptyParts);
+- if (tokens.length() >= 3 && tokens.takeLast() == QLatin1String("icons")) {
+- const QString appName = tokens.takeLast().toString();
+-
+- return QVariant(QIcon(new AppIconEngine(variant.toString(), path, appName)));
+- } else {
+- qCWarning(SYSTEM_TRAY) << "Wrong IconThemePath" << path << ": too short or does not end with 'icons'";
+- }
+- }
+-
+- //return just the string hoping that IconItem will know how to interpret it anyways as either a normal icon or a SVG from the theme
+- return variant;
+- }
+- }
+-
+- // Most importantly QIcons. Nothing to do for those.
+- return variant;
+-}
+-
+ void SystemTray::showPlasmoidMenu(QQuickItem *appletInterface, int x, int y)
+ {
+ if (!appletInterface) {
+diff --git a/dataengines/statusnotifieritem/statusnotifieritemsource.cpp b/dataengines/statusnotifieritem/statusnotifieritemsource.cpp
+--- a/dataengines/statusnotifieritem/statusnotifieritemsource.cpp
++++ b/dataengines/statusnotifieritem/statusnotifieritemsource.cpp
+@@ -240,14 +240,19 @@
+ if (!m_customIconLoader) {
+ m_customIconLoader = new KIconLoader(QString(), QStringList(), this);
+ }
++ // FIXME: If last part of path is not "icons", this won't work!
++ QString appName;
++ auto tokens = path.splitRef('/', QString::SkipEmptyParts);
++ if (tokens.length() >= 3 && tokens.takeLast() == QLatin1String("icons"))
++ appName = tokens.takeLast().toString();
+
+ //icons may be either in the root directory of the passed path or in a appdir format
+ //i.e hicolor/32x32/iconname.png
+
+- m_customIconLoader->reconfigure(QString(), QStringList(path));
++ m_customIconLoader->reconfigure(appName, QStringList(path));
+
+ //add app dir requires an app name, though this is completely unused in this context
+- m_customIconLoader->addAppDir(QStringLiteral("unused"), path);
++ m_customIconLoader->addAppDir(appName.size() ? appName : QStringLiteral("unused"), path);
+ }
+ setData(QStringLiteral("IconThemePath"), path);
+
+