actor: Propagate the cloned state to the children

If we clone a container, we still want redraws queued on the children to
be propagated.
This commit is contained in:
Emmanuele Bassi 2013-03-07 19:10:55 +00:00
parent 0e0db890e1
commit 20c0985869

View File

@ -774,6 +774,11 @@ struct _ClutterActorPrivate
/* a set of clones of the actor */ /* a set of clones of the actor */
GHashTable *clones; GHashTable *clones;
/* whether the actor is inside a cloned branch; this
* value is propagated to all the actor's children
*/
gulong in_cloned_branch;
/* bitfields: KEEP AT THE END */ /* bitfields: KEEP AT THE END */
/* fixed position and sizes */ /* fixed position and sizes */
@ -8611,7 +8616,8 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
* of their parents has been hidden * of their parents has been hidden
*/ */
if (!CLUTTER_ACTOR_IS_MAPPED (self) && if (!CLUTTER_ACTOR_IS_MAPPED (self) &&
!clutter_actor_has_mapped_clones (self)) !clutter_actor_has_mapped_clones (self) &&
self->priv->in_cloned_branch == 0)
return; return;
/* given the check above we could end up queueing a redraw on an /* given the check above we could end up queueing a redraw on an
@ -20157,6 +20163,32 @@ clutter_actor_get_child_transform (ClutterActor *self,
clutter_matrix_init_identity (transform); clutter_matrix_init_identity (transform);
} }
static void
clutter_actor_push_in_cloned_branch (ClutterActor *self)
{
ClutterActor *iter;
for (iter = self->priv->first_child;
iter != NULL;
iter = iter->priv->next_sibling)
clutter_actor_push_in_cloned_branch (iter);
self->priv->in_cloned_branch += 1;
}
static void
clutter_actor_pop_in_cloned_branch (ClutterActor *self)
{
ClutterActor *iter;
self->priv->in_cloned_branch -= 1;
for (iter = self->priv->first_child;
iter != NULL;
iter = iter->priv->next_sibling)
clutter_actor_pop_in_cloned_branch (iter);
}
void void
_clutter_actor_attach_clone (ClutterActor *actor, _clutter_actor_attach_clone (ClutterActor *actor,
ClutterActor *clone) ClutterActor *clone)
@ -20169,6 +20201,8 @@ _clutter_actor_attach_clone (ClutterActor *actor,
priv->clones = g_hash_table_new (NULL, NULL); priv->clones = g_hash_table_new (NULL, NULL);
g_hash_table_add (priv->clones, clone); g_hash_table_add (priv->clones, clone);
clutter_actor_push_in_cloned_branch (actor);
} }
void void
@ -20183,6 +20217,8 @@ _clutter_actor_detach_clone (ClutterActor *actor,
g_hash_table_lookup (priv->clones, clone) == NULL) g_hash_table_lookup (priv->clones, clone) == NULL)
return; return;
clutter_actor_pop_in_cloned_branch (actor);
g_hash_table_remove (priv->clones, clone); g_hash_table_remove (priv->clones, clone);
if (g_hash_table_size (priv->clones) == 0) if (g_hash_table_size (priv->clones) == 0)