From 095b54c26d8fface496800bdff1c66ce07356708 Mon Sep 17 00:00:00 2001 From: Charlotte Meyer Date: Mon, 28 Jan 2019 13:22:15 +0100 Subject: [PATCH] This way is actually smarter --- src/input/keyboard.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/input/keyboard.rs b/src/input/keyboard.rs index 58f9c75..ea435d9 100644 --- a/src/input/keyboard.rs +++ b/src/input/keyboard.rs @@ -3,7 +3,7 @@ use log::debug; use wlroots::{ compositor, input::{self, keyboard}, - xkbcommon::xkb::{keysyms, keysym_get_name}, + xkbcommon::xkb::{keysym_get_name, keysyms}, WLR_KEY_PRESSED, }; @@ -16,8 +16,8 @@ impl input::keyboard::Handler for Keyboard { _keyboard_handle: keyboard::Handle, key_event: &keyboard::event::Key, ) { - for key in key_event.pressed_keys() { - if key_event.key_state() == WLR_KEY_PRESSED { + if key_event.key_state() == WLR_KEY_PRESSED { + for key in key_event.pressed_keys() { debug!("Key down: {}", keysym_get_name(key)); match key { keysyms::KEY_Escape => compositor::terminate(), @@ -33,7 +33,9 @@ impl input::keyboard::Handler for Keyboard { } _ => {} } - } else { + } + } else { + for key in key_event.pressed_keys() { debug!("Key up: {}", keysym_get_name(key)); } }