Implement TTY switching

Having to pass backend around turns out to be a problem...
This commit is contained in:
Ivan Molodetskikh
2023-08-09 14:21:29 +04:00
parent 7527cad200
commit 0047272673
3 changed files with 18 additions and 4 deletions
+9 -1
View File
@@ -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}");
}
}
}