From 7c8d40dc72b70a996011a6b1668a6e4af9178bf8 Mon Sep 17 00:00:00 2001 From: fufesou Date: Thu, 15 Dec 2022 22:16:39 +0800 Subject: [PATCH] fix keycodes Signed-off-by: fufesou --- src/keyboard.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/keyboard.rs b/src/keyboard.rs index 6b4b6fea5..edd03d6e6 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -622,14 +622,14 @@ pub fn map_keyboard_mode(event: &Event, mut key_event: KeyEvent) -> Option rdev::macos_code_to_win_scancode(event.code as _)?, - "macos" => rdev::macos_code_to_linux_code(event.code as _)?, - _ => event.code, + "macos" => event.code, + _ => rdev::macos_code_to_linux_code(event.code as _)?, }; #[cfg(target_os = "linux")] let keycode = match peer.as_str() { "windows" => rdev::linux_code_to_win_scancode(event.code as _)?, - "macos" => event.code, - _ => rdev::linux_code_to_macos_code(event.code as _)?, + "macos" => rdev::linux_code_to_macos_code(event.code as _)?, + _ => event.code, }; key_event.set_chr(keycode);