feat: Support new keyboard mode

This commit is contained in:
Asura 2022-07-13 02:14:32 -07:00
parent 7b3b900764
commit 7fe2609ffb
5 changed files with 0 additions and 16 deletions

View File

@ -105,8 +105,6 @@ impl Enigo {
}
fn send_rdev(&mut self, key: &Key, is_press: bool) -> bool {
log::info!("{:?} {:?}", key, is_press);
if let Key::Raw(keycode) = key {
let event_type = match is_press {
// todo: Acccodding to client type
@ -139,7 +137,6 @@ impl Enigo {
fn string_to_static_str(s: String) -> &'static str {
Box::leak(s.into_boxed_str())
}
dbg!(chr.to_string());
return self
.tx
.send((PyMsg::Str(string_to_static_str(chr.to_string())), is_press))

View File

@ -432,8 +432,6 @@ impl Enigo {
}
fn send_rdev(&mut self, key: &Key, is_press: bool) -> bool {
log::info!("{:?} {:?}", key, is_press);
if let Key::Raw(keycode) = key {
let event_type = match is_press {
// todo: Acccodding to client type

View File

@ -284,8 +284,6 @@ impl Enigo {
}
fn send_rdev(&mut self, key: &Key, is_press: bool) -> bool {
log::info!("{:?} {:?}", key, is_press);
if let Key::Raw(keycode) = key {
let event_type = match is_press {
// todo: Acccodding to client type

View File

@ -589,10 +589,8 @@ fn handle_key_(evt: &KeyEvent) {
if keyboard_mode == 1 {
if let Some(key_event::Union::chr(chr)) = evt.union {
if evt.down {
println!("key down: {:?}", chr);
en.key_down(Key::Raw(chr.try_into().unwrap()));
} else {
println!("key up: {:?}", chr);
en.key_up(Key::Raw(chr.try_into().unwrap()));
}
}

View File

@ -321,7 +321,6 @@ impl Handler {
}
MUTEX_SPECIAL_KEYS.lock().unwrap().insert(k, true);
}
println!("keydown {:?} {:?} {:?}", k, evt.code, evt.scan_code);
(k, 1)
}
KeyRelease(k) => {
@ -329,7 +328,6 @@ impl Handler {
if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) {
MUTEX_SPECIAL_KEYS.lock().unwrap().insert(k, false);
}
println!("keyup {:?} {:?} {:?}", k, evt.code, evt.scan_code);
(k, 0)
}
_ => return,
@ -339,11 +337,6 @@ impl Handler {
#[cfg(target_os = "windows")]
let key = rdev::get_win_key(evt.code.into(), evt.scan_code);
// todo: up down left right in numpad
// #[cfg(target_os = "linux")]
dbg!(key);
println!("--------------");
let mut key_event = KeyEvent::new();
// According to peer platform.
if peer == "Linux" {