From e4e407f2601190358a1e0a43c51620414446bdce Mon Sep 17 00:00:00 2001 From: Luminiscental Date: Thu, 12 Sep 2024 10:12:03 +0100 Subject: [PATCH] lock: listen to commit signal rather than map Fixes https://github.com/swaywm/sway/issues/8342 --- sway/lock.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sway/lock.c b/sway/lock.c index 289e8ca4..33bd8817 100644 --- a/sway/lock.c +++ b/sway/lock.c @@ -25,7 +25,7 @@ struct sway_session_lock_output { // invalid if surface is NULL struct wl_listener surface_destroy; - struct wl_listener surface_map; + struct wl_listener surface_commit; }; static void focus_surface(struct sway_session_lock *lock, @@ -59,8 +59,8 @@ static void refocus_output(struct sway_session_lock_output *output) { } } -static void handle_surface_map(struct wl_listener *listener, void *data) { - struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_map); +static void handle_surface_commit(struct wl_listener *listener, void *data) { + struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_commit); if (surf->lock->focused == NULL) { focus_surface(surf->lock, surf->surface->surface); } @@ -75,7 +75,7 @@ static void handle_surface_destroy(struct wl_listener *listener, void *data) { sway_assert(output->surface, "Trying to destroy a surface that the lock doesn't think exists"); output->surface = NULL; wl_list_remove(&output->surface_destroy.link); - wl_list_remove(&output->surface_map.link); + wl_list_remove(&output->surface_commit.link); } static void lock_output_reconfigure(struct sway_session_lock_output *output) { @@ -112,8 +112,8 @@ static void handle_new_surface(struct wl_listener *listener, void *data) { lock_output->surface_destroy.notify = handle_surface_destroy; wl_signal_add(&lock_surface->events.destroy, &lock_output->surface_destroy); - lock_output->surface_map.notify = handle_surface_map; - wl_signal_add(&lock_surface->surface->events.map, &lock_output->surface_map); + lock_output->surface_commit.notify = handle_surface_commit; + wl_signal_add(&lock_surface->surface->events.commit, &lock_output->surface_commit); lock_output_reconfigure(lock_output); } @@ -122,7 +122,7 @@ static void sway_session_lock_output_destroy(struct sway_session_lock_output *ou if (output->surface) { refocus_output(output); wl_list_remove(&output->surface_destroy.link); - wl_list_remove(&output->surface_map.link); + wl_list_remove(&output->surface_commit.link); } wl_list_remove(&output->commit.link);