[gtk+/extended-layout-jhs: 60/64] Properly calculate minimum_height in size-allocate. So I yell it into the



commit 95e810c39a2701e36e128e10e52edece555e500f
Author: Mathias Hasselmann <mathias hasselmann gmx de>
Date:   Mon Aug 20 18:54:48 2007 +0000

    Properly calculate minimum_height in size-allocate. So I yell it into the
    
    2007-08-20  Mathias Hasselmann  <mathias hasselmann gmx de>
    
    	* gtk/gtkvbox.c: Properly calculate minimum_height in size-allocate.
    	So I yell it into the night: Height-for-width is shiny and bright!
    
    svn path=/branches/extended-layout/; revision=18660

 ChangeLog.gtk-extended-layout |    5 +++++
 gtk/gtkvbox.c                 |   13 ++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog.gtk-extended-layout b/ChangeLog.gtk-extended-layout
index e928caf..fef9120 100644
--- a/ChangeLog.gtk-extended-layout
+++ b/ChangeLog.gtk-extended-layout
@@ -1,5 +1,10 @@
 2007-08-20  Mathias Hasselmann  <mathias hasselmann gmx de>
 
+	* gtk/gtkvbox.c: Properly calculate minimum_height in size-allocate.
+	So I yell it into the night: Height-for-width is shiny and bright!
+
+2007-08-20  Mathias Hasselmann  <mathias hasselmann gmx de>
+
 	* gtk/gtklabel.c: Announce size-for-allocation features only when
 	ellipsis or wrapping with full size allocation are active.
 	* tests/testextendedlayout.c: Display size-for-allocation information
diff --git a/gtk/gtkvbox.c b/gtk/gtkvbox.c
index e8d90d0..bf9c917 100644
--- a/gtk/gtkvbox.c
+++ b/gtk/gtkvbox.c
@@ -96,8 +96,6 @@ gtk_vbox_natural_size_request (GtkWidget      *child,
     gtk_extended_layout_get_natural_size ((GtkExtendedLayout*) child, requisition);
   else 
     gtk_widget_size_request (child, requisition);
-
-g_print ("%s: %dx%d (%dx%d)\n", G_OBJECT_TYPE_NAME (child), requisition->width, requisition->height, child->allocation.width, child->allocation.height);
 }
 
 static void
@@ -207,7 +205,7 @@ gtk_vbox_size_allocate (GtkWidget     *widget,
 
       border_width = GTK_CONTAINER (box)->border_width;
 
-      minimum_height = 0;
+      minimum_height = widget->requisition.height;
       natural_height = 0;
 
       natural_requisitions = g_newa (gint, nvis_children);
@@ -237,7 +235,13 @@ gtk_vbox_size_allocate (GtkWidget     *widget,
                   if (features & GTK_EXTENDED_LAYOUT_HEIGHT_FOR_WIDTH)
                     {
                       gint height = gtk_extended_layout_get_height_for_width (layout, allocation->width);
-                      minimum_requisitions[i] = MIN (minimum_requisitions[i], height);
+                      gint dy = minimum_requisitions[i] - height;
+
+                      if (dy > 0)
+                        {
+                          minimum_requisitions[i] = height;
+                          minimum_height -= dy;
+                        }
                     }
                   else if (features & GTK_EXTENDED_LAYOUT_NATURAL_SIZE)
                     {
@@ -247,7 +251,6 @@ gtk_vbox_size_allocate (GtkWidget     *widget,
 
                 }
 
-              minimum_height += minimum_requisitions[i];
               natural_height += natural_requisitions[i++];
             }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]