diff --git a/src/keyboard.rs b/src/keyboard.rs index b3d8e4211..2a131e13a 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -862,6 +862,10 @@ fn is_altgr(event: &Event) -> bool { } } +fn is_press(event: &Event) -> bool { + matches!(event.event_type, EventType::KeyPress(_)) +} + pub fn translate_keyboard_mode(peer: &str, event: &Event, key_event: KeyEvent) -> Vec { let mut events: Vec = Vec::new(); if let Some(unicode_info) = &event.unicode { @@ -887,8 +891,8 @@ pub fn translate_keyboard_mode(peer: &str, event: &Event, key_event: KeyEvent) - return events; } - #[cfg(target_os = "windows")] - if matches!(event.event_type, EventType::KeyPress(_)) { + #[cfg(any(target_os = "linux", target_os = "windows"))] + if is_press(event) { try_fill_unicode(event, &key_event, &mut events); } @@ -899,9 +903,6 @@ pub fn translate_keyboard_mode(peer: &str, event: &Event, key_event: KeyEvent) - } } - #[cfg(target_os = "linux")] - try_fill_unicode(event, &key_event, &mut events); - #[cfg(target_os = "macos")] if !unsafe { IS_LEFT_OPTION_DOWN } { try_fill_unicode(event, &key_event, &mut events);