[Xfce4-commits] <xfce4-panel:master> Tasklist: Capping buttons height when button labels are visible.

Nick Schermer noreply at xfce.org
Fri Mar 30 21:32:02 CEST 2012


Updating branch refs/heads/master
         to e733f80b11c61199f7c7ae63d83987706ec734f4 (commit)
       from 42f1ea5f0fb3c64376328cd172e33019511bc1b3 (commit)

commit e733f80b11c61199f7c7ae63d83987706ec734f4
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Tue Mar 6 01:29:12 2012 +0900

    Tasklist: Capping buttons height when button labels are visible.

 plugins/tasklist/tasklist-widget.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index ec0d035..7c60dd9 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -769,6 +769,12 @@ xfce_tasklist_size_request (GtkWidget      *widget,
   else
     {
       rows = MAX (tasklist->nrows, 1);
+      if (tasklist->show_labels && tasklist->max_button_size > 0)
+        {
+          rows = MAX (rows,
+                      ceil ((gdouble) tasklist->size / (gdouble) tasklist->max_button_size));
+          child_height = MIN (child_height, tasklist->max_button_size);
+        }
 
       cols = n_windows / rows;
       if (cols * rows < n_windows)
@@ -840,6 +846,9 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
   /* if we're in deskbar mode, there are no columns */
   if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)
     rows = 1;
+  else if (tasklist->show_labels && tasklist->max_button_size > 0)
+    rows = MAX (tasklist->nrows,
+                ceil ((gdouble) tasklist->size / (gdouble) tasklist->max_button_size));
   else
     rows = tasklist->nrows;
 
@@ -850,7 +859,9 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
   if (cols * rows < tasklist->n_windows)
     cols++;
 
-  if (xfce_tasklist_deskbar (tasklist) || !tasklist->show_labels)
+  if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)
+    min_button_length = MIN (alloc->height / tasklist->nrows, tasklist->max_button_size);
+  else if (!tasklist->show_labels)
     min_button_length = alloc->height / tasklist->nrows;
   else
     min_button_length = tasklist->min_button_length;
@@ -1036,7 +1047,7 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
               if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)
                 {
                   /* fixed width is OK because area.width==w*cols */
-                  w = area.height / tasklist->nrows;
+                  w = MIN (area.height / tasklist->nrows, tasklist->max_button_size);
                 }
               else if (tasklist->show_labels)
                 {


More information about the Xfce4-commits mailing list