[metacity/wip/muktupavels/remove-kwm-win-icon: 2/2] icon-cache: remove support for KWM_WIN_ICON




commit a3feabd50d465cda9ca8b92c139ad895659f8474
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Mar 18 16:32:25 2022 +0200

    icon-cache: remove support for KWM_WIN_ICON
    
    According to Debian Code Search only MPlayer sets this property
    (together with _NET_WM_ICON).

 src/core/atomnames.h    |  1 -
 src/core/iconcache.c    | 86 ++-----------------------------------------------
 src/core/iconcache.h    |  2 --
 src/core/window-props.c | 14 --------
 4 files changed, 2 insertions(+), 101 deletions(-)
---
diff --git a/src/core/atomnames.h b/src/core/atomnames.h
index aacd2285..819ceaa6 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -51,7 +51,6 @@ item(WM_CLIENT_LEADER)
 item(WM_WINDOW_ROLE)
 item(UTF8_STRING)
 item(WM_ICON_SIZE)
-item(_KWM_WIN_ICON)
 item(_METACITY_RESTART_MESSAGE)
 item(_METACITY_RELOAD_THEME_MESSAGE)
 item(_METACITY_SET_KEYBINDINGS_MESSAGE)
diff --git a/src/core/iconcache.c b/src/core/iconcache.c
index 47c12440..7f8bff70 100644
--- a/src/core/iconcache.c
+++ b/src/core/iconcache.c
@@ -440,53 +440,6 @@ try_pixmap_and_mask (MetaDisplay  *display,
     return FALSE;
 }
 
-static void
-get_kwm_win_icon (MetaDisplay *display,
-                  Window       xwindow,
-                  Pixmap      *pixmap,
-                  Pixmap      *mask)
-{
-  Atom type;
-  int format;
-  gulong nitems;
-  gulong bytes_after;
-  guchar *data;
-  Pixmap *icons;
-  int err, result;
-
-  *pixmap = None;
-  *mask = None;
-
-  meta_error_trap_push (display);
-  icons = NULL;
-  result = XGetWindowProperty (display->xdisplay, xwindow,
-                               display->atom__KWM_WIN_ICON,
-                              0, G_MAXLONG,
-                              False,
-                               display->atom__KWM_WIN_ICON,
-                              &type, &format, &nitems,
-                              &bytes_after, &data);
-  icons = (Pixmap *)data;
-
-  err = meta_error_trap_pop_with_return (display);
-  if (err != Success ||
-      result != Success)
-    return;
-
-  if (type != display->atom__KWM_WIN_ICON)
-    {
-      XFree (icons);
-      return;
-    }
-
-  *pixmap = icons[0];
-  *mask = icons[1];
-
-  XFree (icons);
-
-  return;
-}
-
 void
 meta_icon_cache_init (MetaIconCache *icon_cache)
 {
@@ -496,7 +449,6 @@ meta_icon_cache_init (MetaIconCache *icon_cache)
   icon_cache->prev_pixmap = None;
   icon_cache->prev_mask = None;
   icon_cache->wm_hints_dirty = TRUE;
-  icon_cache->kwm_win_icon_dirty = TRUE;
   icon_cache->net_wm_icon_dirty = TRUE;
 }
 
@@ -513,8 +465,6 @@ meta_icon_cache_property_changed (MetaIconCache *icon_cache,
 {
   if (atom == display->atom__NET_WM_ICON)
     icon_cache->net_wm_icon_dirty = TRUE;
-  else if (atom == display->atom__KWM_WIN_ICON)
-    icon_cache->kwm_win_icon_dirty = TRUE;
   else if (atom == XA_WM_HINTS)
     icon_cache->wm_hints_dirty = TRUE;
 }
@@ -522,11 +472,8 @@ meta_icon_cache_property_changed (MetaIconCache *icon_cache,
 gboolean
 meta_icon_cache_get_icon_invalidated (MetaIconCache *icon_cache)
 {
-  if (icon_cache->origin <= USING_KWM_WIN_ICON &&
-      icon_cache->kwm_win_icon_dirty)
-    return TRUE;
-  else if (icon_cache->origin <= USING_WM_HINTS &&
-           icon_cache->wm_hints_dirty)
+  if (icon_cache->origin <= USING_WM_HINTS &&
+      icon_cache->wm_hints_dirty)
     return TRUE;
   else if (icon_cache->origin <= USING_NET_WM_ICON &&
            icon_cache->net_wm_icon_dirty)
@@ -713,35 +660,6 @@ meta_read_icons (MetaScreen     *screen,
         }
     }
 
-  if (icon_cache->origin <= USING_KWM_WIN_ICON &&
-      icon_cache->kwm_win_icon_dirty)
-    {
-      icon_cache->kwm_win_icon_dirty = FALSE;
-
-      get_kwm_win_icon (screen->display, xwindow, &pixmap, &mask);
-
-      if ((pixmap != icon_cache->prev_pixmap ||
-           mask != icon_cache->prev_mask) &&
-          pixmap != None)
-        {
-          if (try_pixmap_and_mask (screen->display,
-                                   pixmap,
-                                   mask,
-                                   iconp,
-                                   ideal_size,
-                                   mini_iconp,
-                                   ideal_mini_size))
-            {
-              icon_cache->prev_pixmap = pixmap;
-              icon_cache->prev_mask = mask;
-
-              icon_cache->origin = USING_KWM_WIN_ICON;
-
-              return TRUE;
-            }
-        }
-    }
-
   if (icon_cache->origin < USING_FALLBACK_ICON)
     {
       get_fallback_icons (screen,
diff --git a/src/core/iconcache.h b/src/core/iconcache.h
index cdc18003..722fb220 100644
--- a/src/core/iconcache.h
+++ b/src/core/iconcache.h
@@ -34,7 +34,6 @@ typedef enum
    */
   USING_NO_ICON,
   USING_FALLBACK_ICON,
-  USING_KWM_WIN_ICON,
   USING_WM_HINTS,
   USING_NET_WM_ICON
 } IconOrigin;
@@ -46,7 +45,6 @@ struct _MetaIconCache
   Pixmap prev_mask;
   /* TRUE if these props have changed */
   guint wm_hints_dirty : 1;
-  guint kwm_win_icon_dirty : 1;
   guint net_wm_icon_dirty : 1;
 };
 
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 680b236b..5a594646 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -286,14 +286,6 @@ reload_net_wm_icon (MetaWindow    *window,
   reload_icon (window, window->display->atom__NET_WM_ICON);
 }
 
-static void
-reload_kwm_win_icon (MetaWindow    *window,
-                     MetaPropValue *value,
-                     gboolean       initial)
-{
-  reload_icon (window, window->display->atom__KWM_WIN_ICON);
-}
-
 static void
 meta_window_set_custom_frame_extents (MetaWindow *window,
                                       GtkBorder  *extents)
@@ -1884,12 +1876,6 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
       reload_net_wm_icon,
       NONE
     },
-    {
-      display->atom__KWM_WIN_ICON,
-      META_PROP_VALUE_INVALID,
-      reload_kwm_win_icon,
-      NONE
-    },
     {
       display->atom__NET_WM_ICON_GEOMETRY,
       META_PROP_VALUE_CARDINAL_LIST,


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