Merge branch 'master' of github.com:asur4s/rustdesk

This commit is contained in:
Asura
2022-08-25 21:29:42 +08:00
36 changed files with 910 additions and 304 deletions

View File

@@ -22,6 +22,7 @@ appveyor = { repository = "pythoneer/enigo-85xiy" }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
log = "0.4"
rdev = { git = "https://github.com/asur4s/rdev" }
hbb_common = { path = "../hbb_common" }
[features]

View File

@@ -257,7 +257,7 @@ pub enum Key {
Backspace,
/// caps lock key
CapsLock,
#[deprecated(since = "0.0.12", note = "now renamed to Meta")]
// #[deprecated(since = "0.0.12", note = "now renamed to Meta")]
/// command key on macOS (super key on Linux, windows key on Windows)
Command,
/// control key
@@ -314,14 +314,14 @@ pub enum Key {
Shift,
/// space key
Space,
#[deprecated(since = "0.0.12", note = "now renamed to Meta")]
// #[deprecated(since = "0.0.12", note = "now renamed to Meta")]
/// super key on linux (command key on macOS, windows key on Windows)
Super,
/// tab key (tabulator)
Tab,
/// up arrow key
UpArrow,
#[deprecated(since = "0.0.12", note = "now renamed to Meta")]
// #[deprecated(since = "0.0.12", note = "now renamed to Meta")]
/// windows key on Windows (super key on Linux, command key on macOS)
Windows,
///

View File

@@ -167,12 +167,7 @@ impl KeyboardControllable for Enigo {
}
}
fn key_click(&mut self, key: Key) {
if self.is_x11 {
self.xdo.key_click(key)
} else {
if let Some(keyboard) = &mut self.uinput_keyboard {
keyboard.key_click(key)
}
}
self.key_down(key).ok();
self.key_up(key);
}
}

View File

@@ -67,16 +67,16 @@ impl EnigoPynput {
Key::Space => "space",
Key::Tab => "Tab",
Key::UpArrow => "Up",
Key::Numpad0 => "0",
Key::Numpad1 => "1",
Key::Numpad2 => "2",
Key::Numpad3 => "3",
Key::Numpad4 => "4",
Key::Numpad5 => "5",
Key::Numpad6 => "6",
Key::Numpad7 => "7",
Key::Numpad8 => "8",
Key::Numpad9 => "9",
Key::Numpad0 => "KP_0",
Key::Numpad1 => "KP_1",
Key::Numpad2 => "KP_2",
Key::Numpad3 => "KP_3",
Key::Numpad4 => "KP_4",
Key::Numpad5 => "KP_5",
Key::Numpad6 => "KP_6",
Key::Numpad7 => "KP_7",
Key::Numpad8 => "KP_8",
Key::Numpad9 => "KP_9",
Key::Decimal => "KP_Decimal",
Key::Cancel => "Cancel",
Key::Clear => "Clear",
@@ -110,7 +110,6 @@ impl EnigoPynput {
return true;
}
};
log::info!("send pynput: {:?}", &s);
return self.tx.send((PyMsg::Str(s), is_press)).is_ok();
}
}

View File

@@ -370,4 +370,19 @@ impl KeyboardControllable for EnigoXdo {
}
}
}
fn key_sequence_parse(&mut self, sequence: &str)
where
Self: Sized,
{
self.key_sequence_parse_try(sequence)
.expect("Could not parse sequence");
}
fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), crate::dsl::ParseError>
where
Self: Sized,
{
crate::dsl::eval(self, sequence)
}
}

View File

@@ -1,5 +1,4 @@
use core_graphics;
// TODO(dustin): use only the things i need
use self::core_graphics::display::*;

View File

@@ -1,9 +1,8 @@
use winapi;
use self::winapi::ctypes::c_int;
use self::winapi::shared::{basetsd::ULONG_PTR, minwindef::*, windef::*};
use self::winapi::um::winbase::*;
use self::winapi::um::winuser::*;
use winapi;
use crate::win::keycodes::*;
use crate::{Key, KeyboardControllable, MouseButton, MouseControllable};
@@ -200,7 +199,7 @@ impl KeyboardControllable for Enigo {
fn key_down(&mut self, key: Key) -> crate::ResultType {
let code = self.key_to_keycode(key);
if code == 0 || code == 65535 {
return Err("".into());
return Err("".into());
}
let res = keybd_event(0, code, 0);
if res == 0 {
@@ -227,7 +226,8 @@ impl KeyboardControllable for Enigo {
}
impl Enigo {
/// Gets the (width, height) of the main display in screen coordinates (pixels).
/// Gets the (width, height) of the main display in screen coordinates
/// (pixels).
///
/// # Example
///

View File

@@ -105,6 +105,13 @@ message MouseEvent {
repeated ControlKey modifiers = 4;
}
enum KeyboardMode{
Legacy = 0;
Map = 1;
Translate = 2;
Auto = 3;
}
enum ControlKey {
Unknown = 0;
Alt = 1;
@@ -198,6 +205,7 @@ message KeyEvent {
string seq = 6;
}
repeated ControlKey modifiers = 8;
KeyboardMode mode = 9;
}
message CursorData {