- Add add-tray-icon-cache.patch (kde#356479):
* High load due to animated tray icons OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5:LTS/plasma5-workspace?expand=0&rev=22
This commit is contained in:
parent
fe4c0bfe34
commit
eb442efc24
36
add-tray-icon-cache.patch
Normal file
36
add-tray-icon-cache.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Subject: Workaround for high load due to animated tray icons
|
||||
References: kde#356479
|
||||
|
||||
When a tray icon name changes, it always does a full lookup, which is expensive.
|
||||
Add a small QHash as cache to work around this.
|
||||
|
||||
diff --git a/applets/systemtray/systemtray.cpp b/applets/systemtray/systemtray.cpp
|
||||
index 66bb5b4..f440ff0 100644
|
||||
--- a/applets/systemtray/systemtray.cpp
|
||||
+++ b/applets/systemtray/systemtray.cpp
|
||||
@@ -127,8 +127,13 @@ void SystemTray::cleanupTask(const QString &task)
|
||||
|
||||
QVariant SystemTray::resolveIcon(const QVariant &variant, const QString &iconThemePath)
|
||||
{
|
||||
+ static QHash<QString, QVariant> cache;
|
||||
if (variant.canConvert<QString>()) {
|
||||
if (!iconThemePath.isEmpty()) {
|
||||
+ auto i = cache.find(variant.toString() + iconThemePath);
|
||||
+ if(i != cache.end())
|
||||
+ return i.value();
|
||||
+ qCWarning(SYSTEM_TRAY) << "Cache not hit" << iconThemePath;
|
||||
const QString path = iconThemePath;
|
||||
if (!path.isEmpty()) {
|
||||
// FIXME: If last part of path is not "icons", this won't work!
|
||||
@@ -136,7 +141,9 @@ QVariant SystemTray::resolveIcon(const QVariant &variant, const QString &iconThe
|
||||
if (tokens.length() >= 3 && tokens.takeLast() == QLatin1String("icons")) {
|
||||
const QString appName = tokens.takeLast().toString();
|
||||
|
||||
- return QVariant(QIcon(new AppIconEngine(variant.toString(), path, appName)));
|
||||
+ auto v = QVariant(QIcon(new AppIconEngine(variant.toString(), path, appName)));
|
||||
+ cache.insert(variant.toString() + iconThemePath, v);
|
||||
+ return v;
|
||||
} else {
|
||||
qCWarning(SYSTEM_TRAY) << "Wrong IconThemePath" << path << ": too short or does not end with 'icons'";
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Oct 2 09:30:48 UTC 2016 - fabian@ritter-vogt.de
|
||||
|
||||
- Add add-tray-icon-cache.patch (kde#356479):
|
||||
* High load due to animated tray icons
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 1 17:25:04 UTC 2016 - fabian@ritter-vogt.de
|
||||
|
||||
|
@ -35,6 +35,8 @@ Patch0: 0001-Rename-qdbus-in-startkde.patch
|
||||
Patch1: change-kioremote-severity.patch
|
||||
# PATCH-FIX-OPENSUSE 0001-Ignore-default-sddm-face-icons.patch boo#1001364 fabian@ritter-vogt.de -- Ignore default sddm face icons
|
||||
Patch2: 0001-Ignore-default-sddm-face-icons.patch
|
||||
# PATCH-FIX-OPENSUSE add-tray-icon-cache.patch kde#356479 fabian@ritter-vogt.de -- Workaround for high load due to animated tray icons
|
||||
Patch3: add-tray-icon-cache.patch
|
||||
# PATCHES 100-200 and above are from upstream 5.8 branch
|
||||
# PATCHES 201-300 and above are from upstream master/5.9 branch
|
||||
BuildRequires: breeze5-icons
|
||||
@ -205,6 +207,7 @@ workspace. Development files.
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
%build
|
||||
%cmake_kf5 -d build -- -DKDE4_COMMON_PAM_SERVICE=xdm -DKDE_DEFAULT_HOME=.kde4 -DCMAKE_INSTALL_LOCALEDIR=%{_kf5_localedir}
|
||||
|
Loading…
x
Reference in New Issue
Block a user