Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions input-emulation/src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,21 @@ impl Emulation for MacOSEmulation {
key,
state,
} => {
let code = match KeyMap::from_key_mapping(KeyMapping::Evdev(key as u16)) {
Ok(k) => k.mac as CGKeyCode,
Err(_) => {
log::warn!("unable to map key event");
return Ok(());
}
// Fallback table for Linux evdev keys that have no macOS CGKeyCode in
// the keycode crate's Chromium-derived table. F13/F14/F15 are the
// conventional macOS stand-ins for Print Screen / Scroll Lock / Pause,
// which do not exist on Apple keyboards.
let code: CGKeyCode = match scancode::Linux::try_from(key) {
Ok(scancode::Linux::KeySysrq) => 0x69, // F13
Ok(scancode::Linux::KeyScrollLock) => 0x6B, // F14
Ok(scancode::Linux::KeyPause) => 0x71, // F15
_ => match KeyMap::from_key_mapping(KeyMapping::Evdev(key as u16)) {
Comment on lines +459 to +463
Ok(k) => k.mac as CGKeyCode,
Err(_) => {
log::warn!("unable to map key event");
return Ok(());
}
},
};
let is_modifier = update_modifiers(&self.modifier_state, key, state);
if is_modifier {
Expand Down
Loading