diff options
author | Simon Ser <[email protected]> | 2021-11-30 20:55:04 +0100 |
---|---|---|
committer | Isaac Freund <[email protected]> | 2021-11-30 20:16:24 +0000 |
commit | 7970772290d21575fa00dbe50556914d0723bd4e (patch) | |
tree | dc82baf155679fb2772205f7d7c3ee98502e499b /wlr_scene.c | |
parent | d320c2acc3a5733e87a883f8c8f615799f019de7 (diff) |
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.
Diffstat (limited to 'wlr_scene.c')
-rw-r--r-- | wlr_scene.c | 12 |
1 files changed, 12 insertions, 0 deletions
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) { |