summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2018-12-30 14:18:09 +0100
committerJonas Ã…dahl <jadahl@gmail.com>2019-05-24 15:30:31 +0000
commit2f217109aabb097a66c2b963467990d2d92f9c40 (patch)
treea33f681729fac3b3e076c3ee996236bf977c25f6
parent5e0523cc8bbcc639a48071d4021716319e356582 (diff)
downloadmutter-2f217109aabb097a66c2b963467990d2d92f9c40.tar.gz
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. https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
-rw-r--r--src/core/window.c57
1 files changed, 2 insertions, 55 deletions
diff --git a/src/core/window.c b/src/core/window.c
index abd56bfe9..5721dadf1 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5373,50 +5373,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)
@@ -5433,17 +5389,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]);
@@ -5452,9 +5402,6 @@ meta_window_update_icon_now (MetaWindow *window,
redraw_icon (window);
}
-
- g_assert (window->icon);
- g_assert (window->mini_icon);
}
static gboolean