ensure next iteration

Added an internal clutter function, _clutter_master_clock_ensure_next_iteration
that ensures another iteration of the master clock, can be called from repaint
functions as well as other threads.
This commit is contained in:
Robert Bragg 2009-07-09 20:03:01 +01:00 committed by Øyvind Kolås
parent e2c4a2a9f8
commit 211bf79854
2 changed files with 31 additions and 7 deletions

View File

@ -68,6 +68,7 @@ struct _ClutterMasterClock
GSource *source;
guint updated_stages : 1;
guint ensure_next_iteration : 1;
};
struct _ClutterMasterClockClass
@ -125,6 +126,12 @@ master_clock_is_running (ClutterMasterClock *master_clock)
_clutter_stage_needs_update (l->data))
return TRUE;
if (master_clock->ensure_next_iteration)
{
master_clock->ensure_next_iteration = FALSE;
return TRUE;
}
return FALSE;
}
@ -322,6 +329,7 @@ clutter_master_clock_init (ClutterMasterClock *self)
self->source = source;
self->updated_stages = TRUE;
self->ensure_next_iteration = FALSE;
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
g_source_set_can_recurse (source, FALSE);
@ -428,3 +436,18 @@ _clutter_master_clock_advance (ClutterMasterClock *master_clock)
clutter_timeline_do_tick (l->data, &master_clock->cur_tick);
}
}
/**
* _clutter_master_clock_ensure_next_iteration:
* @master_clock: a #ClutterMasterClock
*
* Ensures that the master clock will run at least one iteration
*/
void
_clutter_master_clock_ensure_next_iteration (ClutterMasterClock *master_clock)
{
g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
master_clock->ensure_next_iteration = TRUE;
}

View File

@ -36,13 +36,14 @@ typedef struct _ClutterMasterClock ClutterMasterClock;
GType clutter_master_clock_get_type (void) G_GNUC_CONST;
ClutterMasterClock *_clutter_master_clock_get_default (void);
void _clutter_master_clock_add_timeline (ClutterMasterClock *master_clock,
ClutterTimeline *timeline);
void _clutter_master_clock_remove_timeline (ClutterMasterClock *master_clock,
ClutterTimeline *timeline);
void _clutter_master_clock_advance (ClutterMasterClock *master_clock);
void _clutter_master_clock_start_running (ClutterMasterClock *master_clock);
ClutterMasterClock *_clutter_master_clock_get_default (void);
void _clutter_master_clock_add_timeline (ClutterMasterClock *master_clock,
ClutterTimeline *timeline);
void _clutter_master_clock_remove_timeline (ClutterMasterClock *master_clock,
ClutterTimeline *timeline);
void _clutter_master_clock_advance (ClutterMasterClock *master_clock);
void _clutter_master_clock_start_running (ClutterMasterClock *master_clock);
void _clutter_master_clock_ensure_next_iteration (ClutterMasterClock *master_clock);
G_END_DECLS