diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2024-01-13 17:04:22 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-01-17 16:54:37 +0100 |
commit | 904d256581c4d2f6b2b08cd0ef84966bb8a0befd (patch) | |
tree | eeef67479f26e093115ca149477c827195890ce6 | |
parent | Mark DRM lease protocol privileged (diff) | |
download | sway-904d256581c4d2f6b2b08cd0ef84966bb8a0befd.tar.gz sway-904d256581c4d2f6b2b08cd0ef84966bb8a0befd.tar.zst sway-904d256581c4d2f6b2b08cd0ef84966bb8a0befd.zip |
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.c | 35 |
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) { | |||
360 | transaction_commit_dirty(); | 360 | transaction_commit_dirty(); |
361 | } | 361 | } |
362 | 362 | ||
363 | static void unmap(struct sway_layer_surface *sway_layer) { | ||
364 | struct sway_seat *seat; | ||
365 | wl_list_for_each(seat, &server.input->seats, link) { | ||
366 | if (seat->focused_layer == sway_layer->layer_surface) { | ||
367 | seat_set_focus_layer(seat, NULL); | ||
368 | } | ||
369 | } | ||
370 | |||
371 | cursor_rebase_all(); | ||
372 | |||
373 | struct wlr_output *wlr_output = sway_layer->layer_surface->output; | ||
374 | sway_assert(wlr_output, "wlr_layer_surface_v1 has null output"); | ||
375 | struct sway_output *output = wlr_output->data; | ||
376 | output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, | ||
377 | sway_layer->layer_surface->surface, true); | ||
378 | } | ||
379 | |||
380 | static void layer_subsurface_destroy(struct sway_layer_subsurface *subsurface); | 363 | static void layer_subsurface_destroy(struct sway_layer_subsurface *subsurface); |
381 | 364 | ||
382 | static void handle_destroy(struct wl_listener *listener, void *data) { | 365 | static void handle_destroy(struct wl_listener *listener, void *data) { |
@@ -384,9 +367,6 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
384 | wl_container_of(listener, sway_layer, destroy); | 367 | wl_container_of(listener, sway_layer, destroy); |
385 | sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)", | 368 | sway_log(SWAY_DEBUG, "Layer surface destroyed (%s)", |
386 | sway_layer->layer_surface->namespace); | 369 | sway_layer->layer_surface->namespace); |
387 | if (sway_layer->layer_surface->surface->mapped) { | ||
388 | unmap(sway_layer); | ||
389 | } | ||
390 | 370 | ||
391 | struct sway_layer_subsurface *subsurface, *subsurface_tmp; | 371 | struct sway_layer_subsurface *subsurface, *subsurface_tmp; |
392 | wl_list_for_each_safe(subsurface, subsurface_tmp, &sway_layer->subsurfaces, link) { | 372 | 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) { | |||
426 | static void handle_unmap(struct wl_listener *listener, void *data) { | 406 | static void handle_unmap(struct wl_listener *listener, void *data) { |
427 | struct sway_layer_surface *sway_layer = wl_container_of( | 407 | struct sway_layer_surface *sway_layer = wl_container_of( |
428 | listener, sway_layer, unmap); | 408 | listener, sway_layer, unmap); |
429 | unmap(sway_layer); | 409 | struct sway_seat *seat; |
410 | wl_list_for_each(seat, &server.input->seats, link) { | ||
411 | if (seat->focused_layer == sway_layer->layer_surface) { | ||
412 | seat_set_focus_layer(seat, NULL); | ||
413 | } | ||
414 | } | ||
415 | |||
416 | cursor_rebase_all(); | ||
417 | |||
418 | struct wlr_output *wlr_output = sway_layer->layer_surface->output; | ||
419 | sway_assert(wlr_output, "wlr_layer_surface_v1 has null output"); | ||
420 | struct sway_output *output = wlr_output->data; | ||
421 | output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, | ||
422 | sway_layer->layer_surface->surface, true); | ||
430 | } | 423 | } |
431 | 424 | ||
432 | static void subsurface_damage(struct sway_layer_subsurface *subsurface, | 425 | static void subsurface_damage(struct sway_layer_subsurface *subsurface, |