[Xfce4-commits] [xfce/xfce4-panel] 01/03: tasklist: Make all-minimized group buttons translucent (Bug #10862)

noreply at xfce.org noreply at xfce.org
Sat Dec 1 01:06:02 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 9921b874b7c929696eca061b8818303d3e439a93
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Nov 29 00:23:19 2018 +0100

    tasklist: Make all-minimized group buttons translucent (Bug #10862)
---
 plugins/tasklist/tasklist-widget.c | 52 +++++++++++++++++++++++++++++++++-----
 1 file changed, 46 insertions(+), 6 deletions(-)

diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index b3a2807..1c53180 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -343,6 +343,8 @@ static XfceTasklistChild *xfce_tasklist_button_new                       (WnckWi
 static void               xfce_tasklist_group_button_remove              (XfceTasklistChild    *group_child);
 static void               xfce_tasklist_group_button_add_window          (XfceTasklistChild    *group_child,
                                                                           XfceTasklistChild    *window_child);
+static void               xfce_tasklist_group_button_icon_changed        (WnckClassGroup       *class_group,
+                                                                          XfceTasklistChild    *group_child);
 static XfceTasklistChild *xfce_tasklist_group_button_new                 (WnckClassGroup       *class_group,
                                                                           XfceTasklist         *tasklist);
 
@@ -1684,6 +1686,9 @@ xfce_tasklist_active_window_changed (WnckScreen   *screen,
         if (child->type == CHILD_TYPE_GROUP
           && child->class_group == class_group)
           {
+            /* update the button's state and icon, the latter makes sure it is rendered correctly
+               if all previous group windows were minimized */
+            xfce_tasklist_group_button_icon_changed (child->class_group, child);
             gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child->button), TRUE);
           }
       }
@@ -2655,10 +2660,11 @@ xfce_tasklist_button_state_changed (WnckWindow        *window,
                                     WnckWindowState    new_state,
                                     XfceTasklistChild *child)
 {
-  gboolean       blink;
-  WnckScreen    *screen;
-  XfceTasklist  *tasklist;
-  WnckWorkspace *active_ws;
+  gboolean           blink;
+  WnckScreen        *screen;
+  XfceTasklist      *tasklist;
+  WnckWorkspace     *active_ws;
+  XfceTasklistChild *group_child;
 
   panel_return_if_fail (WNCK_IS_WINDOW (window));
   panel_return_if_fail (child->window == window);
@@ -2698,6 +2704,14 @@ xfce_tasklist_button_state_changed (WnckWindow        *window,
         {
           /* update the icon (lucent) */
           xfce_tasklist_button_icon_changed (window, child);
+          if (child->class_group != NULL)
+            {
+              /* find the child for the group */
+              g_hash_table_lookup_extended (child->tasklist->class_groups,
+                                            child->class_group,
+                                            NULL, (gpointer *) &group_child);
+              xfce_tasklist_group_button_icon_changed (child->class_group, group_child);
+            }
         }
     }
 
@@ -3656,8 +3670,12 @@ static void
 xfce_tasklist_group_button_icon_changed (WnckClassGroup    *class_group,
                                          XfceTasklistChild *group_child)
 {
-  GdkPixbuf *pixbuf;
-  gint       icon_size;
+  GdkPixbuf         *pixbuf;
+  GdkPixbuf         *lucent = NULL;
+  GSList            *li;
+  XfceTasklistChild *child;
+  gboolean           all_minimized_in_group = TRUE;
+  gint               icon_size;
 
   panel_return_if_fail (XFCE_IS_TASKLIST (group_child->tasklist));
   panel_return_if_fail (WNCK_IS_CLASS_GROUP (class_group));
@@ -3679,6 +3697,28 @@ xfce_tasklist_group_button_icon_changed (WnckClassGroup    *class_group,
   else
     pixbuf = wnck_class_group_get_icon (class_group);
 
+  /* check if all the windows in the group are minimized */
+  for (li = group_child->windows; li != NULL; li = li->next)
+    {
+      child = li->data;
+      if (!wnck_window_is_minimized (child->window))
+        {
+          all_minimized_in_group = FALSE;
+          break;
+        }
+    }
+  /* if the icons in the group are ALL minimized, than display
+   * a minimized lucent effect for the group icon too */
+  if (!group_child->tasklist->only_minimized
+      && group_child->tasklist->minimized_icon_lucency < 100
+      && all_minimized_in_group)
+    {
+      lucent = exo_gdk_pixbuf_lucent (pixbuf, group_child->tasklist->minimized_icon_lucency);
+      if (G_UNLIKELY (lucent != NULL))
+        pixbuf = lucent;
+    }
+
+
   if (G_LIKELY (pixbuf != NULL))
     gtk_image_set_from_pixbuf (GTK_IMAGE (group_child->icon), pixbuf);
   else

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


More information about the Xfce4-commits mailing list