summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2018-11-14 13:22:05 +0100
committerJonas Ådahl <jadahl@gmail.com>2018-11-14 14:37:04 +0100
commit626c3745e2678eaa825b188bfe1f88404534b455 (patch)
tree85d65c8ef34ea749d41c2c8af5b8da8ac18d573f
parentbda9c359af714cc465ef40bc9649b845ade80b7a (diff)
downloadmutter-626c3745e2678eaa825b188bfe1f88404534b455.tar.gz
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
-rw-r--r--clutter/clutter/clutter-master-clock-default.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/clutter/clutter/clutter-master-clock-default.c b/clutter/clutter/clutter-master-clock-default.c
index 440382e76..d28dd474f 100644
--- a/clutter/clutter/clutter-master-clock-default.c
+++ b/clutter/clutter/clutter-master-clock-default.c
@@ -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;
}