[mutter/wip/carlosg/xwayland-on-demand: 421/430] core: Relax requirement that MetaWindow shall have icon/mini-icon



commit c45a7b28331cf43ceda7e21b4682d9b770f5d612
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 30 14:18:09 2018 +0100

    core: Relax requirement that MetaWindow shall have icon/mini-icon
    
    We use a GtkIconTheme (thus icon-theme, thus xsettings, thus x11) just to
    grab a "missing icon" icon to show in place. Relax this requirement that
    surfaces for icon/mini-icon will be set, and just let it have NULL here.
    
    It seems better to have the callers (presumably UI layers) aware of this
    and set a proper icon by themselves, but AFAICS there is none in sight,
    not even plain mutter seems to use MetaWindow::[mini-]icon. Probably
    worth a future cleanup.

 src/core/window.c | 57 ++-----------------------------------------------------
 1 file changed, 2 insertions(+), 55 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index e944ce207..0e23d4ba3 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5384,50 +5384,6 @@ redraw_icon (MetaWindow *window)
     meta_frame_queue_draw (window->frame);
 }
 
-static cairo_surface_t *
-load_default_window_icon (int size)
-{
-  GtkIconTheme *theme = gtk_icon_theme_get_default ();
-  g_autoptr (GdkPixbuf) pixbuf = NULL;
-  const char *icon_name;
-
-  if (gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME))
-    icon_name = META_DEFAULT_ICON_NAME;
-  else
-    icon_name = "image-missing";
-
-  pixbuf = gtk_icon_theme_load_icon (theme, icon_name, size, 0, NULL);
-  return gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
-}
-
-static cairo_surface_t *
-get_default_window_icon (void)
-{
-  static cairo_surface_t *default_icon = NULL;
-
-  if (default_icon == NULL)
-    {
-      default_icon = load_default_window_icon (META_ICON_WIDTH);
-      g_assert (default_icon);
-    }
-
-  return cairo_surface_reference (default_icon);
-}
-
-static cairo_surface_t *
-get_default_mini_icon (void)
-{
-  static cairo_surface_t *default_icon = NULL;
-
-  if (default_icon == NULL)
-    {
-      default_icon = load_default_window_icon (META_MINI_ICON_WIDTH);
-      g_assert (default_icon);
-    }
-
-  return cairo_surface_reference (default_icon);
-}
-
 static void
 meta_window_update_icon_now (MetaWindow *window,
                              gboolean    force)
@@ -5444,17 +5400,11 @@ meta_window_update_icon_now (MetaWindow *window,
     {
       if (window->icon)
         cairo_surface_destroy (window->icon);
-      if (icon)
-        window->icon = icon;
-      else
-        window->icon = get_default_window_icon ();
+      window->icon = icon;
 
       if (window->mini_icon)
         cairo_surface_destroy (window->mini_icon);
-      if (mini_icon)
-        window->mini_icon = mini_icon;
-      else
-        window->mini_icon = get_default_mini_icon ();
+      window->mini_icon = mini_icon;
 
       g_object_freeze_notify (G_OBJECT (window));
       g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_ICON]);
@@ -5463,9 +5413,6 @@ meta_window_update_icon_now (MetaWindow *window,
 
       redraw_icon (window);
     }
-
-  g_assert (window->icon);
-  g_assert (window->mini_icon);
 }
 
 static gboolean


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