[Xfce4-commits] <xfce4-panel:devel> Improve allocations for expanding plugins without any width.

Nick Schermer nick at xfce.org
Tue Aug 11 20:28:17 CEST 2009


Updating branch refs/heads/devel
         to 898894969838169556134907b580b079ffc8e38c (commit)
       from be7314b353ed2bc8bd6051ac73b09c8920c3eb23 (commit)

commit 898894969838169556134907b580b079ffc8e38c
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Feb 22 20:31:26 2009 +0100

    Improve allocations for expanding plugins without any width.

 panel/panel-itembar.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index eac1987..2195c73 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -441,7 +441,7 @@ panel_itembar_size_allocate (GtkWidget     *widget,
   y = allocation->y + border_width;
 
   /* check if the expandable childs fit in the available expandable size */
-  expandable_children_fit = (req_expandable_size == alloc_expandable_size || req_expandable_size <= 0);
+  expandable_children_fit = !!(req_expandable_size == alloc_expandable_size);
 
   /* make sure the allocated expandable size is not below zero */
   alloc_expandable_size = MAX (0, alloc_expandable_size);
@@ -463,13 +463,19 @@ panel_itembar_size_allocate (GtkWidget     *widget,
       child_allocation.y = y;
 
       /* set the width or height of the child */
-      if (G_UNLIKELY (child->expand && expandable_children_fit == FALSE))
+      if (G_UNLIKELY (child->expand && !expandable_children_fit))
         {
           /* get requested size */
           req_size = itembar->horizontal ? child_requisition.width : child_requisition.height;
 
           /* calculate allocated size */
-          alloc_size = alloc_expandable_size * req_size / req_expandable_size;
+          if (G_LIKELY (req_expandable_size > 0 || req_size > 0))
+            alloc_size = alloc_expandable_size * req_size / req_expandable_size;
+          else
+            alloc_size = alloc_expandable_size / n_expand_children;
+
+          /* decrease counter */
+          n_expand_children--;
 
           /* set the calculated expanding size */
           if (itembar->horizontal)



More information about the Xfce4-commits mailing list