From 52ba9a1800302f887ebe6d2e7aa7ab4503ea6e5e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sat, 27 Feb 2010 18:24:17 +0000 Subject: [PATCH] actor: Use the TOPLEVEL flag instead of a type check We can use the internal private CLUTTER_ACTOR_IS_TOPLEVEL flag, which is set only on Stages. --- clutter/clutter-actor.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index e871fb4..3709ab5 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -5477,14 +5477,21 @@ clutter_actor_set_width_internal (ClutterActor *self, { if (width >= 0) { - if (!CLUTTER_IS_STAGE (self)) + /* the Stage will use the :min-width to control the minimum + * width to be resized to, so we should not be setting it + * along with the :natural-width + */ + if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) clutter_actor_set_min_width (self, width); + clutter_actor_set_natural_width (self, width); } else { - if (!CLUTTER_IS_STAGE (self)) + /* we only unset the :natural-width for the Stage */ + if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) clutter_actor_set_min_width_set (self, FALSE); + clutter_actor_set_natural_width_set (self, FALSE); } } @@ -5498,14 +5505,18 @@ clutter_actor_set_height_internal (ClutterActor *self, { if (height >= 0) { - if (!CLUTTER_IS_STAGE (self)) + /* see the comment above in set_width_internal() */ + if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) clutter_actor_set_min_height (self, height); + clutter_actor_set_natural_height (self, height); } else { - if (!CLUTTER_IS_STAGE (self)) + /* see the comment above in set_width_internal() */ + if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) clutter_actor_set_min_height_set (self, FALSE); + clutter_actor_set_natural_height_set (self, FALSE); } } -- 2.7.4