[gtk+/native-layout] Fixed bug in gtk_extended_get_desired_size().



commit da318411dca2e47d3327d10dac0408bf40a4abb0
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Apr 18 18:12:30 2010 -0400

    Fixed bug in gtk_extended_get_desired_size().
    
    gtk_extended_get_desired_size() was mixing up orientations based
    on the preference, considering ditching the preference anyway.
    Also slightly enhanced debug prints.

 gtk/gtkextendedlayout.c |   32 +++++++++++++-------------------
 1 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/gtk/gtkextendedlayout.c b/gtk/gtkextendedlayout.c
index f08fced..96e071b 100644
--- a/gtk/gtkextendedlayout.c
+++ b/gtk/gtkextendedlayout.c
@@ -252,12 +252,14 @@ compute_size_for_orientation (GtkExtendedLayout *layout,
   g_assert (cached_size->minimum_size <= cached_size->natural_size);
 
 #if DEBUG_EXTENDED_LAYOUT
-  g_message ("%s size for orientation %s: %d is minimum %d and natural: %d",
-	     G_OBJECT_TYPE_NAME (layout), 
-	     orientation == GTK_SIZE_GROUP_HORIZONTAL ? "horizontal" : "vertical",
+  g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d (hit cache: %s)\n",
+	     layout, G_OBJECT_TYPE_NAME (layout), 
+	     orientation == GTK_SIZE_GROUP_HORIZONTAL ? 
+	     "width for height" : "height for width" ,
 	     for_size,
 	     cached_size->minimum_size,
-	     cached_size->natural_size);
+	     cached_size->natural_size,
+	     found_in_cache ? "yes" : "no");
 #endif
 
 }
@@ -406,34 +408,26 @@ gtk_extended_layout_get_desired_size (GtkExtendedLayout *layout,
 	     G_OBJECT_TYPE_NAME (layout), 
 	     min_height, nat_width);
 #endif
-
-      /* The minimum size here is the minimum height for the natrual width */
-      if (minimum_size)
-	{
-	  minimum_size->width  = min_width; 
-	  minimum_size->height = min_height;
-	}
       
     }
   else
     {
       gtk_extended_layout_get_desired_height (layout, &min_height, &nat_height);
-      gtk_extended_layout_get_height_for_width (layout, min_height, &min_width, &nat_width);
+      gtk_extended_layout_get_width_for_height (layout, min_height, &min_width, &nat_width);
 
 #if DEBUG_EXTENDED_LAYOUT
   g_message ("%s get_desired_size min width: %d for natural height: %d",
 	     G_OBJECT_TYPE_NAME (layout), 
 	     min_width, nat_height);
 #endif
-
-      /* The minimum size here is the minimum width for the natrual height */
-      if (minimum_size)
-	{
-	  minimum_size->width  = min_width; 
-	  minimum_size->height = min_height;
-	}
     }
 
+  if (minimum_size)
+    {
+      minimum_size->width  = min_width; 
+      minimum_size->height = min_height;
+    }
+  
   if (natural_size)
     {
       natural_size->width  = nat_width; 



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