swap_modifier_key()

This commit is contained in:
sjpark 2023-02-09 20:28:36 +09:00
parent edff4acbcb
commit f438dd9fd0

View File

@ -202,15 +202,8 @@ pub fn update_grab_get_key_name() {
#[cfg(target_os = "windows")]
static mut IS_0X021D_DOWN: bool = false;
pub fn start_grab_loop() {
#[cfg(any(target_os = "windows", target_os = "macos"))]
std::thread::spawn(move || {
let try_handle_keyboard = move |mut event: Event, key: Key, is_press: bool| -> Option<Event> {
// fix #2211CAPS LOCK don't work
if key == Key::CapsLock || key == Key::NumLock {
return Some(event);
}
{
fn swap_modifier_key(mut event: Event) -> Event {
let mut allow_swap_key = false;
#[cfg(not(any(feature = "flutter", feature = "cli")))]
if let Some(session) = CUR_SESSION.lock().unwrap().as_ref() {
@ -260,8 +253,19 @@ pub fn start_grab_loop() {
}
_ => {}
};
};
};
}
event
}
pub fn start_grab_loop() {
#[cfg(any(target_os = "windows", target_os = "macos"))]
std::thread::spawn(move || {
let try_handle_keyboard = move |event: Event, key: Key, is_press: bool| -> Option<Event> {
// fix #2211CAPS LOCK don't work
if key == Key::CapsLock || key == Key::NumLock {
return Some(event);
}
let event = swap_modifier_key(event);
let mut _keyboard_mode = KeyboardMode::Map;
let _scan_code = event.scan_code;