summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Malm <[email protected]>2022-11-26 17:18:33 +0000
committerKirill Primak <[email protected]>2022-11-29 21:14:41 +0300
commit946cc0d426f21d13313076ef02b258bce10c032d (patch)
tree0c3d16d1d844b3a5fc31e1bcd5c6a9757983ff34
parentbc4f884e01c957022991eff299e07972ea3f56d5 (diff)
scene/layer_shell_v1.c: set exclusive zone correctly
...when only one edge is anchored. The layer-shell protocol specifies that a positive exclusive-zone value is 'meaningful' if the surface is anchored to either: 1. one edge 2. one edge and both perpendicular edges. For example, if you wish to position a layer-shell client along the top edge and make it exclusive, you should be able to either set anchor=TOP or anchor=TOP|LEFT|RIGHT. It appears that many panels/bars use the latter approach (anchor to an edge and also both perpendicular edges) which is probably why this has not been reported previously. This patch adds support for the first case and thereby makes exclusive zone behaviour consistent with the protocol and also with sway's extant layer-shell implementation. (cherry picked from commit 8e80432a72b18a1ddbacdb08ff0c41645578f1ee)
-rw-r--r--layer_shell_v1.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/layer_shell_v1.c b/layer_shell_v1.c
index 2298698..e523d31 100644
--- a/layer_shell_v1.c
+++ b/layer_shell_v1.c
@@ -39,6 +39,7 @@ static void layer_surface_exclusive_zone(
struct wlr_layer_surface_v1_state *state,
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):
@@ -46,12 +47,14 @@ static void layer_surface_exclusive_zone(
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
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):
@@ -59,6 +62,7 @@ static void layer_surface_exclusive_zone(
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