diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-09 14:21:29 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-10 14:50:51 +0400 |
| commit | 0047272673f8cc3679299b2626a526b9a329b7de (patch) | |
| tree | 4f8398eafd7aa9cb4b0325fadb1568f274983ecc /src/tty.rs | |
| parent | 7527cad20035c87255826ee276658b0b89d58f7f (diff) | |
| download | niri-0047272673f8cc3679299b2626a526b9a329b7de.tar.gz niri-0047272673f8cc3679299b2626a526b9a329b7de.tar.bz2 niri-0047272673f8cc3679299b2626a526b9a329b7de.zip | |
Implement TTY switching
Having to pass backend around turns out to be a problem...
Diffstat (limited to 'src/tty.rs')
| -rw-r--r-- | src/tty.rs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -117,7 +117,9 @@ impl Tty { let input_backend = LibinputInputBackend::new(libinput.clone()); event_loop .insert_source(input_backend, |event, _, data| { - data.niri.process_input_event(event) + let tty = data.tty.as_mut().unwrap(); + let mut change_vt = |vt| tty.change_vt(vt); + data.niri.process_input_event(&mut change_vt, event); }) .unwrap(); @@ -440,4 +442,10 @@ impl Tty { )?; Ok(compositor) } + + fn change_vt(&mut self, vt: i32) { + if let Err(err) = self.session.change_vt(vt) { + error!("error changing VT: {err}"); + } + } } |
