use all modifiers to switch back instead of ESC

This commit is contained in:
Ferdinand Schober
2022-09-20 08:40:27 +02:00
parent 76261ad24a
commit 7a2c82a4e1

View File

@@ -360,9 +360,12 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for App {
_: &QueueHandle<Self>,
) {
match event {
wl_keyboard::Event::Key { serial: _, time: _, key, state: _ } => {
if key == 1 {
// ESC key
wl_keyboard::Event::Key {..} => {
app.connection.send_event(event);
}
wl_keyboard::Event::Modifiers { mods_depressed, ..} => {
app.connection.send_event(event);
if mods_depressed == 77 { // ctrl shift super alt
if let Some(pointer_lock) = app.pointer_lock.as_ref() {
pointer_lock.destroy();
app.pointer_lock = None;
@@ -375,13 +378,8 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for App {
shortcut_inhibitor.destroy();
app.shortcut_inhibitor = None;
}
} else {
app.connection.send_event(event);
}
}
wl_keyboard::Event::Modifiers {..} => {
app.connection.send_event(event);
}
wl_keyboard::Event::Keymap { format:_ , fd, size:_ } => {
let mmap = unsafe { Mmap::map(&File::from_raw_fd(fd.as_raw_fd())).unwrap() };
app.connection.offer_data(protocol::DataRequest::KeyMap, mmap);