commit
357ca07aa4
@ -10,7 +10,9 @@ use crate::ui::CUR_SESSION;
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
use hbb_common::log;
|
||||
use hbb_common::message_proto::*;
|
||||
use rdev::{Event, EventType, Key, KeyCode};
|
||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||
use rdev::KeyCode;
|
||||
use rdev::{Event, EventType, Key};
|
||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::{
|
||||
@ -907,6 +909,12 @@ pub fn translate_keyboard_mode(peer: &str, event: &Event, key_event: KeyEvent) -
|
||||
return events;
|
||||
}
|
||||
}
|
||||
if is_numpad_key(&event) {
|
||||
if let Some(evt) = translate_key_code(peer, event, key_event) {
|
||||
events.push(evt);
|
||||
}
|
||||
return events;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
// ignore right option key
|
||||
|
@ -1233,16 +1233,23 @@ fn translate_keyboard_mode(evt: &KeyEvent) {
|
||||
// remote: Shift + 1 => 1
|
||||
let mut en = ENIGO.lock().unwrap();
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
en.key_sequence(seq);
|
||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||
{
|
||||
simulate_(&EventType::KeyRelease(RdevKey::ShiftLeft));
|
||||
simulate_(&EventType::KeyRelease(RdevKey::ShiftRight));
|
||||
if get_modifier_state(Key::Shift, &mut en) {
|
||||
simulate_(&EventType::KeyRelease(RdevKey::ShiftLeft));
|
||||
}
|
||||
if get_modifier_state(Key::RightShift, &mut en) {
|
||||
simulate_(&EventType::KeyRelease(RdevKey::ShiftRight));
|
||||
}
|
||||
for chr in seq.chars() {
|
||||
#[cfg(target_os = "windows")]
|
||||
rdev::simulate_char(chr).ok();
|
||||
#[cfg(target_os = "linux")]
|
||||
en.key_click(Key::Layout(chr));
|
||||
}
|
||||
}
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
en.key_sequence(seq);
|
||||
}
|
||||
Some(key_event::Union::Chr(..)) => {
|
||||
#[cfg(target_os = "windows")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user