diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c index 8d44faac..a08065b9 100644 --- a/plugins/tasklist/tasklist-widget.c +++ b/plugins/tasklist/tasklist-widget.c @@ -616,7 +616,38 @@ xfce_tasklist_init (XfceTasklist *tasklist) gtk_widget_show (tasklist->arrow_button); } - +static GdkPixbuf * +xfce_tasklist_get_icon(WnckWindow *window, gboolean show_labels, int size, int type) +{ + GdkPixbuf *pixbuf; + if (show_labels || type == CHILD_TYPE_GROUP_MENU) + { + pixbuf = wnck_window_get_mini_icon (window); + } + else if (size <= 31) + { + pixbuf = wnck_window_get_mini_icon (window); + } + else + { + pixbuf = wnck_window_get_icon (window); + } + if (!pixbuf || wnck_window_get_icon_is_fallback (window)) + { + GdkPixbuf *theme_icon; + GtkIconTheme *theme = gtk_icon_theme_get_default (); + const char *name = wnck_window_get_class_instance_name (window); + // Get the pixbuf from the icon theme, and also avoid + // overwriting `pixbuf' because if it holds a valid fallback + // icon then it can become `NULL' after this call leading + // to no icon at all to render + theme_icon = gtk_icon_theme_load_icon (theme, name, size, + GTK_ICON_LOOKUP_FORCE_SIZE, NULL); + if (theme_icon) + pixbuf = theme_icon; + } + return pixbuf; +} static void xfce_tasklist_get_property (GObject *object, @@ -2553,14 +2584,7 @@ xfce_tasklist_button_icon_changed (WnckWindow *window, context = gtk_widget_get_style_context (GTK_WIDGET (child->icon)); /* get the window icon */ - if (tasklist->show_labels || - child->type == CHILD_TYPE_GROUP_MENU) - pixbuf = wnck_window_get_mini_icon (window); - else if (icon_size <= 31) - pixbuf = wnck_window_get_mini_icon (window); - else - pixbuf = wnck_window_get_icon (window); - + pixbuf = xfce_tasklist_get_icon(child->window, tasklist->show_labels, icon_size, child->type); /* leave when there is no valid pixbuf */ if (G_UNLIKELY (pixbuf == NULL)) { @@ -3259,7 +3283,7 @@ xfce_tasklist_button_drag_begin (GtkWidget *button, } #endif - pixbuf = wnck_window_get_icon (child->window); + pixbuf = xfce_tasklist_get_icon (child->window, FALSE, 32, CHILD_TYPE_WINDOW); if (G_LIKELY (pixbuf != NULL)) gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0); } @@ -3318,8 +3342,6 @@ xfce_tasklist_button_drag_data_received (GtkWidget *button, } } - - static XfceTasklistChild * xfce_tasklist_button_new (WnckWindow *window, XfceTasklist *tasklist) @@ -3701,8 +3723,6 @@ xfce_tasklist_group_button_name_changed (WnckClassGroup *class_group, xfce_tasklist_sort (group_child->tasklist); } - - static void xfce_tasklist_group_button_icon_changed (WnckClassGroup *class_group, XfceTasklistChild *group_child)