Fix input lock when starting compositor while on a different TTY (#3593)
Browse files at this commit1 changed file +8 -0
- src/backend/tty.rs +8 -0
src/backend/tty.rsmodified+8 -0
| @@ -441,6 +441,14 @@ impl Tty { | |||
| 441 | } | 441 | } |
| 442 | .map_err(|()| anyhow!("error assigning the seat to libinput"))?; | 442 | .map_err(|()| anyhow!("error assigning the seat to libinput"))?; |
| 443 | 443 | ||
| 444 | + // If the session is not active at startup (e.g. niri was launched from a different TTY), | ||
| 445 | + // suspend libinput now so that when ActivateSession fires, libinput.resume() performs a | ||
| 446 | + // full re-enumeration of input devices instead of being a no-op. | ||
| 447 | + if !session.is_active() { | ||
| 448 | + debug!("session is not active, starting libinput in paused state"); | ||
| 449 | + libinput.suspend(); | ||
| 450 | + } | ||
| 451 | + | ||
| 444 | let input_backend = LibinputInputBackend::new(libinput.clone()); | 452 | let input_backend = LibinputInputBackend::new(libinput.clone()); |
| 445 | event_loop | 453 | event_loop |
| 446 | .insert_source(input_backend, |mut event, _, state| { | 454 | .insert_source(input_backend, |mut event, _, state| { |