From 7970772290d21575fa00dbe50556914d0723bd4e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 30 Nov 2021 20:55:04 +0100 Subject: scene: add wlr_scene_get_scene_output This allows getting a wlr_scene_output from a wlr_output. Since an output can only be added once to a scene-graph there's no ambiguity. This is useful for compositors using wlr_scene_attach_output_layout: the output layout integration automatically creates a scene-graph output for each wlr_output added to the layout. --- wlr_scene.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'wlr_scene.c') diff --git a/wlr_scene.c b/wlr_scene.c index 0343922..d1236fe 100644 --- a/wlr_scene.c +++ b/wlr_scene.c @@ -828,6 +828,18 @@ void wlr_scene_output_destroy(struct wlr_scene_output *scene_output) { free(scene_output); } +struct wlr_scene_output *wlr_scene_get_scene_output(struct wlr_scene *scene, + struct wlr_output *output) { + struct wlr_addon *addon = + wlr_addon_find(&output->addons, scene, &output_addon_impl); + if (addon == NULL) { + return NULL; + } + struct wlr_scene_output *scene_output = + wl_container_of(addon, scene_output, addon); + return scene_output; +} + void wlr_scene_output_set_position(struct wlr_scene_output *scene_output, int lx, int ly) { if (scene_output->x == lx && scene_output->y == ly) { -- cgit v1.2.3