From 968c1df7e978d57ad5d21bcf3c6506a465ae7de6 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 17 Aug 2021 12:24:11 +0200 Subject: scene: add scene outputs These allow describing an output's viewport inside the scene-graph. --- include/wlr/types/wlr_scene.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'include') diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index 651840c3..6e3c13cd 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -56,6 +56,8 @@ struct wlr_scene_node { /** The root scene-graph node. */ struct wlr_scene { struct wlr_scene_node node; + + struct wl_list outputs; // wlr_scene_output.link }; /** A scene-graph node displaying a single surface. */ @@ -75,6 +77,16 @@ struct wlr_scene_rect { float color[4]; }; +/** A viewport for an output in the scene-graph */ +struct wlr_scene_output { + struct wlr_output *output; + struct wl_list link; // wlr_scene.outputs + struct wlr_scene *scene; + struct wlr_addon addon; + + int x, y; +}; + typedef void (*wlr_scene_node_iterator_func_t)(struct wlr_scene_node *node, int sx, int sy, void *data); @@ -161,4 +173,21 @@ void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height) */ void wlr_scene_rect_set_color(struct wlr_scene_rect *rect, const float color[static 4]); +/** + * Add a viewport for the specified output to the scene-graph. + * + * An output can only be added once to the scene-graph. + */ +struct wlr_scene_output *wlr_scene_output_create(struct wlr_scene *scene, + struct wlr_output *output); +/** + * Destroy a scene-graph output. + */ +void wlr_scene_output_destroy(struct wlr_scene_output *scene_output); +/** + * Set the output's position in the scene-graph. + */ +void wlr_scene_output_set_position(struct wlr_scene_output *scene_output, + int lx, int ly); + #endif -- cgit v1.2.3