forked from AuroraMiddleware/gtk
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:
commit
2bd93c1e9e
@ -4007,6 +4007,18 @@ ensure_icon_info (GtkWindow *window)
|
||||
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 *
|
||||
icon_list_from_theme (GtkWindow *window,
|
||||
const gchar *name)
|
||||
@ -4044,7 +4056,7 @@ icon_list_from_theme (GtkWindow *window,
|
||||
0);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user