Fix sycn of CapsLock

This commit is contained in:
Asura 2022-08-03 14:52:08 +08:00
parent d0702ddfd9
commit b3b50829f5
2 changed files with 9 additions and 0 deletions

View File

@ -822,6 +822,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
}
fn translate_keyboard_mode(evt: &KeyEvent) {
// Caps affects the keycode map of the peer system(Linux).
let mut en = ENIGO.lock().unwrap();
if en.get_key_state(Key::CapsLock){
rdev_key_click(RdevKey::CapsLock);
}
let chr = char::from_u32(evt.chr()).unwrap_or_default();
if evt.down {
KBD_CONTEXT.lock().unwrap().unicode_char_down(chr).expect("unicode_char_down error");

View File

@ -1122,6 +1122,10 @@ impl Handler {
if key == RdevKey::AltGr || evt.scan_code == 541 {
return;
}
// Caps affects the keycode map of the peer system(Linux).
if key == RdevKey::CapsLock {
return;
}
dbg!(key);
self.map_keyboard_mode(down_or_up, key, None);
}