actor: re-allocation implies need to redraw

If clutter_actor_allocate finds it necessary to update an actors
allocation then it now also queue a redraw of that actor. Currently we
queue redraws for actors very early on when queuing a relayout instead
of waiting to determine the final outcome of relayouting to determine if
a redraw is really required. With this in place we can move away from
preemptive queuing of redraws.
This commit is contained in:
Robert Bragg 2010-09-07 21:56:33 +01:00
parent 267e458a43
commit dc97692271

View File

@ -5487,6 +5487,7 @@ clutter_actor_allocate (ClutterActor *self,
ClutterActorClass *klass; ClutterActorClass *klass;
ClutterActorBox alloc; ClutterActorBox alloc;
gboolean child_moved; gboolean child_moved;
gboolean stage_allocation_changed;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
if (G_UNLIKELY (_clutter_actor_get_stage_internal (self) == NULL)) if (G_UNLIKELY (_clutter_actor_get_stage_internal (self) == NULL))
@ -5516,6 +5517,14 @@ clutter_actor_allocate (ClutterActor *self,
child_moved = (alloc.x1 != priv->allocation.x1 || child_moved = (alloc.x1 != priv->allocation.x1 ||
alloc.y1 != priv->allocation.y1); alloc.y1 != priv->allocation.y1);
if (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED ||
child_moved ||
alloc.x2 != priv->allocation.x2 ||
alloc.y2 != priv->allocation.y2)
stage_allocation_changed = TRUE;
else
stage_allocation_changed = FALSE;
/* If we get an allocation "out of the blue" /* If we get an allocation "out of the blue"
* (we did not queue relayout), then we want to * (we did not queue relayout), then we want to
* ignore it. But if we have needs_allocation set, * ignore it. But if we have needs_allocation set,
@ -5529,11 +5538,7 @@ clutter_actor_allocate (ClutterActor *self,
* not moved. * not moved.
*/ */
if (!priv->needs_allocation && if (!priv->needs_allocation && !stage_allocation_changed)
!(flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED) &&
!child_moved &&
alloc.x2 == priv->allocation.x2 &&
alloc.y2 == priv->allocation.y2)
{ {
CLUTTER_NOTE (LAYOUT, "No allocation needed"); CLUTTER_NOTE (LAYOUT, "No allocation needed");
return; return;
@ -5554,6 +5559,9 @@ clutter_actor_allocate (ClutterActor *self,
klass->allocate (self, &alloc, flags); klass->allocate (self, &alloc, flags);
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT); CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT);
if (stage_allocation_changed)
clutter_actor_queue_redraw (self);
} }
/** /**