diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2013-03-08 15:24:50 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2013-03-13 16:10:22 -0300 |
commit | 84e5bdd87117f81ce3eee3ddb9727b67f1441532 (patch) | |
tree | f1811a33764311566a31915d77ac2f3904284af6 | |
parent | 09f4d5dbc410b71249213a158357f7175ab64f03 (diff) | |
download | clutter-84e5bdd87117f81ce3eee3ddb9727b67f1441532.tar.gz |
actor: Clean up ::show and ::hide class handlers
The main body of the function should not live inside an 'if' block.
-rw-r--r-- | clutter/clutter-actor.c | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 5f868db04..eefc3d4d7 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -1612,34 +1612,35 @@ clutter_actor_unmap (ClutterActor *self) static void clutter_actor_real_show (ClutterActor *self) { - if (!CLUTTER_ACTOR_IS_VISIBLE (self)) - { - ClutterActorPrivate *priv = self->priv; + ClutterActorPrivate *priv = self->priv; - CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_VISIBLE); + if (CLUTTER_ACTOR_IS_VISIBLE (self)) + return; - /* we notify on the "visible" flag in the clutter_actor_show() - * wrapper so the entire show signal emission completes first - * (?) - */ - clutter_actor_update_map_state (self, MAP_STATE_CHECK); + CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_VISIBLE); - /* we queue a relayout unless the actor is inside a - * container that explicitly told us not to + /* we notify on the "visible" flag in the clutter_actor_show() + * wrapper so the entire show signal emission completes first, + * and the branch of the scene graph is in a stable state + */ + clutter_actor_update_map_state (self, MAP_STATE_CHECK); + + /* we queue a relayout unless the actor is inside a + * container that explicitly told us not to + */ + if (priv->parent != NULL && + (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT))) + { + /* While an actor is hidden the parent may not have + * allocated/requested so we need to start from scratch + * and avoid the short-circuiting in + * clutter_actor_queue_relayout(). */ - if (priv->parent != NULL && - (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT))) - { - /* While an actor is hidden the parent may not have - * allocated/requested so we need to start from scratch - * and avoid the short-circuiting in - * clutter_actor_queue_relayout(). - */ - priv->needs_width_request = FALSE; - priv->needs_height_request = FALSE; - priv->needs_allocation = FALSE; - clutter_actor_queue_relayout (self); - } + priv->needs_width_request = FALSE; + priv->needs_height_request = FALSE; + priv->needs_allocation = FALSE; + + clutter_actor_queue_relayout (self); } } @@ -1747,25 +1748,25 @@ clutter_actor_show_all (ClutterActor *self) static void clutter_actor_real_hide (ClutterActor *self) { - if (CLUTTER_ACTOR_IS_VISIBLE (self)) - { - ClutterActorPrivate *priv = self->priv; + ClutterActorPrivate *priv = self->priv; + + if (!CLUTTER_ACTOR_IS_VISIBLE (self)) + return; - CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_VISIBLE); + CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_VISIBLE); - /* we notify on the "visible" flag in the clutter_actor_hide() - * wrapper so the entire hide signal emission completes first - * (?) - */ - clutter_actor_update_map_state (self, MAP_STATE_CHECK); + /* we notify on the "visible" flag in the clutter_actor_hide() + * wrapper so the entire hide signal emission completes first, + * and the branch of the scene graph is in a stable state + */ + clutter_actor_update_map_state (self, MAP_STATE_CHECK); - /* we queue a relayout unless the actor is inside a - * container that explicitly told us not to - */ - if (priv->parent != NULL && - (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT))) - clutter_actor_queue_relayout (priv->parent); - } + /* we queue a relayout unless the actor is inside a + * container that explicitly told us not to + */ + if (priv->parent != NULL && + (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT))) + clutter_actor_queue_relayout (priv->parent); } /** |