[Xfce4-commits] <xfce4-panel:andrzejr/deskbar2> tasklist plugin: capping buttons height when button labels are visible.

Andrzej noreply at xfce.org
Mon Mar 5 17:30:02 CET 2012


Updating branch refs/heads/andrzejr/deskbar2
         to 265d3ca70a120145216b6080def5d6345cd7e5b1 (commit)
       from 4e796257880b0f193b4a1099aa803bb5572db8f8 (commit)

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

    tasklist plugin: 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