Fix redraw queueing in the presence of cloning

We can't short-circuit the emission of ::queue-redraw for not-visible
actors, since ClutterClone uses that signal to know when things need
to be redrawn.

Calling clutter_actor_queue_redraw() out of clutter_actor_real_map() /
clutter_actor_real_unmap() was causing the flag state to get set
incorrectly from _clutter_actor_set_enable_paint_unmapped(), because
a paint queueing a redraw was not expected.

Moving queuing the redraw to clutter_actor_hide()/show() fixes this, and
also fixes a problem where showing a child of a cloned actor wouldn't
cause the clone to be repainted.

http://bugzilla.openedhand.com/show_bug.cgi?id=1484

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Owen W. Taylor 2009-06-11 18:56:27 -04:00 committed by Emmanuele Bassi
parent abac520f0c
commit e6a987d670

View File

@ -851,8 +851,6 @@ clutter_actor_real_map (ClutterActor *self)
*/ */
g_object_notify (G_OBJECT (self), "mapped"); g_object_notify (G_OBJECT (self), "mapped");
clutter_actor_queue_redraw (self);
if (CLUTTER_IS_CONTAINER (self)) if (CLUTTER_IS_CONTAINER (self))
clutter_container_foreach_with_internals (CLUTTER_CONTAINER (self), clutter_container_foreach_with_internals (CLUTTER_CONTAINER (self),
CLUTTER_CALLBACK (clutter_actor_map), CLUTTER_CALLBACK (clutter_actor_map),
@ -922,8 +920,6 @@ clutter_actor_real_unmap (ClutterActor *self)
clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL); clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL);
} }
} }
clutter_actor_queue_redraw (self);
} }
/** /**
@ -1011,6 +1007,9 @@ clutter_actor_show (ClutterActor *self)
g_object_notify (G_OBJECT (self), "visible"); g_object_notify (G_OBJECT (self), "visible");
} }
if (priv->parent_actor)
clutter_actor_queue_redraw (priv->parent_actor);
g_object_thaw_notify (G_OBJECT (self)); g_object_thaw_notify (G_OBJECT (self));
} }
@ -1091,6 +1090,9 @@ clutter_actor_hide (ClutterActor *self)
g_object_notify (G_OBJECT (self), "visible"); g_object_notify (G_OBJECT (self), "visible");
} }
if (priv->parent_actor)
clutter_actor_queue_redraw (priv->parent_actor);
g_object_thaw_notify (G_OBJECT (self)); g_object_thaw_notify (G_OBJECT (self));
} }
@ -1589,10 +1591,6 @@ static void
clutter_actor_queue_redraw_with_origin (ClutterActor *self, clutter_actor_queue_redraw_with_origin (ClutterActor *self,
ClutterActor *origin) ClutterActor *origin)
{ {
/* short-circuit the trivial case */
if (!CLUTTER_ACTOR_IS_MAPPED(self))
return;
/* already queued since last paint() */ /* already queued since last paint() */
if (self->priv->queued_redraw) if (self->priv->queued_redraw)
return; return;
@ -1607,10 +1605,6 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
{ {
ClutterActor *parent; ClutterActor *parent;
/* short-circuit the trivial case */
if (!CLUTTER_ACTOR_IS_MAPPED (self))
return;
/* already queued since last paint() */ /* already queued since last paint() */
if (self->priv->queued_redraw) if (self->priv->queued_redraw)
return; return;
@ -1620,6 +1614,13 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
: G_OBJECT_TYPE_NAME (self)); : G_OBJECT_TYPE_NAME (self));
self->priv->queued_redraw = TRUE; self->priv->queued_redraw = TRUE;
/* If the actor isn't visible, we still had to emit the signal
* to allow for a ClutterClone, but the appearance of the parent
* won't change so we don't have to propagate up the hierarchy.
*/
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
return;
/* notify parents, if they are all visible eventually we'll /* notify parents, if they are all visible eventually we'll
* queue redraw on the stage, which queues the redraw idle. * queue redraw on the stage, which queues the redraw idle.
*/ */