[gtk+/native-layout] Fixed _gtk_size_group_bump_requisition() to properly handle values specified by gtk_widget_set_size_



commit 4c1fa76520216d15ca547c16be97ce6974a18cdf
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Apr 18 20:45:42 2010 -0400

    Fixed _gtk_size_group_bump_requisition() to properly handle values specified by gtk_widget_set_size_request()

 gtk/gtkextendedlayout.c |    2 ++
 gtk/gtksizegroup.c      |   24 +++++++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkextendedlayout.c b/gtk/gtkextendedlayout.c
index 92a1c64..b764f46 100644
--- a/gtk/gtkextendedlayout.c
+++ b/gtk/gtkextendedlayout.c
@@ -230,6 +230,8 @@ compute_size_for_orientation (GtkExtendedLayout *layout,
 
       /* Get size groups to compute the base requisition once one of the values have been cached,
        * then go ahead and update the cache with the sizegroup computed value.
+       *
+       * Note this is also where values from gtk_widget_set_size_request() are considered.
        */
       group_size = 
 	_gtk_size_group_bump_requisition (GTK_WIDGET (layout), 
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index c672390..56965aa 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -750,13 +750,31 @@ _gtk_size_group_bump_requisition (GtkWidget        *widget,
 {
   gint result = widget_requisition;
 
-  if (!is_bumping (widget) && get_size_groups (widget))
+  if (!is_bumping (widget))
     {
+      GtkWidgetAuxInfo *aux_info = 
+	_gtk_widget_get_aux_info (widget, FALSE);
+
       /* Avoid recursion here */
       mark_bumping (widget, TRUE);
 
-      result = compute_dimension (widget, mode, widget_requisition);
-
+      if (get_size_groups (widget))
+	{
+	  if (aux_info)
+	    {
+	      if (mode == GTK_SIZE_GROUP_HORIZONTAL)
+		result = compute_dimension (widget, mode, MAX (aux_info->width, widget_requisition));
+	      else 
+		result = compute_dimension (widget, mode, MAX (aux_info->height, widget_requisition));
+	    }
+	}
+      else if (aux_info)
+	{
+	  if (mode == GTK_SIZE_GROUP_HORIZONTAL)
+	    result = MAX (aux_info->width, widget_requisition);
+	  else 
+	    result = MAX (aux_info->height, widget_requisition);
+	}
       mark_bumping (widget, FALSE);
     }
   return result;



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