[repaint] Run the repaint functions in clutter_redraw()

The clutter_redraw() function is used by libraries embedding
Clutter inside another toolkit, instead of queueing a redraw
on the embedded stage. This means that clutter_redraw() should
perform the same sequence of actions done by the redraw idle
callback.
This commit is contained in:
Emmanuele Bassi 2009-06-05 17:55:24 +01:00
parent f66021825c
commit 6fe22ac850
3 changed files with 32 additions and 9 deletions

View File

@ -174,14 +174,8 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage)
}
}
/**
* clutter_redraw:
*
* Forces a redraw of the entire stage. Applications should never use this
* function, but queue a redraw using clutter_actor_queue_redraw().
*/
void
clutter_redraw (ClutterStage *stage)
_clutter_do_redraw (ClutterStage *stage)
{
ClutterMainContext *ctx;
ClutterMasterClock *master_clock;
@ -235,6 +229,32 @@ clutter_redraw (ClutterStage *stage)
CLUTTER_TIMESTAMP (SCHEDULER, "Redraw finish for stage:%p", stage);
}
/**
* clutter_redraw:
*
* Forces a redraw of the entire stage. Applications should never use this
* function, but queue a redraw using clutter_actor_queue_redraw().
*
* This function should only be used by libraries integrating Clutter from
* within another toolkit.
*/
void
clutter_redraw (ClutterStage *stage)
{
ClutterMasterClock *master_clock;
/* we need to do this because the clutter_redraw() might be called by
* clutter-gtk, and this will not cause the master clock to advance nor
* the repaint functions to be run
*/
master_clock = _clutter_master_clock_get_default ();
_clutter_master_clock_advance (master_clock);
_clutter_run_repaint_functions ();
_clutter_do_redraw (stage);
}
/**
* clutter_set_motion_events_enabled:
* @enable: %TRUE to enable per-actor motion events

View File

@ -211,6 +211,9 @@ ClutterActor *_clutter_do_pick (ClutterStage *stage,
gint y,
ClutterPickMode mode);
/* the actual redraw */
void _clutter_do_redraw (ClutterStage *stage);
guint _clutter_pixel_to_id (guchar pixel[4]);
void _clutter_id_to_color (guint id, ClutterColor *col);

View File

@ -417,7 +417,7 @@ redraw_update_idle (gpointer user_data)
CLUTTER_NOTE (PAINT, "Repaint functions");
_clutter_run_repaint_functions ();
/* clutter_redraw() will also call maybe_relayout(), but since a relayout
/* clutter_do_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
@ -427,7 +427,7 @@ redraw_update_idle (gpointer user_data)
/* redrawing will advance the master clock */
CLUTTER_NOTE (PAINT, "redrawing via idle for stage[%p]", stage);
clutter_redraw (stage);
_clutter_do_redraw (stage);
/* reset the guard, so that new redraws are possible */
priv->update_idle = 0;