aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorLeonardo Hernandez Hernandez <leohdz172@protonmail.com>2022-01-26 00:54:00 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-11 18:46:13 -0600
commit0e5d7124de4e7ba0baa080547fcfee41b1d5174d (patch)
tree7cede27fb5b4d2dee8d26214c16580be2e6af39e /dwl.c
parentc49a42ee580888f922cd21eb884271e2fa64f063 (diff)
use loop to call arrangelayer
zwlr_layer_shell_v1_layer are ordered by bottom-most first so we can just use a loop from 3 to 0
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/dwl.c b/dwl.c
index 9991c95..cd9e74d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -560,6 +560,7 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int
void
arrangelayers(Monitor *m)
{
+ int i;
struct wlr_box usable_area = m->m;
uint32_t layers_above_shell[] = {
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
@@ -568,30 +569,18 @@ arrangelayers(Monitor *m)
LayerSurface *layersurface;
struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
- // Arrange exclusive surfaces from top->bottom
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
- &usable_area, 1);
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
- &usable_area, 1);
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
- &usable_area, 1);
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
- &usable_area, 1);
+ /* Arrange exclusive surfaces from top->bottom */
+ for (i = 3; i >= 0; i--)
+ arrangelayer(m, &m->layers[i], &usable_area, 1);
if (memcmp(&usable_area, &m->w, sizeof(struct wlr_box))) {
m->w = usable_area;
arrange(m);
}
- // Arrange non-exlusive surfaces from top->bottom
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
- &usable_area, 0);
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
- &usable_area, 0);
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
- &usable_area, 0);
- arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
- &usable_area, 0);
+ /* Arrange non-exlusive surfaces from top->bottom */
+ for (i = 3; i >= 0; i--)
+ arrangelayer(m, &m->layers[i], &usable_area, 0);
// Find topmost keyboard interactive layer, if such a layer exists
for (size_t i = 0; i < LENGTH(layers_above_shell); i++) {