don't give the keyboard back to a lock surface being destroyed

wlroots still lists the lock surface being destroyed, and inserts new ones
at the head, so when the focused surface was the newest one,
destroylocksurface() gave the focus back to it and then nothing had it:
the password could not be typed until an output changed. Happens e.g.
when unplugging a monitor while locked with waylock.
This commit is contained in:
dvh
2026-11-11 10:54:13 +01:00
parent 1f5b30aeb3
commit 8fde769b78
+13 -6
View File
@@ -1512,14 +1512,21 @@ destroylocksurface(struct wl_listener *listener, void *data)
if (lock_surface->surface != seat->keyboard_state.focused_surface) if (lock_surface->surface != seat->keyboard_state.focused_surface)
return; return;
if (locked && cur_lock && !wl_list_empty(&cur_lock->surfaces)) { if (!locked) {
surface = wl_container_of(cur_lock->surfaces.next, surface, link);
client_notify_enter(surface->surface, wlr_seat_get_keyboard(seat));
} else if (!locked) {
focusclient(focustop(selmon), NULL, 1); focusclient(focustop(selmon), NULL, 1);
} else { return;
wlr_seat_keyboard_clear_focus(seat);
} }
/* The surface being destroyed is still in the list */
if (cur_lock) {
wl_list_for_each(surface, &cur_lock->surfaces, link) {
if (surface != lock_surface) {
client_notify_enter(surface->surface, wlr_seat_get_keyboard(seat));
return;
}
}
}
wlr_seat_keyboard_clear_focus(seat);
} }
void void