aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2022-01-09 23:48:24 +0100
committerKenny Levinsen <kl@kl.wtf>2022-02-01 13:31:26 +0100
commit1e3662ce5769bb82e5893733c48423e10ae47b56 (patch)
treec00b4f399acb66cd3e5f1eb9d9ff4a6b07771aa6 /include/wlr
parent3db1bcbe641b407b9f5c9e5d0a012b45aa2c6cb7 (diff)
scene: Add layer_shell_v1 helper
This helper behaves similar to the xdg_shell helper, and additionally provides a little assistance for positioning and exclusive_zone management.
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/types/wlr_scene.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h
index a77eb6c2..86775399 100644
--- a/include/wlr/types/wlr_scene.h
+++ b/include/wlr/types/wlr_scene.h
@@ -26,6 +26,7 @@
struct wlr_output;
struct wlr_output_layout;
struct wlr_xdg_surface;
+struct wlr_layer_surface_v1;
enum wlr_scene_node_type {
WLR_SCENE_NODE_ROOT,
@@ -136,6 +137,19 @@ struct wlr_scene_output {
bool prev_scanout;
};
+/** A layer shell scene helper */
+struct wlr_scene_layer_surface_v1 {
+ struct wlr_scene_node *node;
+ struct wlr_layer_surface_v1 *layer_surface;
+
+ // private state
+
+ struct wl_listener tree_destroy;
+ struct wl_listener layer_surface_destroy;
+ struct wl_listener layer_surface_map;
+ struct wl_listener layer_surface_unmap;
+};
+
typedef void (*wlr_scene_node_iterator_func_t)(struct wlr_scene_node *node,
int sx, int sy, void *data);
@@ -354,4 +368,28 @@ struct wlr_scene_node *wlr_scene_subsurface_tree_create(
struct wlr_scene_node *wlr_scene_xdg_surface_create(
struct wlr_scene_node *parent, struct wlr_xdg_surface *xdg_surface);
+/**
+ * Add a node displaying a layer_surface_v1 and all of its sub-surfaces to the
+ * scene-graph.
+ *
+ * The origin of the returned scene-graph node will match the top-left corner
+ * of the layer surface.
+ */
+struct wlr_scene_layer_surface_v1 *wlr_scene_layer_surface_v1_create(
+ struct wlr_scene_node *parent, struct wlr_layer_surface_v1 *layer_surface);
+
+/**
+ * Configure a layer_surface_v1, position its scene node in accordance to its
+ * current state, and update the remaining usable area.
+ *
+ * full_area represents the entire area that may be used by the layer surface
+ * if its exclusive_zone is -1, and is usually the output dimensions.
+ * usable_area represents what remains of full_area that can be used if
+ * exclusive_zone is >= 0. usable_area is updated if the surface has a positive
+ * exclusive_zone, so that it can be used for the next layer surface.
+ */
+void wlr_scene_layer_surface_v1_configure(
+ struct wlr_scene_layer_surface_v1 *scene_layer_surface,
+ const struct wlr_box *full_area, struct wlr_box *usable_area);
+
#endif