aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2024-01-13 17:04:22 +0300
committerSimon Ser <contact@emersion.fr>2024-01-17 16:54:37 +0100
commit904d256581c4d2f6b2b08cd0ef84966bb8a0befd (patch)
treeeeef67479f26e093115ca149477c827195890ce6
parentc5fd8c050f7ddbfe3e5b7abc8f5f6ace3a3c5307 (diff)
layer-shell: don't try to unmap on destroy
A surface is guaranteed to be unmapped on destruction.
-rw-r--r--sway/desktop/layer_shell.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 31d8558c..1da4c61a 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -360,23 +360,6 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
transaction_commit_dirty();
}
-static void unmap(struct sway_layer_surface *sway_layer) {
- struct sway_seat *seat;
- wl_list_for_each(seat, &server.input->seats, link) {
- if (seat->focused_layer == sway_layer->layer_surface) {
- seat_set_focus_layer(seat, NULL);
- }
- }
-
- cursor_rebase_all();
-
- struct wlr_output *wlr_output = sway_layer->layer_surface->output;
- sway_assert(wlr_output, "wlr_layer_surface_v1 has null output");
- struct sway_output *output = wlr_output->data;
- output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y,
- sway_layer->layer_surface->surface, true);
-}
-
static void layer_subsurface_destroy(struct sway_layer_subsurface *subsurface);
static void handle_destroy(struct wl_listener *listener, void *data) {
@@ -384,9 +367,6 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_container_of(listener, sway_layer, destroy);
sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)",
sway_layer->layer_surface->namespace);
- if (sway_layer->layer_surface->surface->mapped) {
- unmap(sway_layer);
- }
struct sway_layer_subsurface *subsurface, *subsurface_tmp;
wl_list_for_each_safe(subsurface, subsurface_tmp, &sway_layer->subsurfaces, link) {
@@ -426,7 +406,20 @@ static void handle_map(struct wl_listener *listener, void *data) {
static void handle_unmap(struct wl_listener *listener, void *data) {
struct sway_layer_surface *sway_layer = wl_container_of(
listener, sway_layer, unmap);
- unmap(sway_layer);
+ struct sway_seat *seat;
+ wl_list_for_each(seat, &server.input->seats, link) {
+ if (seat->focused_layer == sway_layer->layer_surface) {
+ seat_set_focus_layer(seat, NULL);
+ }
+ }
+
+ cursor_rebase_all();
+
+ struct wlr_output *wlr_output = sway_layer->layer_surface->output;
+ sway_assert(wlr_output, "wlr_layer_surface_v1 has null output");
+ struct sway_output *output = wlr_output->data;
+ output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y,
+ sway_layer->layer_surface->surface, true);
}
static void subsurface_damage(struct sway_layer_subsurface *subsurface,