[mutter/wip/carlosg/xwayland-on-demand: 20/32] core: Relax requirement that MetaWindow shall have icon/mini-icon
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/xwayland-on-demand: 20/32] core: Relax requirement that MetaWindow shall have icon/mini-icon
- Date: Mon, 7 Jan 2019 12:50:06 +0000 (UTC)
commit 6782ab45e330d8d79399d17de0148df0d24259f0
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 1aec95710..49edc1b66 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5336,50 +5336,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)
@@ -5396,17 +5352,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]);
@@ -5415,9 +5365,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]