summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2020-06-01 10:53:24 +0200
committerAlexander Larsson <alexl@redhat.com>2020-06-05 11:06:42 +0200
commitede4d061921645d30450cee4946a345eeb8fba8e (patch)
treec7bb1d01814e87921549f85c39f7d4a4975a2126
parent1a598c32d9d19ad3ea23cdb25468bfbfe3b3e08d (diff)
downloadgtk+-ede4d061921645d30450cee4946a345eeb8fba8e.tar.gz
Fix frameclock going backwards
When we run the frameclock RUN_FLUSH_IDLE idle before the paint, then gdk_frame_clock_flush_idle() sets ``` priv->phase = GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT ``` at the end if there is a paint comming. But, before doing the paint cycle it may handle other X events, and during that time the phase is set to BEFORE_PAINT. This means that the current check on whether we're inside a paint is wrong: ``` if (priv->phase != GDK_FRAME_CLOCK_PHASE_NONE && priv->phase != GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) return priv->smoothed_frame_time_base; ``` This caused us to sometimes use this smoothed_frame_time_base even though we previously reported a later value during PHASE_NONE, thus being non-monotonic. We can't just additionally check for the BEGIN_PAINT phase though, becasue if we are in the paint loop actually doing that phase we should use the time base. Instead we check for `!(BEFORE_PAINT && in_paint_idle)`. (cherry picked from commit a36e2bc764ba493a07c982995e1f76eac53a9383)
-rw-r--r--gdk/gdkframeclockidle.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index c5dd5ac791..b56ee90d75 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -237,7 +237,8 @@ gdk_frame_clock_idle_get_frame_time (GdkFrameClock *clock)
/* can't change frame time during a paint */
if (priv->phase != GDK_FRAME_CLOCK_PHASE_NONE &&
- priv->phase != GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS)
+ priv->phase != GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS &&
+ (priv->phase != GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT || priv->in_paint_idle))
return priv->smoothed_frame_time_base;
/* Outside a paint, pick something smoothed close to now */