diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index 374a76917..a4d36d641 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -592,6 +592,13 @@ void wlr_scene_output_destroy(struct wlr_scene_output *scene_output); */ void wlr_scene_output_set_position(struct wlr_scene_output *scene_output, int lx, int ly); +/** + * Replace the frame scheduler for this scene output, destroying the previous + * scheduler. If scene output currently needs a new frame, a frame will be + * scheduled on the new frame scheduler. + */ +void wlr_scene_output_set_frame_scheduler(struct wlr_scene_output *scene_output, + struct wlr_frame_scheduler *scheduler); struct wlr_scene_output_state_options { struct wlr_scene_timer *timer; diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index f77ab37fe..ac69765cd 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1790,6 +1790,15 @@ static void highlight_region_destroy(struct highlight_region *damage) { free(damage); } +void wlr_scene_output_set_frame_scheduler(struct wlr_scene_output *scene_output, + struct wlr_frame_scheduler *scheduler) { + wlr_frame_scheduler_destroy(scene_output->frame_scheduler); + scene_output->frame_scheduler = scheduler; + if (wlr_scene_output_needs_frame(scene_output)) { + wlr_frame_scheduler_schedule_frame(scheduler); + } +} + void wlr_scene_output_destroy(struct wlr_scene_output *scene_output) { if (scene_output == NULL) { return;