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]