ignore modifiers for name

This commit is contained in:
rustdesk 2022-01-10 03:11:53 +08:00
parent 3a6dc19616
commit e2a879692d
2 changed files with 2 additions and 8 deletions

2
Cargo.lock generated
View File

@ -2958,7 +2958,7 @@ dependencies = [
[[package]]
name = "rdev"
version = "0.5.0"
source = "git+https://github.com/open-trade/rdev#bc1d62c9966a56eecc5de61b1dee43dfc80ec141"
source = "git+https://github.com/open-trade/rdev#2a3205a13102907da2442a369f8b704601eecc9d"
dependencies = [
"cocoa 0.22.0",
"core-foundation 0.7.0",

View File

@ -233,8 +233,6 @@ impl Handler {
let mut me = self.clone();
let peer = self.peer_platform();
let is_win = peer == "Windows";
let version = self.lc.read().unwrap().version;
const OFFSET_CASE: u8 = 'a' as u8 - 'A' as u8;
std::thread::spawn(move || {
// This will block.
std::env::set_var("KEYBOARD_ONLY", "y"); // pass to rdev
@ -331,7 +329,7 @@ impl Handler {
if let Some(k) = control_key {
key_event.set_control_key(k);
} else {
let mut chr = match evt.name {
let chr = match evt.name {
Some(ref s) => s.chars().next().unwrap_or('\0'),
_ => '\0',
};
@ -340,10 +338,6 @@ impl Handler {
me.lock_screen();
return;
}
// <= 1.1.8, caps modifier only for 'a' -> 'z', so here adjust it
if version <= 1001008 && chr >= 'A' && chr <= 'Z' {
chr = (chr as u8 + OFFSET_CASE) as _;
}
key_event.set_chr(chr as _);
} else {
log::error!("Unknown key {:?}", evt);