Avoid drawing twice if relayout queues a draw

It's reasonably normal for a relayout of the stage to cause the stage
to be queued for drawing; for this reason we should do the relayout before
we clear stage->update_idle. (But want to clear update_idle() before actually
doing the redraw to handle the corner case where the draw queues another
redraw.)
This commit is contained in:
Owen W. Taylor 2009-03-12 15:33:36 -04:00 committed by Emmanuele Bassi
parent 72f9646804
commit e1742af368

View File

@ -356,6 +356,13 @@ redraw_update_idle (gpointer user_data)
ClutterStage *stage = user_data;
ClutterStagePrivate *priv = stage->priv;
/* clutter_redraw() will also call maybe_relayout(), but since a relayout can
* queue a redraw, we want to do the relayout before we clear the update_idle
* to avoid painting the stage twice. Calling maybe_relayout() twice in a row
* is cheap because of caching of requested and allocated size.
*/
_clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage));
if (priv->update_idle)
{
g_source_remove (priv->update_idle);