mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
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
This commit is contained in:
parent
5e0523cc8b
commit
2f217109aa
@ -5373,50 +5373,6 @@ redraw_icon (MetaWindow *window)
|
|||||||
meta_frame_queue_draw (window->frame);
|
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
|
static void
|
||||||
meta_window_update_icon_now (MetaWindow *window,
|
meta_window_update_icon_now (MetaWindow *window,
|
||||||
gboolean force)
|
gboolean force)
|
||||||
@ -5433,17 +5389,11 @@ meta_window_update_icon_now (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
if (window->icon)
|
if (window->icon)
|
||||||
cairo_surface_destroy (window->icon);
|
cairo_surface_destroy (window->icon);
|
||||||
if (icon)
|
window->icon = icon;
|
||||||
window->icon = icon;
|
|
||||||
else
|
|
||||||
window->icon = get_default_window_icon ();
|
|
||||||
|
|
||||||
if (window->mini_icon)
|
if (window->mini_icon)
|
||||||
cairo_surface_destroy (window->mini_icon);
|
cairo_surface_destroy (window->mini_icon);
|
||||||
if (mini_icon)
|
window->mini_icon = mini_icon;
|
||||||
window->mini_icon = mini_icon;
|
|
||||||
else
|
|
||||||
window->mini_icon = get_default_mini_icon ();
|
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (window));
|
g_object_freeze_notify (G_OBJECT (window));
|
||||||
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_ICON]);
|
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);
|
redraw_icon (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert (window->icon);
|
|
||||||
g_assert (window->mini_icon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user