Fix libinput panic on tty switch
This commit is contained in:
parent
495c492e50
commit
5411209bb5
|
@ -381,7 +381,8 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
.filter(|x| x.seat() == device_seat)
|
||||
.any(|x| x.has_capability(libinput::DeviceCapability::Touch));
|
||||
} else {
|
||||
panic!("Seat changed that was never created")
|
||||
warn!(self.logger, "Seat changed that was never created");
|
||||
continue;
|
||||
}
|
||||
|
||||
// check if the seat has any other devices
|
||||
|
@ -393,13 +394,18 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
handler.on_seat_destroyed(evlh, &seat);
|
||||
}
|
||||
} else {
|
||||
panic!("Seat destroyed that was never created");
|
||||
warn!(self.logger, "Seat destroyed that was never created");
|
||||
continue;
|
||||
}
|
||||
// it has, notify about updates
|
||||
} else if let Some(ref mut handler) = self.handler {
|
||||
let seat = &self.seats[&device_seat];
|
||||
if let Some(seat) = self.seats.get(&device_seat) {
|
||||
trace!(self.logger, "Calling on_seat_changed with {:?}", seat);
|
||||
handler.on_seat_changed(evlh, seat);
|
||||
handler.on_seat_changed(evlh, &seat);
|
||||
} else {
|
||||
warn!(self.logger, "Seat changed that was never created");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,9 +417,7 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
use input::event::touch::*;
|
||||
if let Some(ref mut handler) = self.handler {
|
||||
let device_seat = touch_event.device().seat();
|
||||
let seat = &self.seats
|
||||
.get(&device_seat)
|
||||
.expect("Recieved touch event of non existing Seat");
|
||||
if let &Some(ref seat) = &self.seats.get(&device_seat) {
|
||||
match touch_event {
|
||||
TouchEvent::Down(down_event) => {
|
||||
trace!(self.logger, "Calling on_touch_down with {:?}", down_event);
|
||||
|
@ -444,6 +448,10 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
handler.on_touch_frame(evlh, seat, frame_event)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warn!(self.logger, "Recieved touch event of non existing Seat");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
libinput::Event::Keyboard(keyboard_event) => {
|
||||
|
@ -451,11 +459,13 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
match keyboard_event {
|
||||
KeyboardEvent::Key(key_event) => if let Some(ref mut handler) = self.handler {
|
||||
let device_seat = key_event.device().seat();
|
||||
let seat = &self.seats
|
||||
.get(&device_seat)
|
||||
.expect("Recieved key event of non existing Seat");
|
||||
if let &Some(ref seat) = &self.seats.get(&device_seat) {
|
||||
trace!(self.logger, "Calling on_keyboard_key with {:?}", key_event);
|
||||
handler.on_keyboard_key(evlh, seat, key_event);
|
||||
} else {
|
||||
warn!(self.logger, "Recieved key event of non existing Seat");
|
||||
continue;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -463,9 +473,7 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
use input::event::pointer::*;
|
||||
if let Some(ref mut handler) = self.handler {
|
||||
let device_seat = pointer_event.device().seat();
|
||||
let seat = &self.seats
|
||||
.get(&device_seat)
|
||||
.expect("Recieved pointer event of non existing Seat");
|
||||
if let &Some(ref seat) = &self.seats.get(&device_seat) {
|
||||
match pointer_event {
|
||||
PointerEvent::Motion(motion_event) => {
|
||||
trace!(
|
||||
|
@ -525,6 +533,10 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
handler.on_pointer_button(evlh, seat, button_event);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warn!(self.logger, "Recieved pointer event of non existing Seat");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {} //FIXME: What to do with the rest.
|
||||
|
|
Loading…
Reference in New Issue