feat: keyboard map mode control side
This commit is contained in:
parent
b3e2ab0f3b
commit
28c11801f3
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -1811,7 +1811,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"objc",
|
"objc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"rdev",
|
"rdev 0.5.0-2 (git+https://github.com/fufesou/rdev)",
|
||||||
"serde 1.0.163",
|
"serde 1.0.163",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"tfc",
|
"tfc",
|
||||||
@ -4911,6 +4911,30 @@ dependencies = [
|
|||||||
"x11 2.21.0",
|
"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]]
|
[[package]]
|
||||||
name = "rdrand"
|
name = "rdrand"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@ -5196,7 +5220,7 @@ dependencies = [
|
|||||||
"os-version",
|
"os-version",
|
||||||
"pam",
|
"pam",
|
||||||
"parity-tokio-ipc",
|
"parity-tokio-ipc",
|
||||||
"rdev",
|
"rdev 0.5.0-2 (git+https://github.com/mcfans/rdev)",
|
||||||
"repng",
|
"repng",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"ringbuf",
|
"ringbuf",
|
||||||
|
@ -64,7 +64,7 @@ default-net = "0.14"
|
|||||||
wol-rs = "1.0"
|
wol-rs = "1.0"
|
||||||
flutter_rust_bridge = { version = "1.75", features = ["uuid"], optional = true}
|
flutter_rust_bridge = { version = "1.75", features = ["uuid"], optional = true}
|
||||||
errno = "0.3"
|
errno = "0.3"
|
||||||
rdev = { git = "https://github.com/fufesou/rdev" }
|
rdev = { git = "https://github.com/mcfans/rdev" }
|
||||||
url = { version = "2.3", features = ["serde"] }
|
url = { version = "2.3", features = ["serde"] }
|
||||||
crossbeam-queue = "0.3"
|
crossbeam-queue = "0.3"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
|
@ -28,6 +28,8 @@ const OS_LOWER_WINDOWS: &str = "windows";
|
|||||||
const OS_LOWER_LINUX: &str = "linux";
|
const OS_LOWER_LINUX: &str = "linux";
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
const OS_LOWER_MACOS: &str = "macos";
|
const OS_LOWER_MACOS: &str = "macos";
|
||||||
|
#[allow(dead_code)]
|
||||||
|
const OS_LOWER_ANDROID: &str = "android";
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||||
static KEYBOARD_HOOKED: AtomicBool = AtomicBool::new(false);
|
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)?
|
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)?,
|
_ => rdev::win_scancode_to_linux_code(event.position_code)?,
|
||||||
};
|
};
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let keycode = match _peer {
|
let keycode = match _peer {
|
||||||
OS_LOWER_WINDOWS => rdev::macos_code_to_win_scancode(event.platform_code as _)?,
|
OS_LOWER_WINDOWS => rdev::macos_code_to_win_scancode(event.platform_code as _)?,
|
||||||
OS_LOWER_MACOS => 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 _)?,
|
_ => rdev::macos_code_to_linux_code(event.platform_code as _)?,
|
||||||
};
|
};
|
||||||
#[cfg(target_os = "linux")]
|
#[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 _)?
|
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 _,
|
_ => event.position_code as _,
|
||||||
};
|
};
|
||||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user