mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
clutter/master-clock: Destroy source when paused
Pausing the master clock didn't actually pause it if there was already a scheduled frame in progress. This is problematic if one actually expects to see no new frame scheduling to happen after pausing, for example it caused actor 'pre-paint' to be signalled on actors, but nothing was ever painted. Avoid this by destroying the master clock source when pausing, and then recreating it when resuming. https://gitlab.gnome.org/GNOME/mutter/merge_requests/309
This commit is contained in:
parent
bda9c359af
commit
626c3745e2
@ -470,6 +470,8 @@ clutter_clock_source_new (ClutterMasterClockDefault *master_clock)
|
||||
ClutterClockSource *clock_source = (ClutterClockSource *) source;
|
||||
|
||||
g_source_set_name (source, "Clutter master clock");
|
||||
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
|
||||
g_source_set_can_recurse (source, FALSE);
|
||||
clock_source->master_clock = master_clock;
|
||||
|
||||
return source;
|
||||
@ -615,8 +617,6 @@ clutter_master_clock_default_init (ClutterMasterClockDefault *self)
|
||||
self->frame_budget = G_USEC_PER_SEC / 60;
|
||||
#endif
|
||||
|
||||
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
|
||||
g_source_set_can_recurse (source, FALSE);
|
||||
g_source_attach (source, NULL);
|
||||
}
|
||||
|
||||
@ -675,6 +675,16 @@ clutter_master_clock_default_set_paused (ClutterMasterClock *clock,
|
||||
{
|
||||
ClutterMasterClockDefault *master_clock = (ClutterMasterClockDefault *) clock;
|
||||
|
||||
if (paused && !master_clock->paused)
|
||||
{
|
||||
g_clear_pointer (&master_clock->source, g_source_destroy);
|
||||
}
|
||||
else if (!paused && master_clock->paused)
|
||||
{
|
||||
master_clock->source = clutter_clock_source_new (master_clock);
|
||||
g_source_attach (master_clock->source, NULL);
|
||||
}
|
||||
|
||||
master_clock->paused = !!paused;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user