Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3
plasma5-workspace
add-tray-icon-cache.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File add-tray-icon-cache.patch of Package plasma5-workspace
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'"; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor