Merge branch 'wip/sort-icons-by-size' into 'master'

window: sort icons before adding to _NET_WM_ICON

See merge request GNOME/gtk!1038
This commit is contained in:
Matthias Clasen 2019-08-01 23:31:44 +00:00
commit 2bd93c1e9e

View File

@ -4007,6 +4007,18 @@ ensure_icon_info (GtkWindow *window)
return info; return info;
} }
static int
icon_size_compare (GdkTexture *a,
GdkTexture *b)
{
int area_a, area_b;
area_a = gdk_texture_get_width (a) * gdk_texture_get_height (a);
area_b = gdk_texture_get_width (b) * gdk_texture_get_height (b);
return area_a - area_b;
}
static GList * static GList *
icon_list_from_theme (GtkWindow *window, icon_list_from_theme (GtkWindow *window,
const gchar *name) const gchar *name)
@ -4044,7 +4056,7 @@ icon_list_from_theme (GtkWindow *window,
0); 0);
if (info) if (info)
{ {
list = g_list_append (list, gtk_icon_info_load_texture (info)); list = g_list_insert_sorted (list, gtk_icon_info_load_texture (info), (GCompareFunc) icon_size_compare);
g_object_unref (info); g_object_unref (info);
} }
} }