From 225df7c08cbc9a7d320042d384a49cc9fc640a23 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Wed, 26 Aug 2020 15:29:16 +0200 Subject: [PATCH] alt key should work now --- src/key/keystate.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/key/keystate.rs b/src/key/keystate.rs index 4563dcf..ac5a426 100644 --- a/src/key/keystate.rs +++ b/src/key/keystate.rs @@ -1,6 +1,6 @@ use std::ffi::OsString; -use winapi::um::winuser::{GetKeyNameTextW, KBDLLHOOKSTRUCT, LLKHF_ALTDOWN, LLKHF_EXTENDED}; +use winapi::um::winuser::{GetKeyNameTextW, KBDLLHOOKSTRUCT, LLKHF_EXTENDED}; use wio::wide::FromWide; #[allow(clippy::struct_excessive_bools)] @@ -37,18 +37,15 @@ impl KeyState { match key.vkCode { 160 | 161 => self.shift_down = key_down, 162 | 163 => self.ctrl_down = key_down, + 164 | 165 => self.alt_down = key_down, 91 => self.win_down = key_down, - _ => {} - } - - if key.flags & LLKHF_ALTDOWN != 0 { - self.alt_down = key_down + _ => {}, } } /// true if the key is an auxiliary key like shift, control or the windows key pub fn is_aux_key(&self) -> bool { - matches!(self.kbdllstruct.vkCode, 160 | 161 | 162 | 163 | 91) + matches!(self.kbdllstruct.vkCode, 160..=165 | 91) } #[no_mangle]