diff options
-rw-r--r-- | include/sway/output.h | 4 | ||||
-rw-r--r-- | sway/desktop/layer_shell.c | 9 | ||||
-rw-r--r-- | sway/desktop/output.c | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index 70f746dc..8180ce3d 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -32,6 +32,10 @@ struct sway_output { | |||
32 | struct wl_list link; | 32 | struct wl_list link; |
33 | 33 | ||
34 | pid_t bg_pid; | 34 | pid_t bg_pid; |
35 | |||
36 | struct { | ||
37 | struct wl_signal destroy; | ||
38 | } events; | ||
35 | }; | 39 | }; |
36 | 40 | ||
37 | void output_damage_whole(struct sway_output *output); | 41 | void output_damage_whole(struct sway_output *output); |
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 3accdefb..b57d1ee6 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -219,6 +219,8 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) { | |||
219 | struct sway_layer_surface *sway_layer = | 219 | struct sway_layer_surface *sway_layer = |
220 | wl_container_of(listener, sway_layer, output_destroy); | 220 | wl_container_of(listener, sway_layer, output_destroy); |
221 | wl_list_remove(&sway_layer->output_destroy.link); | 221 | wl_list_remove(&sway_layer->output_destroy.link); |
222 | wl_list_remove(&sway_layer->link); | ||
223 | wl_list_init(&sway_layer->link); | ||
222 | sway_layer->layer_surface->output = NULL; | 224 | sway_layer->layer_surface->output = NULL; |
223 | wlr_layer_surface_close(sway_layer->layer_surface); | 225 | wlr_layer_surface_close(sway_layer->layer_surface); |
224 | } | 226 | } |
@@ -350,10 +352,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
350 | wl_signal_add(&layer_surface->surface->events.commit, | 352 | wl_signal_add(&layer_surface->surface->events.commit, |
351 | &sway_layer->surface_commit); | 353 | &sway_layer->surface_commit); |
352 | 354 | ||
353 | sway_layer->output_destroy.notify = handle_output_destroy; | ||
354 | wl_signal_add(&layer_surface->output->events.destroy, | ||
355 | &sway_layer->output_destroy); | ||
356 | |||
357 | sway_layer->destroy.notify = handle_destroy; | 355 | sway_layer->destroy.notify = handle_destroy; |
358 | wl_signal_add(&layer_surface->events.destroy, &sway_layer->destroy); | 356 | wl_signal_add(&layer_surface->events.destroy, &sway_layer->destroy); |
359 | sway_layer->map.notify = handle_map; | 357 | sway_layer->map.notify = handle_map; |
@@ -366,6 +364,9 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
366 | layer_surface->data = sway_layer; | 364 | layer_surface->data = sway_layer; |
367 | 365 | ||
368 | struct sway_output *output = layer_surface->output->data; | 366 | struct sway_output *output = layer_surface->output->data; |
367 | sway_layer->output_destroy.notify = handle_output_destroy; | ||
368 | wl_signal_add(&output->events.destroy, &sway_layer->output_destroy); | ||
369 | |||
369 | wl_list_insert(&output->layers[layer_surface->layer], &sway_layer->link); | 370 | wl_list_insert(&output->layers[layer_surface->layer], &sway_layer->link); |
370 | 371 | ||
371 | // Temporarily set the layer's current state to client_pending | 372 | // Temporarily set the layer's current state to client_pending |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index d4115be8..f0f1603a 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -1199,6 +1199,8 @@ static void damage_handle_destroy(struct wl_listener *listener, void *data) { | |||
1199 | 1199 | ||
1200 | static void handle_destroy(struct wl_listener *listener, void *data) { | 1200 | static void handle_destroy(struct wl_listener *listener, void *data) { |
1201 | struct sway_output *output = wl_container_of(listener, output, destroy); | 1201 | struct sway_output *output = wl_container_of(listener, output, destroy); |
1202 | wl_signal_emit(&output->events.destroy, output); | ||
1203 | |||
1202 | if (output->swayc) { | 1204 | if (output->swayc) { |
1203 | container_destroy(output->swayc); | 1205 | container_destroy(output->swayc); |
1204 | } | 1206 | } |
@@ -1277,6 +1279,7 @@ void output_enable(struct sway_output *output) { | |||
1277 | for (size_t i = 0; i < len; ++i) { | 1279 | for (size_t i = 0; i < len; ++i) { |
1278 | wl_list_init(&output->layers[i]); | 1280 | wl_list_init(&output->layers[i]); |
1279 | } | 1281 | } |
1282 | wl_signal_init(&output->events.destroy); | ||
1280 | 1283 | ||
1281 | input_manager_configure_xcursor(input_manager); | 1284 | input_manager_configure_xcursor(input_manager); |
1282 | 1285 | ||