input/seat: prevent layer surfaces from focusing under session lock

When the screen is locked, `server.session_lock.lock` is active and
keyboard input must be forced to the screen lock surface. While
`seat_set_focus` checked for an active session lock and redirected
focus, `seat_set_focus_layer` was missing the same check. This allowed
layer surfaces to steal keyboard input while the screen lock was active.

This commit adds the missing session check to `seat_set_focus_layer` to
prevent layer surfaces from being focused when the screen is locked.
This commit is contained in:
Scott Leggett 2026-06-08 21:18:11 +08:00
parent 97c342f9e1
commit efa5ee7947
No known key found for this signature in database

View file

@ -1312,6 +1312,9 @@ void seat_set_focus_layer(struct sway_seat *seat,
} else if (!layer) { } else if (!layer) {
return; return;
} }
if (server.session_lock.lock) {
return;
}
assert(layer->surface->mapped); assert(layer->surface->mapped);
if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP && if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP &&
layer->current.keyboard_interactive layer->current.keyboard_interactive