Skip to content

Commit

Permalink
Merge pull request #11 from fufesou/fix/macos_convert_unicode
Browse files Browse the repository at this point in the history
fix: macos, convert unicode, shift
  • Loading branch information
rustdesk authored Dec 10, 2024
2 parents c6982ca + 3678a58 commit f9b60b1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/macos/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,21 @@ pub unsafe fn convert(
EventType::KeyPress(..) => {
let code =
cg_event.get_integer_value_field(EventField::KEYBOARD_EVENT_KEYCODE) as u32;
if code == kVK_Shift as _ || code == kVK_RightShift as _ {
return None;
#[allow(non_upper_case_globals)]
let skip_unicode = match code as CGKeyCode {
kVK_Shift | kVK_RightShift | kVK_ForwardDelete => true,
_ => false,
};
if skip_unicode {
None
} else {
let flags = cg_event.get_flags();
let s = keyboard_state.create_unicode_for_key(code, flags);
// if s.is_none() {
// s = Some(key_to_name(_k).to_owned())
// }
s
}
let flags = cg_event.get_flags();
let s = keyboard_state.create_unicode_for_key(code, flags);
// if s.is_none() {
// s = Some(key_to_name(_k).to_owned())
// }
s
}
EventType::KeyRelease(..) => None,
_ => None,
Expand Down

0 comments on commit f9b60b1

Please sign in to comment.