Refactor is altgr for clearer expression

This commit is contained in:
asur4s 2023-03-22 05:09:02 -07:00
parent 8478c2ba48
commit 33a1ab0d32

@ -842,24 +842,12 @@ fn is_altgr(event: &Event) -> bool {
false false
} }
#[cfg(target_os = "macos")]
// ignore right option key
if event.platform_code as u32 == rdev::kVK_RightOption {
true
} else {
false
}
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
if unsafe { IS_0X021D_DOWN } { if unsafe { IS_0X021D_DOWN } && event.position_code == 0xE038 {
if event.position_code == 0xE038 {
true true
} else { } else {
false false
} }
} else {
false
}
} }
fn is_press(event: &Event) -> bool { fn is_press(event: &Event) -> bool {
@ -882,6 +870,13 @@ pub fn translate_keyboard_mode(peer: &str, event: &Event, key_event: KeyEvent) -
} }
} }
#[cfg(target_os = "macos")]
// ignore right option key
if event.code as u32 == rdev::kVK_RightOption {
return events;
}
#[cfg(not(target_os = "macos"))]
if is_altgr(event) { if is_altgr(event) {
return events; return events;
} }