Remove log

This commit is contained in:
Asura 2022-07-18 18:47:38 -07:00
parent 48466bfe37
commit a77d64d181
2 changed files with 17 additions and 17 deletions

View File

@ -3,7 +3,7 @@ use libc;
use crate::{Key, KeyboardControllable, MouseButton, MouseControllable};
use self::libc::{c_char, c_int, c_void, useconds_t};
use std::{borrow::Cow, ffi::CString, io::prelude::*, ptr, sync::mpsc, thread, time};
use std::{borrow::Cow, ffi::CString, io::prelude::*, ptr, sync::mpsc};
const CURRENT_WINDOW: c_int = 0;
const DEFAULT_DELAY: u64 = 12000;
type Window = c_int;

View File

@ -965,22 +965,23 @@ impl Handler {
self.send(Data::Message(msg_out));
}
fn convert_numpad_keys(&mut self, key: &RdevKey) -> &RdevKey {
fn convert_numpad_keys(&mut self, key: RdevKey) -> RdevKey {
if get_key_state(enigo::Key::NumLock) {
return;
return key;
}
match key {
&RdevKey::Num0 => &RdevKey::Insert,
&RdevKey::KpDecimal => &RdevKey::Delete,
&RdevKey::Num1 => &RdevKey::End,
&RdevKey::Num2 => &RdevKey::DownArrow,
&RdevKey::Num3 => &RdevKey::PageDown,
&RdevKey::Num4 => &RdevKey::LeftArrow,
&RdevKey::Num5 => &RdevKey::Clear,
&RdevKey::Num6 => &RdevKey::RightArrow,
&RdevKey::Num7 => &RdevKey::Home,
&RdevKey::Num8 => &RdevKey::UpArrow,
&RdevKey::Num9 => &RdevKey::PageUp,
RdevKey::Kp0 => RdevKey::Insert,
RdevKey::KpDecimal => RdevKey::Delete,
RdevKey::Kp1 => RdevKey::End,
RdevKey::Kp2 => RdevKey::DownArrow,
RdevKey::Kp3 => RdevKey::PageDown,
RdevKey::Kp4 => RdevKey::LeftArrow,
RdevKey::Kp5 => RdevKey::Clear,
RdevKey::Kp6 => RdevKey::RightArrow,
RdevKey::Kp7 => RdevKey::Home,
RdevKey::Kp8 => RdevKey::UpArrow,
RdevKey::Kp9 => RdevKey::PageUp,
_ => key,
}
}
@ -994,9 +995,9 @@ impl Handler {
rdev::linux_keycode_from_key(key).unwrap_or_default().into()
} else if peer == "Windows" {
#[cfg(not(windows))]
self.convert_numpad_keys(&key);
let key = self.convert_numpad_keys(key);
rdev::win_keycode_from_key(key).unwrap_or_default().into()
} else if peer == "Mac OS" {
} else {
rdev::macos_keycode_from_key(key).unwrap_or_default().into()
};
key_event.set_chr(keycode);
@ -1065,7 +1066,6 @@ impl Handler {
fn legacy_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Event) {
// legacy mode(3): Generate characters locally, look for keycode on other side.
println!("legacy_keyboard_mode {:?}", key);
let peer = self.peer_platform();
let is_win = peer == "Windows";