From 5a3755b2337b4961814193ba7de958ff31cd55ae Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 21 Feb 2023 13:10:31 -0500 Subject: [PATCH] frameclock: Add a debug helper Begin able to query the current phase is useful for debugging purposes. --- gdk/gdkframeclockidle.c | 11 +++++++++++ gdk/gdkframeclockprivate.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c index 31931b0432..f3ed84627d 100644 --- a/gdk/gdkframeclockidle.c +++ b/gdk/gdkframeclockidle.c @@ -584,6 +584,8 @@ gdk_frame_clock_paint_idle (void *data) { priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT; _gdk_frame_clock_emit_layout (clock); + if (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT) + g_print ("looping in layout %d\n", iter); } if (iter == 5) g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries"); @@ -809,3 +811,12 @@ _gdk_frame_clock_idle_new (void) return GDK_FRAME_CLOCK (clock); } + +GdkFrameClockPhase +gdk_frame_clock_get_current_phase (GdkFrameClock *clock) +{ + GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock); + GdkFrameClockIdlePrivate *priv = clock_idle->priv; + + return priv->phase; +} diff --git a/gdk/gdkframeclockprivate.h b/gdk/gdkframeclockprivate.h index 010aa4564f..6abbfb96a0 100644 --- a/gdk/gdkframeclockprivate.h +++ b/gdk/gdkframeclockprivate.h @@ -127,6 +127,8 @@ void _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock); void _gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock); void _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock); +GdkFrameClockPhase gdk_frame_clock_get_current_phase (GdkFrameClock *frame_clock); + G_END_DECLS #endif /* __GDK_FRAME_CLOCK_PRIVATE_H__ */