[frameworks/kirigami] src/platform: PlatformTheme: Only emit color changes if color actually changes

Devin Lin <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit b4eafdefe421c5c994940774c6f8f62145b5576f by Devin Lin.
Committed on 20/07/2026 at 18:43.
Pushed by devinlin into branch 'master'.

PlatformTheme: Only emit color changes if color actually changes

In the Plasma Mobile homescreen, we have a bunch of icons drawn on the
screen. When the shell becomes unfocused, we get a gigantic spike in lag
that appears to be caused due to Kirigami.PlatformTheme emitting
colorsChanged (due to inactive color getting set), which causes Icon to
call polish().

M  +5    -3    src/platform/platformtheme.cpp

https://invent.kde.org/frameworks/kirigami/-/commit/b4eafdefe421c5c994940774c6f8f62145b5576f

diff --git a/src/platform/platformtheme.cpp b/src/platform/platformtheme.cpp
index 8bbfce0b2..2c707a895 100644
--- a/src/platform/platformtheme.cpp
+++ b/src/platform/platformtheme.cpp
@@ -380,9 +380,11 @@ public:
             }
         }
 
-        PlatformThemeChangeTracker tracker(theme, PlatformThemeChangeTracker::PropertyChange::Color);
-
-        if (data) {
+        // Only mark colors as changed if the value will actually change; the
+        // subclasses reset all colors when e.g. the window's active state
+        // changes.
+        if (data && data->owner == theme && data->colors[color] != value) {
+            PlatformThemeChangeTracker tracker(theme, PlatformThemeChangeTracker::PropertyChange::Color);
             data->setColor(theme, color, value);
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.