Merge pull request #183 from mewhhaha/workaround-nordic-keyboard

Add workaround for Nordic keyboard
macos-click-through
Keith Simmons 5 years ago committed by GitHub
commit c3b216df66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)),

@ -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;
}

Loading…
Cancel
Save