mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 00:41:28 +00:00
lock: listen to commit signal rather than map
Fixes https://github.com/swaywm/sway/issues/8342
This commit is contained in:
parent
d7a76d381b
commit
e4e407f260
14
sway/lock.c
14
sway/lock.c
|
@ -25,7 +25,7 @@ struct sway_session_lock_output {
|
||||||
|
|
||||||
// invalid if surface is NULL
|
// invalid if surface is NULL
|
||||||
struct wl_listener surface_destroy;
|
struct wl_listener surface_destroy;
|
||||||
struct wl_listener surface_map;
|
struct wl_listener surface_commit;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void focus_surface(struct sway_session_lock *lock,
|
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) {
|
static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
||||||
struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_map);
|
struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_commit);
|
||||||
if (surf->lock->focused == NULL) {
|
if (surf->lock->focused == NULL) {
|
||||||
focus_surface(surf->lock, surf->surface->surface);
|
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");
|
sway_assert(output->surface, "Trying to destroy a surface that the lock doesn't think exists");
|
||||||
output->surface = NULL;
|
output->surface = NULL;
|
||||||
wl_list_remove(&output->surface_destroy.link);
|
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) {
|
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;
|
lock_output->surface_destroy.notify = handle_surface_destroy;
|
||||||
wl_signal_add(&lock_surface->events.destroy, &lock_output->surface_destroy);
|
wl_signal_add(&lock_surface->events.destroy, &lock_output->surface_destroy);
|
||||||
lock_output->surface_map.notify = handle_surface_map;
|
lock_output->surface_commit.notify = handle_surface_commit;
|
||||||
wl_signal_add(&lock_surface->surface->events.map, &lock_output->surface_map);
|
wl_signal_add(&lock_surface->surface->events.commit, &lock_output->surface_commit);
|
||||||
|
|
||||||
lock_output_reconfigure(lock_output);
|
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) {
|
if (output->surface) {
|
||||||
refocus_output(output);
|
refocus_output(output);
|
||||||
wl_list_remove(&output->surface_destroy.link);
|
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);
|
wl_list_remove(&output->commit.link);
|
||||||
|
|
Loading…
Reference in a new issue