[Xfce4-commits] [xfce/xfce4-panel] 01/01: tasklist: Add support for larger application icons

noreply at xfce.org noreply at xfce.org
Sun Dec 9 11:55:43 CET 2018


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit fc4efcc991b21d191f0b82412fb33070009780c5
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Fri Dec 7 12:11:41 2018 +0100

    tasklist: Add support for larger application icons
    
    As libwnck now supports larger icon sizes we should make use of them.
    In some cases the icon-cache of libwnck is outdated. To be exact:
    a correct icon is there, but the size is not. So we sometimes get a
    32px icon even though we requested a larger one.
    The only way to work around this is to take the icon of an app in
    that group until the cache is valid again.
---
 configure.ac.in                    |  2 +-
 plugins/tasklist/tasklist-widget.c | 33 +++++++++++++++++++++++++++------
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 04f42b5..31604c3 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -152,7 +152,7 @@ XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.24.0])
 PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.24.0])
 XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.24.0])
 XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.0.0])
-XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-3.0], [3.0])
+XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-3.0], [3.4])
 
 dnl ***********************************************************
 dnl *** Optional support for a GTK+2 version of the library ***
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index fd9476a..dd30962 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -2568,13 +2568,12 @@ xfce_tasklist_button_icon_changed (WnckWindow        *window,
     return;
 
   icon_size = xfce_panel_plugin_get_icon_size (XFCE_PANEL_PLUGIN (xfce_tasklist_get_panel_plugin (tasklist)));
+  wnck_set_default_icon_size (icon_size);
   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)
+  if (tasklist->show_labels
+      || child->type == CHILD_TYPE_GROUP_MENU)
     pixbuf = wnck_window_get_mini_icon (window);
   else
     pixbuf = wnck_window_get_icon (window);
@@ -3744,13 +3743,12 @@ xfce_tasklist_group_button_icon_changed (WnckClassGroup    *class_group,
     return;
 
   icon_size = xfce_panel_plugin_get_icon_size (XFCE_PANEL_PLUGIN (xfce_tasklist_get_panel_plugin (group_child->tasklist)));
+  wnck_set_default_icon_size (icon_size);
   context = gtk_widget_get_style_context (GTK_WIDGET (group_child->icon));
 
   /* get the class group icon */
   if (group_child->tasklist->show_labels)
     pixbuf = wnck_class_group_get_mini_icon (class_group);
-  else if (icon_size <= 31)
-    pixbuf = wnck_class_group_get_mini_icon (class_group);
   else
     pixbuf = wnck_class_group_get_icon (class_group);
 
@@ -3758,6 +3756,13 @@ xfce_tasklist_group_button_icon_changed (WnckClassGroup    *class_group,
   for (li = group_child->windows; li != NULL; li = li->next)
     {
       child = li->data;
+      /* in case the libwnck icon_cache provided us with a 32px group icon and that's not
+         what we want we take the app icon of the first app in the group instead (only until
+         cache is invalidated of course), because we always get that at the correct size */
+      if (gdk_pixbuf_get_width (pixbuf) != icon_size
+          && !group_child->tasklist->show_labels)
+          pixbuf = wnck_window_get_icon (child->window);
+
       if (!wnck_window_is_minimized (child->window))
         {
           all_minimized_in_group = FALSE;
@@ -3786,6 +3791,20 @@ xfce_tasklist_group_button_icon_changed (WnckClassGroup    *class_group,
 
 
 
+static gboolean
+xfce_tasklist_group_button_size_allocate (GtkWidget         *widget,
+                                          GdkRectangle      *allocation,
+                                          gpointer           user_data)
+{
+  XfceTasklistChild *child = user_data;
+  /* Make sure the icons have the correct size */
+  xfce_tasklist_group_button_icon_changed (child->class_group, child);
+
+  return TRUE;
+}
+
+
+
 static void
 xfce_tasklist_group_button_remove (XfceTasklistChild *group_child)
 {
@@ -3964,6 +3983,8 @@ xfce_tasklist_group_button_new (WnckClassGroup *class_group,
   /* note that the same signals should be in the proxy menu item too */
   g_signal_connect (G_OBJECT (child->button), "button-press-event",
       G_CALLBACK (xfce_tasklist_group_button_button_press_event), child);
+  g_signal_connect (G_OBJECT (child->button), "size-allocate",
+      G_CALLBACK (xfce_tasklist_group_button_size_allocate), child);
 
   /* monitor class group changes */
   g_signal_connect (G_OBJECT (class_group), "icon-changed",

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list