Merge branch 'translate_mode' of github.com:asur4s/rustdesk into translate_mode

This commit is contained in:
Asura 2022-08-01 00:52:21 +08:00
commit ee4fd58b3f
2 changed files with 8 additions and 1 deletions

View File

@ -156,7 +156,6 @@ impl KeyboardControllable for Enigo {
} }
fn key_up(&mut self, key: Key) { fn key_up(&mut self, key: Key) {
if self.is_x11 { if self.is_x11 {
dbg!(key);
if self.pynput.send_pynput(&key, false) { if self.pynput.send_pynput(&key, false) {
return; return;
} }

View File

@ -819,6 +819,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
} }
} }
fn translate_keyboard_mode(evt: &KeyEvent) {
dbg!(evt.chr());
let chr = char::from_u32(evt.chr()).unwrap_or_default();
rdev::simulate_char(chr, evt.down);
}
fn handle_key_(evt: &KeyEvent) { fn handle_key_(evt: &KeyEvent) {
if EXITING.load(Ordering::SeqCst) { if EXITING.load(Ordering::SeqCst) {
@ -832,6 +837,9 @@ fn handle_key_(evt: &KeyEvent) {
KeyboardMode::Map => { KeyboardMode::Map => {
map_keyboard_mode(evt); map_keyboard_mode(evt);
} }
KeyboardMode::Translate => {
translate_keyboard_mode(evt);
}
_ => { _ => {
legacy_keyboard_mode(evt); legacy_keyboard_mode(evt);
} }