summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-07-08 18:26:03 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2011-07-08 18:29:13 -0400
commit1cb671392cbe57cac898c05bce45da1c9b818f21 (patch)
treec26794382c9c5999d74dee689f160da44ff46590
parent0ec642a24c25742167d42dd6552c12b8923ea4bc (diff)
downloadclutter-gtk-1cb671392cbe57cac898c05bce45da1c9b818f21.tar.gz
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
-rw-r--r--clutter-gtk/gtk-clutter-actor.c45
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;