rename: sync status && add numlock capslock
This commit is contained in:
parent
14e21863ba
commit
d675bfa7e3
@ -264,7 +264,7 @@ pub fn get_keyboard_mode_enum() -> KeyboardMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
pub fn add_numlock_capslock_state(key_event: &mut KeyEvent) {
|
pub fn add_numlock_capslock_status(key_event: &mut KeyEvent) {
|
||||||
if get_key_state(enigo::Key::CapsLock) {
|
if get_key_state(enigo::Key::CapsLock) {
|
||||||
key_event.modifiers.push(ControlKey::CapsLock.into());
|
key_event.modifiers.push(ControlKey::CapsLock.into());
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ pub fn event_to_key_event(event: &Event) -> KeyEvent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
add_numlock_capslock_state(&mut key_event);
|
add_numlock_capslock_status(&mut key_event);
|
||||||
|
|
||||||
return key_event;
|
return key_event;
|
||||||
}
|
}
|
||||||
|
@ -830,7 +830,7 @@ fn click_numlock(en: &mut Enigo) {
|
|||||||
en.key_click(enigo::Key::NumLock);
|
en.key_click(enigo::Key::NumLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sync_status(key_event: &KeyEvent) {
|
fn sync_numlock_capslock_status(key_event: &KeyEvent) {
|
||||||
let mut en = ENIGO.lock().unwrap();
|
let mut en = ENIGO.lock().unwrap();
|
||||||
|
|
||||||
let client_caps_locking = is_modifier_in_key_event(ControlKey::CapsLock, key_event);
|
let client_caps_locking = is_modifier_in_key_event(ControlKey::CapsLock, key_event);
|
||||||
@ -851,7 +851,7 @@ fn sync_status(key_event: &KeyEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if need_click_numlock && !disable_numlock {
|
if need_click_numlock && !disable_numlock {
|
||||||
click_capslock(&mut en);
|
click_numlock(&mut en);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1001,7 +1001,7 @@ pub fn handle_key_(evt: &KeyEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if evt.down {
|
if evt.down {
|
||||||
sync_status(evt)
|
sync_numlock_capslock_status(evt)
|
||||||
}
|
}
|
||||||
match evt.mode.unwrap() {
|
match evt.mode.unwrap() {
|
||||||
KeyboardMode::Map => {
|
KeyboardMode::Map => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user