mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-25 05:09:04 +08:00
Refactor: is press
This commit is contained in:
parent
e99af2b0d4
commit
8478c2ba48
@ -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<KeyEvent> {
|
||||
let mut events: Vec<KeyEvent> = 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);
|
||||
|
Loading…
Reference in New Issue
Block a user