aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-10-11 13:11:14 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-10-11 13:11:14 -0500
commit4eabf6f7eb4ec596e41db4ced0c5ac7149e0eaeb (patch)
tree753e5d391c047f57612f38f3f57cfff795d29f26 /dwl.c
parent765656902fdaaf8c4320d4a16ea8cba4294656a7 (diff)
disable and destroy monitor's layer surfaces when it's being destroyed
Fixes: https://github.com/djpohly/dwl/issues/314
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/dwl.c b/dwl.c
index 29c9eea..64bf2e2 100644
--- a/dwl.c
+++ b/dwl.c
@@ -762,7 +762,15 @@ void
cleanupmon(struct wl_listener *listener, void *data)
{
Monitor *m = wl_container_of(listener, m, destroy);
- int nmons, i = 0;
+ LayerSurface *l, *tmp;
+ int nmons, i;
+
+ for (i = 0; i <= ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; i++) {
+ wl_list_for_each_safe(l, tmp, &m->layers[i], link) {
+ wlr_scene_node_set_enabled(l->scene, 0);
+ wlr_layer_surface_v1_destroy(l->layer_surface);
+ }
+ }
wl_list_remove(&m->destroy.link);
wl_list_remove(&m->frame.link);
@@ -771,7 +779,7 @@ cleanupmon(struct wl_listener *listener, void *data)
wlr_output_layout_remove(output_layout, m->wlr_output);
wlr_scene_output_destroy(m->scene_output);
- if ((nmons = wl_list_length(&mons)))
+ if (!(i = 0) && (nmons = wl_list_length(&mons)))
do /* don't switch to disabled mons */
selmon = wl_container_of(mons.prev, selmon, link);
while (!selmon->wlr_output->enabled && i++ < nmons);