From fe4942e078f04fdc1958591bf2c92e9d3356e6b2 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 24 Sep 2021 16:16:16 +0200 Subject: [PATCH] Fix layer surface commit handler Fixes: c11b5db4d6c1 ("layer-shell: check `committed` bitmask") --- sway/desktop/layer_shell.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 2b4b20276..01470683e 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -297,18 +297,19 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { if (wlr_output == NULL) { return; } - if (layer_surface->current.committed == 0) { - // The layer surface state didn't change - return; - } struct sway_output *output = wlr_output->data; struct wlr_box old_extent = layer->extent; - arrange_layers(output); + bool layer_changed = + layer_surface->current.committed & WLR_LAYER_SURFACE_V1_STATE_LAYER; + bool extent_changed = false; + if (layer_surface->current.committed != 0) { + arrange_layers(output); + + extent_changed = memcmp(&old_extent, &layer->extent, + sizeof(struct wlr_box)) != 0; + } - bool extent_changed = - memcmp(&old_extent, &layer->extent, sizeof(struct wlr_box)) != 0; - bool layer_changed = layer->layer != layer_surface->current.layer; if (layer_changed) { wl_list_remove(&layer->link); wl_list_insert(&output->layers[layer_surface->current.layer],