From 1ce992d7cb5023a7a7c91ed6ce156529e3709657 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Tue, 24 Feb 2026 11:52:00 +0100 Subject: [PATCH] scene/layer_shell_v1: Add support for exclusive_edge The v5 layer shell interface allows the client to specify which edge the exclusive zone will apply to, instead of deducing it from the anchor points. Add support for this to the layer shell scene helper. --- types/scene/layer_shell_v1.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/types/scene/layer_shell_v1.c b/types/scene/layer_shell_v1.c index 4ae736ddf..234227df1 100644 --- a/types/scene/layer_shell_v1.c +++ b/types/scene/layer_shell_v1.c @@ -1,6 +1,7 @@ #include #include #include +#include static void scene_layer_surface_handle_tree_destroy( struct wl_listener *listener, void *data) { @@ -21,36 +22,23 @@ static void scene_layer_surface_handle_layer_surface_destroy( static void layer_surface_exclusive_zone( struct wlr_layer_surface_v1_state *state, + enum wlr_edges edge, struct wlr_box *usable_area) { - switch (state->anchor) { - case ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP: - case (ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | - ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | - ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT): - // Anchor top + switch (edge) { + case WLR_EDGE_NONE: + return; + case WLR_EDGE_TOP: usable_area->y += state->exclusive_zone + state->margin.top; usable_area->height -= state->exclusive_zone + state->margin.top; break; - case ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM: - case (ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | - ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | - ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT): - // Anchor bottom + case WLR_EDGE_BOTTOM: usable_area->height -= state->exclusive_zone + state->margin.bottom; break; - case ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT: - case (ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | - ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | - ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT): - // Anchor left + case WLR_EDGE_LEFT: usable_area->x += state->exclusive_zone + state->margin.left; usable_area->width -= state->exclusive_zone + state->margin.left; break; - case ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT: - case (ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | - ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | - ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT): - // Anchor right + case WLR_EDGE_RIGHT: usable_area->width -= state->exclusive_zone + state->margin.right; break; } @@ -121,7 +109,8 @@ void wlr_scene_layer_surface_v1_configure( wlr_layer_surface_v1_configure(layer_surface, box.width, box.height); if (layer_surface->surface->mapped && state->exclusive_zone > 0) { - layer_surface_exclusive_zone(state, usable_area); + enum wlr_edges edge = wlr_layer_surface_v1_get_exclusive_edge(layer_surface); + layer_surface_exclusive_zone(state, edge, usable_area); } }