clutter/frame-clock: Allow frame clock listener iface allocate frame

This will allow the frame clock listener to allocate larger structs
where it can keep e.g. backend specific frame state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
This commit is contained in:
Jonas Ådahl 2022-07-07 09:20:04 +02:00 committed by Robert Mader
parent 1abd930c56
commit b80e84dea6
2 changed files with 7 additions and 1 deletions

View File

@ -732,7 +732,11 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
frame_count = frame_clock->frame_count++;
frame = clutter_frame_new ();
if (iface->new_frame)
frame = iface->new_frame (frame_clock, frame_clock->listener.user_data);
if (!frame)
frame = clutter_frame_new ();
frame->frame_count = frame_count;
frame->has_target_presentation_time = frame_clock->is_next_presentation_time_valid;
frame->target_presentation_time_us = frame_clock->next_presentation_time_us;

View File

@ -51,6 +51,8 @@ typedef struct _ClutterFrameListenerIface
ClutterFrameResult (* frame) (ClutterFrameClock *frame_clock,
ClutterFrame *frame,
gpointer user_data);
ClutterFrame * (* new_frame) (ClutterFrameClock *frame_clock,
gpointer user_data);
} ClutterFrameListenerIface;
CLUTTER_EXPORT