Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

feat: keyboard map mode control side

mcfans28c11801f3fe
diff --git a/Cargo.lock b/Cargo.lock
index 519476e93..261f4a544 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1811,7 +1811,7 @@ dependencies = [
"log",
"objc",
"pkg-config",
- "rdev",
+ "rdev 0.5.0-2 (git+https://github.com/fufesou/rdev)",
"serde 1.0.163",
"serde_derive",
"tfc",
@@ -4911,6 +4911,30 @@ dependencies = [
"x11 2.21.0",
]
+[[package]]
+name = "rdev"
+version = "0.5.0-2"
+source = "git+https://github.com/mcfans/rdev#d643ea4542e61931cb20e1ecd390d6a3c9569171"
+dependencies = [
+ "cocoa",
+ "core-foundation",
+ "core-foundation-sys 0.8.4",
+ "core-graphics",
+ "dispatch",
+ "enum-map",
+ "epoll",
+ "inotify",
+ "lazy_static",
+ "libc",
+ "log",
+ "mio",
+ "strum 0.24.1",
+ "strum_macros 0.24.3",
+ "widestring",
+ "winapi 0.3.9",
+ "x11 2.21.0",
+]
+
[[package]]
name = "rdrand"
version = "0.4.0"
@@ -5196,7 +5220,7 @@ dependencies = [
"os-version",
"pam",
"parity-tokio-ipc",
- "rdev",
+ "rdev 0.5.0-2 (git+https://github.com/mcfans/rdev)",
"repng",
"reqwest",
"ringbuf",
diff --git a/Cargo.toml b/Cargo.toml
index f6c014483..2a45b074b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -64,7 +64,7 @@ default-net = "0.14"
wol-rs = "1.0"
flutter_rust_bridge = { version = "1.75", features = ["uuid"], optional = true}
errno = "0.3"
-rdev = { git = "https://github.com/fufesou/rdev" }
+rdev = { git = "https://github.com/mcfans/rdev" }
url = { version = "2.3", features = ["serde"] }
crossbeam-queue = "0.3"
hex = "0.4"
diff --git a/src/keyboard.rs b/src/keyboard.rs
index 4a46d8934..20368c9d6 100644
--- a/src/keyboard.rs
+++ b/src/keyboard.rs
@@ -28,6 +28,8 @@ const OS_LOWER_WINDOWS: &str = "windows";
const OS_LOWER_LINUX: &str = "linux";
#[allow(dead_code)]
const OS_LOWER_MACOS: &str = "macos";
+#[allow(dead_code)]
+const OS_LOWER_ANDROID: &str = "android";
#[cfg(any(target_os = "windows", target_os = "macos"))]
static KEYBOARD_HOOKED: AtomicBool = AtomicBool::new(false);
@@ -865,12 +867,14 @@ pub fn map_keyboard_mode(_peer: &str, event: &Event, mut key_event: KeyEvent) ->
rdev::win_scancode_to_macos_code(event.position_code)?
}
}
+ OS_LOWER_ANDROID => rdev::win_scancode_to_android_key_code(event.position_code)?,
_ => rdev::win_scancode_to_linux_code(event.position_code)?,
};
#[cfg(target_os = "macos")]
let keycode = match _peer {
OS_LOWER_WINDOWS => rdev::macos_code_to_win_scancode(event.platform_code as _)?,
OS_LOWER_MACOS => event.platform_code as _,
+ OS_LOWER_ANDROID => rdev::macos_code_to_android_key_code(event.platform_code as _)?,
_ => rdev::macos_code_to_linux_code(event.platform_code as _)?,
};
#[cfg(target_os = "linux")]
@@ -883,6 +887,7 @@ pub fn map_keyboard_mode(_peer: &str, event: &Event, mut key_event: KeyEvent) ->
rdev::linux_code_to_macos_code(event.position_code as _)?
}
}
+ OS_LOWER_ANDROID => rdev::linux_code_to_android_key_code(event.position_code as _)?,
_ => event.position_code as _,
};
#[cfg(any(target_os = "android", target_os = "ios"))]