From 7a2c82a4e10f63ba8e44429055aac5a89f9b9c64 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Tue, 20 Sep 2022 08:40:27 +0200 Subject: [PATCH] use all modifiers to switch back instead of ESC --- src/bin/server.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/bin/server.rs b/src/bin/server.rs index 38541b4..53a01e7 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -360,9 +360,12 @@ impl Dispatch for App { _: &QueueHandle, ) { 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 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);