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..aeaea76 100644 --- a/src/window.rs +++ b/src/window.rs @@ -126,15 +126,18 @@ impl WindowWrapper { pub fn handle_key_down(&mut self, keycode: Keycode, modifiers: Mod) { trace!("KeyDown Received: {}", keycode); + if let Some((key_text, special)) = parse_keycode(keycode) { - let will_text_input = - !modifiers.contains(Mod::LCTRLMOD) && - !modifiers.contains(Mod::RCTRLMOD) && - !modifiers.contains(Mod::LALTMOD) && - !modifiers.contains(Mod::RALTMOD) && - !modifiers.contains(Mod::LGUIMOD) && - !modifiers.contains(Mod::RGUIMOD); - if modifiers.contains(Mod::MODEMOD) || (will_text_input && !special) { + let ctrl = modifiers.contains(Mod::LCTRLMOD) || modifiers.contains(Mod::RCTRLMOD); + let alt = modifiers.contains(Mod::LALTMOD) || modifiers.contains(Mod::RALTMOD); + let gui = modifiers.contains(Mod::LGUIMOD) || modifiers.contains(Mod::RGUIMOD); + + let will_text_input = + modifiers.contains(Mod::MODEMOD) || + (ctrl && alt) || + !ctrl && !alt && !gui; + + if will_text_input && !special { self.ignore_text_input = false; return; }