frameclock: Add a debug helper

Begin able to query the current phase
is useful for debugging purposes.
This commit is contained in:
Matthias Clasen 2023-02-21 13:10:31 -05:00
parent cad5771a66
commit 5a3755b233
2 changed files with 13 additions and 0 deletions

View File

@ -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;
}

View File

@ -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__ */