From f3f441bb86f3fcf872e4a00233d0e2fc2789a781 Mon Sep 17 00:00:00 2001 From: mewhhaha Date: Sat, 7 Mar 2020 00:59:06 +0100 Subject: [PATCH] Add workaround for Nordic keyboard --- src/bridge/keybindings.rs | 4 ++-- src/window.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bridge/keybindings.rs b/src/bridge/keybindings.rs index d448bd2..a4285eb 100644 --- a/src/bridge/keybindings.rs +++ b/src/bridge/keybindings.rs @@ -46,9 +46,9 @@ pub fn parse_keycode(keycode: Keycode) -> Option<(&'static str, bool)> { Keycode::Num9 => Some(("9", false)), Keycode::Colon => Some((":", false)), Keycode::Semicolon => Some((";", false)), - Keycode::Less => Some(("lt", true)), + Keycode::Less => Some(("lt", false)), Keycode::Equals => Some(("=", false)), - Keycode::Greater => Some(("gt", true)), + Keycode::Greater => Some(("gt", false)), Keycode::Question => Some(("?", false)), Keycode::At => Some(("@", false)), Keycode::LeftBracket => Some(("[", false)), diff --git a/src/window.rs b/src/window.rs index 35a6285..bdd98ab 100644 --- a/src/window.rs +++ b/src/window.rs @@ -126,8 +126,11 @@ impl WindowWrapper { pub fn handle_key_down(&mut self, keycode: Keycode, modifiers: Mod) { trace!("KeyDown Received: {}", keycode); + const ALTGR: Mod = Mod::from_bits_truncate(0x0240); + if let Some((key_text, special)) = parse_keycode(keycode) { let will_text_input = + modifiers.contains(ALTGR) || !modifiers.contains(Mod::LCTRLMOD) && !modifiers.contains(Mod::RCTRLMOD) && !modifiers.contains(Mod::LALTMOD) &&