[clutter-gtk] actor: don't use -1 for width/height requests



commit 1cb671392cbe57cac898c05bce45da1c9b818f21
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jul 8 18:26:03 2011 -0400

    actor: don't use -1 for width/height requests
    
    This is not supported by GTK+ master, and breaks widget embedding.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654282

 clutter-gtk/gtk-clutter-actor.c |   45 +++++++++++++++++++++++++-------------
 1 files changed, 29 insertions(+), 16 deletions(-)
---
diff --git a/clutter-gtk/gtk-clutter-actor.c b/clutter-gtk/gtk-clutter-actor.c
index 947a58c..9016b77 100644
--- a/clutter-gtk/gtk-clutter-actor.c
+++ b/clutter-gtk/gtk-clutter-actor.c
@@ -174,16 +174,22 @@ gtk_clutter_actor_get_preferred_width (ClutterActor *actor,
   GtkClutterActorPrivate *priv = clutter->priv;
   gint min_width, natural_width;
 
+  min_width = natural_width = 0;
+
   if (for_height >= 0)
-    for_height = floorf (for_height + 0.5);
+    {
+      for_height = floorf (for_height + 0.5);
+      gtk_widget_get_preferred_width_for_height (priv->widget,
+                                                 for_height,
+                                                 &min_width,
+                                                 &natural_width);
+    }
   else
-    for_height = -1;
-
-  min_width = natural_width = 0;
-  gtk_widget_get_preferred_width_for_height (priv->widget,
-                                             for_height,
-                                             &min_width,
-                                             &natural_width);
+    {
+      gtk_widget_get_preferred_width (priv->widget,
+                                      &min_width,
+                                      &natural_width);
+    }
 
   if (min_width_p)
     *min_width_p = min_width;
@@ -202,16 +208,23 @@ gtk_clutter_actor_get_preferred_height (ClutterActor *actor,
   GtkClutterActorPrivate *priv = clutter->priv;
   gint min_height, natural_height;
 
+  min_height = natural_height = 0;
+
   if (for_width >= 0)
-    for_width = floorf (for_width + 0.5);
-  else
-    for_width = -1;
+    {
+      for_width = floorf (for_width + 0.5);
 
-  min_height = natural_height = 0;
-  gtk_widget_get_preferred_height_for_width (priv->widget,
-                                             for_width,
-                                             &min_height,
-                                             &natural_height);
+      gtk_widget_get_preferred_height_for_width (priv->widget,
+                                                 for_width,
+                                                 &min_height,
+                                                 &natural_height);
+    }
+  else
+    {
+      gtk_widget_get_preferred_height (priv->widget,
+                                       &min_height,
+                                       &natural_height);
+    }
 
   if (min_height_p)
     *min_height_p = min_height;



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