Fix clutter_redraw() to match the redraw cycle

The clutter_redraw() function is used by embedding toolkits to
force a redraw on a stage. Since everything is performed by
toggling a flag inside the Stage itself and then letting the
master clock advance, we need a ClutterStage method to ensure
that we start the master clock and redraw.
This commit is contained in:
Emmanuele Bassi 2009-06-09 16:29:29 +01:00
parent 7099d251c6
commit e1cac4fece
4 changed files with 31 additions and 11 deletions

View File

@ -236,18 +236,9 @@ _clutter_do_redraw (ClutterStage *stage)
void
clutter_redraw (ClutterStage *stage)
{
ClutterMasterClock *master_clock;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
/* 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_stage_ensure_redraw (stage);
}
/**

View File

@ -1946,6 +1946,33 @@ clutter_stage_ensure_viewport (ClutterStage *stage)
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
/**
* clutter_stage_ensure_redraw:
* @stage: a #ClutterStage
*
* Ensures that @stage is redrawn
*
* This function should not be called by applications: it is
* used when embedding a #ClutterStage into a toolkit with
* another windowing system, like GTK+.
*
* Since: 1.0
*/
void
clutter_stage_ensure_redraw (ClutterStage *stage)
{
ClutterMasterClock *master_clock;
ClutterStagePrivate *priv;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
priv->redraw_pending = TRUE;
master_clock = _clutter_master_clock_get_default ();
_clutter_master_clock_start_running (master_clock);
}
/**
* clutter_stage_queue_redraw:
* @stage: the #ClutterStage

View File

@ -243,6 +243,7 @@ void clutter_stage_ensure_current (ClutterStage *stage);
void clutter_stage_queue_redraw (ClutterStage *stage);
gboolean clutter_stage_is_default (ClutterStage *stage);
void clutter_stage_ensure_viewport (ClutterStage *stage);
void clutter_stage_ensure_redraw (ClutterStage *stage);
/* Commodity macro */
#define clutter_stage_add(stage,actor) G_STMT_START { \

View File

@ -485,6 +485,7 @@ ClutterPickMode
clutter_stage_get_actor_at_pos
clutter_stage_ensure_current
clutter_stage_ensure_viewport
clutter_stage_ensure_redraw
clutter_stage_queue_redraw
clutter_stage_event
clutter_stage_set_key_focus