[metacity] icon-cache: reset origin if property change invalidates icon



commit 94be8fa628e3407c44e47cfa018023e4eb3dc9a1
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Mar 22 20:32:43 2022 +0200

    icon-cache: reset origin if property change invalidates icon
    
    Client theoretically can unset / remove icon. We need to reset
    origin to make sure we try to load icon from other sources.
    
    Test application that can be used to set/unset icons:
    https://gitlab.gnome.org/GNOME/libwnck/-/merge_requests/42

 src/core/iconcache.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/src/core/iconcache.c b/src/core/iconcache.c
index d4c2f0fd..4dec0049 100644
--- a/src/core/iconcache.c
+++ b/src/core/iconcache.c
@@ -458,17 +458,6 @@ meta_icon_cache_free (MetaIconCache *icon_cache)
   icon_cache->origin = USING_NO_ICON;
 }
 
-void
-meta_icon_cache_property_changed (MetaIconCache *icon_cache,
-                                  MetaDisplay   *display,
-                                  Atom           atom)
-{
-  if (atom == display->atom__NET_WM_ICON)
-    icon_cache->net_wm_icon_dirty = TRUE;
-  else if (atom == XA_WM_HINTS)
-    icon_cache->wm_hints_dirty = TRUE;
-}
-
 static gboolean
 meta_icon_cache_get_icon_invalidated (MetaIconCache *icon_cache)
 {
@@ -486,6 +475,22 @@ meta_icon_cache_get_icon_invalidated (MetaIconCache *icon_cache)
     return FALSE;
 }
 
+void
+meta_icon_cache_property_changed (MetaIconCache *icon_cache,
+                                  MetaDisplay   *display,
+                                  Atom           atom)
+{
+  if (atom == display->atom__NET_WM_ICON)
+    icon_cache->net_wm_icon_dirty = TRUE;
+  else if (atom == XA_WM_HINTS)
+    icon_cache->wm_hints_dirty = TRUE;
+
+  if (!meta_icon_cache_get_icon_invalidated (icon_cache))
+    return;
+
+  icon_cache->origin = USING_NO_ICON;
+}
+
 static GdkPixbuf*
 scaled_from_pixdata (guchar *pixdata,
                      int     w,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]