From 234b8df41717b9c92fd7d16965b61edfd5c2439f Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 4 Jul 2022 08:08:43 -0700 Subject: [PATCH 001/113] fix(pynput): Add dead key conversion rules to support Czech keyboard --- pynput_service.py | 6 +++++- src/ui/remote.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pynput_service.py b/pynput_service.py index c51e9a524..5aca57986 100644 --- a/pynput_service.py +++ b/pynput_service.py @@ -145,7 +145,11 @@ class MyController(Controller): or (keycode_flag == False and keycode == list(keycode_set)[0] and len(keycode_set) == 1): deakkey_chr = str(key).replace("'", '') keysym = DEAD_KEYS[deakkey_chr] - keycode, shift_state = self.keyboard_mapping[keysym][0] + # shift_state = 0 + keycode, shift_state = list( + filter(lambda x: x[1] == 0, + self.keyboard_mapping[keysym]) + )[0] # If the key has a virtual key code, use that immediately with # fake_input; fake input,being an X server extension, has access to diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 5917314ca..8aa0bccb1 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -276,7 +276,7 @@ impl Handler { KeyRelease(k) => (k, 0), _ => return, }; - log::debug!("{:?}", key); + log::debug!("{:?}", key);a let alt = get_key_state(enigo::Key::Alt); #[cfg(windows)] let ctrl = { From 9237ae30dc200caededbe8e1648f3d1bdd398839 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 4 Jul 2022 08:18:58 -0700 Subject: [PATCH 002/113] fix(pynput): Add dead key conversion rules to support Czech keyboard --- pynput_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pynput_service.py b/pynput_service.py index c51e9a524..5aca57986 100644 --- a/pynput_service.py +++ b/pynput_service.py @@ -145,7 +145,11 @@ class MyController(Controller): or (keycode_flag == False and keycode == list(keycode_set)[0] and len(keycode_set) == 1): deakkey_chr = str(key).replace("'", '') keysym = DEAD_KEYS[deakkey_chr] - keycode, shift_state = self.keyboard_mapping[keysym][0] + # shift_state = 0 + keycode, shift_state = list( + filter(lambda x: x[1] == 0, + self.keyboard_mapping[keysym]) + )[0] # If the key has a virtual key code, use that immediately with # fake_input; fake input,being an X server extension, has access to From e82e0bf69706914a57b16fba945fb29c2d17e370 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 11 Jul 2022 03:26:12 -0700 Subject: [PATCH 003/113] feat: Add new simulate key method --- Cargo.lock | 19 +++++++++++- libs/enigo/Cargo.toml | 3 +- libs/enigo/src/linux.rs | 65 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 80 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7e679ef91..bdf981356 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,6 +1317,7 @@ dependencies = [ "log", "objc", "pkg-config", + "rdev 0.5.1", "serde 1.0.137", "serde_derive", "unicode-segmentation", @@ -3836,6 +3837,22 @@ dependencies = [ "x11", ] +[[package]] +name = "rdev" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7336f02e29f34e9a7186ccf87051f6a5697536195569012e076e18a4efddcede" +dependencies = [ + "cocoa 0.22.0", + "core-foundation 0.7.0", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "lazy_static", + "libc", + "winapi 0.3.9", + "x11", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -4076,7 +4093,7 @@ dependencies = [ "num_cpus", "objc", "parity-tokio-ipc", - "rdev", + "rdev 0.5.0", "repng", "reqwest", "rpassword 6.0.1", diff --git a/libs/enigo/Cargo.toml b/libs/enigo/Cargo.toml index 6842dab56..29d7ee87f 100644 --- a/libs/enigo/Cargo.toml +++ b/libs/enigo/Cargo.toml @@ -21,7 +21,8 @@ appveyor = { repository = "pythoneer/enigo-85xiy" } [dependencies] serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } -log = "0.4" +log = "0.4.17" +rdev = "0.5.1" [features] with_serde = ["serde", "serde_derive"] diff --git a/libs/enigo/src/linux.rs b/libs/enigo/src/linux.rs index adfe9507c..ee27e06cf 100644 --- a/libs/enigo/src/linux.rs +++ b/libs/enigo/src/linux.rs @@ -3,8 +3,8 @@ 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}; - +use rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; +use std::{borrow::Cow, ffi::CString, io::prelude::*, ptr, sync::mpsc, thread, time}; const CURRENT_WINDOW: c_int = 0; const DEFAULT_DELAY: u64 = 12000; type Window = c_int; @@ -103,6 +103,30 @@ impl Enigo { pub fn reset(&mut self) { self.tx.send((PyMsg::Char('\0'), true)).ok(); } + + 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 + true => Box::leak(Box::new(EventType::KeyPress(RdevKey::Unknown( + (*keycode).into(), + )))), + false => Box::leak(Box::new(EventType::KeyRelease(RdevKey::Unknown( + (*keycode).into(), + )))), + }; + + match simulate(event_type) { + Ok(()) => true, + Err(SimulateError) => false, + } + } else { + false + } + } + #[inline] fn send_pynput(&mut self, key: &Key, is_press: bool) -> bool { if unsafe { PYNPUT_EXIT || !PYNPUT_REDAY } { @@ -111,8 +135,15 @@ impl Enigo { if let Key::Layout(c) = key { return self.tx.send((PyMsg::Char(*c), is_press)).is_ok(); } - if let Key::Raw(_) = key { - return false; + if let Key::Raw(chr) = key { + 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)) + .is_ok(); } #[allow(deprecated)] let s = match key { @@ -431,6 +462,9 @@ impl KeyboardControllable for Enigo { if self.xdo.is_null() { return Ok(()); } + if self.send_rdev(&key, true) { + return Ok(()); + } if self.send_pynput(&key, true) { return Ok(()); } @@ -449,6 +483,11 @@ impl KeyboardControllable for Enigo { if self.xdo.is_null() { return; } + // todo + let keyboard_mode = 1; + if keyboard_mode == 1 && self.send_rdev(&key, false) { + return; + } if self.send_pynput(&key, false) { return; } @@ -478,6 +517,21 @@ impl KeyboardControllable for Enigo { } } } + + 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) + } } static mut PYNPUT_EXIT: bool = false; @@ -492,7 +546,8 @@ fn start_pynput_service(rx: mpsc::Receiver<(PyMsg, bool)>) { py = "/usr/lib/rustdesk/pynput_service.py".to_owned(); if !std::path::Path::new(&py).exists() { // enigo libs, not rustdesk root project, so skip using appimage features - py = std::env::var("APPDIR").unwrap_or("".to_string()) + "/usr/lib/rustdesk/pynput_service.py"; + py = std::env::var("APPDIR").unwrap_or("".to_string()) + + "/usr/lib/rustdesk/pynput_service.py"; if !std::path::Path::new(&py).exists() { log::error!("{} not exists", py); } From 956cef4a1c6eac44a06500e268f30224448c9833 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 11 Jul 2022 08:14:57 -0700 Subject: [PATCH 004/113] refactor: Use new keyboard mode --- src/server/connection.rs | 3 ++- src/server/input_service.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index 304b20655..40b541c99 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -421,7 +421,8 @@ impl Connection { msg.down = true; } handle_key(&msg); - if press { + let keyboard_mode = 1; + if press && keyboard_mode != 1{ msg.down = false; handle_key(&msg); } diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 8c5f3060b..a8fd5fbbb 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -585,6 +585,19 @@ fn handle_key_(evt: &KeyEvent) { #[cfg(windows)] crate::platform::windows::try_change_desktop(); let mut en = ENIGO.lock().unwrap(); + let keyboard_mode = 1; + 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())); + } + } + return; + } // disable numlock if press home etc when numlock is on, // because we will get numpad value (7,8,9 etc) if not #[cfg(windows)] From 9837c9b89305b7ec924fd47003f29a40e906cda7 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 12 Jul 2022 00:33:20 -0700 Subject: [PATCH 005/113] Use map mode when keyboard monitor --- src/ui/remote.rs | 491 +++++++++++++++++++++++++++-------------------- 1 file changed, 283 insertions(+), 208 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index f85e37d04..0b73ee504 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -289,219 +289,294 @@ impl Handler { std::thread::spawn(move || { // This will block. std::env::set_var("KEYBOARD_ONLY", "y"); // pass to rdev - use rdev::{EventType::*, *}; - let func = move |evt: Event| { - if !IS_IN.load(Ordering::SeqCst) || !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst) - { - return; - } - let (key, down) = match evt.event_type { - KeyPress(k) => (k, 1), - KeyRelease(k) => (k, 0), - _ => return, - }; - let alt = get_key_state(enigo::Key::Alt); - #[cfg(windows)] - let ctrl = { - let mut tmp = get_key_state(enigo::Key::Control); - unsafe { - if IS_ALT_GR { - if alt || key == Key::AltGr { - if tmp { - tmp = false; - } - } else { - IS_ALT_GR = false; - } - } - } - tmp - }; - #[cfg(not(windows))] - let ctrl = get_key_state(enigo::Key::Control); - let shift = get_key_state(enigo::Key::Shift); - #[cfg(windows)] - let command = crate::platform::windows::get_win_key_state(); - #[cfg(not(windows))] - let command = get_key_state(enigo::Key::Meta); - let control_key = match key { - Key::Alt => Some(ControlKey::Alt), - Key::AltGr => Some(ControlKey::RAlt), - Key::Backspace => Some(ControlKey::Backspace), - Key::ControlLeft => { - // when pressing AltGr, an extra VK_LCONTROL with a special - // scancode with bit 9 set is sent, let's ignore this. - #[cfg(windows)] - if evt.scan_code & 0x200 != 0 { - unsafe { - IS_ALT_GR = true; - } - return; - } - Some(ControlKey::Control) - } - Key::ControlRight => Some(ControlKey::RControl), - Key::DownArrow => Some(ControlKey::DownArrow), - Key::Escape => Some(ControlKey::Escape), - Key::F1 => Some(ControlKey::F1), - Key::F10 => Some(ControlKey::F10), - Key::F11 => Some(ControlKey::F11), - Key::F12 => Some(ControlKey::F12), - Key::F2 => Some(ControlKey::F2), - Key::F3 => Some(ControlKey::F3), - Key::F4 => Some(ControlKey::F4), - Key::F5 => Some(ControlKey::F5), - Key::F6 => Some(ControlKey::F6), - Key::F7 => Some(ControlKey::F7), - Key::F8 => Some(ControlKey::F8), - Key::F9 => Some(ControlKey::F9), - Key::LeftArrow => Some(ControlKey::LeftArrow), - Key::MetaLeft => Some(ControlKey::Meta), - Key::MetaRight => Some(ControlKey::RWin), - Key::Return => Some(ControlKey::Return), - Key::RightArrow => Some(ControlKey::RightArrow), - Key::ShiftLeft => Some(ControlKey::Shift), - Key::ShiftRight => Some(ControlKey::RShift), - Key::Space => Some(ControlKey::Space), - Key::Tab => Some(ControlKey::Tab), - Key::UpArrow => Some(ControlKey::UpArrow), - Key::Delete => { - if is_win && ctrl && alt { - me.ctrl_alt_del(); - return; - } - Some(ControlKey::Delete) - } - Key::Apps => Some(ControlKey::Apps), - Key::Cancel => Some(ControlKey::Cancel), - Key::Clear => Some(ControlKey::Clear), - Key::Kana => Some(ControlKey::Kana), - Key::Hangul => Some(ControlKey::Hangul), - Key::Junja => Some(ControlKey::Junja), - Key::Final => Some(ControlKey::Final), - Key::Hanja => Some(ControlKey::Hanja), - Key::Hanji => Some(ControlKey::Hanja), - Key::Convert => Some(ControlKey::Convert), - Key::Print => Some(ControlKey::Print), - Key::Select => Some(ControlKey::Select), - Key::Execute => Some(ControlKey::Execute), - Key::PrintScreen => Some(ControlKey::Snapshot), - Key::Help => Some(ControlKey::Help), - Key::Sleep => Some(ControlKey::Sleep), - Key::Separator => Some(ControlKey::Separator), - Key::KpReturn => Some(ControlKey::NumpadEnter), - Key::Kp0 => Some(ControlKey::Numpad0), - Key::Kp1 => Some(ControlKey::Numpad1), - Key::Kp2 => Some(ControlKey::Numpad2), - Key::Kp3 => Some(ControlKey::Numpad3), - Key::Kp4 => Some(ControlKey::Numpad4), - Key::Kp5 => Some(ControlKey::Numpad5), - Key::Kp6 => Some(ControlKey::Numpad6), - Key::Kp7 => Some(ControlKey::Numpad7), - Key::Kp8 => Some(ControlKey::Numpad8), - Key::Kp9 => Some(ControlKey::Numpad9), - Key::KpDivide => Some(ControlKey::Divide), - Key::KpMultiply => Some(ControlKey::Multiply), - Key::KpDecimal => Some(ControlKey::Decimal), - Key::KpMinus => Some(ControlKey::Subtract), - Key::KpPlus => Some(ControlKey::Add), - Key::CapsLock | Key::NumLock | Key::ScrollLock => { - return; - } - Key::Home => Some(ControlKey::Home), - Key::End => Some(ControlKey::End), - Key::Insert => Some(ControlKey::Insert), - Key::PageUp => Some(ControlKey::PageUp), - Key::PageDown => Some(ControlKey::PageDown), - Key::Pause => Some(ControlKey::Pause), - _ => None, - }; - let mut key_event = KeyEvent::new(); - if let Some(k) = control_key { - key_event.set_control_key(k); - } else { - let mut chr = match evt.name { - Some(ref s) => { - if s.len() <= 2 { - // exclude chinese characters - s.chars().next().unwrap_or('\0') - } else { - '\0' - } - } - _ => '\0', + let keyboard_mode = 1; + if keyboard_mode == 1 { + use rdev::{Event, EventType::*, Key as RdevKey}; + lazy_static::lazy_static! { + static ref MUTEX_SPECIAL_KEYS: Mutex> = { + let mut m = HashMap::new(); + // m.insert(RdevKey::PrintScreen, false); // TODO + m.insert(RdevKey::ShiftLeft, false); + m.insert(RdevKey::ShiftRight, false); + m.insert(RdevKey::ControlLeft, false); + m.insert(RdevKey::ControlRight, false); + m.insert(RdevKey::Alt, false); + m.insert(RdevKey::AltGr, false); + Mutex::new(m) }; - if chr == '·' { - // special for Chinese - chr = '`'; - } - if chr == '\0' { - chr = match key { - Key::Num1 => '1', - Key::Num2 => '2', - Key::Num3 => '3', - Key::Num4 => '4', - Key::Num5 => '5', - Key::Num6 => '6', - Key::Num7 => '7', - Key::Num8 => '8', - Key::Num9 => '9', - Key::Num0 => '0', - Key::KeyA => 'a', - Key::KeyB => 'b', - Key::KeyC => 'c', - Key::KeyD => 'd', - Key::KeyE => 'e', - Key::KeyF => 'f', - Key::KeyG => 'g', - Key::KeyH => 'h', - Key::KeyI => 'i', - Key::KeyJ => 'j', - Key::KeyK => 'k', - Key::KeyL => 'l', - Key::KeyM => 'm', - Key::KeyN => 'n', - Key::KeyO => 'o', - Key::KeyP => 'p', - Key::KeyQ => 'q', - Key::KeyR => 'r', - Key::KeyS => 's', - Key::KeyT => 't', - Key::KeyU => 'u', - Key::KeyV => 'v', - Key::KeyW => 'w', - Key::KeyX => 'x', - Key::KeyY => 'y', - Key::KeyZ => 'z', - Key::Comma => ',', - Key::Dot => '.', - Key::SemiColon => ';', - Key::Quote => '\'', - Key::LeftBracket => '[', - Key::RightBracket => ']', - Key::BackSlash => '\\', - Key::Minus => '-', - Key::Equal => '=', - Key::BackQuote => '`', - _ => '\0', - } - } - if chr != '\0' { - if chr == 'l' && is_win && command { - me.lock_screen(); - return; - } - key_event.set_chr(chr as _); - } else { - log::error!("Unknown key {:?}", evt); + } + // todo: auto change paltform + let func = move |evt: Event| { + if !IS_IN.load(Ordering::SeqCst) + || !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst) + { return; } + let (key, down) = match evt.event_type { + KeyPress(k) => { + // keyboard long press + if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) { + if *MUTEX_SPECIAL_KEYS.lock().unwrap().get(&k).unwrap() { + return; + } + MUTEX_SPECIAL_KEYS.lock().unwrap().insert(k, true); + } + println!("keydown {:?} {:?} {:?}", k, evt.code, evt.scan_code); + (k, 1) + } + KeyRelease(k) => { + // keyboard long press + 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, + }; + + // todo: clear key + #[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" { + let keycode: u32 = rdev::linux_keycode_from_key(key).unwrap().into(); + key_event.set_chr(keycode); + } else if peer == "Windows" { + let keycode: u32 = rdev::win_keycode_from_key(key).unwrap().into(); + key_event.set_chr(keycode); + } else if peer == "Mac OS" { + let keycode: u32 = rdev::macos_keycode_from_key(key).unwrap().into(); + key_event.set_chr(keycode); + } + me.key_down_or_up(down, key_event, false, false, false, false); + }; + if let Err(error) = rdev::listen(func) { + log::error!("rdev: {:?}", error); + } + } else { + use rdev::{EventType::*, *}; + let func = move |evt: Event| { + if !IS_IN.load(Ordering::SeqCst) + || !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst) + { + return; + } + let (key, down) = match evt.event_type { + KeyPress(k) => (k, 1), + KeyRelease(k) => (k, 0), + _ => return, + }; + let alt = get_key_state(enigo::Key::Alt); + #[cfg(windows)] + let ctrl = { + let mut tmp = get_key_state(enigo::Key::Control); + unsafe { + if IS_ALT_GR { + if alt || key == Key::AltGr { + if tmp { + tmp = false; + } + } else { + IS_ALT_GR = false; + } + } + } + tmp + }; + #[cfg(not(windows))] + let ctrl = get_key_state(enigo::Key::Control); + let shift = get_key_state(enigo::Key::Shift); + #[cfg(windows)] + let command = crate::platform::windows::get_win_key_state(); + #[cfg(not(windows))] + let command = get_key_state(enigo::Key::Meta); + let control_key = match key { + Key::Alt => Some(ControlKey::Alt), + Key::AltGr => Some(ControlKey::RAlt), + Key::Backspace => Some(ControlKey::Backspace), + Key::ControlLeft => { + // when pressing AltGr, an extra VK_LCONTROL with a special + // scancode with bit 9 set is sent, let's ignore this. + #[cfg(windows)] + if evt.scan_code & 0x200 != 0 { + unsafe { + IS_ALT_GR = true; + } + return; + } + Some(ControlKey::Control) + } + Key::ControlRight => Some(ControlKey::RControl), + Key::DownArrow => Some(ControlKey::DownArrow), + Key::Escape => Some(ControlKey::Escape), + Key::F1 => Some(ControlKey::F1), + Key::F10 => Some(ControlKey::F10), + Key::F11 => Some(ControlKey::F11), + Key::F12 => Some(ControlKey::F12), + Key::F2 => Some(ControlKey::F2), + Key::F3 => Some(ControlKey::F3), + Key::F4 => Some(ControlKey::F4), + Key::F5 => Some(ControlKey::F5), + Key::F6 => Some(ControlKey::F6), + Key::F7 => Some(ControlKey::F7), + Key::F8 => Some(ControlKey::F8), + Key::F9 => Some(ControlKey::F9), + Key::LeftArrow => Some(ControlKey::LeftArrow), + Key::MetaLeft => Some(ControlKey::Meta), + Key::MetaRight => Some(ControlKey::RWin), + Key::Return => Some(ControlKey::Return), + Key::RightArrow => Some(ControlKey::RightArrow), + Key::ShiftLeft => Some(ControlKey::Shift), + Key::ShiftRight => Some(ControlKey::RShift), + Key::Space => Some(ControlKey::Space), + Key::Tab => Some(ControlKey::Tab), + Key::UpArrow => Some(ControlKey::UpArrow), + Key::Delete => { + if is_win && ctrl && alt { + me.ctrl_alt_del(); + return; + } + Some(ControlKey::Delete) + } + Key::Apps => Some(ControlKey::Apps), + Key::Cancel => Some(ControlKey::Cancel), + Key::Clear => Some(ControlKey::Clear), + Key::Kana => Some(ControlKey::Kana), + Key::Hangul => Some(ControlKey::Hangul), + Key::Junja => Some(ControlKey::Junja), + Key::Final => Some(ControlKey::Final), + Key::Hanja => Some(ControlKey::Hanja), + Key::Hanji => Some(ControlKey::Hanja), + Key::Convert => Some(ControlKey::Convert), + Key::Print => Some(ControlKey::Print), + Key::Select => Some(ControlKey::Select), + Key::Execute => Some(ControlKey::Execute), + Key::PrintScreen => Some(ControlKey::Snapshot), + Key::Help => Some(ControlKey::Help), + Key::Sleep => Some(ControlKey::Sleep), + Key::Separator => Some(ControlKey::Separator), + Key::KpReturn => Some(ControlKey::NumpadEnter), + Key::Kp0 => Some(ControlKey::Numpad0), + Key::Kp1 => Some(ControlKey::Numpad1), + Key::Kp2 => Some(ControlKey::Numpad2), + Key::Kp3 => Some(ControlKey::Numpad3), + Key::Kp4 => Some(ControlKey::Numpad4), + Key::Kp5 => Some(ControlKey::Numpad5), + Key::Kp6 => Some(ControlKey::Numpad6), + Key::Kp7 => Some(ControlKey::Numpad7), + Key::Kp8 => Some(ControlKey::Numpad8), + Key::Kp9 => Some(ControlKey::Numpad9), + Key::KpDivide => Some(ControlKey::Divide), + Key::KpMultiply => Some(ControlKey::Multiply), + Key::KpDecimal => Some(ControlKey::Decimal), + Key::KpMinus => Some(ControlKey::Subtract), + Key::KpPlus => Some(ControlKey::Add), + Key::CapsLock | Key::NumLock | Key::ScrollLock => { + return; + } + Key::Home => Some(ControlKey::Home), + Key::End => Some(ControlKey::End), + Key::Insert => Some(ControlKey::Insert), + Key::PageUp => Some(ControlKey::PageUp), + Key::PageDown => Some(ControlKey::PageDown), + Key::Pause => Some(ControlKey::Pause), + _ => None, + }; + let mut key_event = KeyEvent::new(); + if let Some(k) = control_key { + key_event.set_control_key(k); + } else { + let mut chr = match evt.name { + Some(ref s) => { + if s.len() <= 2 { + // exclude chinese characters + s.chars().next().unwrap_or('\0') + } else { + '\0' + } + } + _ => '\0', + }; + if chr == '·' { + // special for Chinese + chr = '`'; + } + if chr == '\0' { + chr = match key { + Key::Num1 => '1', + Key::Num2 => '2', + Key::Num3 => '3', + Key::Num4 => '4', + Key::Num5 => '5', + Key::Num6 => '6', + Key::Num7 => '7', + Key::Num8 => '8', + Key::Num9 => '9', + Key::Num0 => '0', + Key::KeyA => 'a', + Key::KeyB => 'b', + Key::KeyC => 'c', + Key::KeyD => 'd', + Key::KeyE => 'e', + Key::KeyF => 'f', + Key::KeyG => 'g', + Key::KeyH => 'h', + Key::KeyI => 'i', + Key::KeyJ => 'j', + Key::KeyK => 'k', + Key::KeyL => 'l', + Key::KeyM => 'm', + Key::KeyN => 'n', + Key::KeyO => 'o', + Key::KeyP => 'p', + Key::KeyQ => 'q', + Key::KeyR => 'r', + Key::KeyS => 's', + Key::KeyT => 't', + Key::KeyU => 'u', + Key::KeyV => 'v', + Key::KeyW => 'w', + Key::KeyX => 'x', + Key::KeyY => 'y', + Key::KeyZ => 'z', + Key::Comma => ',', + Key::Dot => '.', + Key::SemiColon => ';', + Key::Quote => '\'', + Key::LeftBracket => '[', + Key::RightBracket => ']', + Key::BackSlash => '\\', + Key::Minus => '-', + Key::Equal => '=', + Key::BackQuote => '`', + _ => '\0', + } + } + if chr != '\0' { + if chr == 'l' && is_win && command { + me.lock_screen(); + return; + } + key_event.set_chr(chr as _); + } else { + log::error!("Unknown key {:?}", evt); + return; + } + } + me.key_down_or_up(down, key_event, alt, ctrl, shift, command); + }; + if let Err(error) = rdev::listen(func) { + log::error!("rdev: {:?}", error); } - me.key_down_or_up(down, key_event, alt, ctrl, shift, command); }; - if let Err(error) = rdev::listen(func) { - log::error!("rdev: {:?}", error); - } }); } From 1cc6c7e167f2f9ce9b86879fabea47071325dd24 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 12 Jul 2022 04:27:27 -0700 Subject: [PATCH 006/113] Use map mode when Windows are simulated --- libs/enigo/src/win/win_impl.rs | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/libs/enigo/src/win/win_impl.rs b/libs/enigo/src/win/win_impl.rs index ea1543faa..d0d97ecee 100644 --- a/libs/enigo/src/win/win_impl.rs +++ b/libs/enigo/src/win/win_impl.rs @@ -1,9 +1,9 @@ -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 rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; +use winapi; use crate::win::keycodes::*; use crate::{Key, KeyboardControllable, MouseButton, MouseControllable}; @@ -198,9 +198,14 @@ impl KeyboardControllable for Enigo { } fn key_down(&mut self, key: Key) -> crate::ResultType { + let keyboard_mode = 1; + if keyboard_mode == 1 { + self.send_rdev(&key, true); + return Ok(()); + }; 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 { @@ -213,6 +218,11 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { + let keyboard_mode = 1; + if keyboard_mode == 1 { + self.send_rdev(&key, false); + return; + }; keybd_event(KEYEVENTF_KEYUP, self.key_to_keycode(key), 0); } @@ -227,7 +237,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 /// @@ -272,6 +283,29 @@ impl Enigo { keybd_event(KEYEVENTF_UNICODE | KEYEVENTF_KEYUP, 0, unicode_char); } + 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 + true => Box::leak(Box::new(EventType::KeyPress(RdevKey::Unknown( + (*keycode).into(), + )))), + false => Box::leak(Box::new(EventType::KeyRelease(RdevKey::Unknown( + (*keycode).into(), + )))), + }; + + match simulate(event_type) { + Ok(()) => true, + Err(SimulateError) => false, + } + } else { + false + } + } + fn key_to_keycode(&self, key: Key) -> u16 { unsafe { LAYOUT = std::ptr::null_mut(); From a6f9c16d50eae2b3978c169ebc448181ed21aecc Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 12 Jul 2022 04:29:32 -0700 Subject: [PATCH 007/113] fix: Correct the string corresponding to the platform --- src/ui/remote.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 0b73ee504..5bef6579c 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -346,7 +346,7 @@ impl Handler { let mut key_event = KeyEvent::new(); // According to peer platform. - if peer == "linux" { + if peer == "Linux" { let keycode: u32 = rdev::linux_keycode_from_key(key).unwrap().into(); key_event.set_chr(keycode); } else if peer == "Windows" { From 7395f1a7557a123269b028cd7800d84069e0d693 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 12 Jul 2022 04:40:38 -0700 Subject: [PATCH 008/113] ci: Change source of lib --- Cargo.lock | 30 +++++++++++++++++++++++++----- Cargo.toml | 2 +- libs/enigo/Cargo.toml | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17832eb8b..6f3895c1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,13 +1317,33 @@ dependencies = [ "log", "objc", "pkg-config", - "rdev 0.5.1", + "rdev 0.5.0 (git+https://github.com/asur4s/rdev)", "serde 1.0.137", "serde_derive", "unicode-segmentation", "winapi 0.3.9", ] +[[package]] +name = "enum-map" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ddfe61e8040145222887d0d32a939c70c8cae681490d72fb868305e9b40ced8" +dependencies = [ + "enum-map-derive", +] + +[[package]] +name = "enum-map-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d1c54e25a57236a790ecf051c2befbb57740c9b86c4273eac378ba84d620d6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "enum_dispatch" version = "0.3.8" @@ -3838,12 +3858,12 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0" -source = "git+https://github.com/open-trade/rdev#fbbefd0b5d87095a7349965aec9ecd33de7035ac" dependencies = [ "cocoa 0.22.0", "core-foundation 0.7.0", "core-foundation-sys 0.7.0", "core-graphics 0.19.2", + "enum-map", "lazy_static", "libc", "winapi 0.3.9", @@ -3852,14 +3872,14 @@ dependencies = [ [[package]] name = "rdev" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7336f02e29f34e9a7186ccf87051f6a5697536195569012e076e18a4efddcede" +version = "0.5.0" +source = "git+https://github.com/asur4s/rdev#83d998895677129f0ba8fc2ada4cddd1e0df418f" dependencies = [ "cocoa 0.22.0", "core-foundation 0.7.0", "core-foundation-sys 0.7.0", "core-graphics 0.19.2", + "enum-map", "lazy_static", "libc", "winapi 0.3.9", diff --git a/Cargo.toml b/Cargo.toml index f270f7b30..39789c772 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ sciter-rs = { git = "https://github.com/open-trade/rust-sciter", branch = "dyn" sys-locale = "0.2" enigo = { path = "libs/enigo" } clipboard = { path = "libs/clipboard" } -rdev = { git = "https://github.com/open-trade/rdev" } +rdev = { path = "../rdev" } ctrlc = "3.2" arboard = "2.0" #minreq = { version = "2.4", features = ["punycode", "https-native"] } diff --git a/libs/enigo/Cargo.toml b/libs/enigo/Cargo.toml index 29d7ee87f..b1c57ca92 100644 --- a/libs/enigo/Cargo.toml +++ b/libs/enigo/Cargo.toml @@ -22,7 +22,7 @@ appveyor = { repository = "pythoneer/enigo-85xiy" } serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } log = "0.4.17" -rdev = "0.5.1" +rdev = { git = "https://github.com/asur4s/rdev" } [features] with_serde = ["serde", "serde_derive"] From fa8595b77d5a22f3213937cb7efbad6a0c1146ce Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 12 Jul 2022 08:36:45 -0700 Subject: [PATCH 009/113] Supports Mac OS simulate input by scancode --- Cargo.lock | 21 +++--------------- Cargo.toml | 2 +- libs/enigo/src/macos/macos_impl.rs | 35 +++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f3895c1c..f2db3ff15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,7 +1317,7 @@ dependencies = [ "log", "objc", "pkg-config", - "rdev 0.5.0 (git+https://github.com/asur4s/rdev)", + "rdev", "serde 1.0.137", "serde_derive", "unicode-segmentation", @@ -3858,22 +3858,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0" -dependencies = [ - "cocoa 0.22.0", - "core-foundation 0.7.0", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", - "enum-map", - "lazy_static", - "libc", - "winapi 0.3.9", - "x11", -] - -[[package]] -name = "rdev" -version = "0.5.0" -source = "git+https://github.com/asur4s/rdev#83d998895677129f0ba8fc2ada4cddd1e0df418f" +source = "git+https://github.com/asur4s/rdev#e0ed6e08b7fb7e8ac80b2ef6e710ba1db9fe0751" dependencies = [ "cocoa 0.22.0", "core-foundation 0.7.0", @@ -4126,7 +4111,7 @@ dependencies = [ "num_cpus", "objc", "parity-tokio-ipc", - "rdev 0.5.0", + "rdev", "repng", "reqwest", "rpassword 6.0.1", diff --git a/Cargo.toml b/Cargo.toml index 39789c772..264c82940 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ sciter-rs = { git = "https://github.com/open-trade/rust-sciter", branch = "dyn" sys-locale = "0.2" enigo = { path = "libs/enigo" } clipboard = { path = "libs/clipboard" } -rdev = { path = "../rdev" } +rdev = { git = "https://github.com/asur4s/rdev" } ctrlc = "3.2" arboard = "2.0" #minreq = { version = "2.4", features = ["punycode", "https-native"] } diff --git a/libs/enigo/src/macos/macos_impl.rs b/libs/enigo/src/macos/macos_impl.rs index 28c9362ed..6cae30984 100644 --- a/libs/enigo/src/macos/macos_impl.rs +++ b/libs/enigo/src/macos/macos_impl.rs @@ -1,5 +1,5 @@ use core_graphics; - +use rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; // TODO(dustin): use only the things i need use self::core_graphics::display::*; @@ -354,6 +354,11 @@ impl KeyboardControllable for Enigo { } fn key_down(&mut self, key: Key) -> crate::ResultType { + let keyboard_mode = 1; + if keyboard_mode == 1 { + self.send_rdev(&key, true); + return Ok(()); + }; let code = self.key_to_keycode(key); if code == u16::MAX { return Err("".into()); @@ -369,6 +374,11 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { + let keyboard_mode = 1; + if keyboard_mode == 1 { + self.send_rdev(&key, true); + return Ok(()); + }; if let Some(src) = self.event_source.as_ref() { if let Ok(event) = CGEvent::new_keyboard_event(src.clone(), self.key_to_keycode(key), false) @@ -421,6 +431,29 @@ impl Enigo { (x, (display_height as i32) - y_inv) } + 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 + true => Box::leak(Box::new(EventType::KeyPress(RdevKey::Unknown( + (*keycode).into(), + )))), + false => Box::leak(Box::new(EventType::KeyRelease(RdevKey::Unknown( + (*keycode).into(), + )))), + }; + + match simulate(event_type) { + Ok(()) => true, + Err(SimulateError) => false, + } + } else { + false + } + } + fn key_to_keycode(&mut self, key: Key) -> CGKeyCode { #[allow(deprecated)] // I mean duh, we still need to support deprecated keys until they're removed From 7b3b9007647ccd1b3ed4aefc9ca21c0368ba036d Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 12 Jul 2022 18:56:08 -0700 Subject: [PATCH 010/113] Update rdev dependency version --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f2db3ff15..056c14ae7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3857,8 +3857,8 @@ dependencies = [ [[package]] name = "rdev" -version = "0.5.0" -source = "git+https://github.com/asur4s/rdev#e0ed6e08b7fb7e8ac80b2ef6e710ba1db9fe0751" +version = "0.5.0-2" +source = "git+https://github.com/asur4s/rdev#95cecfd1b0f0b20c6cd728afca859107b911f3b8" dependencies = [ "cocoa 0.22.0", "core-foundation 0.7.0", From 7fe2609ffb4598d4bc666af0395fc89a7bf3eaba Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 13 Jul 2022 02:14:32 -0700 Subject: [PATCH 011/113] feat: Support new keyboard mode --- libs/enigo/src/linux.rs | 3 --- libs/enigo/src/macos/macos_impl.rs | 2 -- libs/enigo/src/win/win_impl.rs | 2 -- src/server/input_service.rs | 2 -- src/ui/remote.rs | 7 ------- 5 files changed, 16 deletions(-) diff --git a/libs/enigo/src/linux.rs b/libs/enigo/src/linux.rs index ee27e06cf..7f2afc3dc 100644 --- a/libs/enigo/src/linux.rs +++ b/libs/enigo/src/linux.rs @@ -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)) diff --git a/libs/enigo/src/macos/macos_impl.rs b/libs/enigo/src/macos/macos_impl.rs index 6cae30984..df494b9cb 100644 --- a/libs/enigo/src/macos/macos_impl.rs +++ b/libs/enigo/src/macos/macos_impl.rs @@ -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 diff --git a/libs/enigo/src/win/win_impl.rs b/libs/enigo/src/win/win_impl.rs index d0d97ecee..0967d07c9 100644 --- a/libs/enigo/src/win/win_impl.rs +++ b/libs/enigo/src/win/win_impl.rs @@ -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 diff --git a/src/server/input_service.rs b/src/server/input_service.rs index a8fd5fbbb..8e8e2abb4 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -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())); } } diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 5bef6579c..cc2ce8154 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -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" { From 7c24f6bb12964df3d152b2518fb299fe85d0233c Mon Sep 17 00:00:00 2001 From: Asura Date: Sun, 17 Jul 2022 14:14:51 -0700 Subject: [PATCH 012/113] Refactor listening keyboard to support switching keyboard modes --- libs/enigo/src/win/win_impl.rs | 2 +- libs/hbb_common/protos/message.proto | 1 + src/ui/remote.rs | 600 ++++++++++++++------------- 3 files changed, 306 insertions(+), 297 deletions(-) diff --git a/libs/enigo/src/win/win_impl.rs b/libs/enigo/src/win/win_impl.rs index 0967d07c9..b8f3d0fa3 100644 --- a/libs/enigo/src/win/win_impl.rs +++ b/libs/enigo/src/win/win_impl.rs @@ -2,7 +2,7 @@ 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 rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; +use rdev::{simulate, EventType, Key as RdevKey, SimulateError}; use winapi; use crate::win::keycodes::*; diff --git a/libs/hbb_common/protos/message.proto b/libs/hbb_common/protos/message.proto index 0538f1aef..645930eb4 100644 --- a/libs/hbb_common/protos/message.proto +++ b/libs/hbb_common/protos/message.proto @@ -190,6 +190,7 @@ message KeyEvent { string seq = 6; } repeated ControlKey modifiers = 8; + uint32 mode = 9; } message CursorData { diff --git a/src/ui/remote.rs b/src/ui/remote.rs index cc2ce8154..8ebced2c4 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -43,6 +43,7 @@ use hbb_common::{ Stream, }; use hbb_common::{config::TransferSerde, fs::TransferJobMeta}; +use rdev::{Event, EventType::*, Key as RdevKey}; #[cfg(windows)] use crate::clipboard_file::*; @@ -288,288 +289,54 @@ impl Handler { crate::platform::windows::enable_lowlevel_keyboard(std::ptr::null_mut() as _); std::thread::spawn(move || { // This will block. - std::env::set_var("KEYBOARD_ONLY", "y"); // pass to rdev - let keyboard_mode = 1; - if keyboard_mode == 1 { - use rdev::{Event, EventType::*, Key as RdevKey}; - lazy_static::lazy_static! { - static ref MUTEX_SPECIAL_KEYS: Mutex> = { - let mut m = HashMap::new(); - // m.insert(RdevKey::PrintScreen, false); // TODO - m.insert(RdevKey::ShiftLeft, false); - m.insert(RdevKey::ShiftRight, false); - m.insert(RdevKey::ControlLeft, false); - m.insert(RdevKey::ControlRight, false); - m.insert(RdevKey::Alt, false); - m.insert(RdevKey::AltGr, false); - Mutex::new(m) - }; - } - // todo: auto change paltform - let func = move |evt: Event| { - if !IS_IN.load(Ordering::SeqCst) - || !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst) - { - return; - } - let (key, down) = match evt.event_type { - KeyPress(k) => { - // keyboard long press - if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) { - if *MUTEX_SPECIAL_KEYS.lock().unwrap().get(&k).unwrap() { - return; - } - MUTEX_SPECIAL_KEYS.lock().unwrap().insert(k, true); - } - (k, 1) - } - KeyRelease(k) => { - // keyboard long press - if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) { - MUTEX_SPECIAL_KEYS.lock().unwrap().insert(k, false); - } - (k, 0) - } - _ => return, - }; - - // todo: clear key - #[cfg(target_os = "windows")] - let key = rdev::get_win_key(evt.code.into(), evt.scan_code); - - let mut key_event = KeyEvent::new(); - // According to peer platform. - if peer == "Linux" { - let keycode: u32 = rdev::linux_keycode_from_key(key).unwrap().into(); - key_event.set_chr(keycode); - } else if peer == "Windows" { - let keycode: u32 = rdev::win_keycode_from_key(key).unwrap().into(); - key_event.set_chr(keycode); - } else if peer == "Mac OS" { - let keycode: u32 = rdev::macos_keycode_from_key(key).unwrap().into(); - key_event.set_chr(keycode); - } - me.key_down_or_up(down, key_event, false, false, false, false); + std::env::set_var("KEYBOARD_ONLY", "y"); + lazy_static::lazy_static! { + static ref MUTEX_SPECIAL_KEYS: Mutex> = { + let mut m = HashMap::new(); + m.insert(RdevKey::ShiftLeft, false); + m.insert(RdevKey::ShiftRight, false); + m.insert(RdevKey::ControlLeft, false); + m.insert(RdevKey::ControlRight, false); + m.insert(RdevKey::Alt, false); + m.insert(RdevKey::AltGr, false); + Mutex::new(m) }; - if let Err(error) = rdev::listen(func) { - log::error!("rdev: {:?}", error); + } + + let func = move |evt: Event| { + if !IS_IN.load(Ordering::SeqCst) || !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst) + { + return; } - } else { - use rdev::{EventType::*, *}; - let func = move |evt: Event| { - if !IS_IN.load(Ordering::SeqCst) - || !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst) - { - return; + let (key, down) = match evt.event_type { + KeyPress(k) => { + // keyboard long press + if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) { + if *MUTEX_SPECIAL_KEYS.lock().unwrap().get(&k).unwrap() { + return; + } + MUTEX_SPECIAL_KEYS.lock().unwrap().insert(k, true); + } + (k, true) } - let (key, down) = match evt.event_type { - KeyPress(k) => (k, 1), - KeyRelease(k) => (k, 0), - _ => return, - }; - let alt = get_key_state(enigo::Key::Alt); - #[cfg(windows)] - let ctrl = { - let mut tmp = get_key_state(enigo::Key::Control); - unsafe { - if IS_ALT_GR { - if alt || key == Key::AltGr { - if tmp { - tmp = false; - } - } else { - IS_ALT_GR = false; - } - } - } - tmp - }; - #[cfg(not(windows))] - let ctrl = get_key_state(enigo::Key::Control); - let shift = get_key_state(enigo::Key::Shift); - #[cfg(windows)] - let command = crate::platform::windows::get_win_key_state(); - #[cfg(not(windows))] - let command = get_key_state(enigo::Key::Meta); - let control_key = match key { - Key::Alt => Some(ControlKey::Alt), - Key::AltGr => Some(ControlKey::RAlt), - Key::Backspace => Some(ControlKey::Backspace), - Key::ControlLeft => { - // when pressing AltGr, an extra VK_LCONTROL with a special - // scancode with bit 9 set is sent, let's ignore this. - #[cfg(windows)] - if evt.scan_code & 0x200 != 0 { - unsafe { - IS_ALT_GR = true; - } - return; - } - Some(ControlKey::Control) - } - Key::ControlRight => Some(ControlKey::RControl), - Key::DownArrow => Some(ControlKey::DownArrow), - Key::Escape => Some(ControlKey::Escape), - Key::F1 => Some(ControlKey::F1), - Key::F10 => Some(ControlKey::F10), - Key::F11 => Some(ControlKey::F11), - Key::F12 => Some(ControlKey::F12), - Key::F2 => Some(ControlKey::F2), - Key::F3 => Some(ControlKey::F3), - Key::F4 => Some(ControlKey::F4), - Key::F5 => Some(ControlKey::F5), - Key::F6 => Some(ControlKey::F6), - Key::F7 => Some(ControlKey::F7), - Key::F8 => Some(ControlKey::F8), - Key::F9 => Some(ControlKey::F9), - Key::LeftArrow => Some(ControlKey::LeftArrow), - Key::MetaLeft => Some(ControlKey::Meta), - Key::MetaRight => Some(ControlKey::RWin), - Key::Return => Some(ControlKey::Return), - Key::RightArrow => Some(ControlKey::RightArrow), - Key::ShiftLeft => Some(ControlKey::Shift), - Key::ShiftRight => Some(ControlKey::RShift), - Key::Space => Some(ControlKey::Space), - Key::Tab => Some(ControlKey::Tab), - Key::UpArrow => Some(ControlKey::UpArrow), - Key::Delete => { - if is_win && ctrl && alt { - me.ctrl_alt_del(); - return; - } - Some(ControlKey::Delete) - } - Key::Apps => Some(ControlKey::Apps), - Key::Cancel => Some(ControlKey::Cancel), - Key::Clear => Some(ControlKey::Clear), - Key::Kana => Some(ControlKey::Kana), - Key::Hangul => Some(ControlKey::Hangul), - Key::Junja => Some(ControlKey::Junja), - Key::Final => Some(ControlKey::Final), - Key::Hanja => Some(ControlKey::Hanja), - Key::Hanji => Some(ControlKey::Hanja), - Key::Convert => Some(ControlKey::Convert), - Key::Print => Some(ControlKey::Print), - Key::Select => Some(ControlKey::Select), - Key::Execute => Some(ControlKey::Execute), - Key::PrintScreen => Some(ControlKey::Snapshot), - Key::Help => Some(ControlKey::Help), - Key::Sleep => Some(ControlKey::Sleep), - Key::Separator => Some(ControlKey::Separator), - Key::KpReturn => Some(ControlKey::NumpadEnter), - Key::Kp0 => Some(ControlKey::Numpad0), - Key::Kp1 => Some(ControlKey::Numpad1), - Key::Kp2 => Some(ControlKey::Numpad2), - Key::Kp3 => Some(ControlKey::Numpad3), - Key::Kp4 => Some(ControlKey::Numpad4), - Key::Kp5 => Some(ControlKey::Numpad5), - Key::Kp6 => Some(ControlKey::Numpad6), - Key::Kp7 => Some(ControlKey::Numpad7), - Key::Kp8 => Some(ControlKey::Numpad8), - Key::Kp9 => Some(ControlKey::Numpad9), - Key::KpDivide => Some(ControlKey::Divide), - Key::KpMultiply => Some(ControlKey::Multiply), - Key::KpDecimal => Some(ControlKey::Decimal), - Key::KpMinus => Some(ControlKey::Subtract), - Key::KpPlus => Some(ControlKey::Add), - Key::CapsLock | Key::NumLock | Key::ScrollLock => { - return; - } - Key::Home => Some(ControlKey::Home), - Key::End => Some(ControlKey::End), - Key::Insert => Some(ControlKey::Insert), - Key::PageUp => Some(ControlKey::PageUp), - Key::PageDown => Some(ControlKey::PageDown), - Key::Pause => Some(ControlKey::Pause), - _ => None, - }; - let mut key_event = KeyEvent::new(); - if let Some(k) = control_key { - key_event.set_control_key(k); - } else { - let mut chr = match evt.name { - Some(ref s) => { - if s.len() <= 2 { - // exclude chinese characters - s.chars().next().unwrap_or('\0') - } else { - '\0' - } - } - _ => '\0', - }; - if chr == '·' { - // special for Chinese - chr = '`'; - } - if chr == '\0' { - chr = match key { - Key::Num1 => '1', - Key::Num2 => '2', - Key::Num3 => '3', - Key::Num4 => '4', - Key::Num5 => '5', - Key::Num6 => '6', - Key::Num7 => '7', - Key::Num8 => '8', - Key::Num9 => '9', - Key::Num0 => '0', - Key::KeyA => 'a', - Key::KeyB => 'b', - Key::KeyC => 'c', - Key::KeyD => 'd', - Key::KeyE => 'e', - Key::KeyF => 'f', - Key::KeyG => 'g', - Key::KeyH => 'h', - Key::KeyI => 'i', - Key::KeyJ => 'j', - Key::KeyK => 'k', - Key::KeyL => 'l', - Key::KeyM => 'm', - Key::KeyN => 'n', - Key::KeyO => 'o', - Key::KeyP => 'p', - Key::KeyQ => 'q', - Key::KeyR => 'r', - Key::KeyS => 's', - Key::KeyT => 't', - Key::KeyU => 'u', - Key::KeyV => 'v', - Key::KeyW => 'w', - Key::KeyX => 'x', - Key::KeyY => 'y', - Key::KeyZ => 'z', - Key::Comma => ',', - Key::Dot => '.', - Key::SemiColon => ';', - Key::Quote => '\'', - Key::LeftBracket => '[', - Key::RightBracket => ']', - Key::BackSlash => '\\', - Key::Minus => '-', - Key::Equal => '=', - Key::BackQuote => '`', - _ => '\0', - } - } - if chr != '\0' { - if chr == 'l' && is_win && command { - me.lock_screen(); - return; - } - key_event.set_chr(chr as _); - } else { - log::error!("Unknown key {:?}", evt); - return; + KeyRelease(k) => { + // keyboard long press + if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) { + MUTEX_SPECIAL_KEYS.lock().unwrap().insert(k, false); } + (k, false) } - me.key_down_or_up(down, key_event, alt, ctrl, shift, command); + _ => return, }; - if let Err(error) = rdev::listen(func) { - log::error!("rdev: {:?}", error); - } + + #[cfg(target_os = "windows")] + let key = rdev::get_win_key(evt.code.into(), evt.scan_code); + + me.key_down_or_up(down, key, evt); }; + if let Err(error) = rdev::listen(func) { + log::error!("rdev: {:?}", error); + } }); } @@ -1150,18 +917,19 @@ impl Handler { if self.peer_platform() == "Windows" { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::CtrlAltDel); - self.key_down_or_up(1, key_event, false, false, false, false); + // todo + self.send_key_event(key_event, 2); } else { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::Delete); - self.key_down_or_up(3, key_event, true, true, false, false); + // self.key_down_or_up(3, key_event, true, true, false, false); } } fn lock_screen(&mut self) { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::LockScreen); - self.key_down_or_up(1, key_event, false, false, false, false); + // self.key_down_or_up(1, key_event, false, false, false, false); } fn transfer_file(&mut self) { @@ -1180,16 +948,246 @@ impl Handler { } } - fn key_down_or_up( - &mut self, - down_or_up: i32, - evt: KeyEvent, - alt: bool, - ctrl: bool, - shift: bool, - command: bool, - ) { - let mut key_event = evt; + fn send_key_event(&mut self, mut evt: KeyEvent, keyboard_mode: u32) { + // mode: map(1), translate(2), legacy(3), auto(4) + evt.mode = keyboard_mode; + let mut msg_out = Message::new(); + msg_out.set_key_event(evt); + log::info!("{:?}", msg_out); + self.send(Data::Message(msg_out)); + } + + fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { + // map mode(1): Send keycode according to the peer platform. + let peer = self.peer_platform(); + + let mut key_event = KeyEvent::new(); + // According to peer platform. + if peer == "Linux" { + let keycode: u32 = rdev::linux_keycode_from_key(key).unwrap_or_default().into(); + key_event.set_chr(keycode); + } else if peer == "Windows" { + let keycode: u32 = rdev::win_keycode_from_key(key).unwrap_or_default().into(); + key_event.set_chr(keycode); + } else if peer == "Mac OS" { + let keycode: u32 = rdev::macos_keycode_from_key(key).unwrap_or_default().into(); + key_event.set_chr(keycode); + } + if down_or_up == true { + key_event.down = true; + } else if down_or_up == true { + key_event.press = true; + } + self.send_key_event(key_event, 1); + } + + fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { + // translate mode(2): locally generated characters are send to the peer. + } + + 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"; + + let alt = get_key_state(enigo::Key::Alt); + #[cfg(windows)] + let ctrl = { + let mut tmp = get_key_state(enigo::Key::Control); + unsafe { + if IS_ALT_GR { + if alt || key == RdevKey::AltGr { + if tmp { + tmp = false; + } + } else { + IS_ALT_GR = false; + } + } + } + tmp + }; + #[cfg(not(windows))] + let ctrl = get_key_state(enigo::Key::Control); + let shift = get_key_state(enigo::Key::Shift); + #[cfg(windows)] + let command = crate::platform::windows::get_win_key_state(); + #[cfg(not(windows))] + let command = get_key_state(enigo::Key::Meta); + let control_key = match key { + RdevKey::Alt => Some(ControlKey::Alt), + RdevKey::AltGr => Some(ControlKey::RAlt), + RdevKey::Backspace => Some(ControlKey::Backspace), + RdevKey::ControlLeft => { + // when pressing AltGr, an extra VK_LCONTROL with a special + // scancode with bit 9 set is sent, let's ignore this. + #[cfg(windows)] + if evt.scan_code & 0x200 != 0 { + unsafe { + IS_ALT_GR = true; + } + return; + } + Some(ControlKey::Control) + } + RdevKey::ControlRight => Some(ControlKey::RControl), + RdevKey::DownArrow => Some(ControlKey::DownArrow), + RdevKey::Escape => Some(ControlKey::Escape), + RdevKey::F1 => Some(ControlKey::F1), + RdevKey::F10 => Some(ControlKey::F10), + RdevKey::F11 => Some(ControlKey::F11), + RdevKey::F12 => Some(ControlKey::F12), + RdevKey::F2 => Some(ControlKey::F2), + RdevKey::F3 => Some(ControlKey::F3), + RdevKey::F4 => Some(ControlKey::F4), + RdevKey::F5 => Some(ControlKey::F5), + RdevKey::F6 => Some(ControlKey::F6), + RdevKey::F7 => Some(ControlKey::F7), + RdevKey::F8 => Some(ControlKey::F8), + RdevKey::F9 => Some(ControlKey::F9), + RdevKey::LeftArrow => Some(ControlKey::LeftArrow), + RdevKey::MetaLeft => Some(ControlKey::Meta), + RdevKey::MetaRight => Some(ControlKey::RWin), + RdevKey::Return => Some(ControlKey::Return), + RdevKey::RightArrow => Some(ControlKey::RightArrow), + RdevKey::ShiftLeft => Some(ControlKey::Shift), + RdevKey::ShiftRight => Some(ControlKey::RShift), + RdevKey::Space => Some(ControlKey::Space), + RdevKey::Tab => Some(ControlKey::Tab), + RdevKey::UpArrow => Some(ControlKey::UpArrow), + RdevKey::Delete => { + if is_win && ctrl && alt { + self.ctrl_alt_del(); + return; + } + Some(ControlKey::Delete) + } + RdevKey::Apps => Some(ControlKey::Apps), + RdevKey::Cancel => Some(ControlKey::Cancel), + RdevKey::Clear => Some(ControlKey::Clear), + RdevKey::Kana => Some(ControlKey::Kana), + RdevKey::Hangul => Some(ControlKey::Hangul), + RdevKey::Junja => Some(ControlKey::Junja), + RdevKey::Final => Some(ControlKey::Final), + RdevKey::Hanja => Some(ControlKey::Hanja), + RdevKey::Hanji => Some(ControlKey::Hanja), + RdevKey::Convert => Some(ControlKey::Convert), + RdevKey::Print => Some(ControlKey::Print), + RdevKey::Select => Some(ControlKey::Select), + RdevKey::Execute => Some(ControlKey::Execute), + RdevKey::PrintScreen => Some(ControlKey::Snapshot), + RdevKey::Help => Some(ControlKey::Help), + RdevKey::Sleep => Some(ControlKey::Sleep), + RdevKey::Separator => Some(ControlKey::Separator), + RdevKey::KpReturn => Some(ControlKey::NumpadEnter), + RdevKey::Kp0 => Some(ControlKey::Numpad0), + RdevKey::Kp1 => Some(ControlKey::Numpad1), + RdevKey::Kp2 => Some(ControlKey::Numpad2), + RdevKey::Kp3 => Some(ControlKey::Numpad3), + RdevKey::Kp4 => Some(ControlKey::Numpad4), + RdevKey::Kp5 => Some(ControlKey::Numpad5), + RdevKey::Kp6 => Some(ControlKey::Numpad6), + RdevKey::Kp7 => Some(ControlKey::Numpad7), + RdevKey::Kp8 => Some(ControlKey::Numpad8), + RdevKey::Kp9 => Some(ControlKey::Numpad9), + RdevKey::KpDivide => Some(ControlKey::Divide), + RdevKey::KpMultiply => Some(ControlKey::Multiply), + RdevKey::KpDecimal => Some(ControlKey::Decimal), + RdevKey::KpMinus => Some(ControlKey::Subtract), + RdevKey::KpPlus => Some(ControlKey::Add), + RdevKey::CapsLock | RdevKey::NumLock | RdevKey::ScrollLock => { + return; + } + RdevKey::Home => Some(ControlKey::Home), + RdevKey::End => Some(ControlKey::End), + RdevKey::Insert => Some(ControlKey::Insert), + RdevKey::PageUp => Some(ControlKey::PageUp), + RdevKey::PageDown => Some(ControlKey::PageDown), + RdevKey::Pause => Some(ControlKey::Pause), + _ => None, + }; + let mut key_event = KeyEvent::new(); + if let Some(k) = control_key { + key_event.set_control_key(k); + } else { + let mut chr = match evt.name { + Some(ref s) => { + if s.len() <= 2 { + // exclude chinese characters + s.chars().next().unwrap_or('\0') + } else { + '\0' + } + } + _ => '\0', + }; + if chr == '·' { + // special for Chinese + chr = '`'; + } + if chr == '\0' { + chr = match key { + RdevKey::Num1 => '1', + RdevKey::Num2 => '2', + RdevKey::Num3 => '3', + RdevKey::Num4 => '4', + RdevKey::Num5 => '5', + RdevKey::Num6 => '6', + RdevKey::Num7 => '7', + RdevKey::Num8 => '8', + RdevKey::Num9 => '9', + RdevKey::Num0 => '0', + RdevKey::KeyA => 'a', + RdevKey::KeyB => 'b', + RdevKey::KeyC => 'c', + RdevKey::KeyD => 'd', + RdevKey::KeyE => 'e', + RdevKey::KeyF => 'f', + RdevKey::KeyG => 'g', + RdevKey::KeyH => 'h', + RdevKey::KeyI => 'i', + RdevKey::KeyJ => 'j', + RdevKey::KeyK => 'k', + RdevKey::KeyL => 'l', + RdevKey::KeyM => 'm', + RdevKey::KeyN => 'n', + RdevKey::KeyO => 'o', + RdevKey::KeyP => 'p', + RdevKey::KeyQ => 'q', + RdevKey::KeyR => 'r', + RdevKey::KeyS => 's', + RdevKey::KeyT => 't', + RdevKey::KeyU => 'u', + RdevKey::KeyV => 'v', + RdevKey::KeyW => 'w', + RdevKey::KeyX => 'x', + RdevKey::KeyY => 'y', + RdevKey::KeyZ => 'z', + RdevKey::Comma => ',', + RdevKey::Dot => '.', + RdevKey::SemiColon => ';', + RdevKey::Quote => '\'', + RdevKey::LeftBracket => '[', + RdevKey::RightBracket => ']', + RdevKey::BackSlash => '\\', + RdevKey::Minus => '-', + RdevKey::Equal => '=', + RdevKey::BackQuote => '`', + _ => '\0', + } + } + if chr != '\0' { + if chr == 'l' && is_win && command { + self.lock_screen(); + return; + } + key_event.set_chr(chr as _); + } else { + log::error!("Unknown key {:?}", evt); + return; + } + } if alt && !crate::is_control_key(&key_event, &ControlKey::Alt) @@ -1223,15 +1221,25 @@ impl Handler { key_event.modifiers.push(ControlKey::NumLock.into()); } } - if down_or_up == 1 { + if down_or_up == true { key_event.down = true; - } else if down_or_up == 3 { - key_event.press = true; } - let mut msg_out = Message::new(); - msg_out.set_key_event(key_event); - log::debug!("{:?}", msg_out); - self.send(Data::Message(msg_out)); + dbg!(&key_event); + self.send_key_event(key_event, 2) + } + + fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { + // Call different functions according to keyboard mode. + let mode = std::env::var("KEYBOARD_MOAD").unwrap_or(String::from("map")); + match mode.as_str() { + "map" => { + self.map_keyboard_mode(down_or_up, key); + } + "legacy" => self.legacy_keyboard_mode(down_or_up, key, evt), + _ => { + self.map_keyboard_mode(down_or_up, key); + } + } } #[inline] @@ -2692,4 +2700,4 @@ impl Handler { async fn send_note(url: String, id: String, conn_id: i32, note: String) { let body = serde_json::json!({ "id": id, "Id": conn_id, "note": note }); allow_err!(crate::post_request(url, body.to_string(), "").await); -} +} \ No newline at end of file From 5dab7bd9a218caf48ae2ae9f1fa63a827e19d8c1 Mon Sep 17 00:00:00 2001 From: Asura Date: Sun, 17 Jul 2022 20:34:08 -0700 Subject: [PATCH 013/113] Refactor simulate to support switching keyboard modes --- libs/enigo/src/linux.rs | 43 +++----------- libs/enigo/src/macos/macos_impl.rs | 32 ----------- libs/enigo/src/win/win_impl.rs | 32 ----------- src/server/connection.rs | 9 +-- src/server/input_service.rs | 90 +++++++++++++++++++++++++----- 5 files changed, 84 insertions(+), 122 deletions(-) diff --git a/libs/enigo/src/linux.rs b/libs/enigo/src/linux.rs index 7f2afc3dc..67af71a62 100644 --- a/libs/enigo/src/linux.rs +++ b/libs/enigo/src/linux.rs @@ -3,7 +3,6 @@ use libc; use crate::{Key, KeyboardControllable, MouseButton, MouseControllable}; use self::libc::{c_char, c_int, c_void, useconds_t}; -use rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; use std::{borrow::Cow, ffi::CString, io::prelude::*, ptr, sync::mpsc, thread, time}; const CURRENT_WINDOW: c_int = 0; const DEFAULT_DELAY: u64 = 12000; @@ -104,27 +103,7 @@ impl Enigo { self.tx.send((PyMsg::Char('\0'), true)).ok(); } - fn send_rdev(&mut self, key: &Key, is_press: bool) -> bool { - if let Key::Raw(keycode) = key { - let event_type = match is_press { - // todo: Acccodding to client type - true => Box::leak(Box::new(EventType::KeyPress(RdevKey::Unknown( - (*keycode).into(), - )))), - false => Box::leak(Box::new(EventType::KeyRelease(RdevKey::Unknown( - (*keycode).into(), - )))), - }; - - match simulate(event_type) { - Ok(()) => true, - Err(SimulateError) => false, - } - } else { - false - } - } - + #[inline] fn send_pynput(&mut self, key: &Key, is_press: bool) -> bool { if unsafe { PYNPUT_EXIT || !PYNPUT_REDAY } { @@ -459,12 +438,9 @@ impl KeyboardControllable for Enigo { if self.xdo.is_null() { return Ok(()); } - if self.send_rdev(&key, true) { - return Ok(()); - } - if self.send_pynput(&key, true) { - return Ok(()); - } + // if self.send_pynput(&key, true) { + // return Ok(()); + // } let string = CString::new(&*keysequence(key))?; unsafe { xdo_send_keysequence_window_down( @@ -480,14 +456,9 @@ impl KeyboardControllable for Enigo { if self.xdo.is_null() { return; } - // todo - let keyboard_mode = 1; - if keyboard_mode == 1 && self.send_rdev(&key, false) { - return; - } - if self.send_pynput(&key, false) { - return; - } + // if self.send_pynput(&key, false) { + // return; + // } if let Ok(string) = CString::new(&*keysequence(key)) { unsafe { xdo_send_keysequence_window_up( diff --git a/libs/enigo/src/macos/macos_impl.rs b/libs/enigo/src/macos/macos_impl.rs index df494b9cb..520c9dca1 100644 --- a/libs/enigo/src/macos/macos_impl.rs +++ b/libs/enigo/src/macos/macos_impl.rs @@ -1,5 +1,4 @@ use core_graphics; -use rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; // TODO(dustin): use only the things i need use self::core_graphics::display::*; @@ -354,11 +353,6 @@ impl KeyboardControllable for Enigo { } fn key_down(&mut self, key: Key) -> crate::ResultType { - let keyboard_mode = 1; - if keyboard_mode == 1 { - self.send_rdev(&key, true); - return Ok(()); - }; let code = self.key_to_keycode(key); if code == u16::MAX { return Err("".into()); @@ -374,11 +368,6 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { - let keyboard_mode = 1; - if keyboard_mode == 1 { - self.send_rdev(&key, true); - return Ok(()); - }; if let Some(src) = self.event_source.as_ref() { if let Ok(event) = CGEvent::new_keyboard_event(src.clone(), self.key_to_keycode(key), false) @@ -431,27 +420,6 @@ impl Enigo { (x, (display_height as i32) - y_inv) } - fn send_rdev(&mut self, key: &Key, is_press: bool) -> bool { - if let Key::Raw(keycode) = key { - let event_type = match is_press { - // todo: Acccodding to client type - true => Box::leak(Box::new(EventType::KeyPress(RdevKey::Unknown( - (*keycode).into(), - )))), - false => Box::leak(Box::new(EventType::KeyRelease(RdevKey::Unknown( - (*keycode).into(), - )))), - }; - - match simulate(event_type) { - Ok(()) => true, - Err(SimulateError) => false, - } - } else { - false - } - } - fn key_to_keycode(&mut self, key: Key) -> CGKeyCode { #[allow(deprecated)] // I mean duh, we still need to support deprecated keys until they're removed diff --git a/libs/enigo/src/win/win_impl.rs b/libs/enigo/src/win/win_impl.rs index b8f3d0fa3..56fc4caef 100644 --- a/libs/enigo/src/win/win_impl.rs +++ b/libs/enigo/src/win/win_impl.rs @@ -2,7 +2,6 @@ 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 rdev::{simulate, EventType, Key as RdevKey, SimulateError}; use winapi; use crate::win::keycodes::*; @@ -198,11 +197,6 @@ impl KeyboardControllable for Enigo { } fn key_down(&mut self, key: Key) -> crate::ResultType { - let keyboard_mode = 1; - if keyboard_mode == 1 { - self.send_rdev(&key, true); - return Ok(()); - }; let code = self.key_to_keycode(key); if code == 0 || code == 65535 { return Err("".into()); @@ -218,11 +212,6 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { - let keyboard_mode = 1; - if keyboard_mode == 1 { - self.send_rdev(&key, false); - return; - }; keybd_event(KEYEVENTF_KEYUP, self.key_to_keycode(key), 0); } @@ -283,27 +272,6 @@ impl Enigo { keybd_event(KEYEVENTF_UNICODE | KEYEVENTF_KEYUP, 0, unicode_char); } - fn send_rdev(&mut self, key: &Key, is_press: bool) -> bool { - if let Key::Raw(keycode) = key { - let event_type = match is_press { - // todo: Acccodding to client type - true => Box::leak(Box::new(EventType::KeyPress(RdevKey::Unknown( - (*keycode).into(), - )))), - false => Box::leak(Box::new(EventType::KeyRelease(RdevKey::Unknown( - (*keycode).into(), - )))), - }; - - match simulate(event_type) { - Ok(()) => true, - Err(SimulateError) => false, - } - } else { - false - } - } - fn key_to_keycode(&self, key: Key) -> u16 { unsafe { LAYOUT = std::ptr::null_mut(); diff --git a/src/server/connection.rs b/src/server/connection.rs index 682c7d928..48fab0c2d 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -419,15 +419,8 @@ impl Connection { handle_mouse(&msg, id); } MessageInput::Key((mut msg, press)) => { - if press { - msg.down = true; - } + // todo: press and down have similar meanings. handle_key(&msg); - let keyboard_mode = 1; - if press && keyboard_mode != 1{ - msg.down = false; - handle_key(&msg); - } } MessageInput::BlockOn => { if crate::platform::block_input(true) { diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 8e8e2abb4..f041b7e86 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -3,6 +3,7 @@ use super::*; use dispatch::Queue; use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable}; use hbb_common::{config::COMPRESS_LEVEL, protobuf::ProtobufEnumOrUnknown}; +use rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; use std::{ convert::TryFrom, sync::atomic::{AtomicBool, Ordering}, @@ -578,24 +579,27 @@ pub fn handle_key(evt: &KeyEvent) { handle_key_(evt); } -fn handle_key_(evt: &KeyEvent) { - if EXITING.load(Ordering::SeqCst) { - return; +fn map_keyboard_map(evt: &KeyEvent) { + // map mode(1): Send keycode according to the peer platform. + let event_type = match evt.down { + true => EventType::KeyPress(RdevKey::Unknown(evt.get_chr())), + false => EventType::KeyRelease(RdevKey::Unknown(evt.get_chr())), + }; + + match simulate(&event_type) { + Ok(()) => (), + Err(_simulate_error) => { + // todo + log::error!("rdev could not send {:?}", event_type); + } } + return; +} + +fn legacy_keyboard_map(evt: &KeyEvent) { #[cfg(windows)] crate::platform::windows::try_change_desktop(); let mut en = ENIGO.lock().unwrap(); - let keyboard_mode = 1; - if keyboard_mode == 1 { - if let Some(key_event::Union::chr(chr)) = evt.union { - if evt.down { - en.key_down(Key::Raw(chr.try_into().unwrap())); - } else { - en.key_up(Key::Raw(chr.try_into().unwrap())); - } - } - return; - } // disable numlock if press home etc when numlock is on, // because we will get numpad value (7,8,9 etc) if not #[cfg(windows)] @@ -740,9 +744,67 @@ fn handle_key_(evt: &KeyEvent) { } } +fn handle_key_(evt: &KeyEvent) { + if EXITING.load(Ordering::SeqCst) { + return; + } + + match evt.mode { + 1 => { + map_keyboard_map(evt); + } + 3 => { + legacy_keyboard_map(evt); + } + _ => { + map_keyboard_map(evt); + } + } +} + #[tokio::main(flavor = "current_thread")] async fn send_sas() -> ResultType<()> { let mut stream = crate::ipc::connect(1000, crate::POSTFIX_SERVICE).await?; timeout(1000, stream.send(&crate::ipc::Data::SAS)).await??; Ok(()) } + +#[cfg(test)] +mod test { + use super::*; + use rdev::{listen, simulate, Event, EventType, Key}; + use std::sync::mpsc; + use std::thread; + + #[test] + fn test_handle_key() { + // listen + let (tx, rx) = mpsc::channel(); + std::thread::spawn(move || { + std::env::set_var("KEYBOARD_ONLY", "y"); + let func = move |event: Event| { + tx.send(event).ok(); + }; + if let Err(error) = listen(func) { + println!("Error: {:?}", error); + } + }); + // set key/char base on char + let mut evt = KeyEvent::new(); + evt.set_chr(49); + evt.mode = 3; + + // press + evt.down = true; + handle_key(&evt); + if let Ok(listen_evt) = rx.recv() { + assert_eq!(listen_evt.event_type, EventType::KeyPress(Key::Num1)) + } + // release + evt.down = false; + handle_key(&evt); + if let Ok(listen_evt) = rx.recv() { + assert_eq!(listen_evt.event_type, EventType::KeyRelease(Key::Num1)) + } + } +} From 3c61773d75375b493c10f83dd967683a84bbad45 Mon Sep 17 00:00:00 2001 From: Asura Date: Sun, 17 Jul 2022 20:59:14 -0700 Subject: [PATCH 014/113] Recover legacy keyboard mode when simulate --- libs/enigo/src/linux.rs | 12 ++++++------ src/server/connection.rs | 7 +++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/libs/enigo/src/linux.rs b/libs/enigo/src/linux.rs index 67af71a62..6b4c99a1b 100644 --- a/libs/enigo/src/linux.rs +++ b/libs/enigo/src/linux.rs @@ -438,9 +438,9 @@ impl KeyboardControllable for Enigo { if self.xdo.is_null() { return Ok(()); } - // if self.send_pynput(&key, true) { - // return Ok(()); - // } + if self.send_pynput(&key, true) { + return Ok(()); + } let string = CString::new(&*keysequence(key))?; unsafe { xdo_send_keysequence_window_down( @@ -456,9 +456,9 @@ impl KeyboardControllable for Enigo { if self.xdo.is_null() { return; } - // if self.send_pynput(&key, false) { - // return; - // } + if self.send_pynput(&key, false) { + return; + } if let Ok(string) = CString::new(&*keysequence(key)) { unsafe { xdo_send_keysequence_window_up( diff --git a/src/server/connection.rs b/src/server/connection.rs index 48fab0c2d..dd5b32fe9 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -420,7 +420,14 @@ impl Connection { } MessageInput::Key((mut msg, press)) => { // todo: press and down have similar meanings. + if press && msg.mode == 3 { + msg.down = true; + } handle_key(&msg); + if press && msg.mode == 3 { + msg.down = false; + handle_key(&msg); + } } MessageInput::BlockOn => { if crate::platform::block_input(true) { From 7ae065739cb7dae729676466c0adf6e69c6e03d9 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 12:51:17 +0800 Subject: [PATCH 015/113] Recover legacy keyboard mode when listen --- src/ui/remote.rs | 91 +++++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 8ebced2c4..2175cd06b 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -918,18 +918,24 @@ impl Handler { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::CtrlAltDel); // todo - self.send_key_event(key_event, 2); + key_event.down = true; + self.send_key_event(key_event, 3); } else { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::Delete); - // self.key_down_or_up(3, key_event, true, true, false, false); + self.legacy_modifiers(&mut key_event, true, true, false, false); + // todo + key_event.press = true; + self.send_key_event(key_event, 3); } } fn lock_screen(&mut self) { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::LockScreen); - // self.key_down_or_up(1, key_event, false, false, false, false); + // todo + key_event.down = true; + self.send_key_event(key_event, 3); } fn transfer_file(&mut self) { @@ -975,14 +981,49 @@ impl Handler { } if down_or_up == true { key_event.down = true; - } else if down_or_up == true { - key_event.press = true; + } else { + key_event.down = false; } self.send_key_event(key_event, 1); } - fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { - // translate mode(2): locally generated characters are send to the peer. + // fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { + // // translate mode(2): locally generated characters are send to the peer. + // } + + fn legacy_modifiers(&self, key_event: &mut KeyEvent, alt: bool, ctrl: bool, shift: bool, command: bool){ + if alt + && !crate::is_control_key(&key_event, &ControlKey::Alt) + && !crate::is_control_key(&key_event, &ControlKey::RAlt) + { + key_event.modifiers.push(ControlKey::Alt.into()); + } + if shift + && !crate::is_control_key(&key_event, &ControlKey::Shift) + && !crate::is_control_key(&key_event, &ControlKey::RShift) + { + key_event.modifiers.push(ControlKey::Shift.into()); + } + if ctrl + && !crate::is_control_key(&key_event, &ControlKey::Control) + && !crate::is_control_key(&key_event, &ControlKey::RControl) + { + key_event.modifiers.push(ControlKey::Control.into()); + } + if command + && !crate::is_control_key(&key_event, &ControlKey::Meta) + && !crate::is_control_key(&key_event, &ControlKey::RWin) + { + key_event.modifiers.push(ControlKey::Meta.into()); + } + if get_key_state(enigo::Key::CapsLock) { + key_event.modifiers.push(ControlKey::CapsLock.into()); + } + if self.peer_platform() != "Mac OS" { + if get_key_state(enigo::Key::NumLock) && common::valid_for_numlock(&key_event) { + key_event.modifiers.push(ControlKey::NumLock.into()); + } + } } fn legacy_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { @@ -1189,38 +1230,8 @@ impl Handler { } } - if alt - && !crate::is_control_key(&key_event, &ControlKey::Alt) - && !crate::is_control_key(&key_event, &ControlKey::RAlt) - { - key_event.modifiers.push(ControlKey::Alt.into()); - } - if shift - && !crate::is_control_key(&key_event, &ControlKey::Shift) - && !crate::is_control_key(&key_event, &ControlKey::RShift) - { - key_event.modifiers.push(ControlKey::Shift.into()); - } - if ctrl - && !crate::is_control_key(&key_event, &ControlKey::Control) - && !crate::is_control_key(&key_event, &ControlKey::RControl) - { - key_event.modifiers.push(ControlKey::Control.into()); - } - if command - && !crate::is_control_key(&key_event, &ControlKey::Meta) - && !crate::is_control_key(&key_event, &ControlKey::RWin) - { - key_event.modifiers.push(ControlKey::Meta.into()); - } - if get_key_state(enigo::Key::CapsLock) { - key_event.modifiers.push(ControlKey::CapsLock.into()); - } - if self.peer_platform() != "Mac OS" { - if get_key_state(enigo::Key::NumLock) && common::valid_for_numlock(&key_event) { - key_event.modifiers.push(ControlKey::NumLock.into()); - } - } + self.legacy_modifiers(&mut key_event, alt, ctrl, shift, command); + if down_or_up == true { key_event.down = true; } @@ -2700,4 +2711,4 @@ impl Handler { async fn send_note(url: String, id: String, conn_id: i32, note: String) { let body = serde_json::json!({ "id": id, "Id": conn_id, "note": note }); allow_err!(crate::post_request(url, body.to_string(), "").await); -} \ No newline at end of file +} From 828795b4370937c328c3a15e464bced10685cda2 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 01:54:54 -0700 Subject: [PATCH 016/113] Sync Caps status --- src/server/input_service.rs | 48 +++++++++++++++++++++++++++++-------- src/ui/remote.rs | 7 +++++- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index f041b7e86..eac11a743 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -579,20 +579,46 @@ pub fn handle_key(evt: &KeyEvent) { handle_key_(evt); } -fn map_keyboard_map(evt: &KeyEvent) { - // map mode(1): Send keycode according to the peer platform. - let event_type = match evt.down { - true => EventType::KeyPress(RdevKey::Unknown(evt.get_chr())), - false => EventType::KeyRelease(RdevKey::Unknown(evt.get_chr())), - }; - - match simulate(&event_type) { +fn rdev_simulate(event_type: &EventType) { + let delay = std::time::Duration::from_millis(20); + match simulate(event_type) { Ok(()) => (), Err(_simulate_error) => { // todo log::error!("rdev could not send {:?}", event_type); } } + // Let ths OS catchup (at least MacOS) + std::thread::sleep(delay); +} + +fn map_keyboard_map(evt: &KeyEvent) { + // map mode(1): Send keycode according to the peer platform. + let mut en = ENIGO.lock().unwrap(); + // sync CAPS status + let caps_locking = evt + .modifiers + .iter() + .position(|&r| r == ControlKey::CapsLock.into()) + .is_some(); + println!("[*] remote, client: {:?} {:?}", caps_locking, en.get_key_state(enigo::Key::CapsLock)); + if caps_locking && !en.get_key_state(enigo::Key::CapsLock) + { + println!("[*]: Changing status"); + rdev_simulate(&EventType::KeyPress(RdevKey::CapsLock)); + rdev_simulate(&EventType::KeyRelease(RdevKey::CapsLock)); + }else if !caps_locking && en.get_key_state(enigo::Key::CapsLock){ + println!("[*]: Changing status"); + rdev_simulate(&EventType::KeyPress(RdevKey::CapsLock)); + rdev_simulate(&EventType::KeyRelease(RdevKey::CapsLock)); + }; + + let event_type = match evt.down { + true => EventType::KeyPress(RdevKey::Unknown(evt.get_chr())), + false => EventType::KeyRelease(RdevKey::Unknown(evt.get_chr())), + }; + + rdev_simulate(&event_type); return; } @@ -791,8 +817,10 @@ mod test { }); // set key/char base on char let mut evt = KeyEvent::new(); - evt.set_chr(49); - evt.mode = 3; + evt.set_chr(66); + evt.mode = 1; + + evt.modifiers.push(ControlKey::CapsLock.into()); // press evt.down = true; diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 2175cd06b..a230e50fb 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -984,6 +984,11 @@ impl Handler { } else { key_event.down = false; } + + if get_key_state(enigo::Key::CapsLock) { + key_event.modifiers.push(ControlKey::CapsLock.into()); + } + self.send_key_event(key_event, 1); } @@ -1236,7 +1241,7 @@ impl Handler { key_event.down = true; } dbg!(&key_event); - self.send_key_event(key_event, 2) + self.send_key_event(key_event, 3) } fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { From e0a7238cc1d5856cafcc0bc05c80e6ffc6cdcbd3 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 02:09:32 -0700 Subject: [PATCH 017/113] Refactor rdev simulate --- src/server/input_service.rs | 42 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index eac11a743..2061c909d 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -579,21 +579,23 @@ pub fn handle_key(evt: &KeyEvent) { handle_key_(evt); } -fn rdev_simulate(event_type: &EventType) { +fn rdev_key_down_or_up(key: RdevKey, down_or_up: bool) { + let event_type = match down_or_up { + true => EventType::KeyPress(key), + false => EventType::KeyRelease(key), + }; let delay = std::time::Duration::from_millis(20); - match simulate(event_type) { + match simulate(&event_type) { Ok(()) => (), Err(_simulate_error) => { - // todo - log::error!("rdev could not send {:?}", event_type); + println!("We could not send {:?}", &event_type); } } // Let ths OS catchup (at least MacOS) std::thread::sleep(delay); } -fn map_keyboard_map(evt: &KeyEvent) { - // map mode(1): Send keycode according to the peer platform. +fn sync_status(evt: &KeyEvent) { let mut en = ENIGO.lock().unwrap(); // sync CAPS status let caps_locking = evt @@ -601,24 +603,24 @@ fn map_keyboard_map(evt: &KeyEvent) { .iter() .position(|&r| r == ControlKey::CapsLock.into()) .is_some(); - println!("[*] remote, client: {:?} {:?}", caps_locking, en.get_key_state(enigo::Key::CapsLock)); - if caps_locking && !en.get_key_state(enigo::Key::CapsLock) + println!( + "[*] remote, client: {:?} {:?}", + caps_locking, + en.get_key_state(enigo::Key::CapsLock) + ); + if (caps_locking && !en.get_key_state(enigo::Key::CapsLock)) + || (!caps_locking && en.get_key_state(enigo::Key::CapsLock)) { println!("[*]: Changing status"); - rdev_simulate(&EventType::KeyPress(RdevKey::CapsLock)); - rdev_simulate(&EventType::KeyRelease(RdevKey::CapsLock)); - }else if !caps_locking && en.get_key_state(enigo::Key::CapsLock){ - println!("[*]: Changing status"); - rdev_simulate(&EventType::KeyPress(RdevKey::CapsLock)); - rdev_simulate(&EventType::KeyRelease(RdevKey::CapsLock)); + rdev_key_down_or_up(RdevKey::CapsLock, true); + rdev_key_down_or_up(RdevKey::CapsLock, false); }; +} - let event_type = match evt.down { - true => EventType::KeyPress(RdevKey::Unknown(evt.get_chr())), - false => EventType::KeyRelease(RdevKey::Unknown(evt.get_chr())), - }; - - rdev_simulate(&event_type); +fn map_keyboard_map(evt: &KeyEvent) { + // map mode(1): Send keycode according to the peer platform. + sync_status(evt); + rdev_key_down_or_up(RdevKey::Unknown(evt.get_chr()), evt.down); return; } From 72273f454639ac07efaeb8a2c19cdff08389e42e Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 02:19:33 -0700 Subject: [PATCH 018/113] Sync Numpad status --- src/server/input_service.rs | 22 +++++++++++++++------- src/ui/remote.rs | 12 +++++++++++- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 2061c909d..f54290d42 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -597,24 +597,32 @@ fn rdev_key_down_or_up(key: RdevKey, down_or_up: bool) { fn sync_status(evt: &KeyEvent) { let mut en = ENIGO.lock().unwrap(); - // sync CAPS status + + // remote caps status let caps_locking = evt .modifiers .iter() .position(|&r| r == ControlKey::CapsLock.into()) .is_some(); - println!( - "[*] remote, client: {:?} {:?}", - caps_locking, - en.get_key_state(enigo::Key::CapsLock) - ); + // remote numpad status + let num_locking = evt + .modifiers + .iter() + .position(|&r| r == ControlKey::NumLock.into()) + .is_some(); + if (caps_locking && !en.get_key_state(enigo::Key::CapsLock)) || (!caps_locking && en.get_key_state(enigo::Key::CapsLock)) { - println!("[*]: Changing status"); rdev_key_down_or_up(RdevKey::CapsLock, true); rdev_key_down_or_up(RdevKey::CapsLock, false); }; + if (num_locking && !en.get_key_state(enigo::Key::NumLock)) + || (!num_locking && en.get_key_state(enigo::Key::NumLock)) + { + rdev_key_down_or_up(RdevKey::NumLock, true); + rdev_key_down_or_up(RdevKey::NumLock, false); + }; } fn map_keyboard_map(evt: &KeyEvent) { diff --git a/src/ui/remote.rs b/src/ui/remote.rs index a230e50fb..c00d4579d 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -988,6 +988,9 @@ impl Handler { if get_key_state(enigo::Key::CapsLock) { key_event.modifiers.push(ControlKey::CapsLock.into()); } + if get_key_state(enigo::Key::NumLock) { + key_event.modifiers.push(ControlKey::NumLock.into()); + } self.send_key_event(key_event, 1); } @@ -996,7 +999,14 @@ impl Handler { // // translate mode(2): locally generated characters are send to the peer. // } - fn legacy_modifiers(&self, key_event: &mut KeyEvent, alt: bool, ctrl: bool, shift: bool, command: bool){ + fn legacy_modifiers( + &self, + key_event: &mut KeyEvent, + alt: bool, + ctrl: bool, + shift: bool, + command: bool, + ) { if alt && !crate::is_control_key(&key_event, &ControlKey::Alt) && !crate::is_control_key(&key_event, &ControlKey::RAlt) From 80b01a96dbe38cc8bf6d18f5bf11a7825ce6cd11 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 17:42:02 +0800 Subject: [PATCH 019/113] Refactor to remove warning --- src/server/input_service.rs | 2 +- src/ui/remote.rs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index f54290d42..81bfcd06f 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -3,7 +3,7 @@ use super::*; use dispatch::Queue; use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable}; use hbb_common::{config::COMPRESS_LEVEL, protobuf::ProtobufEnumOrUnknown}; -use rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError}; +use rdev::{simulate, EventType, Key as RdevKey}; use std::{ convert::TryFrom, sync::atomic::{AtomicBool, Ordering}, diff --git a/src/ui/remote.rs b/src/ui/remote.rs index c00d4579d..f6031a425 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -283,8 +283,6 @@ impl Handler { } log::info!("keyboard hooked"); let mut me = self.clone(); - let peer = self.peer_platform(); - let is_win = peer == "Windows"; #[cfg(windows)] crate::platform::windows::enable_lowlevel_keyboard(std::ptr::null_mut() as _); std::thread::spawn(move || { @@ -308,7 +306,7 @@ impl Handler { { return; } - let (key, down) = match evt.event_type { + let (_key, down) = match evt.event_type { KeyPress(k) => { // keyboard long press if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) { @@ -330,9 +328,9 @@ impl Handler { }; #[cfg(target_os = "windows")] - let key = rdev::get_win_key(evt.code.into(), evt.scan_code); + let _key = rdev::get_win_key(evt.code.into(), evt.scan_code); - me.key_down_or_up(down, key, evt); + me.key_down_or_up(down, _key, evt); }; if let Err(error) = rdev::listen(func) { log::error!("rdev: {:?}", error); From a2d8c31e856a54eb6ba551d3adefdbbe5135512f Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 22:01:08 +0800 Subject: [PATCH 020/113] Auto release key --- src/ui/remote.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index f6031a425..44e7d705f 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1,5 +1,5 @@ use std::{ - collections::HashMap, + collections::{HashMap, HashSet}, ops::Deref, sync::{ atomic::{AtomicBool, AtomicUsize, Ordering}, @@ -57,6 +57,7 @@ type Video = AssetPtr; lazy_static::lazy_static! { static ref ENIGO: Arc> = Arc::new(Mutex::new(Enigo::new())); static ref VIDEO: Arc>> = Default::default(); + static ref TO_RELEASE: Arc>> = Arc::new(Mutex::new(HashSet::::new())); } fn get_key_state(key: enigo::Key) -> bool { @@ -732,6 +733,9 @@ impl Handler { } fn leave(&mut self) { + for key in TO_RELEASE.lock().unwrap().iter() { + self.map_keyboard_mode(false, *key) + } #[cfg(windows)] crate::platform::windows::stop_system_key_propagate(false); IS_IN.store(false, Ordering::SeqCst); @@ -986,8 +990,10 @@ impl Handler { if get_key_state(enigo::Key::CapsLock) { key_event.modifiers.push(ControlKey::CapsLock.into()); } - if get_key_state(enigo::Key::NumLock) { - key_event.modifiers.push(ControlKey::NumLock.into()); + if self.peer_platform() != "Mac OS" { + if get_key_state(enigo::Key::NumLock) && common::valid_for_numlock(&key_event) { + key_event.modifiers.push(ControlKey::NumLock.into()); + } } self.send_key_event(key_event, 1); @@ -1257,6 +1263,11 @@ impl Handler { let mode = std::env::var("KEYBOARD_MOAD").unwrap_or(String::from("map")); match mode.as_str() { "map" => { + if down_or_up == true { + TO_RELEASE.lock().unwrap().insert(key); + } else { + TO_RELEASE.lock().unwrap().remove(&key); + } self.map_keyboard_mode(down_or_up, key); } "legacy" => self.legacy_keyboard_mode(down_or_up, key, evt), From a8e4591217c478b62c2b93df4795b5edd4e2c596 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 07:38:05 -0700 Subject: [PATCH 021/113] Fix lock_screen and ctrl_alt_del --- libs/enigo/Cargo.toml | 2 +- libs/enigo/src/linux.rs | 11 ++--------- src/server/input_service.rs | 2 ++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/libs/enigo/Cargo.toml b/libs/enigo/Cargo.toml index b1c57ca92..e97f000a6 100644 --- a/libs/enigo/Cargo.toml +++ b/libs/enigo/Cargo.toml @@ -21,7 +21,7 @@ appveyor = { repository = "pythoneer/enigo-85xiy" } [dependencies] serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } -log = "0.4.17" +log = "0.4" rdev = { git = "https://github.com/asur4s/rdev" } [features] diff --git a/libs/enigo/src/linux.rs b/libs/enigo/src/linux.rs index 6b4c99a1b..30c49c014 100644 --- a/libs/enigo/src/linux.rs +++ b/libs/enigo/src/linux.rs @@ -103,7 +103,6 @@ impl Enigo { self.tx.send((PyMsg::Char('\0'), true)).ok(); } - #[inline] fn send_pynput(&mut self, key: &Key, is_press: bool) -> bool { if unsafe { PYNPUT_EXIT || !PYNPUT_REDAY } { @@ -112,14 +111,8 @@ impl Enigo { if let Key::Layout(c) = key { return self.tx.send((PyMsg::Char(*c), is_press)).is_ok(); } - if let Key::Raw(chr) = key { - fn string_to_static_str(s: String) -> &'static str { - Box::leak(s.into_boxed_str()) - } - return self - .tx - .send((PyMsg::Str(string_to_static_str(chr.to_string())), is_press)) - .is_ok(); + if let Key::Raw(_) = key { + return false; } #[allow(deprecated)] let s = match key { diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 81bfcd06f..aadb957a3 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -450,6 +450,7 @@ pub fn lock_screen() { key_event.down = true; key_event.set_chr('l' as _); key_event.modifiers.push(ControlKey::Meta.into()); + key_event.mode = 3; handle_key(&key_event); key_event.down = false; handle_key(&key_event); @@ -462,6 +463,7 @@ pub fn lock_screen() { key_event.set_chr('q' as _); key_event.modifiers.push(ControlKey::Meta.into()); key_event.modifiers.push(ControlKey::Control.into()); + key_event.mode = 3; handle_key(&key_event); key_event.down = false; handle_key(&key_event); From a118056c304c6919ff9aaa10769bd4d78809b7e9 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 23:04:04 +0800 Subject: [PATCH 022/113] Fix sync Numpad status --- src/server/input_service.rs | 11 +++++++++-- src/ui/remote.rs | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index aadb957a3..a116bbbfc 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -810,9 +810,8 @@ async fn send_sas() -> ResultType<()> { #[cfg(test)] mod test { use super::*; - use rdev::{listen, simulate, Event, EventType, Key}; + use rdev::{listen, Event, EventType, Key}; use std::sync::mpsc; - use std::thread; #[test] fn test_handle_key() { @@ -847,4 +846,12 @@ mod test { assert_eq!(listen_evt.event_type, EventType::KeyRelease(Key::Num1)) } } + #[test] + fn test_get_key_state() { + let mut en = ENIGO.lock().unwrap(); + println!( + "[*] test_get_key_state: {:?}", + en.get_key_state(enigo::Key::NumLock) + ); + } } diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 44e7d705f..a0aa5d381 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -990,10 +990,8 @@ impl Handler { if get_key_state(enigo::Key::CapsLock) { key_event.modifiers.push(ControlKey::CapsLock.into()); } - if self.peer_platform() != "Mac OS" { - if get_key_state(enigo::Key::NumLock) && common::valid_for_numlock(&key_event) { - key_event.modifiers.push(ControlKey::NumLock.into()); - } + if get_key_state(enigo::Key::NumLock) { + key_event.modifiers.push(ControlKey::NumLock.into()); } self.send_key_event(key_event, 1); From 48466bfe37824536c4b0b55bed9580dd999c6eb9 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 19 Jul 2022 09:35:39 +0800 Subject: [PATCH 023/113] Numpad when linux -> windows --- src/ui/remote.rs | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index a0aa5d381..7c05c4407 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -965,22 +965,42 @@ impl Handler { self.send(Data::Message(msg_out)); } + fn convert_numpad_keys(&mut self, key: &RdevKey) -> &RdevKey { + if get_key_state(enigo::Key::NumLock) { + return; + } + 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, + } + } + fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { // map mode(1): Send keycode according to the peer platform. let peer = self.peer_platform(); let mut key_event = KeyEvent::new(); // According to peer platform. - if peer == "Linux" { - let keycode: u32 = rdev::linux_keycode_from_key(key).unwrap_or_default().into(); - key_event.set_chr(keycode); + let keycode: u32 = if peer == "Linux" { + rdev::linux_keycode_from_key(key).unwrap_or_default().into() } else if peer == "Windows" { - let keycode: u32 = rdev::win_keycode_from_key(key).unwrap_or_default().into(); - key_event.set_chr(keycode); + #[cfg(not(windows))] + self.convert_numpad_keys(&key); + rdev::win_keycode_from_key(key).unwrap_or_default().into() } else if peer == "Mac OS" { - let keycode: u32 = rdev::macos_keycode_from_key(key).unwrap_or_default().into(); - key_event.set_chr(keycode); - } + rdev::macos_keycode_from_key(key).unwrap_or_default().into() + }; + key_event.set_chr(keycode); + if down_or_up == true { key_event.down = true; } else { From a77d64d18184bd7287475f7558121c6092c5e551 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 18:47:38 -0700 Subject: [PATCH 024/113] Remove log --- libs/enigo/src/linux.rs | 2 +- src/ui/remote.rs | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libs/enigo/src/linux.rs b/libs/enigo/src/linux.rs index 30c49c014..de06923f3 100644 --- a/libs/enigo/src/linux.rs +++ b/libs/enigo/src/linux.rs @@ -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; diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 7c05c4407..f051663f6 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -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"; From 19ebbb145a753e9090b387258dd4746627f4ff05 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 18 Jul 2022 23:45:54 -0700 Subject: [PATCH 025/113] Compatible with legacy mode in remote --- src/server/connection.rs | 4 ++-- src/server/input_service.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index dd5b32fe9..854191c95 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -420,11 +420,11 @@ impl Connection { } MessageInput::Key((mut msg, press)) => { // todo: press and down have similar meanings. - if press && msg.mode == 3 { + if press && msg.mode == 0 { msg.down = true; } handle_key(&msg); - if press && msg.mode == 3 { + if press && msg.mode == 0 { msg.down = false; handle_key(&msg); } diff --git a/src/server/input_service.rs b/src/server/input_service.rs index a116bbbfc..4563ef465 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -450,7 +450,7 @@ pub fn lock_screen() { key_event.down = true; key_event.set_chr('l' as _); key_event.modifiers.push(ControlKey::Meta.into()); - key_event.mode = 3; + key_event.mode = 0; handle_key(&key_event); key_event.down = false; handle_key(&key_event); @@ -463,7 +463,7 @@ pub fn lock_screen() { key_event.set_chr('q' as _); key_event.modifiers.push(ControlKey::Meta.into()); key_event.modifiers.push(ControlKey::Control.into()); - key_event.mode = 3; + key_event.mode = 0; handle_key(&key_event); key_event.down = false; handle_key(&key_event); @@ -788,14 +788,14 @@ fn handle_key_(evt: &KeyEvent) { } match evt.mode { + 0 => { + legacy_keyboard_map(evt); + } 1 => { map_keyboard_map(evt); } - 3 => { - legacy_keyboard_map(evt); - } _ => { - map_keyboard_map(evt); + legacy_keyboard_map(evt); } } } From 0bacc1c250192ccd4ec424f04b97b1c6feb44c63 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 19 Jul 2022 15:09:45 +0800 Subject: [PATCH 026/113] Compatible with legacy mode in client --- src/ui/remote.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index f051663f6..0b96b3c26 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -921,14 +921,14 @@ impl Handler { key_event.set_control_key(ControlKey::CtrlAltDel); // todo key_event.down = true; - self.send_key_event(key_event, 3); + self.send_key_event(key_event, 0); } else { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::Delete); self.legacy_modifiers(&mut key_event, true, true, false, false); // todo key_event.press = true; - self.send_key_event(key_event, 3); + self.send_key_event(key_event, 0); } } @@ -937,7 +937,7 @@ impl Handler { key_event.set_control_key(ControlKey::LockScreen); // todo key_event.down = true; - self.send_key_event(key_event, 3); + self.send_key_event(key_event, 0); } fn transfer_file(&mut self) { @@ -965,6 +965,7 @@ impl Handler { self.send(Data::Message(msg_out)); } + #[allow(dead_code)] fn convert_numpad_keys(&mut self, key: RdevKey) -> RdevKey { if get_key_state(enigo::Key::NumLock) { return key; @@ -1000,13 +1001,9 @@ impl Handler { } else { rdev::macos_keycode_from_key(key).unwrap_or_default().into() }; - key_event.set_chr(keycode); - if down_or_up == true { - key_event.down = true; - } else { - key_event.down = false; - } + key_event.set_chr(keycode); + key_event.down = down_or_up; if get_key_state(enigo::Key::CapsLock) { key_event.modifiers.push(ControlKey::CapsLock.into()); @@ -1065,7 +1062,7 @@ 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. + // legacy mode(0): Generate characters locally, look for keycode on other side. let peer = self.peer_platform(); let is_win = peer == "Windows"; @@ -1273,12 +1270,12 @@ impl Handler { key_event.down = true; } dbg!(&key_event); - self.send_key_event(key_event, 3) + self.send_key_event(key_event, 0) } fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { // Call different functions according to keyboard mode. - let mode = std::env::var("KEYBOARD_MOAD").unwrap_or(String::from("map")); + let mode = std::env::var("KEYBOARD_MOAD").unwrap_or(String::from("legacy")); match mode.as_str() { "map" => { if down_or_up == true { @@ -1289,9 +1286,7 @@ impl Handler { self.map_keyboard_mode(down_or_up, key); } "legacy" => self.legacy_keyboard_mode(down_or_up, key, evt), - _ => { - self.map_keyboard_mode(down_or_up, key); - } + _ => self.legacy_keyboard_mode(down_or_up, key, evt), } } From 02b4d7f1d9dc755d4e55f403479dbb76b4a82f5c Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 19 Jul 2022 15:43:13 +0800 Subject: [PATCH 027/113] Refactor keyboard mode by enum --- libs/hbb_common/protos/message.proto | 9 +++++++- src/server/connection.rs | 4 ++-- src/server/input_service.rs | 10 ++++---- src/ui/remote.rs | 34 +++++++++++++++++----------- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/libs/hbb_common/protos/message.proto b/libs/hbb_common/protos/message.proto index 645930eb4..2282bf43a 100644 --- a/libs/hbb_common/protos/message.proto +++ b/libs/hbb_common/protos/message.proto @@ -97,6 +97,13 @@ message MouseEvent { repeated ControlKey modifiers = 4; } +enum KeyboardMode{ + Legacy = 0; + Map = 1; + Translate = 2; + Auto = 3; +} + enum ControlKey { Unknown = 0; Alt = 1; @@ -190,7 +197,7 @@ message KeyEvent { string seq = 6; } repeated ControlKey modifiers = 8; - uint32 mode = 9; + KeyboardMode mode = 9; } message CursorData { diff --git a/src/server/connection.rs b/src/server/connection.rs index 854191c95..fdeaac106 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -420,11 +420,11 @@ impl Connection { } MessageInput::Key((mut msg, press)) => { // todo: press and down have similar meanings. - if press && msg.mode == 0 { + if press && msg.mode.unwrap() == KeyboardMode::Legacy { msg.down = true; } handle_key(&msg); - if press && msg.mode == 0 { + if press && msg.mode.unwrap() == KeyboardMode::Legacy { msg.down = false; handle_key(&msg); } diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 4563ef465..02f50abff 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -450,7 +450,7 @@ pub fn lock_screen() { key_event.down = true; key_event.set_chr('l' as _); key_event.modifiers.push(ControlKey::Meta.into()); - key_event.mode = 0; + key_event.mode = KeyboardMode::Legacy; handle_key(&key_event); key_event.down = false; handle_key(&key_event); @@ -463,7 +463,7 @@ pub fn lock_screen() { key_event.set_chr('q' as _); key_event.modifiers.push(ControlKey::Meta.into()); key_event.modifiers.push(ControlKey::Control.into()); - key_event.mode = 0; + key_event.mode = KeyboardMode::Legacy; handle_key(&key_event); key_event.down = false; handle_key(&key_event); @@ -787,11 +787,11 @@ fn handle_key_(evt: &KeyEvent) { return; } - match evt.mode { - 0 => { + match evt.mode.unwrap() { + KeyboardMode::Legacy => { legacy_keyboard_map(evt); } - 1 => { + KeyboardMode::Map => { map_keyboard_map(evt); } _ => { diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 0b96b3c26..4deaf05d8 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -41,6 +41,7 @@ use hbb_common::{ time::{self, Duration, Instant, Interval}, }, Stream, + protobuf::ProtobufEnumOrUnknown, }; use hbb_common::{config::TransferSerde, fs::TransferJobMeta}; use rdev::{Event, EventType::*, Key as RdevKey}; @@ -921,14 +922,14 @@ impl Handler { key_event.set_control_key(ControlKey::CtrlAltDel); // todo key_event.down = true; - self.send_key_event(key_event, 0); + self.send_key_event(key_event, KeyboardMode::Legacy); } else { let mut key_event = KeyEvent::new(); key_event.set_control_key(ControlKey::Delete); self.legacy_modifiers(&mut key_event, true, true, false, false); // todo key_event.press = true; - self.send_key_event(key_event, 0); + self.send_key_event(key_event, KeyboardMode::Legacy); } } @@ -937,7 +938,7 @@ impl Handler { key_event.set_control_key(ControlKey::LockScreen); // todo key_event.down = true; - self.send_key_event(key_event, 0); + self.send_key_event(key_event, KeyboardMode::Legacy); } fn transfer_file(&mut self) { @@ -956,9 +957,9 @@ impl Handler { } } - fn send_key_event(&mut self, mut evt: KeyEvent, keyboard_mode: u32) { - // mode: map(1), translate(2), legacy(3), auto(4) - evt.mode = keyboard_mode; + fn send_key_event(&mut self, mut evt: KeyEvent, keyboard_mode: KeyboardMode) { + // mode: legacy(0), map(1), translate(2), auto(3) + evt.mode = ProtobufEnumOrUnknown::new(keyboard_mode); let mut msg_out = Message::new(); msg_out.set_key_event(evt); log::info!("{:?}", msg_out); @@ -1012,7 +1013,7 @@ impl Handler { key_event.modifiers.push(ControlKey::NumLock.into()); } - self.send_key_event(key_event, 1); + self.send_key_event(key_event, KeyboardMode::Map); } // fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { @@ -1269,15 +1270,22 @@ impl Handler { if down_or_up == true { key_event.down = true; } - dbg!(&key_event); - self.send_key_event(key_event, 0) + self.send_key_event(key_event, KeyboardMode::Legacy) } fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { // Call different functions according to keyboard mode. - let mode = std::env::var("KEYBOARD_MOAD").unwrap_or(String::from("legacy")); - match mode.as_str() { - "map" => { + let mode = match std::env::var("KEYBOARD_MOAD") + .unwrap_or(String::from("legacy")) + .as_str() + { + "map" => KeyboardMode::Map, + "legacy" => KeyboardMode::Legacy, + _ => KeyboardMode::Legacy, + }; + + match mode { + KeyboardMode::Map => { if down_or_up == true { TO_RELEASE.lock().unwrap().insert(key); } else { @@ -1285,7 +1293,7 @@ impl Handler { } self.map_keyboard_mode(down_or_up, key); } - "legacy" => self.legacy_keyboard_mode(down_or_up, key, evt), + KeyboardMode::Legacy => self.legacy_keyboard_mode(down_or_up, key, evt), _ => self.legacy_keyboard_mode(down_or_up, key, evt), } } From cbdc28ee2055453ea35fdc52661ef9fc06b0d17f Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 19 Jul 2022 01:04:23 -0700 Subject: [PATCH 028/113] Fix compiler error --- src/server/input_service.rs | 15 ++++++++++----- src/ui/remote.rs | 3 +-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 02f50abff..b20cad35e 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -447,11 +447,14 @@ pub fn lock_screen() { // loginctl lock-session also not work, they both work run rustdesk from cmd std::thread::spawn(|| { let mut key_event = KeyEvent::new(); - key_event.down = true; + key_event.set_chr('l' as _); key_event.modifiers.push(ControlKey::Meta.into()); - key_event.mode = KeyboardMode::Legacy; + key_event.mode = KeyboardMode::Legacy.into(); + + key_event.down = true; handle_key(&key_event); + key_event.down = false; handle_key(&key_event); }); @@ -459,11 +462,13 @@ pub fn lock_screen() { // CGSession -suspend not real lock screen, it is user switch std::thread::spawn(|| { let mut key_event = KeyEvent::new(); - key_event.down = true; + key_event.set_chr('q' as _); key_event.modifiers.push(ControlKey::Meta.into()); key_event.modifiers.push(ControlKey::Control.into()); - key_event.mode = KeyboardMode::Legacy; + key_event.mode = KeyboardMode::Legacy.into(); + + key_event.down = true; handle_key(&key_event); key_event.down = false; handle_key(&key_event); @@ -829,7 +834,7 @@ mod test { // set key/char base on char let mut evt = KeyEvent::new(); evt.set_chr(66); - evt.mode = 1; + evt.mode = ProtobufEnum::new(KeyboardMode::Legacy); evt.modifiers.push(ControlKey::CapsLock.into()); diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 4deaf05d8..4a33be574 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -41,7 +41,6 @@ use hbb_common::{ time::{self, Duration, Instant, Interval}, }, Stream, - protobuf::ProtobufEnumOrUnknown, }; use hbb_common::{config::TransferSerde, fs::TransferJobMeta}; use rdev::{Event, EventType::*, Key as RdevKey}; @@ -959,7 +958,7 @@ impl Handler { fn send_key_event(&mut self, mut evt: KeyEvent, keyboard_mode: KeyboardMode) { // mode: legacy(0), map(1), translate(2), auto(3) - evt.mode = ProtobufEnumOrUnknown::new(keyboard_mode); + evt.mode = keyboard_mode.into(); let mut msg_out = Message::new(); msg_out.set_key_event(evt); log::info!("{:?}", msg_out); From d07ef7af8af6bf88d6b740bce1b778f5448a3ebc Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 19 Jul 2022 16:15:57 +0800 Subject: [PATCH 029/113] Fix compile error of testcase --- src/server/input_service.rs | 2 +- src/ui/remote.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index b20cad35e..252139adb 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -834,7 +834,7 @@ mod test { // set key/char base on char let mut evt = KeyEvent::new(); evt.set_chr(66); - evt.mode = ProtobufEnum::new(KeyboardMode::Legacy); + evt.mode = KeyboardMode::Legacy.into(); evt.modifiers.push(ControlKey::CapsLock.into()); diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 4a33be574..3688a7d75 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -961,7 +961,6 @@ impl Handler { evt.mode = keyboard_mode.into(); let mut msg_out = Message::new(); msg_out.set_key_event(evt); - log::info!("{:?}", msg_out); self.send(Data::Message(msg_out)); } @@ -1274,7 +1273,7 @@ impl Handler { fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { // Call different functions according to keyboard mode. - let mode = match std::env::var("KEYBOARD_MOAD") + let mode = match std::env::var("KEYBOARD_MODE") .unwrap_or(String::from("legacy")) .as_str() { From 669e8b98b233b9918e1e88a05b01941c5dcc8da1 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 19 Jul 2022 16:24:19 +0800 Subject: [PATCH 030/113] Update Cargo.toml about rdev --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 056c14ae7..6a32a7a89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3858,7 +3858,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#95cecfd1b0f0b20c6cd728afca859107b911f3b8" +source = "git+https://github.com/asur4s/rdev#548d1194dd6863ab004d59299b995eb64cf21c3d" dependencies = [ "cocoa 0.22.0", "core-foundation 0.7.0", From fe9923109092827f543560a7af42dff6c3135117 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 19 Jul 2022 16:49:05 +0800 Subject: [PATCH 031/113] Make case insensitive of keyboard_mode --- src/ui/remote.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 3688a7d75..c8ce5d724 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1274,7 +1274,7 @@ impl Handler { fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { // Call different functions according to keyboard mode. let mode = match std::env::var("KEYBOARD_MODE") - .unwrap_or(String::from("legacy")) + .unwrap_or(String::from("legacy")).to_lowercase() .as_str() { "map" => KeyboardMode::Map, From 3a0c10bdb183e4ac6298239f0797902664171d36 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 20 Jul 2022 20:31:17 -0700 Subject: [PATCH 032/113] Refactor for compiler in linux --- libs/enigo/src/lib.rs | 6 +++--- libs/enigo/src/linux/xdo.rs | 2 +- src/server/input_service.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/enigo/src/lib.rs b/libs/enigo/src/lib.rs index 164fb1c17..01e9b67d2 100644 --- a/libs/enigo/src/lib.rs +++ b/libs/enigo/src/lib.rs @@ -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, /// diff --git a/libs/enigo/src/linux/xdo.rs b/libs/enigo/src/linux/xdo.rs index 541dbe81f..ff687eee2 100644 --- a/libs/enigo/src/linux/xdo.rs +++ b/libs/enigo/src/linux/xdo.rs @@ -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}; +use std::{borrow::Cow, ffi::CString, ptr}; const CURRENT_WINDOW: c_int = 0; const DEFAULT_DELAY: u64 = 12000; diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 6103274ee..5532967ca 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -2,7 +2,7 @@ use super::*; #[cfg(target_os = "macos")] use dispatch::Queue; use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable}; -use hbb_common::{config::COMPRESS_LEVEL, protobuf::ProtobufEnumOrUnknown, protobuf::EnumOrUnknown}; +use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown}; use rdev::{simulate, EventType, Key as RdevKey}; use std::{ convert::TryFrom, @@ -654,7 +654,7 @@ fn sync_status(evt: &KeyEvent) { fn map_keyboard_map(evt: &KeyEvent) { // map mode(1): Send keycode according to the peer platform. sync_status(evt); - rdev_key_down_or_up(RdevKey::Unknown(evt.get_chr()), evt.down); + rdev_key_down_or_up(RdevKey::Unknown(evt.chr()), evt.down); return; } From 25c7bbd96fb55a8a31b3ee3f22786b555440db19 Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 21 Jul 2022 12:46:19 +0800 Subject: [PATCH 033/113] Fix numpad error --- libs/enigo/src/linux/pynput.rs | 20 ++++++++++---------- rust-toolchain.toml | 2 -- 2 files changed, 10 insertions(+), 12 deletions(-) delete mode 100644 rust-toolchain.toml diff --git a/libs/enigo/src/linux/pynput.rs b/libs/enigo/src/linux/pynput.rs index 748b30105..7868b7f6f 100644 --- a/libs/enigo/src/linux/pynput.rs +++ b/libs/enigo/src/linux/pynput.rs @@ -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", diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index 05dfa3270..000000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "1.62.0" From 1b0fb5132c2dc00a38ce43efe19029301756f575 Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 23 Jul 2022 20:51:01 +0800 Subject: [PATCH 034/113] Support switching keyboard mode by UI --- src/lang/cn.rs | 2 ++ src/ui/common.tis | 90 +++++++++++++++++++++++++++++++++++++++++++++++ src/ui/header.tis | 31 ++++++++++++++++ src/ui/remote.rs | 17 ++++++--- 4 files changed, 136 insertions(+), 4 deletions(-) diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 6e3d4d067..c1ee5d305 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", "激活一次性访问功能"), ("Set security password", "设置安全密码"), ("Connection not allowed", "对方不允许连接"), + ("Legacy mode", "传统模式"), + ("Map mode", "1:1传输"), ].iter().cloned().collect(); } diff --git a/src/ui/common.tis b/src/ui/common.tis index aae950c2d..8a0beef98 100644 --- a/src/ui/common.tis +++ b/src/ui/common.tis @@ -155,6 +155,96 @@ var svg_send = var svg_chat = ; +var svg_keyboard = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +; function scrollToBottom(el) { var y = el.box(#height, #content) - el.box(#height, #client); diff --git a/src/ui/header.tis b/src/ui/header.tis index 35a132c90..8cce3e18a 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -139,11 +139,22 @@ class Header: Reactor.Component { {svg_chat} {svg_action} {svg_display} + {svg_keyboard} + {this.renderKeyboardPop()} {this.renderDisplayPop()} {this.renderActionPop()} ; } + function renderKeyboardPop(){ + return + +
  • {svg_checkmark}{translate('Legacy mode')}
  • +
  • {svg_checkmark}{translate('Map mode')}
  • + +
    ; + } + function renderDisplayPop() { return @@ -252,6 +263,11 @@ class Header: Reactor.Component { me.popup(menu); } + event click $(#keyboard) (_, me) { + var menu = $(menu#keyboard-options); + me.popup(menu); + } + event click $(#screen) (_, me) { if (pi.current_display == me.index) return; handler.switch_display(me.index); @@ -332,6 +348,16 @@ class Header: Reactor.Component { toggleMenuState(); } } + + event click $(menu#keyboard-options>li) (_, me) { + stdout.println(me.id); + if (me.id == "legacy") { + handler.save_keyboard_mode("legacy"); + } else if (me.id == "map") { + handler.save_keyboard_mode("map"); + } + toggleMenuState() + } } function handle_custom_image_quality() { @@ -355,9 +381,14 @@ function toggleMenuState() { var s = handler.get_view_style(); if (!s) s = "original"; values.push(s); + var k = handler.get_keyboard_mode(); + values.push(k); for (var el in $$(menu#display-options>li)) { el.attributes.toggleClass("selected", values.indexOf(el.id) >= 0); } + for (var el in $$(menu#keyboard-options>li)) { + el.attributes.toggleClass("selected", values.indexOf(el.id) >= 0); + } for (var id in ["show-remote-cursor", "show-quality-monitor", "disable-audio", "enable-file-transfer", "disable-clipboard", "lock-after-session-end"]) { var el = self.select('#' + id); if (el) { diff --git a/src/ui/remote.rs b/src/ui/remote.rs index ef14ef42e..f68d76e1b 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -233,6 +233,8 @@ impl sciter::EventHandler for Handler { fn get_remember(); fn peer_platform(); fn set_write_override(i32, i32, bool, bool, bool); + fn get_keyboard_mode(); + fn save_keyboard_mode(String); } } @@ -347,6 +349,16 @@ impl Handler { return self.lc.read().unwrap().image_quality.clone(); } + fn get_keyboard_mode(&mut self) -> String { + return std::env::var("KEYBOARD_MODE") + .unwrap_or(String::from("legacy")) + .to_lowercase(); + } + + fn save_keyboard_mode(&mut self, value: String) { + std::env::set_var("KEYBOARD_MODE", value); + } + fn get_custom_image_quality(&mut self) -> Value { let mut v = Value::array(0); for x in self.lc.read().unwrap().custom_image_quality.iter() { @@ -1273,10 +1285,7 @@ impl Handler { fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { // Call different functions according to keyboard mode. - let mode = match std::env::var("KEYBOARD_MODE") - .unwrap_or(String::from("legacy")).to_lowercase() - .as_str() - { + let mode = match self.get_keyboard_mode().as_str() { "map" => KeyboardMode::Map, "legacy" => KeyboardMode::Legacy, _ => KeyboardMode::Legacy, From b3b97ee69a62ca4471699f387a89550d3359e73d Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 23 Jul 2022 21:45:00 +0800 Subject: [PATCH 035/113] Remove log info --- libs/enigo/src/linux/pynput.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/enigo/src/linux/pynput.rs b/libs/enigo/src/linux/pynput.rs index 7868b7f6f..836c645fe 100644 --- a/libs/enigo/src/linux/pynput.rs +++ b/libs/enigo/src/linux/pynput.rs @@ -110,7 +110,6 @@ impl EnigoPynput { return true; } }; - log::info!("send pynput: {:?}", &s); return self.tx.send((PyMsg::Str(s), is_press)).is_ok(); } } From 1caee4e30678ba6d784689920ecd83ed2af3293a Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 23 Jul 2022 08:20:39 -0700 Subject: [PATCH 036/113] Sync CapsLock and NumLock status in legacy mode. --- libs/enigo/src/linux/nix_impl.rs | 10 ++----- src/server/input_service.rs | 47 ++++++++++++++++++++------------ src/ui/header.tis | 1 - src/ui/remote.rs | 2 +- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/libs/enigo/src/linux/nix_impl.rs b/libs/enigo/src/linux/nix_impl.rs index 840290b2b..c660bd08c 100644 --- a/libs/enigo/src/linux/nix_impl.rs +++ b/libs/enigo/src/linux/nix_impl.rs @@ -156,6 +156,7 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { if self.is_x11 { + dbg!(key); if self.pynput.send_pynput(&key, false) { return; } @@ -167,12 +168,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); } } diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 01b049ddb..d8d4287fc 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -146,7 +146,8 @@ fn run_cursor(sp: MouseCursorService, state: &mut StateCursor) -> ResultType<()> msg = cached.clone(); } else { let mut data = crate::get_cursor_data(hcursor)?; - data.colors = hbb_common::compress::compress(&data.colors[..], COMPRESS_LEVEL).into(); + data.colors = + hbb_common::compress::compress(&data.colors[..], COMPRESS_LEVEL).into(); let mut tmp = Message::new(); tmp.set_cursor_data(data); msg = Arc::new(tmp); @@ -467,7 +468,7 @@ pub async fn lock_screen() { // loginctl lock-session also not work, they both work run rustdesk from cmd std::thread::spawn(|| { let mut key_event = KeyEvent::new(); - + key_event.set_chr('l' as _); key_event.modifiers.push(ControlKey::Meta.into()); key_event.mode = KeyboardMode::Legacy.into(); @@ -482,7 +483,7 @@ pub async fn lock_screen() { // CGSession -suspend not real lock screen, it is user switch std::thread::spawn(|| { let mut key_event = KeyEvent::new(); - + key_event.set_chr('q' as _); key_event.modifiers.push(ControlKey::Meta.into()); key_event.modifiers.push(ControlKey::Control.into()); @@ -621,7 +622,12 @@ fn rdev_key_down_or_up(key: RdevKey, down_or_up: bool) { std::thread::sleep(delay); } -fn sync_status(evt: &KeyEvent) { +fn rdev_key_click(key: RdevKey) { + rdev_key_down_or_up(key, true); + rdev_key_down_or_up(key, false); +} + +fn sync_status(evt: &KeyEvent) -> (bool, bool) { let mut en = ENIGO.lock().unwrap(); // remote caps status @@ -637,31 +643,38 @@ fn sync_status(evt: &KeyEvent) { .position(|&r| r == ControlKey::NumLock.into()) .is_some(); - if (caps_locking && !en.get_key_state(enigo::Key::CapsLock)) - || (!caps_locking && en.get_key_state(enigo::Key::CapsLock)) - { - rdev_key_down_or_up(RdevKey::CapsLock, true); - rdev_key_down_or_up(RdevKey::CapsLock, false); - }; - if (num_locking && !en.get_key_state(enigo::Key::NumLock)) - || (!num_locking && en.get_key_state(enigo::Key::NumLock)) - { - rdev_key_down_or_up(RdevKey::NumLock, true); - rdev_key_down_or_up(RdevKey::NumLock, false); - }; + let click_capslock = (caps_locking && !en.get_key_state(enigo::Key::CapsLock)) + || (!caps_locking && en.get_key_state(enigo::Key::CapsLock)); + let click_numlock = (num_locking && !en.get_key_state(enigo::Key::NumLock)) + || (!num_locking && en.get_key_state(enigo::Key::NumLock)); + return (click_capslock, click_numlock); } fn map_keyboard_map(evt: &KeyEvent) { // map mode(1): Send keycode according to the peer platform. - sync_status(evt); + let (click_capslock, click_numlock) = sync_status(evt); + if click_capslock { + rdev_key_click(RdevKey::CapsLock); + } + if click_numlock { + rdev_key_click(RdevKey::NumLock); + } rdev_key_down_or_up(RdevKey::Unknown(evt.chr()), evt.down); return; } fn legacy_keyboard_map(evt: &KeyEvent) { + let (click_capslock, click_numlock) = sync_status(evt); + #[cfg(windows)] crate::platform::windows::try_change_desktop(); let mut en = ENIGO.lock().unwrap(); + if click_capslock { + en.key_click(Key::CapsLock); + } + if click_numlock { + en.key_click(Key::NumLock); + } // disable numlock if press home etc when numlock is on, // because we will get numpad value (7,8,9 etc) if not #[cfg(windows)] diff --git a/src/ui/header.tis b/src/ui/header.tis index 0ef473124..def2ab9f7 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -363,7 +363,6 @@ class Header: Reactor.Component { } event click $(menu#keyboard-options>li) (_, me) { - stdout.println(me.id); if (me.id == "legacy") { handler.save_keyboard_mode("legacy"); } else if (me.id == "map") { diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 69153bedc..9338b90d4 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1105,7 +1105,7 @@ impl Handler { key_event.modifiers.push(ControlKey::CapsLock.into()); } if self.peer_platform() != "Mac OS" { - if get_key_state(enigo::Key::NumLock) && common::valid_for_numlock(&key_event) { + if get_key_state(enigo::Key::NumLock) { key_event.modifiers.push(ControlKey::NumLock.into()); } } From 6a3d527f93af7ff5173de9e3fdd9b1ee9556d80d Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 25 Jul 2022 19:30:26 -0700 Subject: [PATCH 037/113] Refactor: function name --- src/server/input_service.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index d8d4287fc..c350e8d04 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -615,7 +615,7 @@ fn rdev_key_down_or_up(key: RdevKey, down_or_up: bool) { match simulate(&event_type) { Ok(()) => (), Err(_simulate_error) => { - println!("We could not send {:?}", &event_type); + log::error!("Could not send {:?}", &event_type); } } // Let ths OS catchup (at least MacOS) @@ -650,7 +650,7 @@ fn sync_status(evt: &KeyEvent) -> (bool, bool) { return (click_capslock, click_numlock); } -fn map_keyboard_map(evt: &KeyEvent) { +fn map_keyboard_mode(evt: &KeyEvent) { // map mode(1): Send keycode according to the peer platform. let (click_capslock, click_numlock) = sync_status(evt); if click_capslock { @@ -663,7 +663,7 @@ fn map_keyboard_map(evt: &KeyEvent) { return; } -fn legacy_keyboard_map(evt: &KeyEvent) { +fn legacy_keyboard_mode(evt: &KeyEvent) { let (click_capslock, click_numlock) = sync_status(evt); #[cfg(windows)] @@ -819,6 +819,7 @@ fn legacy_keyboard_map(evt: &KeyEvent) { } } + fn handle_key_(evt: &KeyEvent) { if EXITING.load(Ordering::SeqCst) { return; @@ -826,13 +827,13 @@ fn handle_key_(evt: &KeyEvent) { match evt.mode.unwrap() { KeyboardMode::Legacy => { - legacy_keyboard_map(evt); + legacy_keyboard_mode(evt); } KeyboardMode::Map => { - map_keyboard_map(evt); + map_keyboard_mode(evt); } _ => { - legacy_keyboard_map(evt); + legacy_keyboard_mode(evt); } } } From d08931c3171f5695e3f58d18eafc15260df1e1d5 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 27 Jul 2022 07:36:50 -0700 Subject: [PATCH 038/113] Doc: update lang for keyboard mode --- src/lang/cs.rs | 2 ++ src/lang/da.rs | 2 ++ src/lang/de.rs | 2 ++ src/lang/eo.rs | 2 ++ src/lang/es.rs | 2 ++ src/lang/fr.rs | 2 ++ src/lang/hu.rs | 2 ++ src/lang/id.rs | 2 ++ src/lang/it.rs | 2 ++ src/lang/ptbr.rs | 2 ++ src/lang/ru.rs | 2 ++ src/lang/sk.rs | 2 ++ src/lang/template.rs | 2 ++ src/lang/tr.rs | 2 ++ src/lang/tw.rs | 2 ++ 15 files changed, 30 insertions(+) diff --git a/src/lang/cs.rs b/src/lang/cs.rs index d9ff10416..bb5304aa6 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index f9776e687..4a4310ae0 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 671bcae98..c64bdec3d 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", "Einmal-Passwort aktivieren"), ("Set security password", "Sicheres Passwort setzen"), ("Connection not allowed", "Verbindung abgelehnt"), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index a21833559..bd4d4bdc0 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 14ba0ab57..fe627713c 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index f387b550b..1142f85a8 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index e35ab8195..b95dce235 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 6bf69e476..e6fefe77d 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 778313d5b..8fa3b77bb 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 176833501..5d653550b 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 55d33c7b3..edb31a7d1 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", "Активировать одноразовый пароль"), ("Set security password", "Задать пароль безопасности"), ("Connection not allowed", "Подключение не разрешено"), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 332336007..f31c31d27 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index 7b39a2876..a211ef398 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 02468201e..f45622c1a 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", ""), ("Set security password", ""), ("Connection not allowed", ""), + ("Legacy mode", ""), + ("Map mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index ea94d159c..0e7d0d573 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -300,5 +300,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Activate onetime password", "激活一次性訪問功能"), ("Set security password", "設置安全密碼"), ("Connection not allowed", "對方不允許連接"), + ("Legacy mode", "傳統模式"), + ("Map mode", "1:1傳輸"), ].iter().cloned().collect(); } From d5ac305e5717cf2144228ca1962b23d35cab14f2 Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 28 Jul 2022 11:00:01 +0800 Subject: [PATCH 039/113] Add translate mode in remote --- Cargo.lock | 110 +++++++++++++++++++++++++++++++---------------- src/ui/remote.rs | 41 ++++++++++++++++-- 2 files changed, 112 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ecbf1646f..833cbe12a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -638,21 +638,6 @@ dependencies = [ "cc", ] -[[package]] -name = "cocoa" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667fdc068627a2816b9ff831201dd9864249d6ee8d190b9532357f1fc0f61ea7" -dependencies = [ - "bitflags", - "block", - "core-foundation 0.9.3", - "core-graphics 0.21.0", - "foreign-types", - "libc", - "objc", -] - [[package]] name = "cocoa" version = "0.24.0" @@ -770,18 +755,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-graphics" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a67c4378cf203eace8fb6567847eb641fd6ff933c1145a115c6ee820ebb978" -dependencies = [ - "bitflags", - "core-foundation 0.9.3", - "foreign-types", - "libc", -] - [[package]] name = "core-graphics" version = "0.22.3" @@ -1336,6 +1309,16 @@ dependencies = [ "termcolor", ] +[[package]] +name = "epoll" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20df693c700404f7e19d4d6fae6b15215d2913c27955d2b9d6f2c0f537511cd0" +dependencies = [ + "bitflags", + "libc", +] + [[package]] name = "err-derive" version = "0.3.1" @@ -1370,6 +1353,29 @@ dependencies = [ "nix 0.23.1", ] +[[package]] +name = "evdev-rs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7db51abf6b3205a6e6e8dd68d7a5414d7c50d61736a6f4c9b97df86ef5567cf" +dependencies = [ + "bitflags", + "evdev-sys", + "libc", + "log", +] + +[[package]] +name = "evdev-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14ead42b547b15d47089c1243d907bcf0eb94e457046d3b315a26ac9c9e9ea6d" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "event-listener" version = "2.5.2" @@ -2342,6 +2348,28 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "inotify" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf888f9575c290197b2c948dc9e9ff10bd1a39ad1ea8585f734585fa6b9d3f9" +dependencies = [ + "bitflags", + "futures-core", + "inotify-sys", + "libc", + "tokio", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + [[package]] name = "instant" version = "0.1.12" @@ -3767,15 +3795,19 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#548d1194dd6863ab004d59299b995eb64cf21c3d" +source = "git+https://github.com/asur4s/rdev#c3a896bcb4a10d171dee1aa685c90abadf8946d2" dependencies = [ - "cocoa 0.22.0", - "core-foundation 0.7.0", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", + "cocoa", + "core-foundation 0.9.3", + "core-foundation-sys 0.8.3", + "core-graphics 0.22.3", "enum-map", + "epoll", + "evdev-rs", + "inotify", "lazy_static", "libc", + "widestring 1.0.2", "winapi 0.3.9", "x11", ] @@ -3994,7 +4026,7 @@ dependencies = [ "cfg-if 1.0.0", "clap 3.2.12", "clipboard", - "cocoa 0.24.0", + "cocoa", "core-foundation 0.9.3", "core-graphics 0.22.3", "cpal", @@ -4936,7 +4968,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76863575f7842ed64fda361f417a787efa82811b4617267709066969cd4ccf3b" dependencies = [ - "cocoa 0.24.0", + "cocoa", "core-graphics 0.22.3", "gtk", "libappindicator", @@ -5348,6 +5380,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + [[package]] name = "winapi" version = "0.2.8" @@ -5421,7 +5459,7 @@ checksum = "0c643e10139d127d30d6d753398c8a6f0a43532e8370f6c9d29ebbff29b984ab" dependencies = [ "bitflags", "err-derive", - "widestring", + "widestring 0.4.3", "winapi 0.3.9", ] @@ -5548,7 +5586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" dependencies = [ "bitflags", - "cocoa 0.24.0", + "cocoa", "core-foundation 0.9.3", "core-graphics 0.22.3", "core-video-sys", diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 9338b90d4..1b5331609 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1065,9 +1065,40 @@ impl Handler { self.send_key_event(key_event, KeyboardMode::Map); } - // fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { - // // translate mode(2): locally generated characters are send to the peer. - // } + fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { + // translate mode(2): locally generated characters are send to the peer. + let string = evt.name.unwrap_or_default(); + + let chars = if string == "" { + None + } else { + let chars: Vec = string.chars().collect(); + Some(chars) + }; + + if let Some(chars) = chars { + for chr in chars { + dbg!(chr); + + let mut key_event = KeyEvent::new(); + key_event.set_chr(chr as _); + key_event.down = true; + self.send_key_event(key_event, KeyboardMode::Translate); + + let mut key_event = KeyEvent::new(); + key_event.set_chr(chr as _); + key_event.down = false; + self.send_key_event(key_event, KeyboardMode::Translate); + } + } else { + if down_or_up == true { + TO_RELEASE.lock().unwrap().insert(key); + } else { + TO_RELEASE.lock().unwrap().remove(&key); + } + self.map_keyboard_mode(down_or_up, key); + } + } fn legacy_modifiers( &self, @@ -1327,6 +1358,7 @@ impl Handler { let mode = match self.get_keyboard_mode().as_str() { "map" => KeyboardMode::Map, "legacy" => KeyboardMode::Legacy, + "translate" => KeyboardMode::Translate, _ => KeyboardMode::Legacy, }; @@ -1340,6 +1372,9 @@ impl Handler { self.map_keyboard_mode(down_or_up, key); } KeyboardMode::Legacy => self.legacy_keyboard_mode(down_or_up, key, evt), + KeyboardMode::Translate => { + self.translate_keyboard_mode(down_or_up, key, evt); + } _ => self.legacy_keyboard_mode(down_or_up, key, evt), } } From 25525cda3f2ee4a05e63f41c602a41c41092bddc Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 27 Jul 2022 20:01:42 -0700 Subject: [PATCH 040/113] Add translte mode in input_service --- Cargo.lock | 110 +++++++++++++++++++++---------- libs/enigo/src/linux/nix_impl.rs | 1 - src/server/input_service.rs | 8 +++ 3 files changed, 82 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ecbf1646f..833cbe12a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -638,21 +638,6 @@ dependencies = [ "cc", ] -[[package]] -name = "cocoa" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667fdc068627a2816b9ff831201dd9864249d6ee8d190b9532357f1fc0f61ea7" -dependencies = [ - "bitflags", - "block", - "core-foundation 0.9.3", - "core-graphics 0.21.0", - "foreign-types", - "libc", - "objc", -] - [[package]] name = "cocoa" version = "0.24.0" @@ -770,18 +755,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-graphics" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a67c4378cf203eace8fb6567847eb641fd6ff933c1145a115c6ee820ebb978" -dependencies = [ - "bitflags", - "core-foundation 0.9.3", - "foreign-types", - "libc", -] - [[package]] name = "core-graphics" version = "0.22.3" @@ -1336,6 +1309,16 @@ dependencies = [ "termcolor", ] +[[package]] +name = "epoll" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20df693c700404f7e19d4d6fae6b15215d2913c27955d2b9d6f2c0f537511cd0" +dependencies = [ + "bitflags", + "libc", +] + [[package]] name = "err-derive" version = "0.3.1" @@ -1370,6 +1353,29 @@ dependencies = [ "nix 0.23.1", ] +[[package]] +name = "evdev-rs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7db51abf6b3205a6e6e8dd68d7a5414d7c50d61736a6f4c9b97df86ef5567cf" +dependencies = [ + "bitflags", + "evdev-sys", + "libc", + "log", +] + +[[package]] +name = "evdev-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14ead42b547b15d47089c1243d907bcf0eb94e457046d3b315a26ac9c9e9ea6d" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "event-listener" version = "2.5.2" @@ -2342,6 +2348,28 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "inotify" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf888f9575c290197b2c948dc9e9ff10bd1a39ad1ea8585f734585fa6b9d3f9" +dependencies = [ + "bitflags", + "futures-core", + "inotify-sys", + "libc", + "tokio", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + [[package]] name = "instant" version = "0.1.12" @@ -3767,15 +3795,19 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#548d1194dd6863ab004d59299b995eb64cf21c3d" +source = "git+https://github.com/asur4s/rdev#c3a896bcb4a10d171dee1aa685c90abadf8946d2" dependencies = [ - "cocoa 0.22.0", - "core-foundation 0.7.0", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", + "cocoa", + "core-foundation 0.9.3", + "core-foundation-sys 0.8.3", + "core-graphics 0.22.3", "enum-map", + "epoll", + "evdev-rs", + "inotify", "lazy_static", "libc", + "widestring 1.0.2", "winapi 0.3.9", "x11", ] @@ -3994,7 +4026,7 @@ dependencies = [ "cfg-if 1.0.0", "clap 3.2.12", "clipboard", - "cocoa 0.24.0", + "cocoa", "core-foundation 0.9.3", "core-graphics 0.22.3", "cpal", @@ -4936,7 +4968,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76863575f7842ed64fda361f417a787efa82811b4617267709066969cd4ccf3b" dependencies = [ - "cocoa 0.24.0", + "cocoa", "core-graphics 0.22.3", "gtk", "libappindicator", @@ -5348,6 +5380,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + [[package]] name = "winapi" version = "0.2.8" @@ -5421,7 +5459,7 @@ checksum = "0c643e10139d127d30d6d753398c8a6f0a43532e8370f6c9d29ebbff29b984ab" dependencies = [ "bitflags", "err-derive", - "widestring", + "widestring 0.4.3", "winapi 0.3.9", ] @@ -5548,7 +5586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" dependencies = [ "bitflags", - "cocoa 0.24.0", + "cocoa", "core-foundation 0.9.3", "core-graphics 0.22.3", "core-video-sys", diff --git a/libs/enigo/src/linux/nix_impl.rs b/libs/enigo/src/linux/nix_impl.rs index c660bd08c..7a8f6668e 100644 --- a/libs/enigo/src/linux/nix_impl.rs +++ b/libs/enigo/src/linux/nix_impl.rs @@ -156,7 +156,6 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { if self.is_x11 { - dbg!(key); if self.pynput.send_pynput(&key, false) { return; } diff --git a/src/server/input_service.rs b/src/server/input_service.rs index c350e8d04..629ed17e4 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -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) { if EXITING.load(Ordering::SeqCst) { @@ -832,6 +837,9 @@ fn handle_key_(evt: &KeyEvent) { KeyboardMode::Map => { map_keyboard_mode(evt); } + KeyboardMode::Translate => { + translate_keyboard_mode(evt); + } _ => { legacy_keyboard_mode(evt); } From 92c4ee15608d2b6eea0e7c6b1159ddee2f124989 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 1 Aug 2022 00:52:07 +0800 Subject: [PATCH 041/113] Fix character generation, altgr only takes effect locally --- Cargo.lock | 2 +- src/ui/remote.rs | 41 ++++++++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 833cbe12a..9d807f12e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#c3a896bcb4a10d171dee1aa685c90abadf8946d2" +source = "git+https://github.com/asur4s/rdev#d009906ba983f26c7b6f6f1a5e3c76bf43164294" dependencies = [ "cocoa", "core-foundation 0.9.3", diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 1b5331609..213158bfc 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -43,7 +43,7 @@ use hbb_common::{ Stream, }; use hbb_common::{config::TransferSerde, fs::TransferJobMeta}; -use rdev::{Event, EventType::*, Key as RdevKey}; +use rdev::{Event, EventType::*, Key as RdevKey, Keyboard as RdevKeyboard, KeyboardState}; #[cfg(windows)] use crate::clipboard_file::*; @@ -58,6 +58,7 @@ lazy_static::lazy_static! { static ref ENIGO: Arc> = Arc::new(Mutex::new(Enigo::new())); static ref VIDEO: Arc>> = Default::default(); static ref TO_RELEASE: Arc>> = Arc::new(Mutex::new(HashSet::::new())); + static ref KEYBOARD: Arc> = Arc::new(Mutex::new(RdevKeyboard::new().unwrap())); } fn get_key_state(key: enigo::Key) -> bool { @@ -333,9 +334,6 @@ impl Handler { _ => return, }; - #[cfg(target_os = "windows")] - let _key = rdev::get_win_key(evt.code.into(), evt.scan_code); - me.key_down_or_up(down, _key, evt); }; if let Err(error) = rdev::listen(func) { @@ -785,7 +783,7 @@ impl Handler { fn leave(&mut self) { for key in TO_RELEASE.lock().unwrap().iter() { - self.map_keyboard_mode(false, *key) + self.map_keyboard_mode(false, *key, None) } #[cfg(windows)] crate::platform::windows::stop_system_key_propagate(false); @@ -1036,8 +1034,15 @@ impl Handler { } } - fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey) { + fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Option) { // map mode(1): Send keycode according to the peer platform. + #[cfg(target_os = "windows")] + let key = if let Some(e) = evt { + rdev::get_win_key(e.code.into(), e.scan_code) + } else { + key + }; + let peer = self.peer_platform(); let mut key_event = KeyEvent::new(); @@ -1067,8 +1072,20 @@ impl Handler { fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { // translate mode(2): locally generated characters are send to the peer. - let string = evt.name.unwrap_or_default(); + // get char + let string = match KEYBOARD.lock() { + Ok(mut keyboard) => { + let string = keyboard.add(&evt.event_type).unwrap_or_default(); + if keyboard.last_is_dead && string == "" { + return; + } + string + } + Err(_) => "".to_owned(), + }; + + // maybe two string let chars = if string == "" { None } else { @@ -1096,7 +1113,13 @@ impl Handler { } else { TO_RELEASE.lock().unwrap().remove(&key); } - self.map_keyboard_mode(down_or_up, key); + // algr without action + // Control left + if key == RdevKey::AltGr || evt.scan_code == 541 { + return; + } + dbg!(key); + self.map_keyboard_mode(down_or_up, key, None); } } @@ -1369,7 +1392,7 @@ impl Handler { } else { TO_RELEASE.lock().unwrap().remove(&key); } - self.map_keyboard_mode(down_or_up, key); + self.map_keyboard_mode(down_or_up, key, Some(evt)); } KeyboardMode::Legacy => self.legacy_keyboard_mode(down_or_up, key, evt), KeyboardMode::Translate => { From 7775a14c9e9ad7e231b317372f6830e20b714902 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 2 Aug 2022 03:47:29 -0700 Subject: [PATCH 042/113] Use keycode mapping table --- Cargo.lock | 11 +++++++++++ Cargo.toml | 3 +++ src/server/input_service.rs | 9 +++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 833cbe12a..e341ff459 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4053,6 +4053,7 @@ dependencies = [ "mouce", "num_cpus", "objc", + "once_cell", "parity-tokio-ipc", "rdev", "repng", @@ -4071,6 +4072,7 @@ dependencies = [ "simple_rc", "sys-locale", "sysinfo", + "tfc", "tray-item", "trayicon", "uuid", @@ -4755,6 +4757,15 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +[[package]] +name = "tfc" +version = "0.6.1" +source = "git+https://github.com/asur4s/The-Fat-Controller#35ed0bc8dd8516bdb99e45ebfc94409637a92c6b" +dependencies = [ + "core-graphics 0.22.3", + "unicode-segmentation", +] + [[package]] name = "thiserror" version = "1.0.31" diff --git a/Cargo.toml b/Cargo.toml index 825f0d739..20ec129ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,6 +73,8 @@ sys-locale = "0.2" enigo = { path = "libs/enigo", features = [ "with_serde" ] } clipboard = { path = "libs/clipboard" } rdev = { git = "https://github.com/asur4s/rdev" } +tfc = { git = "https://github.com/asur4s/The-Fat-Controller" } +once_cell = "1.13.0" ctrlc = "3.2" arboard = "2.0" #minreq = { version = "2.4", features = ["punycode", "https-native"] } @@ -103,6 +105,7 @@ async-process = "1.3" mouce = { git="https://github.com/fufesou/mouce.git" } evdev = { git="https://github.com/fufesou/evdev" } + [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.11" jni = "0.19" diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 629ed17e4..e3ac41a59 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -9,6 +9,7 @@ use std::{ sync::atomic::{AtomicBool, Ordering}, time::Instant, }; +use tfc::{traits::*, Context}; #[derive(Default)] struct StateCursor { @@ -179,6 +180,7 @@ lazy_static::lazy_static! { }; static ref KEYS_DOWN: Arc>> = Default::default(); static ref LATEST_INPUT: Arc> = Default::default(); + static ref KBD_CONTEXT: Mutex = Mutex::new(Context::new().expect("kbd context error")); } static EXITING: AtomicBool = AtomicBool::new(false); @@ -820,9 +822,12 @@ 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); + if evt.down { + KBD_CONTEXT.lock().unwrap().unicode_char_down(chr).expect("unicode_char_down error"); + } else { + KBD_CONTEXT.lock().unwrap().unicode_char_up(chr).expect("unicode_char_up error"); + } } fn handle_key_(evt: &KeyEvent) { From 5dfc41a7b8c462f0d1e952098ef37e0186990bfd Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 2 Aug 2022 06:07:44 -0700 Subject: [PATCH 043/113] Ignore dead keys in Linux --- Cargo.lock | 2 +- src/ui/remote.rs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d4131d41..24418f0a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#d009906ba983f26c7b6f6f1a5e3c76bf43164294" +source = "git+https://github.com/asur4s/rdev#c1175a394d811473e87ea79cb9a511a0f9b71764" dependencies = [ "cocoa", "core-foundation 0.9.3", diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 213158bfc..203a20614 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1077,7 +1077,17 @@ impl Handler { let string = match KEYBOARD.lock() { Ok(mut keyboard) => { let string = keyboard.add(&evt.event_type).unwrap_or_default(); - if keyboard.last_is_dead && string == "" { + #[cfg(target_os = "windows")] + let is_dead = keyboard.last_is_dead; + #[cfg(target_os = "linux")] + let is_dead = unsafe { + CStr::from_ptr(XKeysymToString(*keyboard.keysym)) + .to_str() + .unwrap_or_default() + .to_owned() + .starts_with("dead") + }; + if is_dead && string == "" { return; } string From 90b36795ea7545254fdda34cfdfeb9c51d08bd61 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 2 Aug 2022 10:48:56 -0700 Subject: [PATCH 044/113] Listening for char in Linux --- Cargo.lock | 5 +++-- src/ui/remote.rs | 12 +++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24418f0a5..af872e57d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#c1175a394d811473e87ea79cb9a511a0f9b71764" +source = "git+https://github.com/asur4s/rdev#d6499d2e582bf3549aa4ba33cfd3fbbdfce10947" dependencies = [ "cocoa", "core-foundation 0.9.3", @@ -4760,10 +4760,11 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/asur4s/The-Fat-Controller#35ed0bc8dd8516bdb99e45ebfc94409637a92c6b" +source = "git+https://github.com/asur4s/The-Fat-Controller#6587681075fa312a0d69587721d1ff84d8fa2970" dependencies = [ "core-graphics 0.22.3", "unicode-segmentation", + "winapi 0.3.9", ] [[package]] diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 203a20614..994cd04b2 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1034,10 +1034,10 @@ impl Handler { } } - fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Option) { + fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, _evt: Option) { // map mode(1): Send keycode according to the peer platform. #[cfg(target_os = "windows")] - let key = if let Some(e) = evt { + let key = if let Some(e) = _evt { rdev::get_win_key(e.code.into(), e.scan_code) } else { key @@ -1080,13 +1080,7 @@ impl Handler { #[cfg(target_os = "windows")] let is_dead = keyboard.last_is_dead; #[cfg(target_os = "linux")] - let is_dead = unsafe { - CStr::from_ptr(XKeysymToString(*keyboard.keysym)) - .to_str() - .unwrap_or_default() - .to_owned() - .starts_with("dead") - }; + let is_dead = keyboard.is_dead(); if is_dead && string == "" { return; } From 0695d50b9f0317a314942d8e2593152b284a2b38 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 2 Aug 2022 11:04:36 -0700 Subject: [PATCH 045/113] Fix Shift release failed --- src/ui/remote.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 994cd04b2..dad3e9ae0 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1081,7 +1081,7 @@ impl Handler { let is_dead = keyboard.last_is_dead; #[cfg(target_os = "linux")] let is_dead = keyboard.is_dead(); - if is_dead && string == "" { + if is_dead && string == "" && down_or_up == true { return; } string From d0702ddfd90ce467fd12fee1a9fceafe50e9a7d5 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 3 Aug 2022 14:34:05 +0800 Subject: [PATCH 046/113] Add translate mode in UI --- src/ui/header.tis | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ui/header.tis b/src/ui/header.tis index def2ab9f7..3d8510f80 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -151,6 +151,7 @@ class Header: Reactor.Component {
  • {svg_checkmark}{translate('Legacy mode')}
  • {svg_checkmark}{translate('Map mode')}
  • +
  • {svg_checkmark}{translate('Translate mode')}
  • ; } @@ -367,6 +368,8 @@ class Header: Reactor.Component { handler.save_keyboard_mode("legacy"); } else if (me.id == "map") { handler.save_keyboard_mode("map"); + } else if (me.id == "translate") { + handler.save_keyboard_mode("translate"); } toggleMenuState() } From b3b50829f53c4bb33a0cffacc08102224958549e Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 3 Aug 2022 14:52:08 +0800 Subject: [PATCH 047/113] Fix sycn of CapsLock --- src/server/input_service.rs | 5 +++++ src/ui/remote.rs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index e3ac41a59..0154da085 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -822,6 +822,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } fn translate_keyboard_mode(evt: &KeyEvent) { + // Caps affects the keycode map of the peer system(Linux). + let mut en = ENIGO.lock().unwrap(); + if en.get_key_state(Key::CapsLock){ + rdev_key_click(RdevKey::CapsLock); + } let chr = char::from_u32(evt.chr()).unwrap_or_default(); if evt.down { KBD_CONTEXT.lock().unwrap().unicode_char_down(chr).expect("unicode_char_down error"); diff --git a/src/ui/remote.rs b/src/ui/remote.rs index dad3e9ae0..6625c83fa 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1122,6 +1122,10 @@ impl Handler { if key == RdevKey::AltGr || evt.scan_code == 541 { return; } + // Caps affects the keycode map of the peer system(Linux). + if key == RdevKey::CapsLock { + return; + } dbg!(key); self.map_keyboard_mode(down_or_up, key, None); } From 12129ebf3e5128838c4bc7e2c91429920ca171f9 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 3 Aug 2022 15:33:16 +0800 Subject: [PATCH 048/113] Update dependencies --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index af872e57d..98623611b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4760,7 +4760,7 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/asur4s/The-Fat-Controller#6587681075fa312a0d69587721d1ff84d8fa2970" +source = "git+https://github.com/asur4s/The-Fat-Controller#14d49063c8fc9a02c68c0dc842e8d6bb6c5e7713" dependencies = [ "core-graphics 0.22.3", "unicode-segmentation", From 05b157af455f09175f8fe2acf2aa7e222ff536bf Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 4 Aug 2022 17:26:06 +0800 Subject: [PATCH 049/113] Fix right ctrl #1166 --- src/server/connection.rs | 2 +- src/ui/cm.rs | 1 - src/ui/remote.rs | 7 ++++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index f68c13895..90548afc7 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -6,7 +6,7 @@ use crate::common::update_clipboard; use crate::video_service; #[cfg(any(target_os = "android", target_os = "ios"))] use crate::{common::MOBILE_INFO2, mobile::connection_manager::start_channel}; -use crate::{ipc, VERSION}; +use crate::{ipc}; use hbb_common::{ config::Config, fs, diff --git a/src/ui/cm.rs b/src/ui/cm.rs index 38bfc9359..e2d912c63 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -1,5 +1,4 @@ use crate::ipc::{self, new_listener, Connection, Data}; -use crate::VERSION; #[cfg(windows)] use clipboard::{ create_cliprdr_context, empty_clipboard, get_rx_clip_client, server_clip_file, set_conn_enabled, diff --git a/src/ui/remote.rs b/src/ui/remote.rs index bccd6ad79..9bf125cc0 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1189,7 +1189,7 @@ impl Handler { let alt = get_key_state(enigo::Key::Alt); #[cfg(windows)] let ctrl = { - let mut tmp = get_key_state(enigo::Key::Control); + let mut tmp = get_key_state(enigo::Key::Control) || get_key_state(enigo::Key::RightControl); unsafe { if IS_ALT_GR { if alt || key == RdevKey::AltGr { @@ -1204,8 +1204,8 @@ impl Handler { tmp }; #[cfg(not(windows))] - let ctrl = get_key_state(enigo::Key::Control); - let shift = get_key_state(enigo::Key::Shift); + let ctrl = get_key_state(enigo::Key::Control) || get_key_state(enigo::Key::RightControl); + let shift = get_key_state(enigo::Key::Shift) || get_key_state(enigo::Key::RightShift); #[cfg(windows)] let command = crate::platform::windows::get_win_key_state(); #[cfg(not(windows))] @@ -1389,6 +1389,7 @@ impl Handler { if down_or_up == true { key_event.down = true; } + dbg!(&key_event); self.send_key_event(key_event, KeyboardMode::Legacy) } From 2d0cdd83a27a83d47f57d2537e6b8a7b9bce0ac4 Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 4 Aug 2022 21:02:00 +0800 Subject: [PATCH 050/113] Update lang for keyboard mode --- src/lang/cn.rs | 1 + src/lang/cs.rs | 1 + src/lang/da.rs | 1 + src/lang/de.rs | 1 + src/lang/eo.rs | 1 + src/lang/es.rs | 1 + src/lang/fr.rs | 1 + src/lang/hu.rs | 1 + src/lang/id.rs | 1 + src/lang/it.rs | 1 + src/lang/ja.rs | 3 +++ src/lang/ptbr.rs | 1 + src/lang/ru.rs | 1 + src/lang/sk.rs | 1 + src/lang/template.rs | 1 + src/lang/tr.rs | 1 + src/lang/tw.rs | 1 + src/lang/vn.rs | 3 +++ 18 files changed, 22 insertions(+) diff --git a/src/lang/cn.rs b/src/lang/cn.rs index f433ab4d0..9a5a76250 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", "对方不允许连接"), ("Legacy mode", "传统模式"), ("Map mode", "1:1传输"), + ("Translate mode", "翻译模式"), ("Use temporary password", "使用临时密码"), ("Use permanent password", "使用固定密码"), ("Use both passwords", "同时使用两种密码"), diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 6007c5de9..aa03e1d23 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/da.rs b/src/lang/da.rs index 0981d432e..364e552a3 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/de.rs b/src/lang/de.rs index f5c8bb2dd..f9558bed9 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", "Verbindung abgelehnt"), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", "Temporäres Passwort verwenden"), ("Use permanent password", "Dauerhaftes Passwort verwenden"), ("Use both passwords", "Beide Passwörter verwenden"), diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 67d08c5c2..ad4a2f93a 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/es.rs b/src/lang/es.rs index e34757b8c..73a38dacd 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -302,6 +302,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Connection not allowed", "Conexión no disponible"), ("Use temporary password", "Usar contraseña temporal"), ("Use permanent password", "Usar contraseña permamente"), diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 81c039c0a..3553a5b17 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 432b88115..8a57378ea 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/id.rs b/src/lang/id.rs index 4b1de4330..422851c77 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -302,6 +302,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Connection not allowed", "Koneksi tidak dijinkan"), ("Use temporary password", "Gunakan kata sandi sementara"), ("Use permanent password", "Gunakan kata sandi permanaen"), diff --git a/src/lang/it.rs b/src/lang/it.rs index 661feec02..c98c53100 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 5c6ba1da7..82d91993e 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -288,6 +288,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Ignore Battery Optimizations", "バッテリーの最適化を無効にする"), ("android_open_battery_optimizations_tip", "この機能を使わない場合は、次のRestDeskアプリ設定ページから「バッテリー」に進み、「制限なし」の選択を外してください"), ("Connection not allowed", "接続が許可されていません"), + ("Legacy mode", ""), + ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", "使い捨てのパスワードを使用"), ("Use permanent password", "固定のパスワードを使用"), ("Use both passwords", "どちらのパスワードも使用"), diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 821429389..dea8197b2 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 74536cd23..490fb32e0 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", "Подключение не разрешено"), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", "Использовать временный пароль"), ("Use permanent password", "Использовать постоянный пароль"), ("Use both passwords", "Использовать оба пароля"), diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 23b5bacf7..7a78e2090 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/template.rs b/src/lang/template.rs index 9a24d6d42..f37d84b60 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", ""), ("Use permanent password", ""), ("Use both passwords", ""), diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 85f7b13fc..4b0d6ccb3 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -302,6 +302,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", ""), ("Legacy mode", ""), ("Map mode", ""), + ("Translate mode", ""), ("Connection not allowed", "bağlantıya izin verilmedi"), ("Use temporary password", "Geçici şifre kullan"), ("Use permanent password", "Kalıcı şifre kullan"), diff --git a/src/lang/tw.rs b/src/lang/tw.rs index bcf4e2800..a294acac2 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -290,6 +290,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Connection not allowed", "對方不允許連接"), ("Legacy mode", "傳統模式"), ("Map mode", "1:1傳輸"), + ("Translate mode", "翻譯模式"), ("Use temporary password", "使用臨時密碼"), ("Use permanent password", "使用固定密碼"), ("Use both passwords", "同時使用兩種密碼"), diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 014dcb20e..55570dc40 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -288,6 +288,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Ignore Battery Optimizations", "Bỏ qua các tối ưu pin"), ("android_open_battery_optimizations_tip", "Nếu bạn muốn tắt tính năng này, vui lòng chuyển đến trang cài đặt ứng dụng RustDesk tiếp theo, tìm và nhập [Pin], Bỏ chọn [Không hạn chế]"), ("Connection not allowed", "Kết nối không đuợc phép"), + ("Legacy mode", ""), + ("Map mode", ""), + ("Translate mode", ""), ("Use temporary password", "Sử dụng mật khẩu tạm thời"), ("Use permanent password", "Sử dụng mật khẩu vĩnh viễn"), ("Use both passwords", "Sử dụng cả hai mật khẩu"), From b2cf11f2df89a7a0a6b38d29f91cc3f5b494a826 Mon Sep 17 00:00:00 2001 From: Asura Date: Sun, 7 Aug 2022 10:50:31 +0800 Subject: [PATCH 051/113] Send caps lock key --- src/ui/remote.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 9bf125cc0..3a694dd50 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1125,16 +1125,10 @@ impl Handler { } else { TO_RELEASE.lock().unwrap().remove(&key); } - // algr without action - // Control left + // AltGr && LeftControl(SpecialKey) without action if key == RdevKey::AltGr || evt.scan_code == 541 { return; } - // Caps affects the keycode map of the peer system(Linux). - if key == RdevKey::CapsLock { - return; - } - dbg!(key); self.map_keyboard_mode(down_or_up, key, None); } } From dde6df82e8b67f1c3a74104d3185f320a702e947 Mon Sep 17 00:00:00 2001 From: Asura Date: Sun, 7 Aug 2022 18:52:32 +0800 Subject: [PATCH 052/113] Refector: handline dead keys in translation mode --- Cargo.lock | 60 +----------------------------------------------- src/ui/remote.rs | 6 +---- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca3c29392..09ac0686d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1309,16 +1309,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "epoll" -version = "4.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20df693c700404f7e19d4d6fae6b15215d2913c27955d2b9d6f2c0f537511cd0" -dependencies = [ - "bitflags", - "libc", -] - [[package]] name = "err-derive" version = "0.3.1" @@ -1353,29 +1343,6 @@ dependencies = [ "nix 0.23.1", ] -[[package]] -name = "evdev-rs" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db51abf6b3205a6e6e8dd68d7a5414d7c50d61736a6f4c9b97df86ef5567cf" -dependencies = [ - "bitflags", - "evdev-sys", - "libc", - "log", -] - -[[package]] -name = "evdev-sys" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ead42b547b15d47089c1243d907bcf0eb94e457046d3b315a26ac9c9e9ea6d" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "event-listener" version = "2.5.2" @@ -2348,28 +2315,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "inotify" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf888f9575c290197b2c948dc9e9ff10bd1a39ad1ea8585f734585fa6b9d3f9" -dependencies = [ - "bitflags", - "futures-core", - "inotify-sys", - "libc", - "tokio", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - [[package]] name = "instant" version = "0.1.12" @@ -3795,16 +3740,13 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#d6499d2e582bf3549aa4ba33cfd3fbbdfce10947" +source = "git+https://github.com/asur4s/rdev#3b440f7ff9d622b08eb83146ea3e5e529769a6c2" dependencies = [ "cocoa", "core-foundation 0.9.3", "core-foundation-sys 0.8.3", "core-graphics 0.22.3", "enum-map", - "epoll", - "evdev-rs", - "inotify", "lazy_static", "libc", "widestring 1.0.2", diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 3a694dd50..e6c4109a6 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1085,11 +1085,7 @@ impl Handler { let string = match KEYBOARD.lock() { Ok(mut keyboard) => { let string = keyboard.add(&evt.event_type).unwrap_or_default(); - #[cfg(target_os = "windows")] - let is_dead = keyboard.last_is_dead; - #[cfg(target_os = "linux")] - let is_dead = keyboard.is_dead(); - if is_dead && string == "" && down_or_up == true { + if keyboard.is_dead() && string == "" && down_or_up == true { return; } string From 577cce549f93d8174ef8a920738f26e0c4243c67 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 8 Aug 2022 15:48:11 +0800 Subject: [PATCH 053/113] Update Cargo.lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 09ac0686d..6d1878ddb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4712,7 +4712,7 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/asur4s/The-Fat-Controller#14d49063c8fc9a02c68c0dc842e8d6bb6c5e7713" +source = "git+https://github.com/asur4s/The-Fat-Controller#34ee2472e6a88dd8f0e28113d50130d93cf8a572" dependencies = [ "core-graphics 0.22.3", "unicode-segmentation", From b916ef36599f15248133bb30596d2777cfd5f8cd Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 11 Aug 2022 23:59:18 -0700 Subject: [PATCH 054/113] Refactor translate mode --- Cargo.lock | 4 ++-- src/server/input_service.rs | 12 +++--------- src/ui/remote.rs | 7 ++----- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d1878ddb..8ad3970d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3740,7 +3740,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#3b440f7ff9d622b08eb83146ea3e5e529769a6c2" +source = "git+https://github.com/asur4s/rdev#895c8fb1a6106714793e8877d35d2b7a1c57ce9c" dependencies = [ "cocoa", "core-foundation 0.9.3", @@ -4712,7 +4712,7 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/asur4s/The-Fat-Controller#34ee2472e6a88dd8f0e28113d50130d93cf8a572" +source = "git+https://github.com/asur4s/The-Fat-Controller#25bfa7ef1cb0bd0b522cc4155dea6b99673bcfd4" dependencies = [ "core-graphics 0.22.3", "unicode-segmentation", diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 0154da085..2093395c8 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -822,16 +822,10 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } fn translate_keyboard_mode(evt: &KeyEvent) { - // Caps affects the keycode map of the peer system(Linux). - let mut en = ENIGO.lock().unwrap(); - if en.get_key_state(Key::CapsLock){ - rdev_key_click(RdevKey::CapsLock); - } let chr = char::from_u32(evt.chr()).unwrap_or_default(); - if evt.down { - KBD_CONTEXT.lock().unwrap().unicode_char_down(chr).expect("unicode_char_down error"); - } else { - KBD_CONTEXT.lock().unwrap().unicode_char_up(chr).expect("unicode_char_up error"); + // down(true)->press && press(false)-> release + if evt.down && !evt.press { + KBD_CONTEXT.lock().unwrap().unicode_char(chr).expect("unicode_char_down error"); } } diff --git a/src/ui/remote.rs b/src/ui/remote.rs index e6c4109a6..f26150f31 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1108,11 +1108,8 @@ impl Handler { let mut key_event = KeyEvent::new(); key_event.set_chr(chr as _); key_event.down = true; - self.send_key_event(key_event, KeyboardMode::Translate); - - let mut key_event = KeyEvent::new(); - key_event.set_chr(chr as _); - key_event.down = false; + key_event.press = false; + self.send_key_event(key_event, KeyboardMode::Translate); } } else { From 8310f38c15bdfcb9c8a8af94cfa84819ed07f2ee Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 12 Aug 2022 00:05:31 -0700 Subject: [PATCH 055/113] Fix repeatedly releasing keys without char --- src/ui/remote.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index f26150f31..3d90ac73f 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1113,16 +1113,19 @@ impl Handler { self.send_key_event(key_event, KeyboardMode::Translate); } } else { - if down_or_up == true { - TO_RELEASE.lock().unwrap().insert(key); + let success = if down_or_up == true { + TO_RELEASE.lock().unwrap().insert(key) } else { - TO_RELEASE.lock().unwrap().remove(&key); - } + TO_RELEASE.lock().unwrap().remove(&key) + }; + // AltGr && LeftControl(SpecialKey) without action if key == RdevKey::AltGr || evt.scan_code == 541 { return; } - self.map_keyboard_mode(down_or_up, key, None); + if success{ + self.map_keyboard_mode(down_or_up, key, None); + } } } From e7e846cd42a1297f5ecd31ba1b4167f17e9dbfc7 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 12 Aug 2022 19:32:42 +0800 Subject: [PATCH 056/113] Fix mouse input error #1032 --- src/ui/remote.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 3d90ac73f..bcb79c522 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -301,6 +301,8 @@ impl Handler { m.insert(RdevKey::ControlRight, false); m.insert(RdevKey::Alt, false); m.insert(RdevKey::AltGr, false); + m.insert(RdevKey::MetaLeft, false); + m.insert(RdevKey::MetaRight, false); Mutex::new(m) }; } @@ -816,7 +818,7 @@ impl Handler { command = true; } } - + send_mouse(mask, x, y, alt, ctrl, shift, command, self); // on macos, ctrl + left button down = right button down, up won't emit, so we need to // emit up myself if peer is not macos @@ -1379,7 +1381,6 @@ impl Handler { if down_or_up == true { key_event.down = true; } - dbg!(&key_event); self.send_key_event(key_event, KeyboardMode::Legacy) } From 48ab5e502402ff83e6882ada59bb2324993405ee Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 13 Aug 2022 08:12:45 +0800 Subject: [PATCH 057/113] Fix command+tab #1032 --- src/server/input_service.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 2093395c8..c01212184 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -683,6 +683,14 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { let mut disable_numlock = false; #[cfg(target_os = "macos")] en.reset_flag(); + // When long-pressed the command key, then press and release + // the Tab key, there should be CGEventFlagCommand in the flag. + #[cfg(target_os = "macos")] + for ck in evt.modifiers.iter(){ + if let Some(key) = KEY_MAP.get(&ck.value()){ + en.add_flag(key); + } + } #[cfg(not(target_os = "macos"))] let mut to_release = Vec::new(); #[cfg(not(target_os = "macos"))] @@ -710,8 +718,6 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { continue; } } - #[cfg(target_os = "macos")] - en.add_flag(key); #[cfg(not(target_os = "macos"))] { if key == &Key::CapsLock { From 3172ed63f361d00b6c5582dd2dd02652f2cdcfa0 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 19 Aug 2022 14:50:32 +0800 Subject: [PATCH 058/113] Fix compile error on MacOS --- src/ui/cm.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/cm.rs b/src/ui/cm.rs index f1b4eaf72..f722f8372 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -1,4 +1,6 @@ -use crate::ipc::{self, new_listener, Connection, Data, start_pa}; +use crate::ipc::{self, new_listener, Connection, Data}; +#[cfg(windows)] +use crate::ipc::{start_pa}; #[cfg(windows)] use crate::ipc::start_clipboard_file; use crate::VERSION; From b38c3299d840a91fceace6c832d87e975e960c29 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 24 Aug 2022 17:10:34 -0700 Subject: [PATCH 059/113] fix: can't find rustdesk.so --- flutter/lib/models/native_model.dart | 2 +- flutter/linux/CMakeLists.txt | 8 +- flutter/linux/main.cc | 3 +- .../Flutter/GeneratedPluginRegistrant.swift | 38 ++ flutter/pubspec.lock | 384 +++++++++--------- src/flutter.rs | 2 +- 6 files changed, 240 insertions(+), 197 deletions(-) create mode 100644 flutter/macos/Flutter/GeneratedPluginRegistrant.swift diff --git a/flutter/lib/models/native_model.dart b/flutter/lib/models/native_model.dart index 55f2d0e79..3359e1c4f 100644 --- a/flutter/lib/models/native_model.dart +++ b/flutter/lib/models/native_model.dart @@ -97,7 +97,7 @@ class PlatformFFI { final dylib = Platform.isAndroid ? DynamicLibrary.open('librustdesk.so') : Platform.isLinux - ? DynamicLibrary.open("/usr/lib/rustdesk/librustdesk.so") + ? DynamicLibrary.open("librustdesk.so") : Platform.isWindows ? DynamicLibrary.open("librustdesk.dll") : Platform.isMacOS diff --git a/flutter/linux/CMakeLists.txt b/flutter/linux/CMakeLists.txt index 9f6d0ce52..8484ca5b6 100644 --- a/flutter/linux/CMakeLists.txt +++ b/flutter/linux/CMakeLists.txt @@ -74,6 +74,8 @@ corrosion_import_crate(MANIFEST_PATH ../../Cargo.toml # [FEATURES ... ] ) +set(BASE_RUSTDESK "librustdesk") + # Define the application target. To change its name, change BINARY_NAME above, # not the value here, or `flutter run` will no longer work. # @@ -91,8 +93,8 @@ apply_standard_settings(${BINARY_NAME}) # Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) - -target_link_libraries(${BINARY_NAME} PRIVATE librustdesk) +target_link_libraries(${BINARY_NAME} PRIVATE ${BASE_RUSTDESK}) +# target_link_libraries(${BINARY_NAME} PRIVATE librustdesk) # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) @@ -142,6 +144,8 @@ foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) COMPONENT Runtime) endforeach(bundled_library) +install(FILES $ DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime RENAME librustdesk.so) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") diff --git a/flutter/linux/main.cc b/flutter/linux/main.cc index 55fb650bc..e2ad70957 100644 --- a/flutter/linux/main.cc +++ b/flutter/linux/main.cc @@ -1,7 +1,8 @@ #include #include "my_application.h" -#define RUSTDESK_LIB_PATH "/usr/lib/rustdesk/librustdesk.so" +#define RUSTDESK_LIB_PATH "ibrustdesk.so" +// #define RUSTDESK_LIB_PATH "/usr/lib/rustdesk/librustdesk.so" typedef bool (*RustDeskCoreMain)(); bool flutter_rustdesk_core_main() { diff --git a/flutter/macos/Flutter/GeneratedPluginRegistrant.swift b/flutter/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 000000000..fcbc0f6bf --- /dev/null +++ b/flutter/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,38 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import desktop_drop +import desktop_multi_window +import device_info_plus_macos +import firebase_analytics +import firebase_core +import package_info_plus_macos +import path_provider_macos +import screen_retriever +import shared_preferences_macos +import sqflite +import tray_manager +import url_launcher_macos +import wakelock_macos +import window_manager + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin")) + FlutterMultiWindowPlugin.register(with: registry.registrar(forPlugin: "FlutterMultiWindowPlugin")) + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) + FLTFirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAnalyticsPlugin")) + FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) + FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) + TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) + WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) +} diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index fef32af73..dffb58bf8 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -5,231 +5,231 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "46.0.0" after_layout: dependency: transitive description: name: after_layout - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.6.0" animations: dependency: transitive description: name: animations - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3" archive: dependency: transitive description: name: archive - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.3.1" args: dependency: transitive description: name: args - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.3.1" async: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.9.0" + version: "2.8.2" back_button_interceptor: dependency: "direct main" description: name: back_button_interceptor - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.0.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" build: dependency: transitive description: name: build - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.3.0" build_config: dependency: transitive description: name: build_config - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" build_daemon: dependency: transitive description: name: build_daemon - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" build_resolvers: dependency: transitive description: name: build_resolvers - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.9" build_runner: dependency: "direct dev" description: name: build_runner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" build_runner_core: dependency: transitive description: name: build_runner_core - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "7.2.3" built_collection: dependency: transitive description: name: built_collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "8.4.0" + version: "8.4.1" cached_network_image: dependency: transitive description: name: cached_network_image - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.1" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" characters: dependency: transitive description: name: characters - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" checked_yaml: dependency: transitive description: name: checked_yaml - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" clock: dependency: transitive description: name: clock - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.0" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.2.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.16.0" contextmenu: dependency: "direct main" description: name: contextmenu - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" convert: dependency: transitive description: name: convert - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.2" cross_file: dependency: transitive description: name: cross_file - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.3+1" crypto: dependency: transitive description: name: crypto - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.5" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.3" dash_chat_2: @@ -245,7 +245,7 @@ packages: dependency: "direct main" description: name: desktop_drop - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.3" desktop_multi_window: @@ -261,133 +261,133 @@ packages: dependency: "direct main" description: name: device_info_plus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.1.2" device_info_plus_linux: dependency: transitive description: name: device_info_plus_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" device_info_plus_macos: dependency: transitive description: name: device_info_plus_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" device_info_plus_web: dependency: transitive description: name: device_info_plus_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" device_info_plus_windows: dependency: transitive description: name: device_info_plus_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" draggable_float_widget: dependency: "direct main" description: name: draggable_float_widget - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.2" event_bus: dependency: transitive description: name: event_bus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" external_path: dependency: "direct main" description: name: external_path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.0" ffi: dependency: "direct main" description: name: ffi - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" file: dependency: transitive description: name: file - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "6.1.2" + version: "6.1.4" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "9.3.1" + version: "9.3.2" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "3.3.1" + version: "3.3.2" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.4.2+1" + version: "0.4.2+2" firebase_core: dependency: transitive description: name: firebase_core - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.20.1" + version: "1.21.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.5.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.7.1" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" flutter: @@ -399,42 +399,42 @@ packages: dependency: transitive description: name: flutter_blurhash - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.7.0" flutter_breadcrumb: dependency: "direct main" description: name: flutter_breadcrumb - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.3.0" flutter_launcher_icons: dependency: "direct dev" description: name: flutter_launcher_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.9.3" flutter_parsed_text: dependency: transitive description: name: flutter_parsed_text - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.1" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.7" flutter_rust_bridge: @@ -460,483 +460,483 @@ packages: dependency: "direct dev" description: name: freezed - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0+1" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.3" get: dependency: "direct main" description: name: get - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.6.5" glob: dependency: transitive description: name: glob - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" graphs: dependency: transitive description: name: graphs - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" html: dependency: transitive description: name: html - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.15.0" http: dependency: "direct main" description: name: http - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.13.5" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.0.1" image: dependency: "direct main" description: name: image - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.0" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.8.5+3" image_picker_android: dependency: transitive description: name: image_picker_android - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.8.5+2" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.8" image_picker_ios: dependency: transitive description: name: image_picker_ios - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.8.5+6" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.6.1" intl: dependency: transitive description: name: intl - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.17.0" io: dependency: transitive description: name: io - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.6.4" json_annotation: dependency: transitive description: name: json_annotation - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.6.0" logging: dependency: transitive description: name: logging - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.12" + version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.1.4" menu_base: dependency: transitive description: name: menu_base - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.1" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.7.0" mime: dependency: transitive description: name: mime - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" nested: dependency: transitive description: name: nested - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" octo_image: dependency: transitive description: name: octo_image - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" package_config: dependency: transitive description: name: package_config - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" package_info_plus: dependency: "direct main" description: name: package_info_plus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.4.3+1" package_info_plus_linux: dependency: transitive description: name: package_info_plus_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.5" package_info_plus_macos: dependency: transitive description: name: package_info_plus_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" package_info_plus_web: dependency: transitive description: name: package_info_plus_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.5" package_info_plus_windows: dependency: transitive description: name: package_info_plus_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.8.1" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.19" path_provider_ios: dependency: transitive description: name: path_provider_ios - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.11" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.2" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.11.1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.0.0" platform: dependency: transitive description: name: platform - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.2" pool: dependency: transitive description: name: pool - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.1" process: dependency: transitive description: name: process - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.2.4" provider: dependency: "direct main" description: name: provider - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.0.3" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.1" pubspec_parse: dependency: transitive description: name: pubspec_parse - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" qr_code_scanner: dependency: "direct main" description: name: qr_code_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" quiver: dependency: transitive description: name: quiver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.27.5" screen_retriever: dependency: transitive description: name: screen_retriever - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.2" scroll_pos: dependency: "direct main" description: name: scroll_pos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.0" settings_ui: dependency: "direct main" description: name: settings_ui - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.15" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.12" shared_preferences_ios: dependency: transitive description: name: shared_preferences_ios - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.1" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.1" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.4" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.4" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.1" shelf: dependency: transitive description: name: shelf - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" shortid: dependency: transitive description: name: shortid - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.2" sky_engine: @@ -948,91 +948,91 @@ packages: dependency: transitive description: name: source_gen - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.2" source_span: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.8.2" sqflite: dependency: transitive description: name: sqflite - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.1+1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.0" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0+2" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.4.12" + version: "0.4.9" timing: dependency: transitive description: name: timing - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" toggle_switch: dependency: "direct main" description: name: toggle_switch - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.4.0" tray_manager: @@ -1048,182 +1048,182 @@ packages: dependency: "direct main" description: name: tuple - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.1.5" url_launcher_android: dependency: transitive description: name: url_launcher_android - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.0.17" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.13" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" uuid: dependency: transitive description: name: uuid - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.6" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.2" video_player: dependency: transitive description: name: video_player - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.4.6" video_player_android: dependency: transitive description: name: video_player_android - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.3.8" + version: "2.3.9" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.3.5" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.1.4" video_player_web: dependency: transitive description: name: video_player_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.12" visibility_detector: dependency: "direct main" description: name: visibility_detector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.3" wakelock: dependency: "direct main" description: name: wakelock - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.5.6" wakelock_macos: dependency: transitive description: name: wakelock_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.0" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.0" wakelock_web: dependency: transitive description: name: wakelock_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.0" wakelock_windows: dependency: transitive description: name: wakelock_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" win32: dependency: transitive description: name: win32 - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.7.0" window_manager: @@ -1234,33 +1234,33 @@ packages: resolved-ref: f1d69e5d0531af947373ec26ae22808f08b1aac6 url: "https://github.com/Kingtous/rustdesk_window_manager" source: git - version: "0.2.5" + version: "0.2.6" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.0+1" xml: dependency: transitive description: name: xml - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.1.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.1" zxing2: dependency: "direct main" description: name: zxing2 - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.0" sdks: diff --git a/src/flutter.rs b/src/flutter.rs index 928be607d..d64540cda 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -471,7 +471,7 @@ impl Session { } let mut msg_out = Message::new(); msg_out.set_key_event(key_event); - log::debug!("{:?}", msg_out); + // log::debug!("{:?}", msg_out); self.send_msg(msg_out); } From ee19a03ecc8172754d6605e3f5631d9cb949bc8e Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 26 Aug 2022 18:29:46 -0700 Subject: [PATCH 060/113] Convert keycode to RdevKey --- Cargo.lock | 75 ++++++------- Cargo.toml | 2 +- flutter/lib/desktop/pages/remote_page.dart | 120 ++++++++++++++------- flutter/lib/models/model.dart | 6 ++ src/client.rs | 2 +- src/flutter.rs | 10 ++ src/flutter_ffi.rs | 6 ++ src/ui/cm.rs | 2 +- 8 files changed, 147 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a037b4e33..3029e51ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -627,21 +627,6 @@ dependencies = [ "cc", ] -[[package]] -name = "cocoa" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667fdc068627a2816b9ff831201dd9864249d6ee8d190b9532357f1fc0f61ea7" -dependencies = [ - "bitflags", - "block", - "core-foundation 0.9.3", - "core-graphics 0.21.0", - "foreign-types", - "libc", - "objc", -] - [[package]] name = "cocoa" version = "0.24.0" @@ -759,18 +744,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-graphics" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a67c4378cf203eace8fb6567847eb641fd6ff933c1145a115c6ee820ebb978" -dependencies = [ - "bitflags", - "core-foundation 0.9.3", - "foreign-types", - "libc", -] - [[package]] name = "core-graphics" version = "0.22.3" @@ -1283,6 +1256,26 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "enum-map" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5a56d54c8dd9b3ad34752ed197a4eb2a6601bc010808eb097a04a58ae4c43e1" +dependencies = [ + "enum-map-derive", +] + +[[package]] +name = "enum-map-derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9045e2676cd5af83c3b167d917b0a5c90a4d8e266e2683d6631b235c457fc27" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "enum_dispatch" version = "0.3.8" @@ -3741,15 +3734,17 @@ dependencies = [ [[package]] name = "rdev" -version = "0.5.0" -source = "git+https://github.com/open-trade/rdev#fbbefd0b5d87095a7349965aec9ecd33de7035ac" +version = "0.5.0-2" +source = "git+https://github.com/asur4s/rdev#895c8fb1a6106714793e8877d35d2b7a1c57ce9c" dependencies = [ - "cocoa 0.22.0", - "core-foundation 0.7.0", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", + "cocoa", + "core-foundation 0.9.3", + "core-foundation-sys 0.8.3", + "core-graphics 0.22.3", + "enum-map", "lazy_static", "libc", + "widestring 1.0.2", "winapi 0.3.9", "x11", ] @@ -3967,7 +3962,7 @@ dependencies = [ "cfg-if 1.0.0", "clap 3.1.18", "clipboard", - "cocoa 0.24.0", + "cocoa", "core-foundation 0.9.3", "core-graphics 0.22.3", "cpal", @@ -4939,7 +4934,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76863575f7842ed64fda361f417a787efa82811b4617267709066969cd4ccf3b" dependencies = [ - "cocoa 0.24.0", + "cocoa", "core-graphics 0.22.3", "gtk", "libappindicator", @@ -5357,6 +5352,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + [[package]] name = "winapi" version = "0.2.8" @@ -5430,7 +5431,7 @@ checksum = "0c643e10139d127d30d6d753398c8a6f0a43532e8370f6c9d29ebbff29b984ab" dependencies = [ "bitflags", "err-derive", - "widestring", + "widestring 0.4.3", "winapi 0.3.9", ] @@ -5557,7 +5558,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" dependencies = [ "bitflags", - "cocoa 0.24.0", + "cocoa", "core-foundation 0.9.3", "core-graphics 0.22.3", "core-video-sys", diff --git a/Cargo.toml b/Cargo.toml index d65c9dde3..34ba9d2c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ sciter-rs = { git = "https://github.com/open-trade/rust-sciter", branch = "dyn" sys-locale = "0.2" enigo = { path = "libs/enigo", features = [ "with_serde" ] } clipboard = { path = "libs/clipboard" } -rdev = { git = "https://github.com/open-trade/rdev" } +rdev = { git = "https://github.com/asur4s/rdev" } ctrlc = "3.2" arboard = "2.0" #minreq = { version = "2.4", features = ["punycode", "https-native"] } diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 025db279f..c121fe1ab 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -234,6 +234,89 @@ class _RemotePageState extends State buildBody(context, ffiModel)))); } + KeyEventResult handleRawKeyEvent(FocusNode data, RawKeyEvent e) { + String? keyboardMode = Platform.environment['KEYBOARD_MODE']; + keyboardMode ??= 'legacy'; + + if (keyboardMode == 'map') { + mapKeyboardMode(e); + } else if (keyboardMode == 'translate') { + legacyKeyboardMode(e); + } else { + legacyKeyboardMode(e); + } + + return KeyEventResult.handled; + } + + void mapKeyboardMode(RawKeyEvent e) { + int scanCode; + int keyCode; + bool down; + + if (e.data is RawKeyEventDataMacOs) { + RawKeyEventDataMacOs newData = e.data as RawKeyEventDataMacOs; + scanCode = newData.keyCode; + keyCode = newData.keyCode; + } else if (e.data is RawKeyEventDataWindows) { + RawKeyEventDataWindows newData = e.data as RawKeyEventDataWindows; + scanCode = newData.scanCode; + keyCode = newData.keyCode; + } else if (e.data is RawKeyEventDataLinux) { + RawKeyEventDataLinux newData = e.data as RawKeyEventDataLinux; + scanCode = newData.scanCode; + keyCode = newData.keyCode; + debugPrint(newData.unicodeScalarValues.toString()); + } else { + scanCode = -1; + keyCode = -1; + } + + if (e is RawKeyDownEvent){ + down = true; + }else{ + down = false; + } + + _ffi.inputRawKey(keyCode, scanCode, down); + } + + void legacyKeyboardMode(RawKeyEvent e) { + final key = e.logicalKey; + if (e is RawKeyDownEvent) { + if (e.repeat) { + sendRawKey(e, press: true); + } else { + if (e.isAltPressed && !_ffi.alt) { + _ffi.alt = true; + } else if (e.isControlPressed && !_ffi.ctrl) { + _ffi.ctrl = true; + } else if (e.isShiftPressed && !_ffi.shift) { + _ffi.shift = true; + } else if (e.isMetaPressed && !_ffi.command) { + _ffi.command = true; + } + sendRawKey(e, down: true); + } + } + if (e is RawKeyUpEvent) { + if (key == LogicalKeyboardKey.altLeft || + key == LogicalKeyboardKey.altRight) { + _ffi.alt = false; + } else if (key == LogicalKeyboardKey.controlLeft || + key == LogicalKeyboardKey.controlRight) { + _ffi.ctrl = false; + } else if (key == LogicalKeyboardKey.shiftRight || + key == LogicalKeyboardKey.shiftLeft) { + _ffi.shift = false; + } else if (key == LogicalKeyboardKey.metaLeft || + key == LogicalKeyboardKey.metaRight) { + _ffi.command = false; + } + sendRawKey(e); + } + } + Widget getRawPointerAndKeyBody(Widget child) { return Consumer( builder: (context, FfiModel, _child) => MouseRegion( @@ -249,42 +332,7 @@ class _RemotePageState extends State onFocusChange: (bool v) { _imageFocused = v; }, - onKey: (data, e) { - final key = e.logicalKey; - if (e is RawKeyDownEvent) { - if (e.repeat) { - sendRawKey(e, press: true); - } else { - if (e.isAltPressed && !_ffi.alt) { - _ffi.alt = true; - } else if (e.isControlPressed && !_ffi.ctrl) { - _ffi.ctrl = true; - } else if (e.isShiftPressed && !_ffi.shift) { - _ffi.shift = true; - } else if (e.isMetaPressed && !_ffi.command) { - _ffi.command = true; - } - sendRawKey(e, down: true); - } - } - if (e is RawKeyUpEvent) { - if (key == LogicalKeyboardKey.altLeft || - key == LogicalKeyboardKey.altRight) { - _ffi.alt = false; - } else if (key == LogicalKeyboardKey.controlLeft || - key == LogicalKeyboardKey.controlRight) { - _ffi.ctrl = false; - } else if (key == LogicalKeyboardKey.shiftRight || - key == LogicalKeyboardKey.shiftLeft) { - _ffi.shift = false; - } else if (key == LogicalKeyboardKey.metaLeft || - key == LogicalKeyboardKey.metaRight) { - _ffi.command = false; - } - sendRawKey(e); - } - return KeyEventResult.handled; - }, + onKey: handleRawKeyEvent, child: child)))); } diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index dda22a779..889e13d21 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -980,6 +980,12 @@ class FFI { msg: json.encode(modify({'type': type, 'buttons': button.value}))); } + // Raw Key + void inputRawKey(int keyCode, int scanCode, bool down){ + debugPrint(scanCode.toString()); + bind.sessionInputRawKey(id: id, keycode: keyCode, scancode: scanCode, down: down); + } + /// Send key stroke event. /// [down] indicates the key's state(down or up). /// [press] indicates a click event(down and up). diff --git a/src/client.rs b/src/client.rs index 3c1e5c3c3..f3877e530 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1649,7 +1649,7 @@ pub enum Data { } /// Keycode for key events. -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum Key { ControlKey(ControlKey), Chr(u32), diff --git a/src/flutter.rs b/src/flutter.rs index d64540cda..559e7e0ad 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -373,6 +373,16 @@ impl Session { } } + pub fn input_raw_key(&self, keycode: i32, scancode: i32, down: bool){ + use rdev::{EventType::*, Key as RdevKey, *}; + if scancode < 0 || keycode < 0{ + return; + } + let key = rdev::key_from_scancode(scancode.try_into().unwrap()) as RdevKey; + + log::info!("{:?}", key); + } + /// Input a string of text. /// String is parsed into individual key presses. /// diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 53e3f1ff8..dee3f9dae 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -208,6 +208,12 @@ pub fn session_switch_display(id: String, value: i32) { } } +pub fn session_input_raw_key(id: String, keycode: i32, scancode:i32, down: bool){ + if let Some(session) = SESSIONS.read().unwrap().get(&id) { + session.input_raw_key(keycode, scancode, down); + } +} + pub fn session_input_key( id: String, name: String, diff --git a/src/ui/cm.rs b/src/ui/cm.rs index f722f8372..d9a1efc1f 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -1,5 +1,5 @@ use crate::ipc::{self, new_listener, Connection, Data}; -#[cfg(windows)] +#[cfg(target_os = "linux")] use crate::ipc::{start_pa}; #[cfg(windows)] use crate::ipc::start_clipboard_file; From 67a95cf864768996a8f3141f56c0110772fa14d1 Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 27 Aug 2022 10:01:04 +0800 Subject: [PATCH 061/113] Fix compile error on MacOS --- src/ui/remote.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 9294c6e2b..659f3f05a 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -42,14 +42,6 @@ use hbb_common::{ }, Stream, }; -use hbb_common::{config::TransferSerde, fs::TransferJobMeta}; -use hbb_common::{ - fs::{ - can_enable_overwrite_detection, get_job, get_string, new_send_confirm, DigestCheckResult, - RemoveJobMeta, - }, - get_version_number, -}; use rdev::{Event, EventType::*, Key as RdevKey, Keyboard as RdevKeyboard, KeyboardState}; #[cfg(windows)] From b3f83b98c7f2c23fd2889d1901f6f9697652eeea Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 26 Aug 2022 21:50:21 -0700 Subject: [PATCH 062/113] Fix flutter pub hostname --- flutter/pubspec.lock | 346 +++++++++++++++++++++---------------------- 1 file changed, 173 insertions(+), 173 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index c4492cace..4d0a07287 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -5,231 +5,231 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "46.0.0" after_layout: dependency: transitive description: name: after_layout - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.6.0" animations: dependency: transitive description: name: animations - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" archive: dependency: transitive description: name: archive - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.1" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.1" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.8.2" back_button_interceptor: dependency: "direct main" description: name: back_button_interceptor - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" build: dependency: transitive description: name: build - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.0" build_config: dependency: transitive description: name: build_config - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" build_daemon: dependency: transitive description: name: build_daemon - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" build_resolvers: dependency: transitive description: name: build_resolvers - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.9" build_runner: dependency: "direct dev" description: name: build_runner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" build_runner_core: dependency: transitive description: name: build_runner_core - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "7.2.3" built_collection: dependency: transitive description: name: built_collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "8.4.1" cached_network_image: dependency: transitive description: name: cached_network_image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" checked_yaml: dependency: transitive description: name: checked_yaml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.16.0" contextmenu: dependency: "direct main" description: name: contextmenu - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" cross_file: dependency: transitive description: name: cross_file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.3+1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.3" dash_chat_2: @@ -245,7 +245,7 @@ packages: dependency: "direct main" description: name: desktop_drop - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.3" desktop_multi_window: @@ -261,133 +261,133 @@ packages: dependency: "direct main" description: name: device_info_plus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.1.2" device_info_plus_linux: dependency: transitive description: name: device_info_plus_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_macos: dependency: transitive description: name: device_info_plus_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_web: dependency: transitive description: name: device_info_plus_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_windows: dependency: transitive description: name: device_info_plus_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.0" draggable_float_widget: dependency: "direct main" description: name: draggable_float_widget - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.2" event_bus: dependency: transitive description: name: event_bus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" external_path: dependency: "direct main" description: name: external_path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" ffi: dependency: "direct main" description: name: ffi - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.4" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "9.3.3" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.3" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.2+3" firebase_core: dependency: transitive description: name: firebase_core - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.21.1" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.5.1" firebase_core_web: dependency: transitive description: name: firebase_core_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.2" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" flutter: @@ -399,49 +399,49 @@ packages: dependency: transitive description: name: flutter_blurhash - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.7.0" flutter_breadcrumb: dependency: "direct main" description: name: flutter_breadcrumb - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.0" flutter_launcher_icons: dependency: "direct dev" description: name: flutter_launcher_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.9.3" flutter_lints: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" flutter_parsed_text: dependency: transitive description: name: flutter_parsed_text - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.7" flutter_rust_bridge: @@ -467,490 +467,490 @@ packages: dependency: "direct dev" description: name: freezed - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0+1" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" get: dependency: "direct main" description: name: get - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.6.5" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" graphs: dependency: transitive description: name: graphs - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" html: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.0" http: dependency: "direct main" description: name: http - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.13.5" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.1" image: dependency: "direct main" description: name: image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.0" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.8.5+3" image_picker_android: dependency: transitive description: name: image_picker_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.8.5+2" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.8" image_picker_ios: dependency: transitive description: name: image_picker_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.8.5+6" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.6.1" intl: dependency: transitive description: name: intl - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.0" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.4" json_annotation: dependency: transitive description: name: json_annotation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.6.0" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.4" menu_base: dependency: transitive description: name: menu_base - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" octo_image: dependency: transitive description: name: octo_image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" package_info_plus: dependency: "direct main" description: name: package_info_plus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.3+1" package_info_plus_linux: dependency: transitive description: name: package_info_plus_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" package_info_plus_macos: dependency: transitive description: name: package_info_plus_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" package_info_plus_web: dependency: transitive description: name: package_info_plus_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" package_info_plus_windows: dependency: transitive description: name: package_info_plus_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.1" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.20" path_provider_ios: dependency: transitive description: name: path_provider_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.11.1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.0.0" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.1" process: dependency: transitive description: name: process - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.4" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.3" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" pubspec_parse: dependency: transitive description: name: pubspec_parse - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.1" qr_code_scanner: dependency: "direct main" description: name: qr_code_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.27.5" screen_retriever: dependency: transitive description: name: screen_retriever - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.2" scroll_pos: dependency: "direct main" description: name: scroll_pos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.0" settings_ui: dependency: "direct main" description: name: settings_ui - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.15" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.12" shared_preferences_ios: dependency: transitive description: name: shared_preferences_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" shortid: dependency: transitive description: name: shortid - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.2" sky_engine: @@ -962,91 +962,91 @@ packages: dependency: transitive description: name: source_gen - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.2" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.2" sqflite: dependency: transitive description: name: sqflite - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1+1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0+2" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.9" timing: dependency: transitive description: name: timing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" toggle_switch: dependency: "direct main" description: name: toggle_switch - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.0" tray_manager: @@ -1062,182 +1062,182 @@ packages: dependency: "direct main" description: name: tuple - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.5" url_launcher_android: dependency: transitive description: name: url_launcher_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.17" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.13" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" uuid: dependency: transitive description: name: uuid - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.6" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" video_player: dependency: transitive description: name: video_player - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.7" video_player_android: dependency: transitive description: name: video_player_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.9" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.5" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.4" video_player_web: dependency: transitive description: name: video_player_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.12" visibility_detector: dependency: "direct main" description: name: visibility_detector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.3" wakelock: dependency: "direct main" description: name: wakelock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.5.6" wakelock_macos: dependency: transitive description: name: wakelock_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.0" wakelock_web: dependency: transitive description: name: wakelock_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_windows: dependency: transitive description: name: wakelock_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.7.0" window_manager: @@ -1253,28 +1253,28 @@ packages: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.0+2" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.1" zxing2: dependency: "direct main" description: name: zxing2 - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.0" sdks: From 52a0621d19fdeff24bf770912d972e5359b41a16 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 26 Aug 2022 22:13:19 -0700 Subject: [PATCH 063/113] Fix CI --- Cargo.lock | 801 ++++++++++++++++++++++--------------------- flutter/pubspec.lock | 338 +++++++++--------- 2 files changed, 573 insertions(+), 566 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f90fd2eb..35d87cbd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,6 +29,17 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -40,9 +51,9 @@ dependencies = [ [[package]] name = "allo-isolate" -version = "0.1.13-beta.5" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1a52c9b965fdaf940102bcb1a0aef4bc2f56489056f5872cef705651c7972e" +checksum = "ccb993621e6bf1b67591005b0adad126159a0ab31af379743906158aed5330d0" dependencies = [ "atomic", ] @@ -89,9 +100,9 @@ dependencies = [ [[package]] name = "android_logger" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74b7ddf197de32e415d197aa21c1c0cb36e01e4794fd801302280ac7847ee02" +checksum = "b5e9dd62f37dea550caf48c77591dc50bd1a378ce08855be1a0c42a97b7550fb" dependencies = [ "android_log-sys", "env_logger 0.9.0", @@ -99,6 +110,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "android_system_properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e" +dependencies = [ + "libc", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -110,9 +130,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.57" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" +checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305" [[package]] name = "arboard" @@ -146,9 +166,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ "concurrent-queue", "event-listener", @@ -171,10 +191,11 @@ dependencies = [ [[package]] name = "async-io" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07" +checksum = "0ab006897723d9352f63e2b13047177c3982d8d79709d713ce7747a8f19fd1b0" dependencies = [ + "autocfg 1.1.0", "concurrent-queue", "futures-lite", "libc", @@ -183,7 +204,7 @@ dependencies = [ "parking", "polling", "slab", - "socket2 0.4.4", + "socket2 0.4.6", "waker-fn", "winapi 0.3.9", ] @@ -199,11 +220,12 @@ dependencies = [ [[package]] name = "async-process" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c" +checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" dependencies = [ "async-io", + "autocfg 1.1.0", "blocking", "cfg-if 1.0.0", "event-listener", @@ -227,15 +249,15 @@ dependencies = [ [[package]] name = "async-task" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" +checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.53" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" +checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" dependencies = [ "proc-macro2", "quote", @@ -250,7 +272,7 @@ checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd" dependencies = [ "atk-sys", "bitflags", - "glib 0.15.11", + "glib 0.15.12", "libc", ] @@ -309,9 +331,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", @@ -400,15 +422,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "bytemuck" -version = "1.9.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" +checksum = "2f5715e491b5a1598fc2bef5a606847b5dc1d48ea625bd3c02c00de8285591da" [[package]] name = "byteorder" @@ -422,7 +444,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" dependencies = [ - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -433,13 +455,13 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" [[package]] name = "cairo-rs" -version = "0.15.11" +version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62be3562254e90c1c6050a72aa638f6315593e98c5cdaba9017cedbabf0a5dee" +checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc" dependencies = [ "bitflags", "cairo-sys-rs", - "glib 0.15.11", + "glib 0.15.12", "libc", "thiserror", ] @@ -467,11 +489,11 @@ dependencies = [ [[package]] name = "camino" -version = "1.0.9" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" +checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e" dependencies = [ - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -480,7 +502,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" dependencies = [ - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -491,9 +513,9 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.9", - "serde 1.0.137", - "serde_json 1.0.81", + "semver 1.0.13", + "serde 1.0.144", + "serde_json 1.0.85", ] [[package]] @@ -502,14 +524,14 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b6d248e3ca02f3fbfabcb9284464c596baec223a26d91bbf44a5a62ddb0d900" dependencies = [ - "clap 3.1.18", + "clap 3.2.17", "heck 0.4.0", "indexmap", "log", "proc-macro2", "quote", - "serde 1.0.137", - "serde_json 1.0.81", + "serde 1.0.144", + "serde_json 1.0.85", "syn", "tempfile", "toml", @@ -562,11 +584,11 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" dependencies = [ - "libc", + "iana-time-zone", "num-integer", "num-traits 0.2.15", "winapi 0.3.9", @@ -600,16 +622,16 @@ dependencies = [ [[package]] name = "clap" -version = "3.1.18" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" +checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", "indexmap", - "lazy_static", + "once_cell", "strsim 0.10.0", "termcolor", "textwrap 0.15.0", @@ -617,9 +639,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.1.18" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" +checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -630,9 +652,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.0" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" dependencies = [ "os_str_bytes", ] @@ -644,16 +666,16 @@ dependencies = [ "cc", "hbb_common", "lazy_static", - "serde 1.0.137", + "serde 1.0.144", "serde_derive", "thiserror", ] [[package]] name = "clipboard-win" -version = "4.4.1" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3e1238132dc01f081e1cbb9dace14e5ef4c3a51ee244bd982275fb514605db" +checksum = "c4ab1b92798304eedc095b53942963240037c0516452cb11aeba709d420b2219" dependencies = [ "error-code", "str-buf", @@ -717,9 +739,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "combine" -version = "4.6.4" +version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ "bytes", "memchr", @@ -727,9 +749,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.2.2" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" dependencies = [ "cache-padded", ] @@ -740,7 +762,7 @@ version = "0.4.0" source = "git+https://github.com/open-trade/confy#630cc28a396cb7d01eefdd9f3824486fe4d8554b" dependencies = [ "directories-next", - "serde 1.0.137", + "serde 1.0.144", "thiserror", "toml", ] @@ -879,9 +901,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "dc948ebb96241bb40ab73effeb80d9f93afaad49359d159a5e61be51619fe813" dependencies = [ "libc", ] @@ -895,25 +917,11 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "crossbeam" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -921,9 +929,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", @@ -932,23 +940,23 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" dependencies = [ "autocfg 1.1.0", "cfg-if 1.0.0", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" +checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -956,19 +964,19 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if 1.0.0", - "lazy_static", + "once_cell", ] [[package]] name = "crypto-common" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", @@ -976,9 +984,9 @@ dependencies = [ [[package]] name = "cstr_core" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644828c273c063ab0d39486ba42a5d1f3a499d35529c759e763a9c6cb8a0fb08" +checksum = "dd98742e4fdca832d40cab219dc2e3048de17d873248f83f17df47c1bea70956" dependencies = [ "cty", "memchr", @@ -986,11 +994,11 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.2.2" +version = "3.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865" +checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173" dependencies = [ - "nix 0.24.1", + "nix 0.25.0", "winapi 0.3.9", ] @@ -1173,9 +1181,9 @@ dependencies = [ [[package]] name = "dbus" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0a745c25b32caa56b82a3950f5fec7893a960f4c10ca3b02060b0c38d8c2ce" +checksum = "6f8bcdd56d2e5c4ed26a529c5a9029f5db8290d433497506f958eae3be148eb6" dependencies = [ "libc", "libdbus-sys", @@ -1320,7 +1328,7 @@ checksum = "7f3f119846c823f9eafcf953a8f6ffb6ed69bf6240883261a7f13b634579a51f" dependencies = [ "lazy_static", "regex", - "serde 1.0.137", + "serde 1.0.144", "strsim 0.10.0", ] @@ -1347,9 +1355,9 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "encoding_rs" @@ -1371,7 +1379,7 @@ dependencies = [ "objc", "pkg-config", "rdev", - "serde 1.0.137", + "serde 1.0.144", "serde_derive", "unicode-segmentation", "winapi 0.3.9", @@ -1379,30 +1387,18 @@ dependencies = [ [[package]] name = "enum-map" -<<<<<<< HEAD -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ddfe61e8040145222887d0d32a939c70c8cae681490d72fb868305e9b40ced8" -======= version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5a56d54c8dd9b3ad34752ed197a4eb2a6601bc010808eb097a04a58ae4c43e1" ->>>>>>> flutter_desktop dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -<<<<<<< HEAD -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d1c54e25a57236a790ecf051c2befbb57740c9b86c4273eac378ba84d620d6" -======= version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9045e2676cd5af83c3b167d917b0a5c90a4d8e266e2683d6631b235c457fc27" ->>>>>>> flutter_desktop dependencies = [ "proc-macro2", "quote", @@ -1428,7 +1424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" dependencies = [ "enumflags2_derive", - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -1522,9 +1518,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "failure" @@ -1537,9 +1533,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] @@ -1556,14 +1552,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c" +checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", - "winapi 0.3.9", + "windows-sys 0.36.1", ] [[package]] @@ -1578,14 +1574,15 @@ dependencies = [ [[package]] name = "flexi_logger" -version = "0.22.3" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969940c39bc718475391e53a3a59b0157e64929c80cf83ad5dde5f770ecdc423" +checksum = "0c76a80dd14a27fc3d8bc696502132cb52b3f227256fd8601166c3a35e45f409" dependencies = [ "ansi_term", "atty", "chrono", - "crossbeam", + "crossbeam-channel", + "crossbeam-queue", "glob", "lazy_static", "log", @@ -1624,7 +1621,7 @@ dependencies = [ "pathdiff", "quote", "regex", - "serde 1.0.137", + "serde 1.0.144", "serde_yaml", "structopt", "syn", @@ -1699,9 +1696,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "ab30e97ab6aacfe635fad58f22c2bb06c8b685f7421eb1e064a729e2a5f481fa" dependencies = [ "futures-channel", "futures-core", @@ -1714,9 +1711,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1" dependencies = [ "futures-core", "futures-sink", @@ -1724,15 +1721,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115" [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "1d11aa21b5b587a64682c0094c2bdd4df0076c5324961a40cc3abd7f37930528" dependencies = [ "futures-core", "futures-task", @@ -1741,9 +1738,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5" [[package]] name = "futures-lite" @@ -1762,9 +1759,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d" dependencies = [ "proc-macro2", "quote", @@ -1773,21 +1770,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577" dependencies = [ "futures-channel", "futures-core", @@ -1821,7 +1818,7 @@ dependencies = [ "gdk-pixbuf", "gdk-sys", "gio", - "glib 0.15.11", + "glib 0.15.12", "libc", "pango", ] @@ -1835,7 +1832,7 @@ dependencies = [ "bitflags", "gdk-pixbuf-sys", "gio", - "glib 0.15.11", + "glib 0.15.12", "libc", ] @@ -1871,9 +1868,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -1891,33 +1888,33 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "gimli" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "gio" -version = "0.15.11" +version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f132be35e05d9662b9fa0fee3f349c6621f7782e0105917f4cc73c1bf47eceb" +checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b" dependencies = [ "bitflags", "futures-channel", "futures-core", "futures-io", "gio-sys", - "glib 0.15.11", + "glib 0.15.12", "libc", "once_cell", "thiserror", @@ -1957,9 +1954,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.15.11" +version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124026a2fa8c33a3d17a3fe59c103f2d9fa5bd92c19e029e037736729abeab" +checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d" dependencies = [ "bitflags", "futures-channel", @@ -1999,7 +1996,7 @@ checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64" dependencies = [ "anyhow", "heck 0.4.0", - "proc-macro-crate 1.1.3", + "proc-macro-crate 1.2.1", "proc-macro-error", "proc-macro2", "quote", @@ -2201,7 +2198,7 @@ dependencies = [ "gdk", "gdk-pixbuf", "gio", - "glib 0.15.11", + "glib 0.15.12", "gtk-sys", "gtk3-macros", "libc", @@ -2235,7 +2232,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9" dependencies = [ "anyhow", - "proc-macro-crate 1.1.3", + "proc-macro-crate 1.2.1", "proc-macro-error", "proc-macro2", "quote", @@ -2244,9 +2241,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" dependencies = [ "bytes", "fnv", @@ -2257,7 +2254,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.2", + "tokio-util", "tracing", ] @@ -2267,14 +2264,17 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" dependencies = [ - "ahash", + "ahash 0.4.7", ] [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] [[package]] name = "hbb_common" @@ -2298,15 +2298,15 @@ dependencies = [ "quinn", "rand 0.8.5", "regex", - "serde 1.0.137", + "serde 1.0.144", "serde_derive", - "serde_json 1.0.81", + "serde_json 1.0.85", "serde_with", "socket2 0.3.19", "sodiumoxide", "tokio", "tokio-socks", - "tokio-util 0.7.2", + "tokio-util", "toml", "winapi 0.3.9", "zstd", @@ -2350,13 +2350,13 @@ checksum = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" [[package]] name = "http" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.2", + "itoa 1.0.3", ] [[package]] @@ -2396,16 +2396,16 @@ dependencies = [ "bindgen", "cc", "log", - "serde 1.0.137", + "serde 1.0.144", "serde_derive", - "serde_json 1.0.81", + "serde_json 1.0.85", ] [[package]] name = "hyper" -version = "0.14.19" +version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" dependencies = [ "bytes", "futures-channel", @@ -2416,9 +2416,9 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.2", + "itoa 1.0.3", "pin-project-lite", - "socket2 0.4.4", + "socket2 0.4.6", "tokio", "tower-service", "tracing", @@ -2438,6 +2438,19 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "iana-time-zone" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad2bfd338099682614d3ee3fe0cd72e0b6a41ca6a87f6a74a3bd593c91650501" +dependencies = [ + "android_system_properties", + "core-foundation-sys 0.8.3", + "js-sys", + "wasm-bindgen", + "winapi 0.3.9", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -2492,12 +2505,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.2" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg 1.1.0", - "hashbrown 0.11.2", + "hashbrown 0.12.3", ] [[package]] @@ -2544,9 +2557,9 @@ checksum = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" [[package]] name = "itoa" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "jni" @@ -2585,9 +2598,9 @@ checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" dependencies = [ "wasm-bindgen", ] @@ -2616,11 +2629,11 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libappindicator" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b29fab3280d59f3d06725f75da9ef9a1b001b2c748b1abfebd1c966c61d7de" +checksum = "db2d3cb96d092b4824cb306c9e544c856a4cb6210c1081945187f7f1924b47e8" dependencies = [ - "glib 0.15.11", + "glib 0.15.12", "gtk", "gtk-sys", "libappindicator-sys", @@ -2629,9 +2642,9 @@ dependencies = [ [[package]] name = "libappindicator-sys" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83c2227727d7950ada2ae554613d35fd4e55b87f0a29b86d2368267d19b1d99" +checksum = "f1b3b6681973cea8cc3bce7391e6d7d5502720b80a581c9a95c9cbaf592826aa" dependencies = [ "gtk-sys", "libloading", @@ -2640,9 +2653,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.126" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "libdbus-sys" @@ -2734,9 +2747,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "lock_api" @@ -2900,13 +2913,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.36.1", ] @@ -3036,7 +3049,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" dependencies = [ "darling", - "proc-macro-crate 1.1.3", + "proc-macro-crate 1.2.1", "proc-macro2", "quote", "syn", @@ -3096,13 +3109,26 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" dependencies = [ "bitflags", "cfg-if 1.0.0", "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" +dependencies = [ + "autocfg 1.1.0", + "bitflags", + "cfg-if 1.0.0", + "libc", ] [[package]] @@ -3126,9 +3152,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" dependencies = [ "num-traits 0.2.15", ] @@ -3219,7 +3245,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" dependencies = [ - "proc-macro-crate 1.1.3", + "proc-macro-crate 1.2.1", "proc-macro2", "quote", "syn", @@ -3265,9 +3291,9 @@ dependencies = [ [[package]] name = "object" -version = "0.28.4" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "memchr", ] @@ -3329,9 +3355,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.1.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "padlock" @@ -3346,7 +3372,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" dependencies = [ "bitflags", - "glib 0.15.11", + "glib 0.15.12", "libc", "once_cell", "pango-sys", @@ -3366,8 +3392,8 @@ dependencies = [ [[package]] name = "parity-tokio-ipc" -version = "0.7.3" -source = "git+https://github.com/open-trade/parity-tokio-ipc#52515618bd30ea8101bf46f6c7835e88cec9187f" +version = "0.7.3-1" +source = "git+https://github.com/open-trade/parity-tokio-ipc#20b2895910161605210657f3e751edd55321f698" dependencies = [ "futures", "libc", @@ -3435,9 +3461,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" +checksum = "9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22" [[package]] name = "pathdiff" @@ -3459,10 +3485,11 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pest" -version = "2.1.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +checksum = "4b0560d531d1febc25a3c9398a62a71256c0178f2e3443baedd9ad4bb8c9deb4" dependencies = [ + "thiserror", "ucd-trie", ] @@ -3506,18 +3533,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -3556,10 +3583,11 @@ dependencies = [ [[package]] name = "polling" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" +checksum = "899b00b9c8ab553c743b3e11e87c5c7d423b2a2de229ba95b24a756344748011" dependencies = [ + "autocfg 1.1.0", "cfg-if 1.0.0", "libc", "log", @@ -3581,9 +3609,9 @@ checksum = "bc5c99d529f0d30937f6f4b8a86d988047327bb88d04d2c4afc356de74722131" [[package]] name = "primal-check" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01419cee72c1a1ca944554e23d83e483e1bccf378753344e881de28b5487511d" +checksum = "8b264861209b0641a9b7571695029f516698bd3f2bf46eb61fca408675630b8c" dependencies = [ "num-integer", ] @@ -3599,10 +3627,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" dependencies = [ + "once_cell", "thiserror", "toml", ] @@ -3633,9 +3662,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ "unicode-ident", ] @@ -3707,9 +3736,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7542006acd6e057ff632307d219954c44048f818898da03113d6c0086bfddd9" +checksum = "5b435e71d9bfa0d8889927231970c51fb89c58fa63bffcab117c9c7a41e5ef8f" dependencies = [ "bytes", "futures-channel", @@ -3726,9 +3755,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a13a5c0a674c1ce7150c9df7bc4a1e46c2fbbe7c710f56c0dc78b1a810e779e" +checksum = "3fce546b9688f767a57530652488420d419a8b1f44a478b451c3d1ab6d992a55" dependencies = [ "bytes", "fxhash", @@ -3746,23 +3775,23 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3149f7237331015f1a6adf065c397d1be71e032fcf110ba41da52e7926b882f" +checksum = "9f832d8958db3e84d2ec93b5eb2272b45aa23cf7f8fe6e79f578896f4e6c231b" dependencies = [ "futures-util", "libc", "quinn-proto", - "socket2 0.4.4", + "socket2 0.4.6", "tokio", "tracing", ] [[package]] name = "quote" -version = "1.0.18" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -3970,18 +3999,18 @@ dependencies = [ [[package]] name = "realfft" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a83b876fe55da7e1bf5deeacb93d6411edf81eba0e1a497e79c067734729053a" +checksum = "8028eb3fabd68ddf331f744ba9c25a939804e276d820f9b218ab25a4bd7b91b8" dependencies = [ "rustfft", ] [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -3999,9 +4028,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.6" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -4010,9 +4039,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.26" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" @@ -4035,9 +4064,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.10" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" +checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" dependencies = [ "base64", "bytes", @@ -4057,12 +4086,13 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls", - "rustls-pemfile 0.3.0", - "serde 1.0.137", - "serde_json 1.0.81", + "rustls-pemfile 1.0.1", + "serde 1.0.144", + "serde_json 1.0.85", "serde_urlencoded", "tokio", "tokio-rustls", + "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -4172,7 +4202,7 @@ dependencies = [ name = "rustdesk" version = "1.1.10" dependencies = [ - "android_logger 0.11.0", + "android_logger 0.11.1", "arboard", "async-process", "async-trait", @@ -4180,7 +4210,7 @@ dependencies = [ "bytes", "cc", "cfg-if 1.0.0", - "clap 3.1.18", + "clap 3.2.17", "clipboard", "cocoa", "core-foundation 0.9.3", @@ -4223,9 +4253,9 @@ dependencies = [ "samplerate", "sciter-rs", "scrap", - "serde 1.0.137", + "serde 1.0.144", "serde_derive", - "serde_json 1.0.81", + "serde_json 1.0.85", "sha2", "simple_rc", "sys-locale", @@ -4278,7 +4308,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" dependencies = [ "openssl-probe", - "rustls-pemfile 1.0.0", + "rustls-pemfile 1.0.1", "schannel", "security-framework", ] @@ -4294,33 +4324,24 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "0.3.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" -dependencies = [ - "base64", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ "base64", ] [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "same-file" @@ -4395,8 +4416,8 @@ dependencies = [ "num_cpus", "quest", "repng", - "serde 1.0.137", - "serde_json 1.0.81", + "serde 1.0.144", + "serde_json 1.0.85", "target_build_utils", "tracing", "webm", @@ -4415,9 +4436,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.6.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" dependencies = [ "bitflags", "core-foundation 0.9.3", @@ -4447,11 +4468,11 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.9" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" +checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" dependencies = [ - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -4471,18 +4492,18 @@ checksum = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" [[package]] name = "serde" -version = "1.0.137" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ "proc-macro2", "quote", @@ -4503,13 +4524,13 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ - "itoa 1.0.2", + "itoa 1.0.3", "ryu", - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -4530,9 +4551,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.2", + "itoa 1.0.3", "ryu", - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -4541,7 +4562,7 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ - "serde 1.0.137", + "serde 1.0.144", "serde_with_macros", ] @@ -4559,13 +4580,13 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.24" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" +checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" dependencies = [ "indexmap", "ryu", - "serde 1.0.137", + "serde 1.0.144", "yaml-rust", ] @@ -4622,9 +4643,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" +checksum = "f0ea32af43239f0d353a7dd75a22d94c329c8cdaafdcb4c1c1335aa10c298a4a" [[package]] name = "simple_rc" @@ -4632,7 +4653,7 @@ version = "0.1.0" dependencies = [ "confy", "hbb_common", - "serde 1.0.137", + "serde 1.0.144", "serde_derive", "walkdir", ] @@ -4645,15 +4666,18 @@ checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" [[package]] name = "slab" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg 1.1.0", +] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "smithay-client-toolkit" @@ -4687,9 +4711,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "10c98bba371b9b22a71a9414e420f92ddeb2369239af08200816169d5e2dd7aa" dependencies = [ "libc", "winapi 0.3.9", @@ -4704,7 +4728,7 @@ dependencies = [ "ed25519", "libc", "libsodium-sys", - "serde 1.0.137", + "serde 1.0.144", ] [[package]] @@ -4793,9 +4817,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.95" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", @@ -4816,13 +4840,15 @@ dependencies = [ [[package]] name = "sys-locale" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3913c5a3d30054d7f77cf07cdd800c8103ace15c6e44437c5db66a43dd3a92cf" +checksum = "658ee915b6c7b73ec4c1ffcd838506b5c5a4087eadc1ec8f862f1066cf2c8132" dependencies = [ "cc", "cstr_core", + "js-sys", "libc", + "wasm-bindgen", "web-sys", "winapi 0.3.9", ] @@ -4976,18 +5002,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", @@ -5020,7 +5046,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" dependencies = [ - "itoa 1.0.2", + "itoa 1.0.3", "libc", "num_threads", "time-macros", @@ -5057,22 +5083,22 @@ dependencies = [ "bytes", "libc", "memchr", - "mio 0.8.3", + "mio 0.8.4", "num_cpus", "once_cell", "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2 0.4.4", + "socket2 0.4.6", "tokio-macros", "winapi 0.3.9", ] [[package]] name = "tokio-macros" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", @@ -5092,8 +5118,8 @@ dependencies = [ [[package]] name = "tokio-socks" -version = "0.5.1" -source = "git+https://github.com/open-trade/tokio-socks#3de8300fbce37e2cdaef042e016aa95058d007cf" +version = "0.5.1-1" +source = "git+https://github.com/open-trade/tokio-socks#7034e79263ce25c348be072808d7601d82cd892d" dependencies = [ "bytes", "either", @@ -5103,34 +5129,21 @@ dependencies = [ "pin-project", "thiserror", "tokio", - "tokio-util 0.6.10", + "tokio-util", ] [[package]] name = "tokio-util" -version = "0.6.10" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" dependencies = [ "bytes", "futures-core", "futures-io", "futures-sink", "futures-util", + "hashbrown 0.12.3", "pin-project-lite", "slab", "tokio", @@ -5143,20 +5156,20 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ - "serde 1.0.137", + "serde 1.0.144", ] [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.34" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", @@ -5166,9 +5179,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" +checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ "proc-macro2", "quote", @@ -5177,11 +5190,11 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] @@ -5235,9 +5248,9 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ucd-trie" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" [[package]] name = "uds_windows" @@ -5257,15 +5270,15 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" dependencies = [ "tinyvec", ] @@ -5308,9 +5321,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d5d669b51467dcf7b2f1a796ce0f955f05f01cafda6c19d6e95f730df29238" +checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" dependencies = [ "getrandom", ] @@ -5346,7 +5359,7 @@ dependencies = [ "cc", "hbb_common", "lazy_static", - "serde 1.0.137", + "serde 1.0.144", "serde_derive", "thiserror", ] @@ -5378,12 +5391,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -5392,9 +5399,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -5402,13 +5409,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -5417,9 +5424,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.30" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" +checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -5429,9 +5436,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5439,9 +5446,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ "proc-macro2", "quote", @@ -5452,20 +5459,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" [[package]] name = "wayland-client" -version = "0.29.4" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91223460e73257f697d9e23d401279123d36039a3f7a449e983f123292d4458f" +checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ "bitflags", "downcast-rs", "libc", - "nix 0.22.3", + "nix 0.24.2", "scoped-tls", "wayland-commons", "wayland-scanner", @@ -5474,11 +5481,11 @@ dependencies = [ [[package]] name = "wayland-commons" -version = "0.29.4" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f6e5e340d7c13490eca867898c4cec5af56c27a5ffe5c80c6fc4708e22d33e" +checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" dependencies = [ - "nix 0.22.3", + "nix 0.24.2", "once_cell", "smallvec", "wayland-sys", @@ -5486,20 +5493,20 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.29.4" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c52758f13d5e7861fc83d942d3d99bf270c83269575e52ac29e5b73cb956a6bd" +checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" dependencies = [ - "nix 0.22.3", + "nix 0.24.2", "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" -version = "0.29.4" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60147ae23303402e41fe034f74fb2c35ad0780ee88a1c40ac09a3be1e7465741" +checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ "bitflags", "wayland-client", @@ -5509,9 +5516,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.29.4" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39a1ed3143f7a143187156a2ab52742e89dac33245ba505c17224df48939f9e0" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" dependencies = [ "proc-macro2", "quote", @@ -5520,9 +5527,9 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.29.4" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9341df79a8975679188e37dab3889bfa57c44ac2cb6da166f519a81cbe452d4" +checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" dependencies = [ "dlib", "lazy_static", @@ -5531,9 +5538,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.57" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" +checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -5569,18 +5576,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.3" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" +checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" dependencies = [ "webpki", ] [[package]] name = "weezl" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c97e489d8f836838d497091de568cf16b117486d529ec5579233521065bd5e4" +checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "wepoll-ffi" @@ -5843,7 +5850,7 @@ dependencies = [ "lazy_static", "libc", "log", - "mio 0.8.3", + "mio 0.8.4", "ndk 0.5.0", "ndk-glue 0.5.2", "ndk-sys 0.2.2", @@ -5902,7 +5909,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7f97e69b28b256ccfb02472c25057132e234aa8368fea3bb0268def564ce1f2" dependencies = [ - "clap 3.1.18", + "clap 3.2.17", ] [[package]] @@ -5926,9 +5933,9 @@ dependencies = [ [[package]] name = "x11" -version = "2.19.1" +version = "2.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd0565fa8bfba8c5efe02725b14dff114c866724eff2cfd44d76cea74bcd87a" +checksum = "f7ae97874a928d821b061fce3d1fc52f08071dd53c89a6102bc06efcac3b2908" dependencies = [ "libc", "pkg-config", @@ -5936,9 +5943,9 @@ dependencies = [ [[package]] name = "x11-dl" -version = "2.19.1" +version = "2.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59" +checksum = "0c83627bc137605acc00bb399c7b908ef460b621fc37c953db2b09f88c449ea6" dependencies = [ "lazy_static", "libc", @@ -6009,7 +6016,7 @@ dependencies = [ "once_cell", "ordered-stream", "rand 0.8.5", - "serde 1.0.137", + "serde 1.0.144", "serde_repr", "sha1", "static_assertions", @@ -6027,7 +6034,7 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f8fb5186d1c87ae88cf234974c240671238b4a679158ad3b94ec465237349a6" dependencies = [ - "proc-macro-crate 1.1.3", + "proc-macro-crate 1.2.1", "proc-macro2", "quote", "regex", @@ -6040,7 +6047,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41a408fd8a352695690f53906dc7fd036be924ec51ea5e05666ff42685ed0af5" dependencies = [ - "serde 1.0.137", + "serde 1.0.144", "static_assertions", "zvariant", ] @@ -6083,7 +6090,7 @@ dependencies = [ "byteorder", "enumflags2", "libc", - "serde 1.0.137", + "serde 1.0.144", "static_assertions", "zvariant_derive", ] @@ -6094,7 +6101,7 @@ version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08e977eaa3af652f63d479ce50d924254ad76722a6289ec1a1eac3231ca30430" dependencies = [ - "proc-macro-crate 1.1.3", + "proc-macro-crate 1.2.1", "proc-macro2", "quote", "syn", diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 6000671af..4d0a07287 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -5,231 +5,231 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "46.0.0" after_layout: dependency: transitive description: name: after_layout - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.6.0" animations: dependency: transitive description: name: animations - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" archive: dependency: transitive description: name: archive - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.1" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.1" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.8.2" back_button_interceptor: dependency: "direct main" description: name: back_button_interceptor - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" build: dependency: transitive description: name: build - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.0" build_config: dependency: transitive description: name: build_config - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" build_daemon: dependency: transitive description: name: build_daemon - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" build_resolvers: dependency: transitive description: name: build_resolvers - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.9" build_runner: dependency: "direct dev" description: name: build_runner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" build_runner_core: dependency: transitive description: name: build_runner_core - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "7.2.3" built_collection: dependency: transitive description: name: built_collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "8.4.1" cached_network_image: dependency: transitive description: name: cached_network_image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" checked_yaml: dependency: transitive description: name: checked_yaml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.16.0" contextmenu: dependency: "direct main" description: name: contextmenu - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" cross_file: dependency: transitive description: name: cross_file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.3+1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.3" dash_chat_2: @@ -245,7 +245,7 @@ packages: dependency: "direct main" description: name: desktop_drop - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.3" desktop_multi_window: @@ -261,133 +261,133 @@ packages: dependency: "direct main" description: name: device_info_plus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.1.2" device_info_plus_linux: dependency: transitive description: name: device_info_plus_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_macos: dependency: transitive description: name: device_info_plus_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_web: dependency: transitive description: name: device_info_plus_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" device_info_plus_windows: dependency: transitive description: name: device_info_plus_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.0" draggable_float_widget: dependency: "direct main" description: name: draggable_float_widget - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.2" event_bus: dependency: transitive description: name: event_bus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" external_path: dependency: "direct main" description: name: external_path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" ffi: dependency: "direct main" description: name: ffi - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.4" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "9.3.3" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.3" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.2+3" firebase_core: dependency: transitive description: name: firebase_core - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.21.1" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.5.1" firebase_core_web: dependency: transitive description: name: firebase_core_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.2" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" flutter: @@ -399,21 +399,21 @@ packages: dependency: transitive description: name: flutter_blurhash - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.7.0" flutter_breadcrumb: dependency: "direct main" description: name: flutter_breadcrumb - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.0" flutter_launcher_icons: @@ -434,14 +434,14 @@ packages: dependency: transitive description: name: flutter_parsed_text - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.7" flutter_rust_bridge: @@ -467,133 +467,133 @@ packages: dependency: "direct dev" description: name: freezed - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0+1" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" get: dependency: "direct main" description: name: get - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.6.5" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" graphs: dependency: transitive description: name: graphs - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" html: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.0" http: dependency: "direct main" description: name: http - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.13.5" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.1" image: dependency: "direct main" description: name: image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.0" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.8.5+3" image_picker_android: dependency: transitive description: name: image_picker_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.8.5+2" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.8" image_picker_ios: dependency: transitive description: name: image_picker_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.8.5+6" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.6.1" intl: dependency: transitive description: name: intl - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.0" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.4" json_annotation: @@ -614,343 +614,343 @@ packages: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.4" menu_base: dependency: transitive description: name: menu_base - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" octo_image: dependency: transitive description: name: octo_image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" package_info_plus: dependency: "direct main" description: name: package_info_plus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.3+1" package_info_plus_linux: dependency: transitive description: name: package_info_plus_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" package_info_plus_macos: dependency: transitive description: name: package_info_plus_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" package_info_plus_web: dependency: transitive description: name: package_info_plus_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" package_info_plus_windows: dependency: transitive description: name: package_info_plus_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.1" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.20" path_provider_ios: dependency: transitive description: name: path_provider_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.11.1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.0.0" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.1" process: dependency: transitive description: name: process - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.4" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.3" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" pubspec_parse: dependency: transitive description: name: pubspec_parse - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.1" qr_code_scanner: dependency: "direct main" description: name: qr_code_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.27.5" screen_retriever: dependency: transitive description: name: screen_retriever - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.2" scroll_pos: dependency: "direct main" description: name: scroll_pos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.0" settings_ui: dependency: "direct main" description: name: settings_ui - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.15" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.12" shared_preferences_ios: dependency: transitive description: name: shared_preferences_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" shortid: dependency: transitive description: name: shortid - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.2" sky_engine: @@ -962,91 +962,91 @@ packages: dependency: transitive description: name: source_gen - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.2" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.2" sqflite: dependency: transitive description: name: sqflite - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1+1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0+2" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.9" timing: dependency: transitive description: name: timing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" toggle_switch: dependency: "direct main" description: name: toggle_switch - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.0" tray_manager: @@ -1062,182 +1062,182 @@ packages: dependency: "direct main" description: name: tuple - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.5" url_launcher_android: dependency: transitive description: name: url_launcher_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.17" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.13" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" uuid: dependency: transitive description: name: uuid - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.6" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" video_player: dependency: transitive description: name: video_player - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.7" video_player_android: dependency: transitive description: name: video_player_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.9" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.5" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.4" video_player_web: dependency: transitive description: name: video_player_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.12" visibility_detector: dependency: "direct main" description: name: visibility_detector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.3" wakelock: dependency: "direct main" description: name: wakelock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.5.6" wakelock_macos: dependency: transitive description: name: wakelock_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.0" wakelock_web: dependency: transitive description: name: wakelock_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_windows: dependency: transitive description: name: wakelock_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.7.0" window_manager: @@ -1253,28 +1253,28 @@ packages: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.0+2" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.1" zxing2: dependency: "direct main" description: name: zxing2 - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.0" sdks: From 32f9b4c7875a75e40b805a2b13e56a72e962c53e Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 27 Aug 2022 01:03:44 -0700 Subject: [PATCH 064/113] Support map keyboard mode on flutter --- src/flutter.rs | 82 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/src/flutter.rs b/src/flutter.rs index 9586f845a..09ed01aeb 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -37,6 +37,8 @@ use crate::common::{self, make_fd_to_json, CLIPBOARD_INTERVAL}; use crate::common::{check_clipboard, update_clipboard, ClipboardContext}; use crate::{client::*, flutter_ffi::EventToUI, make_fd_flutter}; +use enigo::{self, Enigo, KeyboardControllable}; +use rdev::{EventType::*, Key as RdevKey}; pub(super) const APP_TYPE_MAIN: &str = "main"; pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote"; @@ -46,6 +48,7 @@ lazy_static::lazy_static! { // static ref SESSION: Arc>> = Default::default(); pub static ref SESSIONS: RwLock> = Default::default(); pub static ref GLOBAL_EVENT_STREAM: RwLock>> = Default::default(); // rust to dart event channel + pub static ref ENIGO: Arc> = Arc::new(Mutex::new(Enigo::new())); } static SERVER_CLIPBOARD_ENABLED: AtomicBool = AtomicBool::new(true); @@ -220,6 +223,15 @@ impl Session { self.send(Data::Message(msg)); } + pub fn send_key_event(&self, mut evt: KeyEvent, keyboard_mode: KeyboardMode) { + // mode: legacy(0), map(1), translate(2), auto(3) + evt.mode = keyboard_mode.into(); + dbg!(&evt); + let mut msg_out = Message::new(); + msg_out.set_key_event(evt); + self.send(Data::Message(msg_out)); + } + /// Send chat message over the current session. /// /// # Arguments @@ -373,14 +385,76 @@ impl Session { } } + #[allow(dead_code)] + pub fn convert_numpad_keys(&self, key: RdevKey) -> RdevKey { + if self.get_key_state(enigo::Key::NumLock) { + return key; + } + match key { + 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, + } + } + + pub fn get_key_state(&self, key: enigo::Key) -> bool { + #[cfg(target_os = "macos")] + if key == enigo::Key::NumLock { + return true; + } + ENIGO.lock().unwrap().get_key_state(key) + } + + /// Map keyboard mode pub fn input_raw_key(&self, keycode: i32, scancode: i32, down: bool){ - use rdev::{EventType::*, Key as RdevKey, *}; if scancode < 0 || keycode < 0{ return; } - let key = rdev::key_from_scancode(scancode.try_into().unwrap()) as RdevKey; - - log::info!("{:?}", key); + let keycode: u32 = keycode as u32; + let scancode: u32 = scancode as u32; + let key = rdev::key_from_scancode(scancode) as RdevKey; + // Windows requires special handling + #[cfg(target_os = "windows")] + let key = if let Some(e) = _evt { + rdev::get_win_key(e.code.into(), e.scan_code) + } else { + key + }; + + let peer = self.peer_platform(); + + let mut key_event = KeyEvent::new(); + // According to peer platform. + let keycode: u32 = if peer == "Linux" { + rdev::linux_keycode_from_key(key).unwrap_or_default().into() + } else if peer == "Windows" { + #[cfg(not(windows))] + let key = self.convert_numpad_keys(key); + rdev::win_keycode_from_key(key).unwrap_or_default().into() + } else { + rdev::macos_keycode_from_key(key).unwrap_or_default().into() + }; + + key_event.set_chr(keycode); + key_event.down = down; + + if self.get_key_state(enigo::Key::CapsLock) { + key_event.modifiers.push(ControlKey::CapsLock.into()); + } + if self.get_key_state(enigo::Key::NumLock) { + key_event.modifiers.push(ControlKey::NumLock.into()); + } + + self.send_key_event(key_event, KeyboardMode::Map); } /// Input a string of text. From 3b5b79712b241f997892a22e03a35ba2c7f29e98 Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 27 Aug 2022 22:17:02 +0800 Subject: [PATCH 065/113] Fix compile error on macos --- flutter/.gitignore | 3 - flutter/lib/generated_bridge.dart | 4047 +++++++++++++++++ flutter/lib/generated_bridge.freezed.dart | 332 ++ flutter/lib/generated_plugin_registrant.dart | 35 + flutter/macos/Podfile.lock | 145 +- flutter/macos/Runner/Release.entitlements | 2 + .../macos/rustdesk.xcodeproj/project.pbxproj | 2 +- 7 files changed, 4504 insertions(+), 62 deletions(-) create mode 100644 flutter/lib/generated_bridge.dart create mode 100644 flutter/lib/generated_bridge.freezed.dart create mode 100644 flutter/lib/generated_plugin_registrant.dart diff --git a/flutter/.gitignore b/flutter/.gitignore index e5db34d22..fdd17a5ed 100644 --- a/flutter/.gitignore +++ b/flutter/.gitignore @@ -32,7 +32,6 @@ /build/ # Web related -lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols @@ -44,8 +43,6 @@ jniLibs .vscode # flutter rust bridge -lib/generated_bridge.dart -lib/generated_bridge.freezed.dart # Flutter Generated Files **/flutter/GeneratedPluginRegistrant.swift diff --git a/flutter/lib/generated_bridge.dart b/flutter/lib/generated_bridge.dart new file mode 100644 index 000000000..8fa7706aa --- /dev/null +++ b/flutter/lib/generated_bridge.dart @@ -0,0 +1,4047 @@ +// AUTO GENERATED FILE, DO NOT EDIT. +// Generated by `flutter_rust_bridge`. + +// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, prefer_single_quotes, prefer_const_constructors + +import 'dart:convert'; +import 'dart:typed_data'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'dart:convert'; +import 'dart:typed_data'; +import 'package:flutter_rust_bridge/flutter_rust_bridge.dart'; +import 'dart:ffi' as ffi; + +part 'generated_bridge.freezed.dart'; + +abstract class Rustdesk { + /// FFI for rustdesk core's main entry. + /// Return true if the app should continue running with UI(possibly Flutter), false if the app should exit. + Future rustdeskCoreMain({dynamic hint}); + + Stream startGlobalEventStream( + {required String appType, dynamic hint}); + + Future stopGlobalEventStream({required String appType, dynamic hint}); + + Future hostStopSystemKeyPropagate( + {required bool stopped, dynamic hint}); + + Stream sessionConnect( + {required String id, required bool isFileTransfer, dynamic hint}); + + Future sessionGetRemember({required String id, dynamic hint}); + + Future sessionGetToggleOption( + {required String id, required String arg, dynamic hint}); + + bool sessionGetToggleOptionSync( + {required String id, required String arg, dynamic hint}); + + Future sessionGetImageQuality({required String id, dynamic hint}); + + Future sessionGetOption( + {required String id, required String arg, dynamic hint}); + + Future sessionLogin( + {required String id, + required String password, + required bool remember, + dynamic hint}); + + Future sessionClose({required String id, dynamic hint}); + + Future sessionRefresh({required String id, dynamic hint}); + + Future sessionReconnect({required String id, dynamic hint}); + + Future sessionToggleOption( + {required String id, required String value, dynamic hint}); + + Future sessionSetImageQuality( + {required String id, required String value, dynamic hint}); + + Future sessionLockScreen({required String id, dynamic hint}); + + Future sessionCtrlAltDel({required String id, dynamic hint}); + + Future sessionSwitchDisplay( + {required String id, required int value, dynamic hint}); + + Future sessionInputRawKey( + {required String id, + required int keycode, + required int scancode, + required bool down, + dynamic hint}); + + Future sessionInputKey( + {required String id, + required String name, + required bool down, + required bool press, + required bool alt, + required bool ctrl, + required bool shift, + required bool command, + dynamic hint}); + + Future sessionInputString( + {required String id, required String value, dynamic hint}); + + Future sessionSendChat( + {required String id, required String text, dynamic hint}); + + Future sessionPeerOption( + {required String id, + required String name, + required String value, + dynamic hint}); + + Future sessionGetPeerOption( + {required String id, required String name, dynamic hint}); + + Future sessionInputOsPassword( + {required String id, required String value, dynamic hint}); + + Future sessionReadRemoteDir( + {required String id, + required String path, + required bool includeHidden, + dynamic hint}); + + Future sessionSendFiles( + {required String id, + required int actId, + required String path, + required String to, + required int fileNum, + required bool includeHidden, + required bool isRemote, + dynamic hint}); + + Future sessionSetConfirmOverrideFile( + {required String id, + required int actId, + required int fileNum, + required bool needOverride, + required bool remember, + required bool isUpload, + dynamic hint}); + + Future sessionRemoveFile( + {required String id, + required int actId, + required String path, + required int fileNum, + required bool isRemote, + dynamic hint}); + + Future sessionReadDirRecursive( + {required String id, + required int actId, + required String path, + required bool isRemote, + required bool showHidden, + dynamic hint}); + + Future sessionRemoveAllEmptyDirs( + {required String id, + required int actId, + required String path, + required bool isRemote, + dynamic hint}); + + Future sessionCancelJob( + {required String id, required int actId, dynamic hint}); + + Future sessionCreateDir( + {required String id, + required int actId, + required String path, + required bool isRemote, + dynamic hint}); + + Future sessionReadLocalDirSync( + {required String id, + required String path, + required bool showHidden, + dynamic hint}); + + Future sessionGetPlatform( + {required String id, required bool isRemote, dynamic hint}); + + Future sessionLoadLastTransferJobs({required String id, dynamic hint}); + + Future sessionAddJob( + {required String id, + required int actId, + required String path, + required String to, + required int fileNum, + required bool includeHidden, + required bool isRemote, + dynamic hint}); + + Future sessionResumeJob( + {required String id, + required int actId, + required bool isRemote, + dynamic hint}); + + Future> mainGetSoundInputs({dynamic hint}); + + Future mainChangeId({required String newId, dynamic hint}); + + Future mainGetAsyncStatus({dynamic hint}); + + Future mainGetOption({required String key, dynamic hint}); + + Future mainSetOption( + {required String key, required String value, dynamic hint}); + + Future mainGetOptions({dynamic hint}); + + Future mainSetOptions({required String json, dynamic hint}); + + Future mainTestIfValidServer({required String server, dynamic hint}); + + Future mainSetSocks( + {required String proxy, + required String username, + required String password, + dynamic hint}); + + Future> mainGetSocks({dynamic hint}); + + Future mainGetAppName({dynamic hint}); + + Future mainGetLicense({dynamic hint}); + + Future mainGetVersion({dynamic hint}); + + Future> mainGetFav({dynamic hint}); + + Future mainStoreFav({required List favs, dynamic hint}); + + Future mainGetPeer({required String id, dynamic hint}); + + Future mainGetLanPeers({dynamic hint}); + + Future mainGetConnectStatus({dynamic hint}); + + Future mainCheckConnectStatus({dynamic hint}); + + Future mainIsUsingPublicServer({dynamic hint}); + + Future mainDiscover({dynamic hint}); + + Future mainHasRendezvousService({dynamic hint}); + + Future mainGetApiServer({dynamic hint}); + + Future mainPostRequest( + {required String url, + required String body, + required String header, + dynamic hint}); + + Future mainGetLocalOption({required String key, dynamic hint}); + + Future mainSetLocalOption( + {required String key, required String value, dynamic hint}); + + Future mainGetMyId({dynamic hint}); + + Future mainGetUuid({dynamic hint}); + + Future mainGetPeerOption( + {required String id, required String key, dynamic hint}); + + Future mainSetPeerOption( + {required String id, + required String key, + required String value, + dynamic hint}); + + Future mainForgetPassword({required String id, dynamic hint}); + + Future mainGetRecentPeers({dynamic hint}); + + Future mainLoadRecentPeers({dynamic hint}); + + Future mainLoadFavPeers({dynamic hint}); + + Future mainLoadLanPeers({dynamic hint}); + + Future mainGetLastRemoteId({dynamic hint}); + + Future mainGetSoftwareUpdateUrl({dynamic hint}); + + Future mainGetHomeDir({dynamic hint}); + + Future mainGetLangs({dynamic hint}); + + Future mainGetTemporaryPassword({dynamic hint}); + + Future mainGetPermanentPassword({dynamic hint}); + + Future mainGetOnlineStatue({dynamic hint}); + + Future mainGetClientsState({dynamic hint}); + + Future mainCheckClientsLength({required int length, dynamic hint}); + + Future mainInit({required String appDir, dynamic hint}); + + Future mainDeviceId({required String id, dynamic hint}); + + Future mainDeviceName({required String name, dynamic hint}); + + Future mainRemovePeer({required String id, dynamic hint}); + + Future mainHasHwcodec({dynamic hint}); + + Future sessionSendMouse( + {required String id, required String msg, dynamic hint}); + + Future sessionRestartRemoteDevice({required String id, dynamic hint}); + + Future mainSetHomeDir({required String home, dynamic hint}); + + Future mainStopService({dynamic hint}); + + Future mainStartService({dynamic hint}); + + Future mainUpdateTemporaryPassword({dynamic hint}); + + Future mainSetPermanentPassword( + {required String password, dynamic hint}); + + Future mainCheckSuperUserPermission({dynamic hint}); + + Future cmSendChat( + {required int connId, required String msg, dynamic hint}); + + Future cmLoginRes( + {required int connId, required bool res, dynamic hint}); + + Future cmCloseConnection({required int connId, dynamic hint}); + + Future cmCheckClickTime({required int connId, dynamic hint}); + + Future cmGetClickTime({dynamic hint}); + + Future cmSwitchPermission( + {required int connId, + required String name, + required bool enabled, + dynamic hint}); + + Future mainGetIcon({dynamic hint}); + + Future queryOnlines({required List ids, dynamic hint}); +} + +@freezed +class EventToUI with _$EventToUI { + const factory EventToUI.event( + String field0, + ) = Event; + const factory EventToUI.rgba( + Uint8List field0, + ) = Rgba; +} + +class RustdeskImpl extends FlutterRustBridgeBase + implements Rustdesk { + factory RustdeskImpl(ffi.DynamicLibrary dylib) => + RustdeskImpl.raw(RustdeskWire(dylib)); + + RustdeskImpl.raw(RustdeskWire inner) : super(inner); + + Future rustdeskCoreMain({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_rustdesk_core_main(port_), + parseSuccessData: _wire2api_bool, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "rustdesk_core_main", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Stream startGlobalEventStream( + {required String appType, dynamic hint}) => + executeStream(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_start_global_event_stream( + port_, _api2wire_String(appType)), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "start_global_event_stream", + argNames: ["appType"], + ), + argValues: [appType], + hint: hint, + )); + + Future stopGlobalEventStream({required String appType, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_stop_global_event_stream( + port_, _api2wire_String(appType)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "stop_global_event_stream", + argNames: ["appType"], + ), + argValues: [appType], + hint: hint, + )); + + Future hostStopSystemKeyPropagate( + {required bool stopped, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_host_stop_system_key_propagate(port_, stopped), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "host_stop_system_key_propagate", + argNames: ["stopped"], + ), + argValues: [stopped], + hint: hint, + )); + + Stream sessionConnect( + {required String id, required bool isFileTransfer, dynamic hint}) => + executeStream(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_connect( + port_, _api2wire_String(id), isFileTransfer), + parseSuccessData: _wire2api_event_to_ui, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_connect", + argNames: ["id", "isFileTransfer"], + ), + argValues: [id, isFileTransfer], + hint: hint, + )); + + Future sessionGetRemember({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_session_get_remember(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_opt_box_autoadd_bool, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_get_remember", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionGetToggleOption( + {required String id, required String arg, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_get_toggle_option( + port_, _api2wire_String(id), _api2wire_String(arg)), + parseSuccessData: _wire2api_opt_box_autoadd_bool, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_get_toggle_option", + argNames: ["id", "arg"], + ), + argValues: [id, arg], + hint: hint, + )); + + bool sessionGetToggleOptionSync( + {required String id, required String arg, dynamic hint}) => + executeSync(FlutterRustBridgeSyncTask( + callFfi: () => inner.wire_session_get_toggle_option_sync( + _api2wire_String(id), _api2wire_String(arg)), + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_get_toggle_option_sync", + argNames: ["id", "arg"], + ), + argValues: [id, arg], + hint: hint, + )); + + Future sessionGetImageQuality({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_session_get_image_quality(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_opt_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_get_image_quality", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionGetOption( + {required String id, required String arg, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_get_option( + port_, _api2wire_String(id), _api2wire_String(arg)), + parseSuccessData: _wire2api_opt_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_get_option", + argNames: ["id", "arg"], + ), + argValues: [id, arg], + hint: hint, + )); + + Future sessionLogin( + {required String id, + required String password, + required bool remember, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_login( + port_, _api2wire_String(id), _api2wire_String(password), remember), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_login", + argNames: ["id", "password", "remember"], + ), + argValues: [id, password, remember], + hint: hint, + )); + + Future sessionClose({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_session_close(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_close", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionRefresh({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_session_refresh(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_refresh", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionReconnect({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_session_reconnect(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_reconnect", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionToggleOption( + {required String id, required String value, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_toggle_option( + port_, _api2wire_String(id), _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_toggle_option", + argNames: ["id", "value"], + ), + argValues: [id, value], + hint: hint, + )); + + Future sessionSetImageQuality( + {required String id, required String value, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_set_image_quality( + port_, _api2wire_String(id), _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_set_image_quality", + argNames: ["id", "value"], + ), + argValues: [id, value], + hint: hint, + )); + + Future sessionLockScreen({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_session_lock_screen(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_lock_screen", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionCtrlAltDel({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_session_ctrl_alt_del(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_ctrl_alt_del", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionSwitchDisplay( + {required String id, required int value, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_switch_display( + port_, _api2wire_String(id), _api2wire_i32(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_switch_display", + argNames: ["id", "value"], + ), + argValues: [id, value], + hint: hint, + )); + + Future sessionInputRawKey( + {required String id, + required int keycode, + required int scancode, + required bool down, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_input_raw_key( + port_, + _api2wire_String(id), + _api2wire_i32(keycode), + _api2wire_i32(scancode), + down), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_input_raw_key", + argNames: ["id", "keycode", "scancode", "down"], + ), + argValues: [id, keycode, scancode, down], + hint: hint, + )); + + Future sessionInputKey( + {required String id, + required String name, + required bool down, + required bool press, + required bool alt, + required bool ctrl, + required bool shift, + required bool command, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_input_key( + port_, + _api2wire_String(id), + _api2wire_String(name), + down, + press, + alt, + ctrl, + shift, + command), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_input_key", + argNames: [ + "id", + "name", + "down", + "press", + "alt", + "ctrl", + "shift", + "command" + ], + ), + argValues: [id, name, down, press, alt, ctrl, shift, command], + hint: hint, + )); + + Future sessionInputString( + {required String id, required String value, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_input_string( + port_, _api2wire_String(id), _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_input_string", + argNames: ["id", "value"], + ), + argValues: [id, value], + hint: hint, + )); + + Future sessionSendChat( + {required String id, required String text, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_send_chat( + port_, _api2wire_String(id), _api2wire_String(text)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_send_chat", + argNames: ["id", "text"], + ), + argValues: [id, text], + hint: hint, + )); + + Future sessionPeerOption( + {required String id, + required String name, + required String value, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_peer_option( + port_, + _api2wire_String(id), + _api2wire_String(name), + _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_peer_option", + argNames: ["id", "name", "value"], + ), + argValues: [id, name, value], + hint: hint, + )); + + Future sessionGetPeerOption( + {required String id, required String name, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_get_peer_option( + port_, _api2wire_String(id), _api2wire_String(name)), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_get_peer_option", + argNames: ["id", "name"], + ), + argValues: [id, name], + hint: hint, + )); + + Future sessionInputOsPassword( + {required String id, required String value, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_input_os_password( + port_, _api2wire_String(id), _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_input_os_password", + argNames: ["id", "value"], + ), + argValues: [id, value], + hint: hint, + )); + + Future sessionReadRemoteDir( + {required String id, + required String path, + required bool includeHidden, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_read_remote_dir( + port_, _api2wire_String(id), _api2wire_String(path), includeHidden), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_read_remote_dir", + argNames: ["id", "path", "includeHidden"], + ), + argValues: [id, path, includeHidden], + hint: hint, + )); + + Future sessionSendFiles( + {required String id, + required int actId, + required String path, + required String to, + required int fileNum, + required bool includeHidden, + required bool isRemote, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_send_files( + port_, + _api2wire_String(id), + _api2wire_i32(actId), + _api2wire_String(path), + _api2wire_String(to), + _api2wire_i32(fileNum), + includeHidden, + isRemote), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_send_files", + argNames: [ + "id", + "actId", + "path", + "to", + "fileNum", + "includeHidden", + "isRemote" + ], + ), + argValues: [id, actId, path, to, fileNum, includeHidden, isRemote], + hint: hint, + )); + + Future sessionSetConfirmOverrideFile( + {required String id, + required int actId, + required int fileNum, + required bool needOverride, + required bool remember, + required bool isUpload, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_set_confirm_override_file( + port_, + _api2wire_String(id), + _api2wire_i32(actId), + _api2wire_i32(fileNum), + needOverride, + remember, + isUpload), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_set_confirm_override_file", + argNames: [ + "id", + "actId", + "fileNum", + "needOverride", + "remember", + "isUpload" + ], + ), + argValues: [id, actId, fileNum, needOverride, remember, isUpload], + hint: hint, + )); + + Future sessionRemoveFile( + {required String id, + required int actId, + required String path, + required int fileNum, + required bool isRemote, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_remove_file( + port_, + _api2wire_String(id), + _api2wire_i32(actId), + _api2wire_String(path), + _api2wire_i32(fileNum), + isRemote), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_remove_file", + argNames: ["id", "actId", "path", "fileNum", "isRemote"], + ), + argValues: [id, actId, path, fileNum, isRemote], + hint: hint, + )); + + Future sessionReadDirRecursive( + {required String id, + required int actId, + required String path, + required bool isRemote, + required bool showHidden, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_read_dir_recursive( + port_, + _api2wire_String(id), + _api2wire_i32(actId), + _api2wire_String(path), + isRemote, + showHidden), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_read_dir_recursive", + argNames: ["id", "actId", "path", "isRemote", "showHidden"], + ), + argValues: [id, actId, path, isRemote, showHidden], + hint: hint, + )); + + Future sessionRemoveAllEmptyDirs( + {required String id, + required int actId, + required String path, + required bool isRemote, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_remove_all_empty_dirs( + port_, + _api2wire_String(id), + _api2wire_i32(actId), + _api2wire_String(path), + isRemote), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_remove_all_empty_dirs", + argNames: ["id", "actId", "path", "isRemote"], + ), + argValues: [id, actId, path, isRemote], + hint: hint, + )); + + Future sessionCancelJob( + {required String id, required int actId, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_cancel_job( + port_, _api2wire_String(id), _api2wire_i32(actId)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_cancel_job", + argNames: ["id", "actId"], + ), + argValues: [id, actId], + hint: hint, + )); + + Future sessionCreateDir( + {required String id, + required int actId, + required String path, + required bool isRemote, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_create_dir( + port_, + _api2wire_String(id), + _api2wire_i32(actId), + _api2wire_String(path), + isRemote), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_create_dir", + argNames: ["id", "actId", "path", "isRemote"], + ), + argValues: [id, actId, path, isRemote], + hint: hint, + )); + + Future sessionReadLocalDirSync( + {required String id, + required String path, + required bool showHidden, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_read_local_dir_sync( + port_, _api2wire_String(id), _api2wire_String(path), showHidden), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_read_local_dir_sync", + argNames: ["id", "path", "showHidden"], + ), + argValues: [id, path, showHidden], + hint: hint, + )); + + Future sessionGetPlatform( + {required String id, required bool isRemote, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_get_platform( + port_, _api2wire_String(id), isRemote), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_get_platform", + argNames: ["id", "isRemote"], + ), + argValues: [id, isRemote], + hint: hint, + )); + + Future sessionLoadLastTransferJobs( + {required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_load_last_transfer_jobs( + port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_load_last_transfer_jobs", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future sessionAddJob( + {required String id, + required int actId, + required String path, + required String to, + required int fileNum, + required bool includeHidden, + required bool isRemote, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_add_job( + port_, + _api2wire_String(id), + _api2wire_i32(actId), + _api2wire_String(path), + _api2wire_String(to), + _api2wire_i32(fileNum), + includeHidden, + isRemote), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_add_job", + argNames: [ + "id", + "actId", + "path", + "to", + "fileNum", + "includeHidden", + "isRemote" + ], + ), + argValues: [id, actId, path, to, fileNum, includeHidden, isRemote], + hint: hint, + )); + + Future sessionResumeJob( + {required String id, + required int actId, + required bool isRemote, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_resume_job( + port_, _api2wire_String(id), _api2wire_i32(actId), isRemote), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_resume_job", + argNames: ["id", "actId", "isRemote"], + ), + argValues: [id, actId, isRemote], + hint: hint, + )); + + Future> mainGetSoundInputs({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_sound_inputs(port_), + parseSuccessData: _wire2api_StringList, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_sound_inputs", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainChangeId({required String newId, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_change_id(port_, _api2wire_String(newId)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_change_id", + argNames: ["newId"], + ), + argValues: [newId], + hint: hint, + )); + + Future mainGetAsyncStatus({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_async_status(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_async_status", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetOption({required String key, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_get_option(port_, _api2wire_String(key)), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_option", + argNames: ["key"], + ), + argValues: [key], + hint: hint, + )); + + Future mainSetOption( + {required String key, required String value, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_set_option( + port_, _api2wire_String(key), _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_set_option", + argNames: ["key", "value"], + ), + argValues: [key, value], + hint: hint, + )); + + Future mainGetOptions({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_options(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_options", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainSetOptions({required String json, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_set_options(port_, _api2wire_String(json)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_set_options", + argNames: ["json"], + ), + argValues: [json], + hint: hint, + )); + + Future mainTestIfValidServer( + {required String server, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_test_if_valid_server( + port_, _api2wire_String(server)), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_test_if_valid_server", + argNames: ["server"], + ), + argValues: [server], + hint: hint, + )); + + Future mainSetSocks( + {required String proxy, + required String username, + required String password, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_set_socks( + port_, + _api2wire_String(proxy), + _api2wire_String(username), + _api2wire_String(password)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_set_socks", + argNames: ["proxy", "username", "password"], + ), + argValues: [proxy, username, password], + hint: hint, + )); + + Future> mainGetSocks({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_socks(port_), + parseSuccessData: _wire2api_StringList, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_socks", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetAppName({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_app_name(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_app_name", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetLicense({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_license(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_license", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetVersion({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_version(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_version", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future> mainGetFav({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_fav(port_), + parseSuccessData: _wire2api_StringList, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_fav", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainStoreFav({required List favs, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_store_fav(port_, _api2wire_StringList(favs)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_store_fav", + argNames: ["favs"], + ), + argValues: [favs], + hint: hint, + )); + + Future mainGetPeer({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_get_peer(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_peer", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future mainGetLanPeers({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_lan_peers(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_lan_peers", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetConnectStatus({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_connect_status(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_connect_status", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainCheckConnectStatus({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_check_connect_status(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_check_connect_status", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainIsUsingPublicServer({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_is_using_public_server(port_), + parseSuccessData: _wire2api_bool, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_is_using_public_server", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainDiscover({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_discover(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_discover", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainHasRendezvousService({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_has_rendezvous_service(port_), + parseSuccessData: _wire2api_bool, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_has_rendezvous_service", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetApiServer({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_api_server(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_api_server", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainPostRequest( + {required String url, + required String body, + required String header, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_post_request( + port_, + _api2wire_String(url), + _api2wire_String(body), + _api2wire_String(header)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_post_request", + argNames: ["url", "body", "header"], + ), + argValues: [url, body, header], + hint: hint, + )); + + Future mainGetLocalOption({required String key, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_get_local_option(port_, _api2wire_String(key)), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_local_option", + argNames: ["key"], + ), + argValues: [key], + hint: hint, + )); + + Future mainSetLocalOption( + {required String key, required String value, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_set_local_option( + port_, _api2wire_String(key), _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_set_local_option", + argNames: ["key", "value"], + ), + argValues: [key, value], + hint: hint, + )); + + Future mainGetMyId({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_my_id(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_my_id", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetUuid({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_uuid(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_uuid", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetPeerOption( + {required String id, required String key, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_peer_option( + port_, _api2wire_String(id), _api2wire_String(key)), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_peer_option", + argNames: ["id", "key"], + ), + argValues: [id, key], + hint: hint, + )); + + Future mainSetPeerOption( + {required String id, + required String key, + required String value, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_set_peer_option( + port_, + _api2wire_String(id), + _api2wire_String(key), + _api2wire_String(value)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_set_peer_option", + argNames: ["id", "key", "value"], + ), + argValues: [id, key, value], + hint: hint, + )); + + Future mainForgetPassword({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_forget_password(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_forget_password", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future mainGetRecentPeers({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_recent_peers(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_recent_peers", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainLoadRecentPeers({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_load_recent_peers(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_load_recent_peers", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainLoadFavPeers({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_load_fav_peers(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_load_fav_peers", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainLoadLanPeers({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_load_lan_peers(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_load_lan_peers", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetLastRemoteId({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_last_remote_id(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_last_remote_id", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetSoftwareUpdateUrl({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_software_update_url(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_software_update_url", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetHomeDir({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_home_dir(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_home_dir", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetLangs({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_langs(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_langs", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetTemporaryPassword({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_temporary_password(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_temporary_password", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetPermanentPassword({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_permanent_password(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_permanent_password", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetOnlineStatue({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_online_statue(port_), + parseSuccessData: _wire2api_i64, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_online_statue", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainGetClientsState({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_clients_state(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_clients_state", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainCheckClientsLength({required int length, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_check_clients_length( + port_, _api2wire_usize(length)), + parseSuccessData: _wire2api_opt_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_check_clients_length", + argNames: ["length"], + ), + argValues: [length], + hint: hint, + )); + + Future mainInit({required String appDir, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_init(port_, _api2wire_String(appDir)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_init", + argNames: ["appDir"], + ), + argValues: [appDir], + hint: hint, + )); + + Future mainDeviceId({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_device_id(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_device_id", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future mainDeviceName({required String name, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_device_name(port_, _api2wire_String(name)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_device_name", + argNames: ["name"], + ), + argValues: [name], + hint: hint, + )); + + Future mainRemovePeer({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_remove_peer(port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_remove_peer", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future mainHasHwcodec({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_has_hwcodec(port_), + parseSuccessData: _wire2api_bool, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_has_hwcodec", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future sessionSendMouse( + {required String id, required String msg, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_send_mouse( + port_, _api2wire_String(id), _api2wire_String(msg)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_send_mouse", + argNames: ["id", "msg"], + ), + argValues: [id, msg], + hint: hint, + )); + + Future sessionRestartRemoteDevice({required String id, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_session_restart_remote_device( + port_, _api2wire_String(id)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "session_restart_remote_device", + argNames: ["id"], + ), + argValues: [id], + hint: hint, + )); + + Future mainSetHomeDir({required String home, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_main_set_home_dir(port_, _api2wire_String(home)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_set_home_dir", + argNames: ["home"], + ), + argValues: [home], + hint: hint, + )); + + Future mainStopService({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_stop_service(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_stop_service", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainStartService({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_start_service(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_start_service", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainUpdateTemporaryPassword({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_update_temporary_password(port_), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_update_temporary_password", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future mainSetPermanentPassword( + {required String password, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_set_permanent_password( + port_, _api2wire_String(password)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_set_permanent_password", + argNames: ["password"], + ), + argValues: [password], + hint: hint, + )); + + Future mainCheckSuperUserPermission({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_check_super_user_permission(port_), + parseSuccessData: _wire2api_bool, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_check_super_user_permission", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future cmSendChat( + {required int connId, required String msg, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_cm_send_chat( + port_, _api2wire_i32(connId), _api2wire_String(msg)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "cm_send_chat", + argNames: ["connId", "msg"], + ), + argValues: [connId, msg], + hint: hint, + )); + + Future cmLoginRes( + {required int connId, required bool res, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_cm_login_res(port_, _api2wire_i32(connId), res), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "cm_login_res", + argNames: ["connId", "res"], + ), + argValues: [connId, res], + hint: hint, + )); + + Future cmCloseConnection({required int connId, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_cm_close_connection(port_, _api2wire_i32(connId)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "cm_close_connection", + argNames: ["connId"], + ), + argValues: [connId], + hint: hint, + )); + + Future cmCheckClickTime({required int connId, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_cm_check_click_time(port_, _api2wire_i32(connId)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "cm_check_click_time", + argNames: ["connId"], + ), + argValues: [connId], + hint: hint, + )); + + Future cmGetClickTime({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_cm_get_click_time(port_), + parseSuccessData: _wire2api_f64, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "cm_get_click_time", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future cmSwitchPermission( + {required int connId, + required String name, + required bool enabled, + dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_cm_switch_permission( + port_, _api2wire_i32(connId), _api2wire_String(name), enabled), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "cm_switch_permission", + argNames: ["connId", "name", "enabled"], + ), + argValues: [connId, name, enabled], + hint: hint, + )); + + Future mainGetIcon({dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => inner.wire_main_get_icon(port_), + parseSuccessData: _wire2api_String, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "main_get_icon", + argNames: [], + ), + argValues: [], + hint: hint, + )); + + Future queryOnlines({required List ids, dynamic hint}) => + executeNormal(FlutterRustBridgeTask( + callFfi: (port_) => + inner.wire_query_onlines(port_, _api2wire_StringList(ids)), + parseSuccessData: _wire2api_unit, + constMeta: const FlutterRustBridgeTaskConstMeta( + debugName: "query_onlines", + argNames: ["ids"], + ), + argValues: [ids], + hint: hint, + )); + + // Section: api2wire + ffi.Pointer _api2wire_String(String raw) { + return _api2wire_uint_8_list(utf8.encoder.convert(raw)); + } + + ffi.Pointer _api2wire_StringList(List raw) { + final ans = inner.new_StringList(raw.length); + for (var i = 0; i < raw.length; i++) { + ans.ref.ptr[i] = _api2wire_String(raw[i]); + } + return ans; + } + + int _api2wire_bool(bool raw) { + return raw ? 1 : 0; + } + + int _api2wire_i32(int raw) { + return raw; + } + + int _api2wire_u8(int raw) { + return raw; + } + + ffi.Pointer _api2wire_uint_8_list(Uint8List raw) { + final ans = inner.new_uint_8_list(raw.length); + ans.ref.ptr.asTypedList(raw.length).setAll(0, raw); + return ans; + } + + int _api2wire_usize(int raw) { + return raw; + } + + // Section: api_fill_to_wire + +} + +// Section: wire2api +String _wire2api_String(dynamic raw) { + return raw as String; +} + +List _wire2api_StringList(dynamic raw) { + return (raw as List).cast(); +} + +Uint8List _wire2api_ZeroCopyBuffer_Uint8List(dynamic raw) { + return raw as Uint8List; +} + +bool _wire2api_bool(dynamic raw) { + return raw as bool; +} + +bool _wire2api_box_autoadd_bool(dynamic raw) { + return raw as bool; +} + +EventToUI _wire2api_event_to_ui(dynamic raw) { + switch (raw[0]) { + case 0: + return Event( + _wire2api_String(raw[1]), + ); + case 1: + return Rgba( + _wire2api_ZeroCopyBuffer_Uint8List(raw[1]), + ); + default: + throw Exception("unreachable"); + } +} + +double _wire2api_f64(dynamic raw) { + return raw as double; +} + +int _wire2api_i64(dynamic raw) { + return raw as int; +} + +String? _wire2api_opt_String(dynamic raw) { + return raw == null ? null : _wire2api_String(raw); +} + +bool? _wire2api_opt_box_autoadd_bool(dynamic raw) { + return raw == null ? null : _wire2api_box_autoadd_bool(raw); +} + +int _wire2api_u8(dynamic raw) { + return raw as int; +} + +Uint8List _wire2api_uint_8_list(dynamic raw) { + return raw as Uint8List; +} + +void _wire2api_unit(dynamic raw) { + return; +} + +// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names + +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. + +/// generated by flutter_rust_bridge +class RustdeskWire implements FlutterRustBridgeWireBase { + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + RustdeskWire(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + /// The symbols are looked up with [lookup]. + RustdeskWire.fromLookup( + ffi.Pointer Function(String symbolName) + lookup) + : _lookup = lookup; + + void wire_rustdesk_core_main( + int port_, + ) { + return _wire_rustdesk_core_main( + port_, + ); + } + + late final _wire_rustdesk_core_mainPtr = + _lookup>( + 'wire_rustdesk_core_main'); + late final _wire_rustdesk_core_main = + _wire_rustdesk_core_mainPtr.asFunction(); + + void wire_start_global_event_stream( + int port_, + ffi.Pointer app_type, + ) { + return _wire_start_global_event_stream( + port_, + app_type, + ); + } + + late final _wire_start_global_event_streamPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer)>>( + 'wire_start_global_event_stream'); + late final _wire_start_global_event_stream = + _wire_start_global_event_streamPtr + .asFunction)>(); + + void wire_stop_global_event_stream( + int port_, + ffi.Pointer app_type, + ) { + return _wire_stop_global_event_stream( + port_, + app_type, + ); + } + + late final _wire_stop_global_event_streamPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_stop_global_event_stream'); + late final _wire_stop_global_event_stream = _wire_stop_global_event_streamPtr + .asFunction)>(); + + void wire_host_stop_system_key_propagate( + int port_, + bool stopped, + ) { + return _wire_host_stop_system_key_propagate( + port_, + stopped, + ); + } + + late final _wire_host_stop_system_key_propagatePtr = + _lookup>( + 'wire_host_stop_system_key_propagate'); + late final _wire_host_stop_system_key_propagate = + _wire_host_stop_system_key_propagatePtr + .asFunction(); + + void wire_session_connect( + int port_, + ffi.Pointer id, + bool is_file_transfer, + ) { + return _wire_session_connect( + port_, + id, + is_file_transfer, + ); + } + + late final _wire_session_connectPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Bool)>>('wire_session_connect'); + late final _wire_session_connect = _wire_session_connectPtr + .asFunction, bool)>(); + + void wire_session_get_remember( + int port_, + ffi.Pointer id, + ) { + return _wire_session_get_remember( + port_, + id, + ); + } + + late final _wire_session_get_rememberPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_session_get_remember'); + late final _wire_session_get_remember = _wire_session_get_rememberPtr + .asFunction)>(); + + void wire_session_get_toggle_option( + int port_, + ffi.Pointer id, + ffi.Pointer arg, + ) { + return _wire_session_get_toggle_option( + port_, + id, + arg, + ); + } + + late final _wire_session_get_toggle_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>( + 'wire_session_get_toggle_option'); + late final _wire_session_get_toggle_option = + _wire_session_get_toggle_optionPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + WireSyncReturnStruct wire_session_get_toggle_option_sync( + ffi.Pointer id, + ffi.Pointer arg, + ) { + return _wire_session_get_toggle_option_sync( + id, + arg, + ); + } + + late final _wire_session_get_toggle_option_syncPtr = _lookup< + ffi.NativeFunction< + WireSyncReturnStruct Function(ffi.Pointer, + ffi.Pointer)>>( + 'wire_session_get_toggle_option_sync'); + late final _wire_session_get_toggle_option_sync = + _wire_session_get_toggle_option_syncPtr.asFunction< + WireSyncReturnStruct Function( + ffi.Pointer, ffi.Pointer)>(); + + void wire_session_get_image_quality( + int port_, + ffi.Pointer id, + ) { + return _wire_session_get_image_quality( + port_, + id, + ); + } + + late final _wire_session_get_image_qualityPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer)>>( + 'wire_session_get_image_quality'); + late final _wire_session_get_image_quality = + _wire_session_get_image_qualityPtr + .asFunction)>(); + + void wire_session_get_option( + int port_, + ffi.Pointer id, + ffi.Pointer arg, + ) { + return _wire_session_get_option( + port_, + id, + arg, + ); + } + + late final _wire_session_get_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_session_get_option'); + late final _wire_session_get_option = _wire_session_get_optionPtr.asFunction< + void Function( + int, ffi.Pointer, ffi.Pointer)>(); + + void wire_session_login( + int port_, + ffi.Pointer id, + ffi.Pointer password, + bool remember, + ) { + return _wire_session_login( + port_, + id, + password, + remember, + ); + } + + late final _wire_session_loginPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer, ffi.Bool)>>('wire_session_login'); + late final _wire_session_login = _wire_session_loginPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, bool)>(); + + void wire_session_close( + int port_, + ffi.Pointer id, + ) { + return _wire_session_close( + port_, + id, + ); + } + + late final _wire_session_closePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer)>>('wire_session_close'); + late final _wire_session_close = _wire_session_closePtr + .asFunction)>(); + + void wire_session_refresh( + int port_, + ffi.Pointer id, + ) { + return _wire_session_refresh( + port_, + id, + ); + } + + late final _wire_session_refreshPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_session_refresh'); + late final _wire_session_refresh = _wire_session_refreshPtr + .asFunction)>(); + + void wire_session_reconnect( + int port_, + ffi.Pointer id, + ) { + return _wire_session_reconnect( + port_, + id, + ); + } + + late final _wire_session_reconnectPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_session_reconnect'); + late final _wire_session_reconnect = _wire_session_reconnectPtr + .asFunction)>(); + + void wire_session_toggle_option( + int port_, + ffi.Pointer id, + ffi.Pointer value, + ) { + return _wire_session_toggle_option( + port_, + id, + value, + ); + } + + late final _wire_session_toggle_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_session_toggle_option'); + late final _wire_session_toggle_option = + _wire_session_toggle_optionPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + void wire_session_set_image_quality( + int port_, + ffi.Pointer id, + ffi.Pointer value, + ) { + return _wire_session_set_image_quality( + port_, + id, + value, + ); + } + + late final _wire_session_set_image_qualityPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>( + 'wire_session_set_image_quality'); + late final _wire_session_set_image_quality = + _wire_session_set_image_qualityPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + void wire_session_lock_screen( + int port_, + ffi.Pointer id, + ) { + return _wire_session_lock_screen( + port_, + id, + ); + } + + late final _wire_session_lock_screenPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_session_lock_screen'); + late final _wire_session_lock_screen = _wire_session_lock_screenPtr + .asFunction)>(); + + void wire_session_ctrl_alt_del( + int port_, + ffi.Pointer id, + ) { + return _wire_session_ctrl_alt_del( + port_, + id, + ); + } + + late final _wire_session_ctrl_alt_delPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_session_ctrl_alt_del'); + late final _wire_session_ctrl_alt_del = _wire_session_ctrl_alt_delPtr + .asFunction)>(); + + void wire_session_switch_display( + int port_, + ffi.Pointer id, + int value, + ) { + return _wire_session_switch_display( + port_, + id, + value, + ); + } + + late final _wire_session_switch_displayPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Int32)>>('wire_session_switch_display'); + late final _wire_session_switch_display = _wire_session_switch_displayPtr + .asFunction, int)>(); + + void wire_session_input_raw_key( + int port_, + ffi.Pointer id, + int keycode, + int scancode, + bool down, + ) { + return _wire_session_input_raw_key( + port_, + id, + keycode, + scancode, + down, + ); + } + + late final _wire_session_input_raw_keyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, ffi.Int32, + ffi.Int32, ffi.Bool)>>('wire_session_input_raw_key'); + late final _wire_session_input_raw_key = + _wire_session_input_raw_keyPtr.asFunction< + void Function(int, ffi.Pointer, int, int, bool)>(); + + void wire_session_input_key( + int port_, + ffi.Pointer id, + ffi.Pointer name, + bool down, + bool press, + bool alt, + bool ctrl, + bool shift, + bool command, + ) { + return _wire_session_input_key( + port_, + id, + name, + down, + press, + alt, + ctrl, + shift, + command, + ); + } + + late final _wire_session_input_keyPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Bool, + ffi.Bool, + ffi.Bool, + ffi.Bool, + ffi.Bool, + ffi.Bool)>>('wire_session_input_key'); + late final _wire_session_input_key = _wire_session_input_keyPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, bool, bool, bool, bool, bool, bool)>(); + + void wire_session_input_string( + int port_, + ffi.Pointer id, + ffi.Pointer value, + ) { + return _wire_session_input_string( + port_, + id, + value, + ); + } + + late final _wire_session_input_stringPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_session_input_string'); + late final _wire_session_input_string = + _wire_session_input_stringPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + void wire_session_send_chat( + int port_, + ffi.Pointer id, + ffi.Pointer text, + ) { + return _wire_session_send_chat( + port_, + id, + text, + ); + } + + late final _wire_session_send_chatPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_session_send_chat'); + late final _wire_session_send_chat = _wire_session_send_chatPtr.asFunction< + void Function( + int, ffi.Pointer, ffi.Pointer)>(); + + void wire_session_peer_option( + int port_, + ffi.Pointer id, + ffi.Pointer name, + ffi.Pointer value, + ) { + return _wire_session_peer_option( + port_, + id, + name, + value, + ); + } + + late final _wire_session_peer_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('wire_session_peer_option'); + late final _wire_session_peer_option = + _wire_session_peer_optionPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + void wire_session_get_peer_option( + int port_, + ffi.Pointer id, + ffi.Pointer name, + ) { + return _wire_session_get_peer_option( + port_, + id, + name, + ); + } + + late final _wire_session_get_peer_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_session_get_peer_option'); + late final _wire_session_get_peer_option = + _wire_session_get_peer_optionPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + void wire_session_input_os_password( + int port_, + ffi.Pointer id, + ffi.Pointer value, + ) { + return _wire_session_input_os_password( + port_, + id, + value, + ); + } + + late final _wire_session_input_os_passwordPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>( + 'wire_session_input_os_password'); + late final _wire_session_input_os_password = + _wire_session_input_os_passwordPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + void wire_session_read_remote_dir( + int port_, + ffi.Pointer id, + ffi.Pointer path, + bool include_hidden, + ) { + return _wire_session_read_remote_dir( + port_, + id, + path, + include_hidden, + ); + } + + late final _wire_session_read_remote_dirPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Bool)>>('wire_session_read_remote_dir'); + late final _wire_session_read_remote_dir = + _wire_session_read_remote_dirPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, bool)>(); + + void wire_session_send_files( + int port_, + ffi.Pointer id, + int act_id, + ffi.Pointer path, + ffi.Pointer to, + int file_num, + bool include_hidden, + bool is_remote, + ) { + return _wire_session_send_files( + port_, + id, + act_id, + path, + to, + file_num, + include_hidden, + is_remote, + ); + } + + late final _wire_session_send_filesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Int32, + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ffi.Bool, + ffi.Bool)>>('wire_session_send_files'); + late final _wire_session_send_files = _wire_session_send_filesPtr.asFunction< + void Function( + int, + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + int, + bool, + bool)>(); + + void wire_session_set_confirm_override_file( + int port_, + ffi.Pointer id, + int act_id, + int file_num, + bool need_override, + bool remember, + bool is_upload, + ) { + return _wire_session_set_confirm_override_file( + port_, + id, + act_id, + file_num, + need_override, + remember, + is_upload, + ); + } + + late final _wire_session_set_confirm_override_filePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Int32, + ffi.Int32, + ffi.Bool, + ffi.Bool, + ffi.Bool)>>('wire_session_set_confirm_override_file'); + late final _wire_session_set_confirm_override_file = + _wire_session_set_confirm_override_filePtr.asFunction< + void Function(int, ffi.Pointer, int, int, bool, + bool, bool)>(); + + void wire_session_remove_file( + int port_, + ffi.Pointer id, + int act_id, + ffi.Pointer path, + int file_num, + bool is_remote, + ) { + return _wire_session_remove_file( + port_, + id, + act_id, + path, + file_num, + is_remote, + ); + } + + late final _wire_session_remove_filePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Int32, + ffi.Pointer, + ffi.Int32, + ffi.Bool)>>('wire_session_remove_file'); + late final _wire_session_remove_file = + _wire_session_remove_filePtr.asFunction< + void Function(int, ffi.Pointer, int, + ffi.Pointer, int, bool)>(); + + void wire_session_read_dir_recursive( + int port_, + ffi.Pointer id, + int act_id, + ffi.Pointer path, + bool is_remote, + bool show_hidden, + ) { + return _wire_session_read_dir_recursive( + port_, + id, + act_id, + path, + is_remote, + show_hidden, + ); + } + + late final _wire_session_read_dir_recursivePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Int32, + ffi.Pointer, + ffi.Bool, + ffi.Bool)>>('wire_session_read_dir_recursive'); + late final _wire_session_read_dir_recursive = + _wire_session_read_dir_recursivePtr.asFunction< + void Function(int, ffi.Pointer, int, + ffi.Pointer, bool, bool)>(); + + void wire_session_remove_all_empty_dirs( + int port_, + ffi.Pointer id, + int act_id, + ffi.Pointer path, + bool is_remote, + ) { + return _wire_session_remove_all_empty_dirs( + port_, + id, + act_id, + path, + is_remote, + ); + } + + late final _wire_session_remove_all_empty_dirsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Int32, + ffi.Pointer, + ffi.Bool)>>('wire_session_remove_all_empty_dirs'); + late final _wire_session_remove_all_empty_dirs = + _wire_session_remove_all_empty_dirsPtr.asFunction< + void Function(int, ffi.Pointer, int, + ffi.Pointer, bool)>(); + + void wire_session_cancel_job( + int port_, + ffi.Pointer id, + int act_id, + ) { + return _wire_session_cancel_job( + port_, + id, + act_id, + ); + } + + late final _wire_session_cancel_jobPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Int32)>>('wire_session_cancel_job'); + late final _wire_session_cancel_job = _wire_session_cancel_jobPtr + .asFunction, int)>(); + + void wire_session_create_dir( + int port_, + ffi.Pointer id, + int act_id, + ffi.Pointer path, + bool is_remote, + ) { + return _wire_session_create_dir( + port_, + id, + act_id, + path, + is_remote, + ); + } + + late final _wire_session_create_dirPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Int32, + ffi.Pointer, + ffi.Bool)>>('wire_session_create_dir'); + late final _wire_session_create_dir = _wire_session_create_dirPtr.asFunction< + void Function(int, ffi.Pointer, int, + ffi.Pointer, bool)>(); + + void wire_session_read_local_dir_sync( + int port_, + ffi.Pointer id, + ffi.Pointer path, + bool show_hidden, + ) { + return _wire_session_read_local_dir_sync( + port_, + id, + path, + show_hidden, + ); + } + + late final _wire_session_read_local_dir_syncPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Bool)>>('wire_session_read_local_dir_sync'); + late final _wire_session_read_local_dir_sync = + _wire_session_read_local_dir_syncPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, bool)>(); + + void wire_session_get_platform( + int port_, + ffi.Pointer id, + bool is_remote, + ) { + return _wire_session_get_platform( + port_, + id, + is_remote, + ); + } + + late final _wire_session_get_platformPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Bool)>>('wire_session_get_platform'); + late final _wire_session_get_platform = _wire_session_get_platformPtr + .asFunction, bool)>(); + + void wire_session_load_last_transfer_jobs( + int port_, + ffi.Pointer id, + ) { + return _wire_session_load_last_transfer_jobs( + port_, + id, + ); + } + + late final _wire_session_load_last_transfer_jobsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer)>>( + 'wire_session_load_last_transfer_jobs'); + late final _wire_session_load_last_transfer_jobs = + _wire_session_load_last_transfer_jobsPtr + .asFunction)>(); + + void wire_session_add_job( + int port_, + ffi.Pointer id, + int act_id, + ffi.Pointer path, + ffi.Pointer to, + int file_num, + bool include_hidden, + bool is_remote, + ) { + return _wire_session_add_job( + port_, + id, + act_id, + path, + to, + file_num, + include_hidden, + is_remote, + ); + } + + late final _wire_session_add_jobPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Int32, + ffi.Pointer, + ffi.Pointer, + ffi.Int32, + ffi.Bool, + ffi.Bool)>>('wire_session_add_job'); + late final _wire_session_add_job = _wire_session_add_jobPtr.asFunction< + void Function( + int, + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + int, + bool, + bool)>(); + + void wire_session_resume_job( + int port_, + ffi.Pointer id, + int act_id, + bool is_remote, + ) { + return _wire_session_resume_job( + port_, + id, + act_id, + is_remote, + ); + } + + late final _wire_session_resume_jobPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, ffi.Int32, + ffi.Bool)>>('wire_session_resume_job'); + late final _wire_session_resume_job = _wire_session_resume_jobPtr.asFunction< + void Function(int, ffi.Pointer, int, bool)>(); + + void wire_main_get_sound_inputs( + int port_, + ) { + return _wire_main_get_sound_inputs( + port_, + ); + } + + late final _wire_main_get_sound_inputsPtr = + _lookup>( + 'wire_main_get_sound_inputs'); + late final _wire_main_get_sound_inputs = + _wire_main_get_sound_inputsPtr.asFunction(); + + void wire_main_change_id( + int port_, + ffi.Pointer new_id, + ) { + return _wire_main_change_id( + port_, + new_id, + ); + } + + late final _wire_main_change_idPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_change_id'); + late final _wire_main_change_id = _wire_main_change_idPtr + .asFunction)>(); + + void wire_main_get_async_status( + int port_, + ) { + return _wire_main_get_async_status( + port_, + ); + } + + late final _wire_main_get_async_statusPtr = + _lookup>( + 'wire_main_get_async_status'); + late final _wire_main_get_async_status = + _wire_main_get_async_statusPtr.asFunction(); + + void wire_main_get_option( + int port_, + ffi.Pointer key, + ) { + return _wire_main_get_option( + port_, + key, + ); + } + + late final _wire_main_get_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_get_option'); + late final _wire_main_get_option = _wire_main_get_optionPtr + .asFunction)>(); + + void wire_main_set_option( + int port_, + ffi.Pointer key, + ffi.Pointer value, + ) { + return _wire_main_set_option( + port_, + key, + value, + ); + } + + late final _wire_main_set_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_main_set_option'); + late final _wire_main_set_option = _wire_main_set_optionPtr.asFunction< + void Function( + int, ffi.Pointer, ffi.Pointer)>(); + + void wire_main_get_options( + int port_, + ) { + return _wire_main_get_options( + port_, + ); + } + + late final _wire_main_get_optionsPtr = + _lookup>( + 'wire_main_get_options'); + late final _wire_main_get_options = + _wire_main_get_optionsPtr.asFunction(); + + void wire_main_set_options( + int port_, + ffi.Pointer json, + ) { + return _wire_main_set_options( + port_, + json, + ); + } + + late final _wire_main_set_optionsPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_set_options'); + late final _wire_main_set_options = _wire_main_set_optionsPtr + .asFunction)>(); + + void wire_main_test_if_valid_server( + int port_, + ffi.Pointer server, + ) { + return _wire_main_test_if_valid_server( + port_, + server, + ); + } + + late final _wire_main_test_if_valid_serverPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer)>>( + 'wire_main_test_if_valid_server'); + late final _wire_main_test_if_valid_server = + _wire_main_test_if_valid_serverPtr + .asFunction)>(); + + void wire_main_set_socks( + int port_, + ffi.Pointer proxy, + ffi.Pointer username, + ffi.Pointer password, + ) { + return _wire_main_set_socks( + port_, + proxy, + username, + password, + ); + } + + late final _wire_main_set_socksPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('wire_main_set_socks'); + late final _wire_main_set_socks = _wire_main_set_socksPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + void wire_main_get_socks( + int port_, + ) { + return _wire_main_get_socks( + port_, + ); + } + + late final _wire_main_get_socksPtr = + _lookup>( + 'wire_main_get_socks'); + late final _wire_main_get_socks = + _wire_main_get_socksPtr.asFunction(); + + void wire_main_get_app_name( + int port_, + ) { + return _wire_main_get_app_name( + port_, + ); + } + + late final _wire_main_get_app_namePtr = + _lookup>( + 'wire_main_get_app_name'); + late final _wire_main_get_app_name = + _wire_main_get_app_namePtr.asFunction(); + + void wire_main_get_license( + int port_, + ) { + return _wire_main_get_license( + port_, + ); + } + + late final _wire_main_get_licensePtr = + _lookup>( + 'wire_main_get_license'); + late final _wire_main_get_license = + _wire_main_get_licensePtr.asFunction(); + + void wire_main_get_version( + int port_, + ) { + return _wire_main_get_version( + port_, + ); + } + + late final _wire_main_get_versionPtr = + _lookup>( + 'wire_main_get_version'); + late final _wire_main_get_version = + _wire_main_get_versionPtr.asFunction(); + + void wire_main_get_fav( + int port_, + ) { + return _wire_main_get_fav( + port_, + ); + } + + late final _wire_main_get_favPtr = + _lookup>( + 'wire_main_get_fav'); + late final _wire_main_get_fav = + _wire_main_get_favPtr.asFunction(); + + void wire_main_store_fav( + int port_, + ffi.Pointer favs, + ) { + return _wire_main_store_fav( + port_, + favs, + ); + } + + late final _wire_main_store_favPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer)>>('wire_main_store_fav'); + late final _wire_main_store_fav = _wire_main_store_favPtr + .asFunction)>(); + + void wire_main_get_peer( + int port_, + ffi.Pointer id, + ) { + return _wire_main_get_peer( + port_, + id, + ); + } + + late final _wire_main_get_peerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer)>>('wire_main_get_peer'); + late final _wire_main_get_peer = _wire_main_get_peerPtr + .asFunction)>(); + + void wire_main_get_lan_peers( + int port_, + ) { + return _wire_main_get_lan_peers( + port_, + ); + } + + late final _wire_main_get_lan_peersPtr = + _lookup>( + 'wire_main_get_lan_peers'); + late final _wire_main_get_lan_peers = + _wire_main_get_lan_peersPtr.asFunction(); + + void wire_main_get_connect_status( + int port_, + ) { + return _wire_main_get_connect_status( + port_, + ); + } + + late final _wire_main_get_connect_statusPtr = + _lookup>( + 'wire_main_get_connect_status'); + late final _wire_main_get_connect_status = + _wire_main_get_connect_statusPtr.asFunction(); + + void wire_main_check_connect_status( + int port_, + ) { + return _wire_main_check_connect_status( + port_, + ); + } + + late final _wire_main_check_connect_statusPtr = + _lookup>( + 'wire_main_check_connect_status'); + late final _wire_main_check_connect_status = + _wire_main_check_connect_statusPtr.asFunction(); + + void wire_main_is_using_public_server( + int port_, + ) { + return _wire_main_is_using_public_server( + port_, + ); + } + + late final _wire_main_is_using_public_serverPtr = + _lookup>( + 'wire_main_is_using_public_server'); + late final _wire_main_is_using_public_server = + _wire_main_is_using_public_serverPtr.asFunction(); + + void wire_main_discover( + int port_, + ) { + return _wire_main_discover( + port_, + ); + } + + late final _wire_main_discoverPtr = + _lookup>( + 'wire_main_discover'); + late final _wire_main_discover = + _wire_main_discoverPtr.asFunction(); + + void wire_main_has_rendezvous_service( + int port_, + ) { + return _wire_main_has_rendezvous_service( + port_, + ); + } + + late final _wire_main_has_rendezvous_servicePtr = + _lookup>( + 'wire_main_has_rendezvous_service'); + late final _wire_main_has_rendezvous_service = + _wire_main_has_rendezvous_servicePtr.asFunction(); + + void wire_main_get_api_server( + int port_, + ) { + return _wire_main_get_api_server( + port_, + ); + } + + late final _wire_main_get_api_serverPtr = + _lookup>( + 'wire_main_get_api_server'); + late final _wire_main_get_api_server = + _wire_main_get_api_serverPtr.asFunction(); + + void wire_main_post_request( + int port_, + ffi.Pointer url, + ffi.Pointer body, + ffi.Pointer header, + ) { + return _wire_main_post_request( + port_, + url, + body, + header, + ); + } + + late final _wire_main_post_requestPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('wire_main_post_request'); + late final _wire_main_post_request = _wire_main_post_requestPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + void wire_main_get_local_option( + int port_, + ffi.Pointer key, + ) { + return _wire_main_get_local_option( + port_, + key, + ); + } + + late final _wire_main_get_local_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_get_local_option'); + late final _wire_main_get_local_option = _wire_main_get_local_optionPtr + .asFunction)>(); + + void wire_main_set_local_option( + int port_, + ffi.Pointer key, + ffi.Pointer value, + ) { + return _wire_main_set_local_option( + port_, + key, + value, + ); + } + + late final _wire_main_set_local_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_main_set_local_option'); + late final _wire_main_set_local_option = + _wire_main_set_local_optionPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + void wire_main_get_my_id( + int port_, + ) { + return _wire_main_get_my_id( + port_, + ); + } + + late final _wire_main_get_my_idPtr = + _lookup>( + 'wire_main_get_my_id'); + late final _wire_main_get_my_id = + _wire_main_get_my_idPtr.asFunction(); + + void wire_main_get_uuid( + int port_, + ) { + return _wire_main_get_uuid( + port_, + ); + } + + late final _wire_main_get_uuidPtr = + _lookup>( + 'wire_main_get_uuid'); + late final _wire_main_get_uuid = + _wire_main_get_uuidPtr.asFunction(); + + void wire_main_get_peer_option( + int port_, + ffi.Pointer id, + ffi.Pointer key, + ) { + return _wire_main_get_peer_option( + port_, + id, + key, + ); + } + + late final _wire_main_get_peer_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_main_get_peer_option'); + late final _wire_main_get_peer_option = + _wire_main_get_peer_optionPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer)>(); + + void wire_main_set_peer_option( + int port_, + ffi.Pointer id, + ffi.Pointer key, + ffi.Pointer value, + ) { + return _wire_main_set_peer_option( + port_, + id, + key, + value, + ); + } + + late final _wire_main_set_peer_optionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('wire_main_set_peer_option'); + late final _wire_main_set_peer_option = + _wire_main_set_peer_optionPtr.asFunction< + void Function(int, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + void wire_main_forget_password( + int port_, + ffi.Pointer id, + ) { + return _wire_main_forget_password( + port_, + id, + ); + } + + late final _wire_main_forget_passwordPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_forget_password'); + late final _wire_main_forget_password = _wire_main_forget_passwordPtr + .asFunction)>(); + + void wire_main_get_recent_peers( + int port_, + ) { + return _wire_main_get_recent_peers( + port_, + ); + } + + late final _wire_main_get_recent_peersPtr = + _lookup>( + 'wire_main_get_recent_peers'); + late final _wire_main_get_recent_peers = + _wire_main_get_recent_peersPtr.asFunction(); + + void wire_main_load_recent_peers( + int port_, + ) { + return _wire_main_load_recent_peers( + port_, + ); + } + + late final _wire_main_load_recent_peersPtr = + _lookup>( + 'wire_main_load_recent_peers'); + late final _wire_main_load_recent_peers = + _wire_main_load_recent_peersPtr.asFunction(); + + void wire_main_load_fav_peers( + int port_, + ) { + return _wire_main_load_fav_peers( + port_, + ); + } + + late final _wire_main_load_fav_peersPtr = + _lookup>( + 'wire_main_load_fav_peers'); + late final _wire_main_load_fav_peers = + _wire_main_load_fav_peersPtr.asFunction(); + + void wire_main_load_lan_peers( + int port_, + ) { + return _wire_main_load_lan_peers( + port_, + ); + } + + late final _wire_main_load_lan_peersPtr = + _lookup>( + 'wire_main_load_lan_peers'); + late final _wire_main_load_lan_peers = + _wire_main_load_lan_peersPtr.asFunction(); + + void wire_main_get_last_remote_id( + int port_, + ) { + return _wire_main_get_last_remote_id( + port_, + ); + } + + late final _wire_main_get_last_remote_idPtr = + _lookup>( + 'wire_main_get_last_remote_id'); + late final _wire_main_get_last_remote_id = + _wire_main_get_last_remote_idPtr.asFunction(); + + void wire_main_get_software_update_url( + int port_, + ) { + return _wire_main_get_software_update_url( + port_, + ); + } + + late final _wire_main_get_software_update_urlPtr = + _lookup>( + 'wire_main_get_software_update_url'); + late final _wire_main_get_software_update_url = + _wire_main_get_software_update_urlPtr.asFunction(); + + void wire_main_get_home_dir( + int port_, + ) { + return _wire_main_get_home_dir( + port_, + ); + } + + late final _wire_main_get_home_dirPtr = + _lookup>( + 'wire_main_get_home_dir'); + late final _wire_main_get_home_dir = + _wire_main_get_home_dirPtr.asFunction(); + + void wire_main_get_langs( + int port_, + ) { + return _wire_main_get_langs( + port_, + ); + } + + late final _wire_main_get_langsPtr = + _lookup>( + 'wire_main_get_langs'); + late final _wire_main_get_langs = + _wire_main_get_langsPtr.asFunction(); + + void wire_main_get_temporary_password( + int port_, + ) { + return _wire_main_get_temporary_password( + port_, + ); + } + + late final _wire_main_get_temporary_passwordPtr = + _lookup>( + 'wire_main_get_temporary_password'); + late final _wire_main_get_temporary_password = + _wire_main_get_temporary_passwordPtr.asFunction(); + + void wire_main_get_permanent_password( + int port_, + ) { + return _wire_main_get_permanent_password( + port_, + ); + } + + late final _wire_main_get_permanent_passwordPtr = + _lookup>( + 'wire_main_get_permanent_password'); + late final _wire_main_get_permanent_password = + _wire_main_get_permanent_passwordPtr.asFunction(); + + void wire_main_get_online_statue( + int port_, + ) { + return _wire_main_get_online_statue( + port_, + ); + } + + late final _wire_main_get_online_statuePtr = + _lookup>( + 'wire_main_get_online_statue'); + late final _wire_main_get_online_statue = + _wire_main_get_online_statuePtr.asFunction(); + + void wire_main_get_clients_state( + int port_, + ) { + return _wire_main_get_clients_state( + port_, + ); + } + + late final _wire_main_get_clients_statePtr = + _lookup>( + 'wire_main_get_clients_state'); + late final _wire_main_get_clients_state = + _wire_main_get_clients_statePtr.asFunction(); + + void wire_main_check_clients_length( + int port_, + int length, + ) { + return _wire_main_check_clients_length( + port_, + length, + ); + } + + late final _wire_main_check_clients_lengthPtr = + _lookup>( + 'wire_main_check_clients_length'); + late final _wire_main_check_clients_length = + _wire_main_check_clients_lengthPtr.asFunction(); + + void wire_main_init( + int port_, + ffi.Pointer app_dir, + ) { + return _wire_main_init( + port_, + app_dir, + ); + } + + late final _wire_main_initPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer)>>('wire_main_init'); + late final _wire_main_init = _wire_main_initPtr + .asFunction)>(); + + void wire_main_device_id( + int port_, + ffi.Pointer id, + ) { + return _wire_main_device_id( + port_, + id, + ); + } + + late final _wire_main_device_idPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_device_id'); + late final _wire_main_device_id = _wire_main_device_idPtr + .asFunction)>(); + + void wire_main_device_name( + int port_, + ffi.Pointer name, + ) { + return _wire_main_device_name( + port_, + name, + ); + } + + late final _wire_main_device_namePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_device_name'); + late final _wire_main_device_name = _wire_main_device_namePtr + .asFunction)>(); + + void wire_main_remove_peer( + int port_, + ffi.Pointer id, + ) { + return _wire_main_remove_peer( + port_, + id, + ); + } + + late final _wire_main_remove_peerPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_remove_peer'); + late final _wire_main_remove_peer = _wire_main_remove_peerPtr + .asFunction)>(); + + void wire_main_has_hwcodec( + int port_, + ) { + return _wire_main_has_hwcodec( + port_, + ); + } + + late final _wire_main_has_hwcodecPtr = + _lookup>( + 'wire_main_has_hwcodec'); + late final _wire_main_has_hwcodec = + _wire_main_has_hwcodecPtr.asFunction(); + + void wire_session_send_mouse( + int port_, + ffi.Pointer id, + ffi.Pointer msg, + ) { + return _wire_session_send_mouse( + port_, + id, + msg, + ); + } + + late final _wire_session_send_mousePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer, + ffi.Pointer)>>('wire_session_send_mouse'); + late final _wire_session_send_mouse = _wire_session_send_mousePtr.asFunction< + void Function( + int, ffi.Pointer, ffi.Pointer)>(); + + void wire_session_restart_remote_device( + int port_, + ffi.Pointer id, + ) { + return _wire_session_restart_remote_device( + port_, + id, + ); + } + + late final _wire_session_restart_remote_devicePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer)>>( + 'wire_session_restart_remote_device'); + late final _wire_session_restart_remote_device = + _wire_session_restart_remote_devicePtr + .asFunction)>(); + + void wire_main_set_home_dir( + int port_, + ffi.Pointer home, + ) { + return _wire_main_set_home_dir( + port_, + home, + ); + } + + late final _wire_main_set_home_dirPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, + ffi.Pointer)>>('wire_main_set_home_dir'); + late final _wire_main_set_home_dir = _wire_main_set_home_dirPtr + .asFunction)>(); + + void wire_main_stop_service( + int port_, + ) { + return _wire_main_stop_service( + port_, + ); + } + + late final _wire_main_stop_servicePtr = + _lookup>( + 'wire_main_stop_service'); + late final _wire_main_stop_service = + _wire_main_stop_servicePtr.asFunction(); + + void wire_main_start_service( + int port_, + ) { + return _wire_main_start_service( + port_, + ); + } + + late final _wire_main_start_servicePtr = + _lookup>( + 'wire_main_start_service'); + late final _wire_main_start_service = + _wire_main_start_servicePtr.asFunction(); + + void wire_main_update_temporary_password( + int port_, + ) { + return _wire_main_update_temporary_password( + port_, + ); + } + + late final _wire_main_update_temporary_passwordPtr = + _lookup>( + 'wire_main_update_temporary_password'); + late final _wire_main_update_temporary_password = + _wire_main_update_temporary_passwordPtr.asFunction(); + + void wire_main_set_permanent_password( + int port_, + ffi.Pointer password, + ) { + return _wire_main_set_permanent_password( + port_, + password, + ); + } + + late final _wire_main_set_permanent_passwordPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Pointer)>>( + 'wire_main_set_permanent_password'); + late final _wire_main_set_permanent_password = + _wire_main_set_permanent_passwordPtr + .asFunction)>(); + + void wire_main_check_super_user_permission( + int port_, + ) { + return _wire_main_check_super_user_permission( + port_, + ); + } + + late final _wire_main_check_super_user_permissionPtr = + _lookup>( + 'wire_main_check_super_user_permission'); + late final _wire_main_check_super_user_permission = + _wire_main_check_super_user_permissionPtr + .asFunction(); + + void wire_cm_send_chat( + int port_, + int conn_id, + ffi.Pointer msg, + ) { + return _wire_cm_send_chat( + port_, + conn_id, + msg, + ); + } + + late final _wire_cm_send_chatPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Int32, + ffi.Pointer)>>('wire_cm_send_chat'); + late final _wire_cm_send_chat = _wire_cm_send_chatPtr + .asFunction)>(); + + void wire_cm_login_res( + int port_, + int conn_id, + bool res, + ) { + return _wire_cm_login_res( + port_, + conn_id, + res, + ); + } + + late final _wire_cm_login_resPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Int32, ffi.Bool)>>('wire_cm_login_res'); + late final _wire_cm_login_res = + _wire_cm_login_resPtr.asFunction(); + + void wire_cm_close_connection( + int port_, + int conn_id, + ) { + return _wire_cm_close_connection( + port_, + conn_id, + ); + } + + late final _wire_cm_close_connectionPtr = + _lookup>( + 'wire_cm_close_connection'); + late final _wire_cm_close_connection = + _wire_cm_close_connectionPtr.asFunction(); + + void wire_cm_check_click_time( + int port_, + int conn_id, + ) { + return _wire_cm_check_click_time( + port_, + conn_id, + ); + } + + late final _wire_cm_check_click_timePtr = + _lookup>( + 'wire_cm_check_click_time'); + late final _wire_cm_check_click_time = + _wire_cm_check_click_timePtr.asFunction(); + + void wire_cm_get_click_time( + int port_, + ) { + return _wire_cm_get_click_time( + port_, + ); + } + + late final _wire_cm_get_click_timePtr = + _lookup>( + 'wire_cm_get_click_time'); + late final _wire_cm_get_click_time = + _wire_cm_get_click_timePtr.asFunction(); + + void wire_cm_switch_permission( + int port_, + int conn_id, + ffi.Pointer name, + bool enabled, + ) { + return _wire_cm_switch_permission( + port_, + conn_id, + name, + enabled, + ); + } + + late final _wire_cm_switch_permissionPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Int64, ffi.Int32, ffi.Pointer, + ffi.Bool)>>('wire_cm_switch_permission'); + late final _wire_cm_switch_permission = + _wire_cm_switch_permissionPtr.asFunction< + void Function(int, int, ffi.Pointer, bool)>(); + + void wire_main_get_icon( + int port_, + ) { + return _wire_main_get_icon( + port_, + ); + } + + late final _wire_main_get_iconPtr = + _lookup>( + 'wire_main_get_icon'); + late final _wire_main_get_icon = + _wire_main_get_iconPtr.asFunction(); + + void wire_query_onlines( + int port_, + ffi.Pointer ids, + ) { + return _wire_query_onlines( + port_, + ids, + ); + } + + late final _wire_query_onlinesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer)>>('wire_query_onlines'); + late final _wire_query_onlines = _wire_query_onlinesPtr + .asFunction)>(); + + ffi.Pointer new_StringList( + int len, + ) { + return _new_StringList( + len, + ); + } + + late final _new_StringListPtr = _lookup< + ffi.NativeFunction Function(ffi.Int32)>>( + 'new_StringList'); + late final _new_StringList = _new_StringListPtr + .asFunction Function(int)>(); + + ffi.Pointer new_uint_8_list( + int len, + ) { + return _new_uint_8_list( + len, + ); + } + + late final _new_uint_8_listPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int32)>>('new_uint_8_list'); + late final _new_uint_8_list = _new_uint_8_listPtr + .asFunction Function(int)>(); + + void free_WireSyncReturnStruct( + WireSyncReturnStruct val, + ) { + return _free_WireSyncReturnStruct( + val, + ); + } + + late final _free_WireSyncReturnStructPtr = + _lookup>( + 'free_WireSyncReturnStruct'); + late final _free_WireSyncReturnStruct = _free_WireSyncReturnStructPtr + .asFunction(); + + void store_dart_post_cobject( + DartPostCObjectFnType ptr, + ) { + return _store_dart_post_cobject( + ptr, + ); + } + + late final _store_dart_post_cobjectPtr = + _lookup>( + 'store_dart_post_cobject'); + late final _store_dart_post_cobject = _store_dart_post_cobjectPtr + .asFunction(); + + bool rustdesk_core_main() { + return _rustdesk_core_main(); + } + + late final _rustdesk_core_mainPtr = + _lookup>('rustdesk_core_main'); + late final _rustdesk_core_main = + _rustdesk_core_mainPtr.asFunction(); +} + +class wire_uint_8_list extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + +class wire_StringList extends ffi.Struct { + external ffi.Pointer> ptr; + + @ffi.Int32() + external int len; +} + +typedef uintptr_t = ffi.UnsignedLong; +typedef DartPostCObjectFnType = ffi.Pointer< + ffi.NativeFunction)>>; +typedef DartPort = ffi.Int64; + +const int GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 2; + +const int GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 4; diff --git a/flutter/lib/generated_bridge.freezed.dart b/flutter/lib/generated_bridge.freezed.dart new file mode 100644 index 000000000..fbaa6105f --- /dev/null +++ b/flutter/lib/generated_bridge.freezed.dart @@ -0,0 +1,332 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target + +part of 'generated_bridge.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$EventToUI { + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) event, + required TResult Function(Uint8List field0) rgba, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(String field0)? event, + TResult Function(Uint8List field0)? rgba, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? event, + TResult Function(Uint8List field0)? rgba, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(Event value) event, + required TResult Function(Rgba value) rgba, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(Event value)? event, + TResult Function(Rgba value)? rgba, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Event value)? event, + TResult Function(Rgba value)? rgba, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $EventToUICopyWith<$Res> { + factory $EventToUICopyWith(EventToUI value, $Res Function(EventToUI) then) = + _$EventToUICopyWithImpl<$Res>; +} + +/// @nodoc +class _$EventToUICopyWithImpl<$Res> implements $EventToUICopyWith<$Res> { + _$EventToUICopyWithImpl(this._value, this._then); + + final EventToUI _value; + // ignore: unused_field + final $Res Function(EventToUI) _then; +} + +/// @nodoc +abstract class _$$EventCopyWith<$Res> { + factory _$$EventCopyWith(_$Event value, $Res Function(_$Event) then) = + __$$EventCopyWithImpl<$Res>; + $Res call({String field0}); +} + +/// @nodoc +class __$$EventCopyWithImpl<$Res> extends _$EventToUICopyWithImpl<$Res> + implements _$$EventCopyWith<$Res> { + __$$EventCopyWithImpl(_$Event _value, $Res Function(_$Event) _then) + : super(_value, (v) => _then(v as _$Event)); + + @override + _$Event get _value => super._value as _$Event; + + @override + $Res call({ + Object? field0 = freezed, + }) { + return _then(_$Event( + field0 == freezed + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$Event implements Event { + const _$Event(this.field0); + + @override + final String field0; + + @override + String toString() { + return 'EventToUI.event(field0: $field0)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$Event && + const DeepCollectionEquality().equals(other.field0, field0)); + } + + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(field0)); + + @JsonKey(ignore: true) + @override + _$$EventCopyWith<_$Event> get copyWith => + __$$EventCopyWithImpl<_$Event>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) event, + required TResult Function(Uint8List field0) rgba, + }) { + return event(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(String field0)? event, + TResult Function(Uint8List field0)? rgba, + }) { + return event?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? event, + TResult Function(Uint8List field0)? rgba, + required TResult orElse(), + }) { + if (event != null) { + return event(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Event value) event, + required TResult Function(Rgba value) rgba, + }) { + return event(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(Event value)? event, + TResult Function(Rgba value)? rgba, + }) { + return event?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Event value)? event, + TResult Function(Rgba value)? rgba, + required TResult orElse(), + }) { + if (event != null) { + return event(this); + } + return orElse(); + } +} + +abstract class Event implements EventToUI { + const factory Event(final String field0) = _$Event; + + String get field0; + @JsonKey(ignore: true) + _$$EventCopyWith<_$Event> get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RgbaCopyWith<$Res> { + factory _$$RgbaCopyWith(_$Rgba value, $Res Function(_$Rgba) then) = + __$$RgbaCopyWithImpl<$Res>; + $Res call({Uint8List field0}); +} + +/// @nodoc +class __$$RgbaCopyWithImpl<$Res> extends _$EventToUICopyWithImpl<$Res> + implements _$$RgbaCopyWith<$Res> { + __$$RgbaCopyWithImpl(_$Rgba _value, $Res Function(_$Rgba) _then) + : super(_value, (v) => _then(v as _$Rgba)); + + @override + _$Rgba get _value => super._value as _$Rgba; + + @override + $Res call({ + Object? field0 = freezed, + }) { + return _then(_$Rgba( + field0 == freezed + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as Uint8List, + )); + } +} + +/// @nodoc + +class _$Rgba implements Rgba { + const _$Rgba(this.field0); + + @override + final Uint8List field0; + + @override + String toString() { + return 'EventToUI.rgba(field0: $field0)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$Rgba && + const DeepCollectionEquality().equals(other.field0, field0)); + } + + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(field0)); + + @JsonKey(ignore: true) + @override + _$$RgbaCopyWith<_$Rgba> get copyWith => + __$$RgbaCopyWithImpl<_$Rgba>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String field0) event, + required TResult Function(Uint8List field0) rgba, + }) { + return rgba(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult Function(String field0)? event, + TResult Function(Uint8List field0)? rgba, + }) { + return rgba?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String field0)? event, + TResult Function(Uint8List field0)? rgba, + required TResult orElse(), + }) { + if (rgba != null) { + return rgba(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(Event value) event, + required TResult Function(Rgba value) rgba, + }) { + return rgba(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult Function(Event value)? event, + TResult Function(Rgba value)? rgba, + }) { + return rgba?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Event value)? event, + TResult Function(Rgba value)? rgba, + required TResult orElse(), + }) { + if (rgba != null) { + return rgba(this); + } + return orElse(); + } +} + +abstract class Rgba implements EventToUI { + const factory Rgba(final Uint8List field0) = _$Rgba; + + Uint8List get field0; + @JsonKey(ignore: true) + _$$RgbaCopyWith<_$Rgba> get copyWith => throw _privateConstructorUsedError; +} diff --git a/flutter/lib/generated_plugin_registrant.dart b/flutter/lib/generated_plugin_registrant.dart new file mode 100644 index 000000000..eba9fb8cc --- /dev/null +++ b/flutter/lib/generated_plugin_registrant.dart @@ -0,0 +1,35 @@ +// +// Generated file. Do not edit. +// + +// ignore_for_file: directives_ordering +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: depend_on_referenced_packages + +import 'package:desktop_drop/desktop_drop_web.dart'; +import 'package:device_info_plus_web/device_info_plus_web.dart'; +import 'package:firebase_analytics_web/firebase_analytics_web.dart'; +import 'package:firebase_core_web/firebase_core_web.dart'; +import 'package:image_picker_for_web/image_picker_for_web.dart'; +import 'package:package_info_plus_web/package_info_plus_web.dart'; +import 'package:shared_preferences_web/shared_preferences_web.dart'; +import 'package:url_launcher_web/url_launcher_web.dart'; +import 'package:video_player_web/video_player_web.dart'; +import 'package:wakelock_web/wakelock_web.dart'; + +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + +// ignore: public_member_api_docs +void registerPlugins(Registrar registrar) { + DesktopDropWeb.registerWith(registrar); + DeviceInfoPlusPlugin.registerWith(registrar); + FirebaseAnalyticsWeb.registerWith(registrar); + FirebaseCoreWeb.registerWith(registrar); + ImagePickerPlugin.registerWith(registrar); + PackageInfoPlugin.registerWith(registrar); + SharedPreferencesPlugin.registerWith(registrar); + UrlLauncherPlugin.registerWith(registrar); + VideoPlayerPlugin.registerWith(registrar); + WakelockWeb.registerWith(registrar); + registrar.registerMessageHandler(); +} diff --git a/flutter/macos/Podfile.lock b/flutter/macos/Podfile.lock index a83616180..e417eb188 100644 --- a/flutter/macos/Podfile.lock +++ b/flutter/macos/Podfile.lock @@ -1,78 +1,84 @@ PODS: - - bitsdojo_window_macos (0.0.1): + - desktop_drop (0.0.1): - FlutterMacOS - desktop_multi_window (0.0.1): - FlutterMacOS - device_info_plus_macos (0.0.1): - FlutterMacOS - - Firebase/Analytics (8.15.0): + - Firebase/Analytics (9.4.0): - Firebase/Core - - Firebase/Core (8.15.0): + - Firebase/Core (9.4.0): - Firebase/CoreOnly - - FirebaseAnalytics (~> 8.15.0) - - Firebase/CoreOnly (8.15.0): - - FirebaseCore (= 8.15.0) - - firebase_analytics (9.1.9): - - Firebase/Analytics (= 8.15.0) + - FirebaseAnalytics (~> 9.4.0) + - Firebase/CoreOnly (9.4.0): + - FirebaseCore (= 9.4.0) + - firebase_analytics (9.3.3): + - Firebase/Analytics (= 9.4.0) - firebase_core - FlutterMacOS - - firebase_core (1.17.1): - - Firebase/CoreOnly (~> 8.15.0) + - firebase_core (1.21.1): + - Firebase/CoreOnly (~> 9.4.0) - FlutterMacOS - - FirebaseAnalytics (8.15.0): - - FirebaseAnalytics/AdIdSupport (= 8.15.0) - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) + - FirebaseAnalytics (9.4.0): + - FirebaseAnalytics/AdIdSupport (= 9.4.0) + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - FirebaseAnalytics/AdIdSupport (8.15.0): - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) - - GoogleAppMeasurement (= 8.15.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseAnalytics/AdIdSupport (9.4.0): + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) + - GoogleAppMeasurement (= 9.4.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - FirebaseCore (8.15.0): - - FirebaseCoreDiagnostics (~> 8.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseCore (9.4.0): + - FirebaseCoreDiagnostics (~> 9.0) + - FirebaseCoreInternal (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - - FirebaseCoreDiagnostics (8.15.0): - - GoogleDataTransport (~> 9.1) + - FirebaseCoreDiagnostics (9.5.0): + - GoogleDataTransport (< 10.0.0, >= 9.1.4) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - - nanopb (~> 2.30908.0) - - FirebaseInstallations (8.15.0): - - FirebaseCore (~> 8.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseCoreInternal (9.5.0): + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - FirebaseInstallations (9.5.0): + - FirebaseCore (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/UserDefaults (~> 7.7) - - PromisesObjC (< 3.0, >= 1.2) + - PromisesObjC (~> 2.1) - FlutterMacOS (1.0.0) - - GoogleAppMeasurement (8.15.0): - - GoogleAppMeasurement/AdIdSupport (= 8.15.0) + - FMDB (2.7.5): + - FMDB/standard (= 2.7.5) + - FMDB/standard (2.7.5) + - GoogleAppMeasurement (9.4.0): + - GoogleAppMeasurement/AdIdSupport (= 9.4.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - GoogleAppMeasurement/AdIdSupport (8.15.0): - - GoogleAppMeasurement/WithoutAdIdSupport (= 8.15.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (9.4.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 9.4.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - GoogleAppMeasurement/WithoutAdIdSupport (8.15.0): + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (9.4.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - GoogleDataTransport (9.1.4): + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleDataTransport (9.2.0): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) @@ -95,18 +101,25 @@ PODS: - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (7.7.0): - GoogleUtilities/Logger - - nanopb (2.30908.0): - - nanopb/decode (= 2.30908.0) - - nanopb/encode (= 2.30908.0) - - nanopb/decode (2.30908.0) - - nanopb/encode (2.30908.0) + - nanopb (2.30909.0): + - nanopb/decode (= 2.30909.0) + - nanopb/encode (= 2.30909.0) + - nanopb/decode (2.30909.0) + - nanopb/encode (2.30909.0) - package_info_plus_macos (0.0.1): - FlutterMacOS - path_provider_macos (0.0.1): - FlutterMacOS - - PromisesObjC (2.1.0) + - PromisesObjC (2.1.1) + - screen_retriever (0.0.1): + - FlutterMacOS - shared_preferences_macos (0.0.1): - FlutterMacOS + - sqflite (0.0.2): + - FlutterMacOS + - FMDB (>= 2.7.5) + - tray_manager (0.0.1): + - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS - wakelock_macos (0.0.1): @@ -115,7 +128,7 @@ PODS: - FlutterMacOS DEPENDENCIES: - - bitsdojo_window_macos (from `Flutter/ephemeral/.symlinks/plugins/bitsdojo_window_macos/macos`) + - desktop_drop (from `Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos`) - desktop_multi_window (from `Flutter/ephemeral/.symlinks/plugins/desktop_multi_window/macos`) - device_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos`) - firebase_analytics (from `Flutter/ephemeral/.symlinks/plugins/firebase_analytics/macos`) @@ -123,7 +136,10 @@ DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`) - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) + - screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`) - shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`) + - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`) + - tray_manager (from `Flutter/ephemeral/.symlinks/plugins/tray_manager/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - wakelock_macos (from `Flutter/ephemeral/.symlinks/plugins/wakelock_macos/macos`) - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) @@ -134,7 +150,9 @@ SPEC REPOS: - FirebaseAnalytics - FirebaseCore - FirebaseCoreDiagnostics + - FirebaseCoreInternal - FirebaseInstallations + - FMDB - GoogleAppMeasurement - GoogleDataTransport - GoogleUtilities @@ -142,8 +160,8 @@ SPEC REPOS: - PromisesObjC EXTERNAL SOURCES: - bitsdojo_window_macos: - :path: Flutter/ephemeral/.symlinks/plugins/bitsdojo_window_macos/macos + desktop_drop: + :path: Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos desktop_multi_window: :path: Flutter/ephemeral/.symlinks/plugins/desktop_multi_window/macos device_info_plus_macos: @@ -158,8 +176,14 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos path_provider_macos: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos + screen_retriever: + :path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos shared_preferences_macos: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos + sqflite: + :path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos + tray_manager: + :path: Flutter/ephemeral/.symlinks/plugins/tray_manager/macos url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos wakelock_macos: @@ -168,25 +192,30 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos SPEC CHECKSUMS: - bitsdojo_window_macos: 44e3b8fe3dd463820e0321f6256c5b1c16bb6a00 + desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898 desktop_multi_window: 566489c048b501134f9d7fb6a2354c60a9126486 device_info_plus_macos: 1ad388a1ef433505c4038e7dd9605aadd1e2e9c7 - Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d - firebase_analytics: d448483150504ed84f25c5437a34af2591a7929e - firebase_core: 7b87364e2d1eae70018a60698e89e7d6f5320bad - FirebaseAnalytics: 7761cbadb00a717d8d0939363eb46041526474fa - FirebaseCore: 5743c5785c074a794d35f2fff7ecc254a91e08b1 - FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb - FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd + Firebase: 7703fc4022824b6d6db1bf7bea58d13b8e17ec46 + firebase_analytics: 57144bae6cd39d3be367a8767a1b8857a037cee5 + firebase_core: 822a1076483bf9764284322c9310daa98e1e6817 + FirebaseAnalytics: a1a24e72b7ba7f47045a4633f1abb545c07bd29c + FirebaseCore: 9a2b10270a854731c4d4d8a97d0aa8380ec3458d + FirebaseCoreDiagnostics: 17cbf4e72b1dbd64bfdc33d4b1f07bce4f16f1d8 + FirebaseCoreInternal: 50a8e39cae8abf72d5145d07ea34c3244f70862b + FirebaseInstallations: 41f811b530c41dd90973d0174381cdb3fcb5e839 FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 - GoogleAppMeasurement: 4c19f031220c72464d460c9daa1fb5d1acce958e - GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b + FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + GoogleAppMeasurement: 5d69e04287fc2c10cc43724bfa4bf31fc12c3dff + GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1 - nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 + nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 - PromisesObjC: 99b6f43f9e1044bd87a95a60beff28c2c44ddb72 + PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb + screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38 shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727 + sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea + tray_manager: 9064e219c56d75c476e46b9a21182087930baf90 url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 wakelock_macos: bc3f2a9bd8d2e6c89fee1e1822e7ddac3bd004a9 window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 diff --git a/flutter/macos/Runner/Release.entitlements b/flutter/macos/Runner/Release.entitlements index 852fa1a47..ee95ab7e5 100644 --- a/flutter/macos/Runner/Release.entitlements +++ b/flutter/macos/Runner/Release.entitlements @@ -4,5 +4,7 @@ com.apple.security.app-sandbox + com.apple.security.network.client + diff --git a/flutter/macos/rustdesk.xcodeproj/project.pbxproj b/flutter/macos/rustdesk.xcodeproj/project.pbxproj index bed41ae67..5e9d16659 100644 --- a/flutter/macos/rustdesk.xcodeproj/project.pbxproj +++ b/flutter/macos/rustdesk.xcodeproj/project.pbxproj @@ -33,7 +33,7 @@ /* Begin PBXFileReference section */ ADDEDBA66A6E1 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; - CA603C4309E13EF4668187A5 /* Cargo.toml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Cargo.toml; path = /Users/ruizruiz/Work/Code/Projects/RustDesk/rustdesk/Cargo.toml; sourceTree = ""; }; + CA603C4309E13EF4668187A5 /* Cargo.toml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Cargo.toml; path = /Users/mac/Documents/project/rustdesk/Cargo.toml; sourceTree = ""; }; CA604C7415FB2A3731F5016A /* liblibrustdesk_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibrustdesk_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; CA6071B5A0F5A7A3EF2297AA /* librustdesk.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = librustdesk.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; CA60D3BC5386B357B2AB834F /* rustdesk */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rustdesk; sourceTree = BUILT_PRODUCTS_DIR; }; From 914847bb6346d9962b5482165247a5d2ae2b28cd Mon Sep 17 00:00:00 2001 From: Asura Date: Sat, 27 Aug 2022 23:00:43 +0800 Subject: [PATCH 066/113] Fix generated_bridge --- flutter/lib/generated_bridge.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/lib/generated_bridge.dart b/flutter/lib/generated_bridge.dart index 8fa7706aa..b4df7c605 100644 --- a/flutter/lib/generated_bridge.dart +++ b/flutter/lib/generated_bridge.dart @@ -4039,7 +4039,7 @@ class wire_StringList extends ffi.Struct { typedef uintptr_t = ffi.UnsignedLong; typedef DartPostCObjectFnType = ffi.Pointer< - ffi.NativeFunction)>>; + ffi.NativeFunction)>>; typedef DartPort = ffi.Int64; const int GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 2; From 5d69a99427ac8366a0b28fe8eb339f3f57b9eba2 Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 29 Aug 2022 15:25:53 +0800 Subject: [PATCH 067/113] Fix compile error on windows --- src/flutter.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/flutter.rs b/src/flutter.rs index 09ed01aeb..9c5dd319d 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -421,14 +421,12 @@ impl Session { } let keycode: u32 = keycode as u32; let scancode: u32 = scancode as u32; + + #[cfg(not(target_os = "windows"))] let key = rdev::key_from_scancode(scancode) as RdevKey; // Windows requires special handling #[cfg(target_os = "windows")] - let key = if let Some(e) = _evt { - rdev::get_win_key(e.code.into(), e.scan_code) - } else { - key - }; + let key = rdev::get_win_key(keycode, scancode); let peer = self.peer_platform(); From 4423a18e797c902022879cfb367dabab0ae3142f Mon Sep 17 00:00:00 2001 From: Asura Date: Mon, 29 Aug 2022 17:14:05 +0800 Subject: [PATCH 068/113] Opt svg of keyboard --- src/ui/common.tis | 91 +---------------------------------------------- 1 file changed, 1 insertion(+), 90 deletions(-) diff --git a/src/ui/common.tis b/src/ui/common.tis index 8a0beef98..69e5565f0 100644 --- a/src/ui/common.tis +++ b/src/ui/common.tis @@ -155,96 +155,7 @@ var svg_send = var svg_chat = ; -var svg_keyboard = - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -; +var svg_keyboard = ; function scrollToBottom(el) { var y = el.box(#height, #content) - el.box(#height, #client); From a0cb39af9c0c3b7718113173ac98ca2acccd7353 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 30 Aug 2022 15:35:39 +0800 Subject: [PATCH 069/113] Fix numlock and capslock on Mac --- src/server/input_service.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index c01212184..684ada483 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -655,12 +655,21 @@ fn sync_status(evt: &KeyEvent) -> (bool, bool) { fn map_keyboard_mode(evt: &KeyEvent) { // map mode(1): Send keycode according to the peer platform. let (click_capslock, click_numlock) = sync_status(evt); + + #[cfg(not(target_os = "macos"))] if click_capslock { rdev_key_click(RdevKey::CapsLock); } + #[cfg(not(target_os = "macos"))] if click_numlock { rdev_key_click(RdevKey::NumLock); } + #[cfg(target_os = "macos")] + if evt.down && click_capslock { + rdev_key_down_or_up(RdevKey::CapsLock, evt.down); + } + log::info!("click capslog {:?} click_numlock {:?}", click_capslock, click_numlock); + rdev_key_down_or_up(RdevKey::Unknown(evt.chr()), evt.down); return; } From 30bfa59e7d861fb3a361b562d4f036bda7f7536d Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 30 Aug 2022 15:53:44 +0800 Subject: [PATCH 070/113] Without Clear Key on Mac OS --- src/ui/remote.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 659f3f05a..34d4251fa 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1061,6 +1061,10 @@ impl Handler { let key = self.convert_numpad_keys(key); rdev::win_keycode_from_key(key).unwrap_or_default().into() } else { + // Without Clear Key on Mac OS + if key == rdev::Key::Clear{ + return; + } rdev::macos_keycode_from_key(key).unwrap_or_default().into() }; From 78112e97541b0264fac747f18e6bd9719ab8276b Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 31 Aug 2022 03:54:31 -0700 Subject: [PATCH 071/113] Replace pynput with tfc --- src/server/input_service.rs | 152 ++++++++++++++++++++++++++++++++++-- 1 file changed, 145 insertions(+), 7 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 684ada483..eddfa3c73 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -9,7 +9,7 @@ use std::{ sync::atomic::{AtomicBool, Ordering}, time::Instant, }; -use tfc::{traits::*, Context}; +use tfc::{traits::*, Context as TFC_Context, Key as TFC_Key}; #[derive(Default)] struct StateCursor { @@ -180,7 +180,7 @@ lazy_static::lazy_static! { }; static ref KEYS_DOWN: Arc>> = Default::default(); static ref LATEST_INPUT: Arc> = Default::default(); - static ref KBD_CONTEXT: Mutex = Mutex::new(Context::new().expect("kbd context error")); + static ref TFC_CONTEXT: Mutex = Mutex::new(TFC_Context::new().expect("kbd context error")); } static EXITING: AtomicBool = AtomicBool::new(false); @@ -668,12 +668,113 @@ fn map_keyboard_mode(evt: &KeyEvent) { if evt.down && click_capslock { rdev_key_down_or_up(RdevKey::CapsLock, evt.down); } - log::info!("click capslog {:?} click_numlock {:?}", click_capslock, click_numlock); + log::info!( + "click capslog {:?} click_numlock {:?}", + click_capslock, + click_numlock + ); rdev_key_down_or_up(RdevKey::Unknown(evt.chr()), evt.down); return; } +fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { + if let Key::Layout(chr) = key { + log::info!("tfc_key_down_or_up: {:?}", chr); + if down { + TFC_CONTEXT.lock().unwrap().unicode_char_down(chr); + } + if up { + TFC_CONTEXT.lock().unwrap().unicode_char_up(chr); + } + return; + } + + let key = match key { + Key::Alt => TFC_Key::Alt, + Key::Backspace => TFC_Key::DeleteOrBackspace, + Key::CapsLock => TFC_Key::CapsLock, + Key::Control => TFC_Key::Control, + Key::Delete => TFC_Key::ForwardDelete, + Key::DownArrow => TFC_Key::DownArrow, + Key::End => TFC_Key::End, + Key::Escape => TFC_Key::Escape, + Key::F1 => TFC_Key::F1, + Key::F10 => TFC_Key::F10, + Key::F11 => TFC_Key::F11, + Key::F12 => TFC_Key::F12, + Key::F2 => TFC_Key::F2, + Key::F3 => TFC_Key::F3, + Key::F4 => TFC_Key::F4, + Key::F5 => TFC_Key::F5, + Key::F6 => TFC_Key::F6, + Key::F7 => TFC_Key::F7, + Key::F8 => TFC_Key::F8, + Key::F9 => TFC_Key::F9, + Key::Home => TFC_Key::Home, + Key::LeftArrow => TFC_Key::LeftArrow, + Key::Option => TFC_Key::Alt, + Key::PageDown => TFC_Key::PageDown, + Key::PageUp => TFC_Key::PageUp, + Key::Return => TFC_Key::ReturnOrEnter, + Key::RightArrow => TFC_Key::RightArrow, + Key::Shift => TFC_Key::Shift, + Key::Space => TFC_Key::Space, + Key::Tab => TFC_Key::Tab, + Key::UpArrow => TFC_Key::UpArrow, + Key::Numpad0 => TFC_Key::N0, + Key::Numpad1 => TFC_Key::N1, + Key::Numpad2 => TFC_Key::N2, + Key::Numpad3 => TFC_Key::N3, + Key::Numpad4 => TFC_Key::N4, + Key::Numpad5 => TFC_Key::N5, + Key::Numpad6 => TFC_Key::N6, + Key::Numpad7 => TFC_Key::N7, + Key::Numpad8 => TFC_Key::N8, + Key::Numpad9 => TFC_Key::N9, + Key::Decimal => TFC_Key::NumpadDecimal, + // Key::Cancel => TFC_Key::Cancel, + Key::Clear => TFC_Key::NumpadClear, + Key::Pause => TFC_Key::PlayPause, + // Key::Kana => TFC_Key::, + // Key::Hangul => "Hangul", + // Key::Hanja => "Hanja", + // Key::Kanji => "Kanji", + // Key::Select => TFC_Key::Sel, + // Key::Print => TFC_Key::P, + // Key::Execute => "Execute", + // Key::Snapshot => "3270_PrintScreen", + // Key::Insert => TFC_Key:, + // Key::Help => "Help", + // Key::Separator => "KP_Separator", + // Key::Scroll => "Scroll_Lock", + // Key::NumLock => "Num_Lock", + Key::RWin => TFC_Key::Meta, + // Key::Apps => "Menu", + Key::Multiply => TFC_Key::NumpadMultiply, + Key::Add => TFC_Key::NumpadPlus, + Key::Subtract => TFC_Key::NumpadMinus, + Key::Divide => TFC_Key::NumpadDivide, + Key::Equals => TFC_Key::NumpadEquals, + Key::NumpadEnter => TFC_Key::NumpadEnter, + Key::RightShift => TFC_Key::RightShift, + Key::RightControl => TFC_Key::RightControl, + Key::RightAlt => TFC_Key::RightAlt, + Key::Command | Key::Super | Key::Windows | Key::Meta => TFC_Key::Meta, + _ => { + return; + } + }; + + log::info!("tfc_key_down_or_up: {:?}", key); + if down { + TFC_CONTEXT.lock().unwrap().key_down(key); + } + if up { + TFC_CONTEXT.lock().unwrap().key_up(key); + } +} + fn legacy_keyboard_mode(evt: &KeyEvent) { let (click_capslock, click_numlock) = sync_status(evt); @@ -681,9 +782,15 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { crate::platform::windows::try_change_desktop(); let mut en = ENIGO.lock().unwrap(); if click_capslock { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(Key::CapsLock, true, true); + #[cfg(not(target_os = "linux"))] en.key_click(Key::CapsLock); } if click_numlock { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(Key::NumLock, true, true); + #[cfg(not(target_os = "linux"))] en.key_click(Key::NumLock); } // disable numlock if press home etc when numlock is on, @@ -692,11 +799,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { let mut disable_numlock = false; #[cfg(target_os = "macos")] en.reset_flag(); - // When long-pressed the command key, then press and release + // When long-pressed the command key, then press and release // the Tab key, there should be CGEventFlagCommand in the flag. #[cfg(target_os = "macos")] - for ck in evt.modifiers.iter(){ - if let Some(key) = KEY_MAP.get(&ck.value()){ + for ck in evt.modifiers.iter() { + if let Some(key) = KEY_MAP.get(&ck.value()) { en.add_flag(key); } } @@ -738,6 +845,9 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } } else { if !get_modifier_state(key.clone(), &mut en) { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(key.clone(), true, false); + #[cfg(not(target_os = "linux"))] en.key_down(key.clone()).ok(); modifier_sleep(); to_release.push(key); @@ -749,7 +859,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] if has_cap != en.get_key_state(Key::CapsLock) { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(Key::CapsLock, true, true); + #[cfg(not(target_os = "linux"))] en.key_down(Key::CapsLock).ok(); + #[cfg(not(target_os = "linux"))] en.key_up(Key::CapsLock); } #[cfg(windows)] @@ -771,12 +885,18 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } } if evt.down { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(key.clone(), true, false); + #[cfg(not(target_os = "linux"))] allow_err!(en.key_down(key.clone())); KEYS_DOWN .lock() .unwrap() .insert(ck.value() as _, Instant::now()); } else { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(key.clone(), false, true); + #[cfg(not(target_os = "linux"))] en.key_up(key.clone()); KEYS_DOWN.lock().unwrap().remove(&(ck.value() as _)); } @@ -791,6 +911,14 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } Some(key_event::Union::Chr(chr)) => { if evt.down { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(get_layout(chr), true, false); + #[cfg(target_os = "linux")] + KEYS_DOWN + .lock() + .unwrap() + .insert(chr as u64 + KEY_CHAR_START, Instant::now()); + #[cfg(not(target_os = "linux"))] if en.key_down(get_layout(chr)).is_ok() { KEYS_DOWN .lock() @@ -808,6 +936,9 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } } } else { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(get_layout(chr), false, true); + #[cfg(not(target_os = "linux"))] en.key_up(get_layout(chr)); KEYS_DOWN .lock() @@ -827,6 +958,9 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] for key in to_release { + #[cfg(target_os = "linux")] + tfc_key_down_or_up(key.clone(), false, true); + #[cfg(not(target_os = "linux"))] en.key_up(key.clone()); } #[cfg(windows)] @@ -840,7 +974,11 @@ fn translate_keyboard_mode(evt: &KeyEvent) { let chr = char::from_u32(evt.chr()).unwrap_or_default(); // down(true)->press && press(false)-> release if evt.down && !evt.press { - KBD_CONTEXT.lock().unwrap().unicode_char(chr).expect("unicode_char_down error"); + TFC_CONTEXT + .lock() + .unwrap() + .unicode_char(chr) + .expect("unicode_char_down error"); } } From 9999e8864e0ac23b314bb5b87fda9f2263fafbc8 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 31 Aug 2022 04:16:49 -0700 Subject: [PATCH 072/113] Update pubspec.lock --- flutter/pubspec.lock | 4 ++-- flutter/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 4d0a07287..2a4558945 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -1244,8 +1244,8 @@ packages: dependency: "direct main" description: path: "." - ref: "799ef079e87938c3f4340591b4330c2598f38bb9" - resolved-ref: "799ef079e87938c3f4340591b4330c2598f38bb9" + ref: a25f1776ccc1119cbb2a8541174293aa36d532ed + resolved-ref: a25f1776ccc1119cbb2a8541174293aa36d532ed url: "https://github.com/Kingtous/rustdesk_window_manager" source: git version: "0.2.6" diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index 93c2f64b2..e109be507 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -61,7 +61,7 @@ dependencies: window_manager: git: url: https://github.com/Kingtous/rustdesk_window_manager - ref: 799ef079e87938c3f4340591b4330c2598f38bb9 + ref: a25f1776ccc1119cbb2a8541174293aa36d532ed desktop_multi_window: git: url: https://github.com/Kingtous/rustdesk_desktop_multi_window From 37dbfcc86d77ae09a44007815ed0ab387029cb0e Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 31 Aug 2022 23:07:52 -0700 Subject: [PATCH 073/113] Delete pynput from repo --- Cargo.lock | 14 +- DEBIAN/postinst | 3 - PKGBUILD | 1 - README-AR.md | 5 - README-CS.md | 6 - README-FA.md | 6 - README-HU.md | 6 - README-JP.md | 6 - README-KR.md | 6 - README-VN.md | 6 - README.md | 6 - appimage/AppImageBuilder.yml | 2 - appimage/requirements.txt | 1 - build.py | 6 - libs/enigo/src/linux/mod.rs | 1 - libs/enigo/src/linux/nix_impl.rs | 14 +- libs/enigo/src/linux/pynput.rs | 279 ------------------------------- pacman_install | 2 +- pynput_service.py | 240 -------------------------- rpm-suse.spec | 3 - rpm.spec | 3 - snap/snapcraft.yaml | 6 - src/flutter.rs | 1 - src/server/input_service.rs | 9 - src/ui/remote.rs | 2 - 25 files changed, 16 insertions(+), 618 deletions(-) delete mode 100644 appimage/requirements.txt delete mode 100644 libs/enigo/src/linux/pynput.rs delete mode 100644 pynput_service.py diff --git a/Cargo.lock b/Cargo.lock index 35d87cbd7..96ff5a811 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3985,7 +3985,7 @@ dependencies = [ "libc", "widestring 1.0.2", "winapi 0.3.9", - "x11", + "x11 2.20.0", ] [[package]] @@ -4993,11 +4993,12 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/asur4s/The-Fat-Controller#25bfa7ef1cb0bd0b522cc4155dea6b99673bcfd4" +source = "git+https://github.com/asur4s/The-Fat-Controller#8ef82be83d8d941f08bdb84e77bea52290f92050" dependencies = [ "core-graphics 0.22.3", "unicode-segmentation", "winapi 0.3.9", + "x11 2.19.0", ] [[package]] @@ -5931,6 +5932,15 @@ dependencies = [ "tap", ] +[[package]] +name = "x11" +version = "2.19.0" +source = "git+https://github.com/bjornsnoen/x11-rs#c2e9bfaa7b196938f8700245564d8ac5d447786a" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "x11" version = "2.20.0" diff --git a/DEBIAN/postinst b/DEBIAN/postinst index 1c7697acc..d643c5caf 100755 --- a/DEBIAN/postinst +++ b/DEBIAN/postinst @@ -12,9 +12,6 @@ if [ "$1" = configure ]; then fi version=$(python3 -V 2>&1 | grep -Po '(?<=Python )(.+)') parsedVersion=$(echo "${version//./}") - if [[ "$parsedVersion" -gt "360" ]]; then - sudo -H pip3 install pynput - fi cp /usr/share/rustdesk/files/systemd/rustdesk.service /usr/lib/systemd/system/rustdesk.service systemctl daemon-reload systemctl enable rustdesk diff --git a/PKGBUILD b/PKGBUILD index 6fb65d48b..1d1956ede 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -26,6 +26,5 @@ package() { install -Dm 644 ${HBB}/libsciter-gtk.so -t "${pkgdir}/usr/lib/rustdesk" install -Dm 644 $HBB/rustdesk.service -t "${pkgdir}/usr/share/rustdesk/files" install -Dm 644 $HBB/rustdesk.desktop -t "${pkgdir}/usr/share/rustdesk/files" - install -Dm 644 $HBB/pynput_service.py -t "${pkgdir}/usr/share/rustdesk/files" install -Dm 644 $HBB/128x128@2x.png "${pkgdir}/usr/share/rustdesk/files/rustdesk.png" } diff --git a/README-AR.md b/README-AR.md index 2deb4914b..c0186037e 100644 --- a/README-AR.md +++ b/README-AR.md @@ -80,11 +80,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### pynput package تثبيت - -```sh -pip3 install pynput -``` ### vcpkg تثبيت diff --git a/README-CS.md b/README-CS.md index 4f2c0e80f..7ad86e08b 100644 --- a/README-CS.md +++ b/README-CS.md @@ -75,12 +75,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### Instalace balíčku pynput - -```sh -pip3 install pynput -``` - ### Instalace vcpkg ```sh diff --git a/README-FA.md b/README-FA.md index 5fd3c0d03..f7de9aa87 100644 --- a/README-FA.md +++ b/README-FA.md @@ -78,12 +78,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### بسته pynput را نصب کنید - -```sh -pip3 install pynput -``` - ### نرم افزار vcpkg را نصب کنید ```sh diff --git a/README-HU.md b/README-HU.md index 3960d8b40..cfc6c793d 100644 --- a/README-HU.md +++ b/README-HU.md @@ -81,12 +81,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### Telepítsd a pynput csomagot - -```sh -pip3 install pynput -``` - ### Telepítsd a vcpkg-t ```sh diff --git a/README-JP.md b/README-JP.md index c1722a90f..394fbc52a 100644 --- a/README-JP.md +++ b/README-JP.md @@ -80,12 +80,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### Install pynput package - -```sh -pip3 install pynput -``` - ### Install vcpkg ```sh diff --git a/README-KR.md b/README-KR.md index c7cf423da..9a87d8ab1 100644 --- a/README-KR.md +++ b/README-KR.md @@ -78,12 +78,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### Install pynput package - -```sh -pip3 install pynput -``` - ### Install vcpkg ```sh diff --git a/README-VN.md b/README-VN.md index 641b80ebd..b7b683e4f 100644 --- a/README-VN.md +++ b/README-VN.md @@ -82,12 +82,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### Cách tải về gói hàng pynput - -```sh -pip3 install pynput -``` - ### Cách cài vcpkg ```sh diff --git a/README.md b/README.md index 456862af5..fbbc1b60b 100644 --- a/README.md +++ b/README.md @@ -80,12 +80,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb- sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` -### Install pynput package - -```sh -pip3 install pynput -``` - ### Install vcpkg ```sh diff --git a/appimage/AppImageBuilder.yml b/appimage/AppImageBuilder.yml index 08a4f0786..cdaead908 100644 --- a/appimage/AppImageBuilder.yml +++ b/appimage/AppImageBuilder.yml @@ -9,8 +9,6 @@ script: # Download sciter.so - mkdir -p AppDir/usr/lib/rustdesk/ - pushd AppDir/usr/lib/rustdesk && wget https://github.com/c-smile/sciter-sdk/raw/29a598b6d20220b93848b5e8abab704619296857/bin.lnx/x64/libsciter-gtk.so && popd - # pynput_service.py - - cp ../pynput_service.py ./AppDir/usr/lib/rustdesk # Build rustdesk - pushd .. && python3 inline-sciter.py && cargo build --features inline,appimage --release && popd - mkdir -p AppDir/usr/bin diff --git a/appimage/requirements.txt b/appimage/requirements.txt deleted file mode 100644 index d632797e5..000000000 --- a/appimage/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pynput \ No newline at end of file diff --git a/build.py b/build.py index 6b03cb57b..095f8b7f1 100755 --- a/build.py +++ b/build.py @@ -140,8 +140,6 @@ def build_flutter_deb(version): 'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/') os.system( 'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/') - os.system( - 'cp ../pynput_service.py tmpdeb/usr/share/rustdesk/files/') os.system( 'cp ../128x128@2x.png tmpdeb/usr/share/rustdesk/files/rustdesk.png') os.system( @@ -150,7 +148,6 @@ def build_flutter_deb(version): os.system('cp -a ../DEBIAN/* tmpdeb/DEBIAN/') md5_file('usr/share/rustdesk/files/systemd/rustdesk.service') md5_file('usr/share/rustdesk/files/systemd/rustdesk.service.user') - md5_file('usr/share/rustdesk/files/pynput_service.py') os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/') os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version) os.chdir("..") @@ -285,15 +282,12 @@ def main(): 'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/') os.system( 'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/') - os.system( - 'cp pynput_service.py tmpdeb/usr/share/rustdesk/files/') os.system('cp -a DEBIAN/* tmpdeb/DEBIAN/') os.system('strip tmpdeb/usr/bin/rustdesk') os.system('mkdir -p tmpdeb/usr/lib/rustdesk') os.system('cp libsciter-gtk.so tmpdeb/usr/lib/rustdesk/') md5_file('usr/share/rustdesk/files/systemd/rustdesk.service') md5_file('usr/share/rustdesk/files/systemd/rustdesk.service.user') - md5_file('usr/share/rustdesk/files/pynput_service.py') md5_file('usr/lib/rustdesk/libsciter-gtk.so') os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/') os.rename('rustdesk.deb', 'rustdesk-%s.deb' % version) diff --git a/libs/enigo/src/linux/mod.rs b/libs/enigo/src/linux/mod.rs index 42e1dfebf..1f73004ad 100644 --- a/libs/enigo/src/linux/mod.rs +++ b/libs/enigo/src/linux/mod.rs @@ -1,5 +1,4 @@ mod nix_impl; -mod pynput; mod xdo; pub use self::nix_impl::Enigo; diff --git a/libs/enigo/src/linux/nix_impl.rs b/libs/enigo/src/linux/nix_impl.rs index 7a8f6668e..0c9b30eff 100644 --- a/libs/enigo/src/linux/nix_impl.rs +++ b/libs/enigo/src/linux/nix_impl.rs @@ -1,11 +1,10 @@ -use super::{pynput::EnigoPynput, xdo::EnigoXdo}; +use super::{xdo::EnigoXdo}; use crate::{Key, KeyboardControllable, MouseButton, MouseControllable}; /// The main struct for handling the event emitting // #[derive(Default)] pub struct Enigo { xdo: EnigoXdo, - pynput: EnigoPynput, is_x11: bool, uinput_keyboard: Option>, uinput_mouse: Option>, @@ -20,9 +19,9 @@ impl Enigo { pub fn set_delay(&mut self, delay: u64) { self.xdo.set_delay(delay) } - /// Reset pynput. + /// Reset pynput?. pub fn reset(&mut self) { - self.pynput.reset(); + todo!() } /// Set uinput keyboard. pub fn set_uinput_keyboard( @@ -44,7 +43,6 @@ impl Default for Enigo { uinput_keyboard: None, uinput_mouse: None, xdo: EnigoXdo::default(), - pynput: EnigoPynput::default(), } } } @@ -142,9 +140,6 @@ impl KeyboardControllable for Enigo { fn key_down(&mut self, key: Key) -> crate::ResultType { if self.is_x11 { - if self.pynput.send_pynput(&key, true) { - return Ok(()); - } self.xdo.key_down(key) } else { if let Some(keyboard) = &mut self.uinput_keyboard { @@ -156,9 +151,6 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { if self.is_x11 { - if self.pynput.send_pynput(&key, false) { - return; - } self.xdo.key_up(key) } else { if let Some(keyboard) = &mut self.uinput_keyboard { diff --git a/libs/enigo/src/linux/pynput.rs b/libs/enigo/src/linux/pynput.rs deleted file mode 100644 index 836c645fe..000000000 --- a/libs/enigo/src/linux/pynput.rs +++ /dev/null @@ -1,279 +0,0 @@ -use crate::Key; -use std::{io::prelude::*, sync::mpsc}; - -enum PyMsg { - Char(char), - Str(&'static str), -} - -/// The main struct for handling the event emitting -pub(super) struct EnigoPynput { - tx: mpsc::Sender<(PyMsg, bool)>, -} - -impl Default for EnigoPynput { - fn default() -> Self { - let (tx, rx) = mpsc::channel(); - start_pynput_service(rx); - Self { tx } - } -} -impl EnigoPynput { - pub(super) fn reset(&mut self) { - self.tx.send((PyMsg::Char('\0'), true)).ok(); - } - - #[inline] - pub(super) fn send_pynput(&mut self, key: &Key, is_press: bool) -> bool { - if unsafe { PYNPUT_EXIT || !PYNPUT_REDAY } { - return false; - } - if let Key::Layout(c) = key { - return self.tx.send((PyMsg::Char(*c), is_press)).is_ok(); - } - if let Key::Raw(_) = key { - return false; - } - #[allow(deprecated)] - let s = match key { - Key::Alt => "Alt_L", - Key::Backspace => "BackSpace", - Key::CapsLock => "Caps_Lock", - Key::Control => "Control_L", - Key::Delete => "Delete", - Key::DownArrow => "Down", - Key::End => "End", - Key::Escape => "Escape", - Key::F1 => "F1", - Key::F10 => "F10", - Key::F11 => "F11", - Key::F12 => "F12", - Key::F2 => "F2", - Key::F3 => "F3", - Key::F4 => "F4", - Key::F5 => "F5", - Key::F6 => "F6", - Key::F7 => "F7", - Key::F8 => "F8", - Key::F9 => "F9", - Key::Home => "Home", - Key::LeftArrow => "Left", - Key::Option => "Option", - Key::PageDown => "Page_Down", - Key::PageUp => "Page_Up", - Key::Return => "Return", - Key::RightArrow => "Right", - Key::Shift => "Shift_L", - Key::Space => "space", - Key::Tab => "Tab", - Key::UpArrow => "Up", - 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", - Key::Pause => "Pause", - Key::Kana => "Kana", - Key::Hangul => "Hangul", - Key::Hanja => "Hanja", - Key::Kanji => "Kanji", - Key::Select => "Select", - Key::Print => "Print", - Key::Execute => "Execute", - Key::Snapshot => "3270_PrintScreen", - Key::Insert => "Insert", - Key::Help => "Help", - Key::Separator => "KP_Separator", - Key::Scroll => "Scroll_Lock", - Key::NumLock => "Num_Lock", - Key::RWin => "Super_R", - Key::Apps => "Menu", - Key::Multiply => "KP_Multiply", - Key::Add => "KP_Add", - Key::Subtract => "KP_Subtract", - Key::Divide => "KP_Divide", - Key::Equals => "KP_Equal", - Key::NumpadEnter => "KP_Enter", - Key::RightShift => "Shift_R", - Key::RightControl => "Control_R", - Key::RightAlt => "Mode_switch", - Key::Command | Key::Super | Key::Windows | Key::Meta => "Super_L", - _ => { - return true; - } - }; - return self.tx.send((PyMsg::Str(s), is_press)).is_ok(); - } -} - -// impl MouseControllable for EnigoPynput { -// fn mouse_move_to(&mut self, _x: i32, _y: i32) { -// unimplemented!() -// } -// fn mouse_move_relative(&mut self, _x: i32, _y: i32) { -// unimplemented!() -// } -// fn mouse_down(&mut self, _button: MouseButton) -> crate::ResultType { -// unimplemented!() -// } -// fn mouse_up(&mut self, _button: MouseButton) { -// unimplemented!() -// } -// fn mouse_click(&mut self, _button: MouseButton) { -// unimplemented!() -// } -// fn mouse_scroll_x(&mut self, _length: i32) { -// unimplemented!() -// } -// fn mouse_scroll_y(&mut self, _length: i32) { -// unimplemented!() -// } -// } - -// impl KeyboardControllable for EnigoPynput { -// fn get_key_state(&mut self, _key: Key) -> bool { -// unimplemented!() -// } - -// fn key_sequence(&mut self, _sequence: &str) { -// unimplemented!() -// } -// fn key_down(&mut self, key: Key) -> crate::ResultType { -// let _ = self.send_pynput(&key, true); -// Ok(()) -// } -// fn key_up(&mut self, key: Key) { -// let _ = self.send_pynput(&key, false); -// } -// fn key_click(&mut self, _key: Key) { -// unimplemented!() -// } -// } - -static mut PYNPUT_EXIT: bool = false; -static mut PYNPUT_REDAY: bool = false; -static IPC_FILE: &'static str = "/tmp/RustDesk/pynput_service"; - -fn start_pynput_service(rx: mpsc::Receiver<(PyMsg, bool)>) { - let mut py = "./pynput_service.py".to_owned(); - if !std::path::Path::new(&py).exists() { - py = "/usr/share/rustdesk/files/pynput_service.py".to_owned(); - if !std::path::Path::new(&py).exists() { - py = "/usr/lib/rustdesk/pynput_service.py".to_owned(); - if !std::path::Path::new(&py).exists() { - log::error!("{} not exits", py); - } - } - } - log::info!("pynput service: {}", py); - std::thread::spawn(move || { - let username = std::env::var("PYNPUT_USERNAME").unwrap_or("".to_owned()); - let userid = std::env::var("PYNPUT_USERID").unwrap_or("".to_owned()); - let status = if username.is_empty() { - std::process::Command::new("python3") - .arg(&py) - .arg(IPC_FILE) - .status() - .map(|x| x.success()) - } else { - let mut status = Ok(true); - for i in 0..100 { - if i % 10 == 0 { - log::info!("#{} try to start pynput server", i); - } - status = std::process::Command::new("sudo") - .args(vec![ - "-E", - &format!("XDG_RUNTIME_DIR=/run/user/{}", userid) as &str, - "-u", - &username, - "python3", - &py, - IPC_FILE, - ]) - .status() - .map(|x| x.success()); - match status { - Ok(true) => break, - _ => {} - } - std::thread::sleep(std::time::Duration::from_millis(100)); - } - status - }; - log::info!( - "pynput server exit with username/id {}/{}: {:?}", - username, - userid, - status - ); - unsafe { - PYNPUT_EXIT = true; - } - }); - std::thread::spawn(move || { - for i in 0..300 { - std::thread::sleep(std::time::Duration::from_millis(100)); - let mut conn = match std::os::unix::net::UnixStream::connect(IPC_FILE) { - Ok(conn) => conn, - Err(err) => { - if i % 15 == 0 { - log::warn!("Failed to connect to {}: {}", IPC_FILE, err); - } - continue; - } - }; - if let Err(err) = conn.set_nonblocking(true) { - log::error!("Failed to set ipc nonblocking: {}", err); - return; - } - log::info!("Conntected to pynput server"); - let d = std::time::Duration::from_millis(30); - unsafe { - PYNPUT_REDAY = true; - } - let mut buf = [0u8; 1024]; - loop { - if unsafe { PYNPUT_EXIT } { - break; - } - match rx.recv_timeout(d) { - Ok((msg, is_press)) => { - let msg = match msg { - PyMsg::Char(chr) => { - format!("{}{}", if is_press { 'p' } else { 'r' }, chr) - } - PyMsg::Str(s) => format!("{}{}", if is_press { 'p' } else { 'r' }, s), - }; - let n = msg.len(); - buf[0] = n as _; - buf[1..(n + 1)].copy_from_slice(msg.as_bytes()); - if let Err(err) = conn.write_all(&buf[..n + 1]) { - log::error!("Failed to write to ipc: {}", err); - break; - } - } - Err(err) => match err { - mpsc::RecvTimeoutError::Disconnected => { - log::error!("pynput sender disconnecte"); - break; - } - _ => {} - }, - } - } - unsafe { - PYNPUT_REDAY = false; - } - break; - } - }); -} diff --git a/pacman_install b/pacman_install index d22423574..cfd3bdd60 100644 --- a/pacman_install +++ b/pacman_install @@ -7,7 +7,7 @@ post_install() { # do something here cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/ - sudo -H pip3 install pynput + sudo -H pip3 install systemctl daemon-reload systemctl enable rustdesk systemctl start rustdesk diff --git a/pynput_service.py b/pynput_service.py deleted file mode 100644 index 5aca57986..000000000 --- a/pynput_service.py +++ /dev/null @@ -1,240 +0,0 @@ -from pynput.keyboard import Key, Controller -from pynput.keyboard._xorg import KeyCode -from pynput._util.xorg import display_manager -import Xlib -from pynput._util.xorg import * -import Xlib -import os -import sys -import socket - -KeyCode._from_symbol("\0") # test - -DEAD_KEYS = { - '`': 65104, - '´': 65105, - '^': 65106, - '~': 65107, - '¯': 65108, - '˘': 65109, - '˙': 65110, - '¨': 65111, - '˚': 65112, - '˝': 65113, - 'ˇ': 65114, - '¸': 65115, - '˛': 65116, - '℩': 65117, # ? - '゛': 65118, # ? - '゚ ': 65119, - 'ٜ': 65120, - '↪': 65121, - ' ̛': 65122, -} - - - -def my_keyboard_mapping(display): - """Generates a mapping from *keysyms* to *key codes* and required - modifier shift states. - - :param Xlib.display.Display display: The display for which to retrieve the - keyboard mapping. - - :return: the keyboard mapping - """ - mapping = {} - - shift_mask = 1 << 0 - group_mask = alt_gr_mask(display) - - # Iterate over all keysym lists in the keyboard mapping - min_keycode = display.display.info.min_keycode - keycode_count = display.display.info.max_keycode - min_keycode + 1 - for index, keysyms in enumerate(display.get_keyboard_mapping( - min_keycode, keycode_count)): - key_code = index + min_keycode - - # Normalise the keysym list to yield a tuple containing the two groups - normalized = keysym_normalize(keysyms) - if not normalized: - continue - - # Iterate over the groups to extract the shift and modifier state - for groups, group in zip(normalized, (False, True)): - for keysym, shift in zip(groups, (False, True)): - - if not keysym: - continue - shift_state = 0 \ - | (shift_mask if shift else 0) \ - | (group_mask if group else 0) - - # !!!: Save all keycode combinations of keysym - if keysym in mapping: - mapping[keysym].append((key_code, shift_state)) - else: - mapping[keysym] = [(key_code, shift_state)] - return mapping - - -class MyController(Controller): - def _update_keyboard_mapping(self): - """Updates the keyboard mapping. - """ - with display_manager(self._display) as dm: - self._keyboard_mapping = my_keyboard_mapping(dm) - - def send_event(self, event, keycode, shift_state): - with display_manager(self._display) as dm, self.modifiers as modifiers: - # Under certain cimcumstances, such as when running under Xephyr, - # the value returned by dm.get_input_focus is an int - window = dm.get_input_focus().focus - send_event = getattr( - window, - 'send_event', - lambda event: dm.send_event(window, event)) - send_event(event( - detail=keycode, - state=shift_state | self._shift_mask(modifiers), - time=0, - root=dm.screen().root, - window=window, - same_screen=0, - child=Xlib.X.NONE, - root_x=0, root_y=0, event_x=0, event_y=0)) - - def fake_input(self, keycode, is_press): - with display_manager(self._display) as dm: - Xlib.ext.xtest.fake_input( - dm, - Xlib.X.KeyPress if is_press else Xlib.X.KeyRelease, - keycode) - - def _handle(self, key, is_press): - """Resolves a key identifier and sends a keyboard event. - :param event: The *X* keyboard event. - :param int keysym: The keysym to handle. - """ - event = Xlib.display.event.KeyPress if is_press \ - else Xlib.display.event.KeyRelease - keysym = self._keysym(key) - - if key.vk is not None: - keycode = self._display.keysym_to_keycode(key.vk) - self.fake_input(keycode, is_press) - # Otherwise use XSendEvent; we need to use this in the general case to - # work around problems with keyboard layouts - self._emit('_on_fake_event', key, is_press) - return - - # Make sure to verify that the key was resolved - if keysym is None: - raise self.InvalidKeyException(key) - - # There may be multiple keycodes for keysym in keyboard_mapping - keycode_flag = len(self.keyboard_mapping[keysym]) == 1 - if keycode_flag: - keycode, shift_state = self.keyboard_mapping[keysym][0] - else: - keycode, shift_state = self._display.keysym_to_keycode(keysym), 0 - - keycode_set = set(map(lambda x: x[0], self.keyboard_mapping[keysym])) - # The keycode of the dead key is inconsistent, The keysym has multiple combinations of a keycode. - if keycode != self._display.keysym_to_keycode(keysym) \ - or (keycode_flag == False and keycode == list(keycode_set)[0] and len(keycode_set) == 1): - deakkey_chr = str(key).replace("'", '') - keysym = DEAD_KEYS[deakkey_chr] - # shift_state = 0 - keycode, shift_state = list( - filter(lambda x: x[1] == 0, - self.keyboard_mapping[keysym]) - )[0] - - # If the key has a virtual key code, use that immediately with - # fake_input; fake input,being an X server extension, has access to - # more internal state that we do - - try: - with self.modifiers as modifiers: - alt_gr = Key.alt_gr in modifiers - # !!!: Send_event can't support lock screen, this condition cann't be modified - if alt_gr: - self.send_event( - event, keycode, shift_state) - else: - self.fake_input(keycode, is_press) - except KeyError: - with self._borrow_lock: - keycode, index, count = self._borrows[keysym] - self._send_key( - event, - keycode, - index_to_shift(self._display, index)) - count += 1 if is_press else -1 - self._borrows[keysym] = (keycode, index, count) - - # Notify any running listeners - self._emit('_on_fake_event', key, is_press) - - -keyboard = MyController() - -server_address = sys.argv[1] -if not os.path.exists(os.path.dirname(server_address)): - os.makedirs(os.path.dirname(server_address)) - -try: - os.unlink(server_address) -except OSError: - if os.path.exists(server_address): - raise - -server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) -server.bind(server_address) -server.listen(1) -clientsocket, address = server.accept() -os.system('chmod a+rw %s' % server_address) -print("Got pynput connection") - - -def loop(): - global keyboard - buf = [] - while True: - data = clientsocket.recv(1024) - if not data: - print("Connection broken") - break - buf.extend(data) - while buf: - n = buf[0] - n = n + 1 - if len(buf) < n: - break - msg = bytearray(buf[1:n]).decode("utf-8") - buf = buf[n:] - if len(msg) < 2: - continue - if msg[1] == "\0": - keyboard = MyController() - print("Keyboard reset") - continue - if len(msg) == 2: - name = msg[1] - else: - name = KeyCode._from_symbol(msg[1:]) - if str(name) == "<0>": - continue - try: - if msg[0] == "p": - keyboard.press(name) - else: - keyboard.release(name) - except Exception as e: - print('[x] error key',e) - - -loop() -clientsocket.close() -server.close() diff --git a/rpm-suse.spec b/rpm-suse.spec index 73a610c11..db4bfe66f 100644 --- a/rpm-suse.spec +++ b/rpm-suse.spec @@ -25,7 +25,6 @@ install $HBB/libsciter-gtk.so %{buildroot}/usr/lib/rustdesk/libsciter-gtk.so install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/ install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/ -install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/ %files /usr/bin/rustdesk @@ -33,7 +32,6 @@ install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/ /usr/share/rustdesk/files/rustdesk.service /usr/share/rustdesk/files/rustdesk.png /usr/share/rustdesk/files/rustdesk.desktop -/usr/share/rustdesk/files/pynput_service.py %changelog # let's skip this for now @@ -54,7 +52,6 @@ esac %post cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/ -sudo -H pip3 install pynput systemctl daemon-reload systemctl enable rustdesk systemctl start rustdesk diff --git a/rpm.spec b/rpm.spec index c61db5d0b..37e8ea4cc 100644 --- a/rpm.spec +++ b/rpm.spec @@ -25,7 +25,6 @@ install $HBB/libsciter-gtk.so %{buildroot}/usr/lib/rustdesk/libsciter-gtk.so install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/ install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/ -install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/ %files /usr/bin/rustdesk @@ -33,7 +32,6 @@ install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/ /usr/share/rustdesk/files/rustdesk.service /usr/share/rustdesk/files/rustdesk.png /usr/share/rustdesk/files/rustdesk.desktop -/usr/share/rustdesk/files/pynput_service.py /usr/share/rustdesk/files/__pycache__/* %changelog @@ -55,7 +53,6 @@ esac %post cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/ -sudo -H pip3 install pynput systemctl daemon-reload systemctl enable rustdesk systemctl start rustdesk diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 310c6f3f6..24882ce4f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -108,13 +108,7 @@ parts: plugin: nil override-pull: | mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/ - cp ${SNAPCRAFT_PART_SRC}/../../rustdesk/src/pynput_service.py ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/ cp ${SNAPCRAFT_PART_SRC}/../../rustdesk/src/rustdesk.service ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/ - - python3-deps: - plugin: python - python-packages: - - pynput == 1.7.6 layout: /usr/share/rustdesk: diff --git a/src/flutter.rs b/src/flutter.rs index 9c5dd319d..6653f96f3 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -226,7 +226,6 @@ impl Session { pub fn send_key_event(&self, mut evt: KeyEvent, keyboard_mode: KeyboardMode) { // mode: legacy(0), map(1), translate(2), auto(3) evt.mode = keyboard_mode.into(); - dbg!(&evt); let mut msg_out = Message::new(); msg_out.set_key_event(evt); self.send(Data::Message(msg_out)); diff --git a/src/server/input_service.rs b/src/server/input_service.rs index eddfa3c73..1e6a10613 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -169,13 +169,6 @@ fn run_cursor(sp: MouseCursorService, state: &mut StateCursor) -> ResultType<()> lazy_static::lazy_static! { static ref ENIGO: Arc> = { - #[cfg(target_os = "linux")] - { - if crate::platform::is_root() { - std::env::set_var("PYNPUT_USERNAME", crate::platform::linux::get_active_username()); - std::env::set_var("PYNPUT_USERID", crate::platform::linux::get_active_userid()); - } - } Arc::new(Mutex::new(Enigo::new())) }; static ref KEYS_DOWN: Arc>> = Default::default(); @@ -680,7 +673,6 @@ fn map_keyboard_mode(evt: &KeyEvent) { fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { if let Key::Layout(chr) = key { - log::info!("tfc_key_down_or_up: {:?}", chr); if down { TFC_CONTEXT.lock().unwrap().unicode_char_down(chr); } @@ -766,7 +758,6 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { } }; - log::info!("tfc_key_down_or_up: {:?}", key); if down { TFC_CONTEXT.lock().unwrap().key_down(key); } diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 34d4251fa..6100c8b87 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1106,8 +1106,6 @@ impl Handler { if let Some(chars) = chars { for chr in chars { - dbg!(chr); - let mut key_event = KeyEvent::new(); key_event.set_chr(chr as _); key_event.down = true; From 763456519e40a61da3d1bbfc10f878f2cab9a511 Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 1 Sep 2022 00:36:24 -0700 Subject: [PATCH 074/113] Add Key for tfc --- Cargo.lock | 2 +- src/server/input_service.rs | 24 ++++++++---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 96ff5a811..62b412062 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4993,7 +4993,7 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/asur4s/The-Fat-Controller#8ef82be83d8d941f08bdb84e77bea52290f92050" +source = "git+https://github.com/asur4s/The-Fat-Controller#a091f887edc2440b17d86c9ba580f2f35ce0cfcc" dependencies = [ "core-graphics 0.22.3", "unicode-segmentation", diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 1e6a10613..ffcaf32a9 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -673,6 +673,7 @@ fn map_keyboard_mode(evt: &KeyEvent) { fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { if let Key::Layout(chr) = key { + log::info!("tfc_key_down_or_up :{:?}", chr); if down { TFC_CONTEXT.lock().unwrap().unicode_char_down(chr); } @@ -705,7 +706,6 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { Key::F9 => TFC_Key::F9, Key::Home => TFC_Key::Home, Key::LeftArrow => TFC_Key::LeftArrow, - Key::Option => TFC_Key::Alt, Key::PageDown => TFC_Key::PageDown, Key::PageUp => TFC_Key::PageUp, Key::Return => TFC_Key::ReturnOrEnter, @@ -725,24 +725,15 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { Key::Numpad8 => TFC_Key::N8, Key::Numpad9 => TFC_Key::N9, Key::Decimal => TFC_Key::NumpadDecimal, - // Key::Cancel => TFC_Key::Cancel, Key::Clear => TFC_Key::NumpadClear, Key::Pause => TFC_Key::PlayPause, - // Key::Kana => TFC_Key::, - // Key::Hangul => "Hangul", - // Key::Hanja => "Hanja", - // Key::Kanji => "Kanji", - // Key::Select => TFC_Key::Sel, - // Key::Print => TFC_Key::P, - // Key::Execute => "Execute", - // Key::Snapshot => "3270_PrintScreen", - // Key::Insert => TFC_Key:, - // Key::Help => "Help", - // Key::Separator => "KP_Separator", - // Key::Scroll => "Scroll_Lock", - // Key::NumLock => "Num_Lock", + Key::Print => TFC_Key::Print, + Key::Snapshot => TFC_Key::PrintScreen, + Key::Insert => TFC_Key::Insert, + Key::Scroll => TFC_Key::ScrollLock, + Key::NumLock => TFC_Key::NumLock, Key::RWin => TFC_Key::Meta, - // Key::Apps => "Menu", + Key::Apps => TFC_Key::Apps, Key::Multiply => TFC_Key::NumpadMultiply, Key::Add => TFC_Key::NumpadPlus, Key::Subtract => TFC_Key::NumpadMinus, @@ -758,6 +749,7 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { } }; + log::info!("tfc_key_down_or_up: {:?}", key); if down { TFC_CONTEXT.lock().unwrap().key_down(key); } From 4421d08384a17d3ee2b251d53aaa8bf319b4a7f4 Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 1 Sep 2022 20:24:50 -0700 Subject: [PATCH 075/113] Delete reset function about enigo --- libs/enigo/src/linux/nix_impl.rs | 4 ---- src/server/input_service.rs | 2 -- 2 files changed, 6 deletions(-) diff --git a/libs/enigo/src/linux/nix_impl.rs b/libs/enigo/src/linux/nix_impl.rs index 0c9b30eff..2e3fb8a24 100644 --- a/libs/enigo/src/linux/nix_impl.rs +++ b/libs/enigo/src/linux/nix_impl.rs @@ -19,10 +19,6 @@ impl Enigo { pub fn set_delay(&mut self, delay: u64) { self.xdo.set_delay(delay) } - /// Reset pynput?. - pub fn reset(&mut self) { - todo!() - } /// Set uinput keyboard. pub fn set_uinput_keyboard( &mut self, diff --git a/src/server/input_service.rs b/src/server/input_service.rs index ffcaf32a9..f8e338a93 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -23,8 +23,6 @@ impl super::service::Reset for StateCursor { *self = Default::default(); crate::platform::reset_input_cache(); fix_key_down_timeout(true); - #[cfg(target_os = "linux")] - ENIGO.lock().unwrap().reset(); } } From a4ee1bcc38c1d874bb8b735d23a883c156df0efe Mon Sep 17 00:00:00 2001 From: Asura Date: Thu, 1 Sep 2022 23:58:14 -0700 Subject: [PATCH 076/113] Get flutter deps when build --- build.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.rs b/build.rs index 860ebae77..5ed40b001 100644 --- a/build.rs +++ b/build.rs @@ -77,6 +77,17 @@ fn install_oboe() { } fn gen_flutter_rust_bridge() { + // Get dependent of flutter + println!("cargo:rerun-if-changed=flutter/pubspec.lock"); + println!("cargo:rerun-if-changed=flutter/pubspec.yaml"); + if !std::path::Path::new("./flutter/.packages").exists(){ + std::process::Command::new("flutter") + .args(["pub", "get"]) + .current_dir("./flutter") + .output() + .expect("failed to execute flutter pub get"); + }; + let llvm_path = match std::env::var("LLVM_HOME") { Ok(path) => Some(vec![path]), Err(_) => None, From 2b0778987cd510cada2b49b36baa0bd560a33abc Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 00:24:09 -0700 Subject: [PATCH 077/113] Update pubspec.lock to fix CI --- flutter/pubspec.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index a6dade189..69e7f3c4b 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -1242,8 +1242,8 @@ packages: dependency: "direct main" description: path: "." - ref: "799ef079e87938c3f4340591b4330c2598f38bb9" - resolved-ref: "799ef079e87938c3f4340591b4330c2598f38bb9" + ref: 4627ba808ed08ff0c08706b01a7f9cc8b747accd + resolved-ref: 4627ba808ed08ff0c08706b01a7f9cc8b747accd url: "https://github.com/Kingtous/rustdesk_window_manager" source: git version: "0.2.6" From be14a102b9971fe611949ce44fa7f074b6798f3e Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 01:11:35 -0700 Subject: [PATCH 078/113] Opt: handle error in tfc --- src/server/input_service.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index f8e338a93..b72370d12 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -7,7 +7,7 @@ use rdev::{simulate, EventType, Key as RdevKey}; use std::{ convert::TryFrom, sync::atomic::{AtomicBool, Ordering}, - time::Instant, + time::Instant }; use tfc::{traits::*, Context as TFC_Context, Key as TFC_Key}; @@ -673,10 +673,14 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { if let Key::Layout(chr) = key { log::info!("tfc_key_down_or_up :{:?}", chr); if down { - TFC_CONTEXT.lock().unwrap().unicode_char_down(chr); + if let Err(e) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ + log::error!("Failed to press char {:?}", chr); + }; } if up { - TFC_CONTEXT.lock().unwrap().unicode_char_up(chr); + if let Err(e) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ + log::error!("Failed to press char {:?}",chr); + }; } return; } @@ -749,10 +753,14 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { log::info!("tfc_key_down_or_up: {:?}", key); if down { - TFC_CONTEXT.lock().unwrap().key_down(key); + if let Err(e) = TFC_CONTEXT.lock().unwrap().key_down(key){ + log::error!("Failed to press char {:?}", key); + }; } if up { - TFC_CONTEXT.lock().unwrap().key_up(key); + if let Err(e) = TFC_CONTEXT.lock().unwrap().key_up(key){ + log::error!("Failed to press char {:?}", key); + }; } } From 03315a3bc4b429a3be0c7bde63abefbd4c345ecb Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 01:11:59 -0700 Subject: [PATCH 079/113] Update pubspec.lock --- flutter/pubspec.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 69e7f3c4b..a6dade189 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -1242,8 +1242,8 @@ packages: dependency: "direct main" description: path: "." - ref: 4627ba808ed08ff0c08706b01a7f9cc8b747accd - resolved-ref: 4627ba808ed08ff0c08706b01a7f9cc8b747accd + ref: "799ef079e87938c3f4340591b4330c2598f38bb9" + resolved-ref: "799ef079e87938c3f4340591b4330c2598f38bb9" url: "https://github.com/Kingtous/rustdesk_window_manager" source: git version: "0.2.6" From 41241867b729ebb19b3339122b620e207cad330e Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 01:20:48 -0700 Subject: [PATCH 080/113] Fix compile warning --- build.rs | 2 -- src/client.rs | 1 - src/common.rs | 1 - src/flutter_ffi.rs | 8 ++++---- src/rendezvous_mediator.rs | 5 +---- src/server/connection.rs | 2 +- src/server/input_service.rs | 8 ++++---- src/ui.rs | 4 ++-- src/ui/cm.rs | 4 ++-- src/ui/remote.rs | 2 +- src/ui_session_interface.rs | 1 - 11 files changed, 15 insertions(+), 23 deletions(-) diff --git a/build.rs b/build.rs index 5ed40b001..d9b7a5516 100644 --- a/build.rs +++ b/build.rs @@ -78,8 +78,6 @@ fn install_oboe() { fn gen_flutter_rust_bridge() { // Get dependent of flutter - println!("cargo:rerun-if-changed=flutter/pubspec.lock"); - println!("cargo:rerun-if-changed=flutter/pubspec.yaml"); if !std::path::Path::new("./flutter/.packages").exists(){ std::process::Command::new("flutter") .args(["pub", "get"]) diff --git a/src/client.rs b/src/client.rs index e47667f72..2bc60765a 100644 --- a/src/client.rs +++ b/src/client.rs @@ -61,7 +61,6 @@ pub struct Client; lazy_static::lazy_static! { static ref AUDIO_HOST: Host = cpal::default_host(); } -use rdev::{Event, EventType::*, Key as RdevKey, Keyboard as RdevKeyboard, KeyboardState}; #[cfg(not(any(target_os = "android", target_os = "ios")))] lazy_static::lazy_static! { diff --git a/src/common.rs b/src/common.rs index 5c387c07e..81adebb0a 100644 --- a/src/common.rs +++ b/src/common.rs @@ -668,7 +668,6 @@ pub fn make_privacy_mode_msg(state: back_notification::PrivacyModeState) -> Mess } pub fn make_fd_to_json(fd: FileDirectory) -> String { - use serde_json::json; let mut fd_json = serde_json::Map::new(); fd_json.insert("id".into(), json!(fd.id)); fd_json.insert("path".into(), json!(fd.path)); diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index bc1335970..78f53bf89 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -5,13 +5,13 @@ use std::{ }; use flutter_rust_bridge::{StreamSink, SyncReturn, ZeroCopyBuffer}; -use serde_json::{json, Number, Value}; +use serde_json::json; use hbb_common::{ - config::{self, Config, LocalConfig, PeerConfig, ONLINE}, + config::{self, LocalConfig, PeerConfig, ONLINE}, fs, log, }; -use hbb_common::{password_security, ResultType}; +use hbb_common::{ResultType}; use crate::{client::file_trait::FileManager, flutter::{session_add, session_start_}}; use crate::common::make_fd_to_json; @@ -20,7 +20,7 @@ use crate::flutter::{self, SESSIONS}; use crate::start_server; use crate::ui_interface; #[cfg(not(any(target_os = "android", target_os = "ios")))] -use crate::ui_interface::{change_id, check_connect_status, is_ok_change_id}; +use crate::ui_interface::{change_id}; use crate::ui_interface::{ check_mouse_time, check_super_user_permission, discover, forget_password, get_api_server, get_app_name, get_async_job_status, get_connect_status, get_fav, get_id, get_lan_peers, diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 08a1316f0..802fed1de 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -1,4 +1,3 @@ -use std::collections::HashMap; use std::{ net::SocketAddr, sync::{ @@ -10,12 +9,10 @@ use std::{ use uuid::Uuid; -use hbb_common::config::DiscoveryPeer; use hbb_common::tcp::FramedStream; use hbb_common::{ allow_err, anyhow::bail, - config, config::{Config, REG_INTERVAL, RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT}, futures::future::join_all, log, @@ -640,7 +637,7 @@ pub async fn query_online_states, Vec)>(ids: Vec ResultType { - let (mut rendezvous_server, servers, contained) = crate::get_rendezvous_server(1_000).await; + let (mut rendezvous_server, _servers, _contained) = crate::get_rendezvous_server(1_000).await; let tmp: Vec<&str> = rendezvous_server.split(":").collect(); if tmp.len() != 2 { bail!("Invalid server address: {}", rendezvous_server); diff --git a/src/server/connection.rs b/src/server/connection.rs index e71b32e35..d93d6d775 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -633,7 +633,7 @@ impl Connection { let mut pi = PeerInfo { username: username.clone(), conn_id: self.inner.id, - version: crate::VERSION.to_owned(), + version: VERSION.to_owned(), ..Default::default() }; diff --git a/src/server/input_service.rs b/src/server/input_service.rs index b72370d12..e0707bded 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -673,12 +673,12 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { if let Key::Layout(chr) = key { log::info!("tfc_key_down_or_up :{:?}", chr); if down { - if let Err(e) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ + if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ log::error!("Failed to press char {:?}", chr); }; } if up { - if let Err(e) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ + if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ log::error!("Failed to press char {:?}",chr); }; } @@ -753,12 +753,12 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { log::info!("tfc_key_down_or_up: {:?}", key); if down { - if let Err(e) = TFC_CONTEXT.lock().unwrap().key_down(key){ + if let Err(_) = TFC_CONTEXT.lock().unwrap().key_down(key){ log::error!("Failed to press char {:?}", key); }; } if up { - if let Err(e) = TFC_CONTEXT.lock().unwrap().key_up(key){ + if let Err(_) = TFC_CONTEXT.lock().unwrap().key_up(key){ log::error!("Failed to press char {:?}", key); }; } diff --git a/src/ui.rs b/src/ui.rs index b66d1453b..0e754e622 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -9,7 +9,7 @@ use sciter::Value; use hbb_common::{ allow_err, - config::{self, Config, LocalConfig, PeerConfig, RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT}, + config::{self, Config, PeerConfig, RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT}, futures::future::join_all, log, protobuf::Message as _, @@ -19,7 +19,7 @@ use hbb_common::{ tokio::{self, sync::mpsc, time}, }; -use crate::common::{get_app_name, SOFTWARE_UPDATE_URL}; +use crate::common::{get_app_name}; use crate::ipc; use crate::ui_interface::{ check_mouse_time, closing, create_shortcut, current_is_wayland, fix_login_wayland, diff --git a/src/ui/cm.rs b/src/ui/cm.rs index 3200d51b4..bef0ee3bd 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -6,13 +6,13 @@ use clipboard::{ create_cliprdr_context, empty_clipboard, get_rx_clip_client, server_clip_file, set_conn_enabled, }; use hbb_common::fs::{ - can_enable_overwrite_detection, get_string, is_write_need_confirmation, new_send_confirm, + get_string, is_write_need_confirmation, new_send_confirm, DigestCheckResult, }; use hbb_common::{ allow_err, config::Config, - fs, get_version_number, log, + fs, log, message_proto::*, protobuf::Message as _, tokio::{self, sync::mpsc, task::spawn_blocking}, diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 91dd08fdc..093ad901e 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -2,7 +2,7 @@ use std::{ collections::HashMap, ops::{Deref, DerefMut}, sync::{ - atomic::{AtomicBool, Ordering}, + atomic::{Ordering}, Arc, Mutex, }, }; diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 33949a116..4f5ec55b8 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -6,7 +6,6 @@ use crate::client::{ load_config, send_mouse, start_video_audio_threads, FileManager, Key, LoginConfigHandler, QualityStatus, KEY_MAP, SERVER_KEYBOARD_ENABLED, }; -use crate::common; use crate::{client::Data, client::Interface}; use async_trait::async_trait; From a2763c2d6f194e573e3e58f41109f1e11a00dca1 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 02:05:29 -0700 Subject: [PATCH 081/113] Remove generate file --- flutter/.gitignore | 5 +- flutter/lib/generated_bridge.dart | 4289 ------------------ flutter/lib/generated_bridge.freezed.dart | 332 -- flutter/lib/generated_plugin_registrant.dart | 35 - 4 files changed, 3 insertions(+), 4658 deletions(-) delete mode 100644 flutter/lib/generated_bridge.dart delete mode 100644 flutter/lib/generated_bridge.freezed.dart delete mode 100644 flutter/lib/generated_plugin_registrant.dart diff --git a/flutter/.gitignore b/flutter/.gitignore index af69247b0..3cbfc0f54 100644 --- a/flutter/.gitignore +++ b/flutter/.gitignore @@ -32,17 +32,18 @@ /build/ # Web related +lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols - # Obfuscation related app.*.map.json jniLibs - .vscode # flutter rust bridge +lib/generated_bridge.dart +lib/generated_bridge.freezed.dart # Flutter Generated Files **/GeneratedPluginRegistrant.swift diff --git a/flutter/lib/generated_bridge.dart b/flutter/lib/generated_bridge.dart deleted file mode 100644 index 2cbeb430e..000000000 --- a/flutter/lib/generated_bridge.dart +++ /dev/null @@ -1,4289 +0,0 @@ -// AUTO GENERATED FILE, DO NOT EDIT. -// Generated by `flutter_rust_bridge`. - -// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, prefer_single_quotes, prefer_const_constructors - -import 'dart:convert'; -import 'dart:typed_data'; -import 'package:freezed_annotation/freezed_annotation.dart'; - -import 'dart:convert'; -import 'dart:typed_data'; -import 'package:flutter_rust_bridge/flutter_rust_bridge.dart'; -import 'dart:ffi' as ffi; - -part 'generated_bridge.freezed.dart'; - -abstract class Rustdesk { - /// FFI for rustdesk core's main entry. - /// Return true if the app should continue running with UI(possibly Flutter), false if the app should exit. - Future rustdeskCoreMain({dynamic hint}); - - Stream startGlobalEventStream( - {required String appType, dynamic hint}); - - Future stopGlobalEventStream({required String appType, dynamic hint}); - - Future hostStopSystemKeyPropagate( - {required bool stopped, dynamic hint}); - - String sessionAddSync( - {required String id, - required bool isFileTransfer, - required bool isPortForward, - dynamic hint}); - - Stream sessionStart({required String id, dynamic hint}); - - Future sessionGetRemember({required String id, dynamic hint}); - - Future sessionGetToggleOption( - {required String id, required String arg, dynamic hint}); - - bool sessionGetToggleOptionSync( - {required String id, required String arg, dynamic hint}); - - Future sessionGetOption( - {required String id, required String arg, dynamic hint}); - - Future sessionLogin( - {required String id, - required String password, - required bool remember, - dynamic hint}); - - Future sessionClose({required String id, dynamic hint}); - - Future sessionRefresh({required String id, dynamic hint}); - - Future sessionReconnect({required String id, dynamic hint}); - - Future sessionToggleOption( - {required String id, required String value, dynamic hint}); - - Future sessionGetImageQuality({required String id, dynamic hint}); - - Future sessionSetImageQuality( - {required String id, required String value, dynamic hint}); - - Future sessionGetCustomImageQuality( - {required String id, dynamic hint}); - - Future sessionSetCustomImageQuality( - {required String id, required int value, dynamic hint}); - - Future sessionLockScreen({required String id, dynamic hint}); - - Future sessionCtrlAltDel({required String id, dynamic hint}); - - Future sessionSwitchDisplay( - {required String id, required int value, dynamic hint}); - - Future sessionInputKey( - {required String id, - required String name, - required bool down, - required bool press, - required bool alt, - required bool ctrl, - required bool shift, - required bool command, - dynamic hint}); - - Future sessionInputString( - {required String id, required String value, dynamic hint}); - - Future sessionSendChat( - {required String id, required String text, dynamic hint}); - - Future sessionPeerOption( - {required String id, - required String name, - required String value, - dynamic hint}); - - Future sessionGetPeerOption( - {required String id, required String name, dynamic hint}); - - Future sessionInputOsPassword( - {required String id, required String value, dynamic hint}); - - Future sessionReadRemoteDir( - {required String id, - required String path, - required bool includeHidden, - dynamic hint}); - - Future sessionSendFiles( - {required String id, - required int actId, - required String path, - required String to, - required int fileNum, - required bool includeHidden, - required bool isRemote, - dynamic hint}); - - Future sessionSetConfirmOverrideFile( - {required String id, - required int actId, - required int fileNum, - required bool needOverride, - required bool remember, - required bool isUpload, - dynamic hint}); - - Future sessionRemoveFile( - {required String id, - required int actId, - required String path, - required int fileNum, - required bool isRemote, - dynamic hint}); - - Future sessionReadDirRecursive( - {required String id, - required int actId, - required String path, - required bool isRemote, - required bool showHidden, - dynamic hint}); - - Future sessionRemoveAllEmptyDirs( - {required String id, - required int actId, - required String path, - required bool isRemote, - dynamic hint}); - - Future sessionCancelJob( - {required String id, required int actId, dynamic hint}); - - Future sessionCreateDir( - {required String id, - required int actId, - required String path, - required bool isRemote, - dynamic hint}); - - Future sessionReadLocalDirSync( - {required String id, - required String path, - required bool showHidden, - dynamic hint}); - - Future sessionGetPlatform( - {required String id, required bool isRemote, dynamic hint}); - - Future sessionLoadLastTransferJobs({required String id, dynamic hint}); - - Future sessionAddJob( - {required String id, - required int actId, - required String path, - required String to, - required int fileNum, - required bool includeHidden, - required bool isRemote, - dynamic hint}); - - Future sessionResumeJob( - {required String id, - required int actId, - required bool isRemote, - dynamic hint}); - - Future> mainGetSoundInputs({dynamic hint}); - - Future mainChangeId({required String newId, dynamic hint}); - - Future mainGetAsyncStatus({dynamic hint}); - - Future mainGetOption({required String key, dynamic hint}); - - Future mainSetOption( - {required String key, required String value, dynamic hint}); - - Future mainGetOptions({dynamic hint}); - - Future mainSetOptions({required String json, dynamic hint}); - - Future mainTestIfValidServer({required String server, dynamic hint}); - - Future mainSetSocks( - {required String proxy, - required String username, - required String password, - dynamic hint}); - - Future> mainGetSocks({dynamic hint}); - - Future mainGetAppName({dynamic hint}); - - Future mainGetLicense({dynamic hint}); - - Future mainGetVersion({dynamic hint}); - - Future> mainGetFav({dynamic hint}); - - Future mainStoreFav({required List favs, dynamic hint}); - - Future mainGetPeer({required String id, dynamic hint}); - - Future mainGetLanPeers({dynamic hint}); - - Future mainGetConnectStatus({dynamic hint}); - - Future mainCheckConnectStatus({dynamic hint}); - - Future mainIsUsingPublicServer({dynamic hint}); - - Future mainDiscover({dynamic hint}); - - Future mainHasRendezvousService({dynamic hint}); - - Future mainGetApiServer({dynamic hint}); - - Future mainPostRequest( - {required String url, - required String body, - required String header, - dynamic hint}); - - Future mainGetLocalOption({required String key, dynamic hint}); - - Future mainSetLocalOption( - {required String key, required String value, dynamic hint}); - - Future mainGetMyId({dynamic hint}); - - Future mainGetUuid({dynamic hint}); - - Future mainGetPeerOption( - {required String id, required String key, dynamic hint}); - - Future mainSetPeerOption( - {required String id, - required String key, - required String value, - dynamic hint}); - - Future mainForgetPassword({required String id, dynamic hint}); - - Future mainGetRecentPeers({dynamic hint}); - - Future mainLoadRecentPeers({dynamic hint}); - - Future mainLoadFavPeers({dynamic hint}); - - Future mainLoadLanPeers({dynamic hint}); - - Future sessionAddPortForward( - {required String id, - required int localPort, - required String remoteHost, - required int remotePort, - dynamic hint}); - - Future sessionRemovePortForward( - {required String id, required int localPort, dynamic hint}); - - Future mainGetLastRemoteId({dynamic hint}); - - Future mainGetSoftwareUpdateUrl({dynamic hint}); - - Future mainGetHomeDir({dynamic hint}); - - Future mainGetLangs({dynamic hint}); - - Future mainGetTemporaryPassword({dynamic hint}); - - Future mainGetPermanentPassword({dynamic hint}); - - Future mainGetOnlineStatue({dynamic hint}); - - Future mainGetClientsState({dynamic hint}); - - Future mainCheckClientsLength({required int length, dynamic hint}); - - Future mainInit({required String appDir, dynamic hint}); - - Future mainDeviceId({required String id, dynamic hint}); - - Future mainDeviceName({required String name, dynamic hint}); - - Future mainRemovePeer({required String id, dynamic hint}); - - Future mainHasHwcodec({dynamic hint}); - - Future sessionSendMouse( - {required String id, required String msg, dynamic hint}); - - Future sessionRestartRemoteDevice({required String id, dynamic hint}); - - Future mainSetHomeDir({required String home, dynamic hint}); - - Future mainStopService({dynamic hint}); - - Future mainStartService({dynamic hint}); - - Future mainUpdateTemporaryPassword({dynamic hint}); - - Future mainSetPermanentPassword( - {required String password, dynamic hint}); - - Future mainCheckSuperUserPermission({dynamic hint}); - - Future mainCheckMouseTime({dynamic hint}); - - Future mainGetMouseTime({dynamic hint}); - - Future cmSendChat( - {required int connId, required String msg, dynamic hint}); - - Future cmLoginRes( - {required int connId, required bool res, dynamic hint}); - - Future cmCloseConnection({required int connId, dynamic hint}); - - Future cmCheckClickTime({required int connId, dynamic hint}); - - Future cmGetClickTime({dynamic hint}); - - Future cmSwitchPermission( - {required int connId, - required String name, - required bool enabled, - dynamic hint}); - - Future mainGetIcon({dynamic hint}); - - Future queryOnlines({required List ids, dynamic hint}); -} - -@freezed -class EventToUI with _$EventToUI { - const factory EventToUI.event( - String field0, - ) = Event; - const factory EventToUI.rgba( - Uint8List field0, - ) = Rgba; -} - -class RustdeskImpl extends FlutterRustBridgeBase - implements Rustdesk { - factory RustdeskImpl(ffi.DynamicLibrary dylib) => - RustdeskImpl.raw(RustdeskWire(dylib)); - - RustdeskImpl.raw(RustdeskWire inner) : super(inner); - - Future rustdeskCoreMain({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_rustdesk_core_main(port_), - parseSuccessData: _wire2api_bool, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "rustdesk_core_main", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Stream startGlobalEventStream( - {required String appType, dynamic hint}) => - executeStream(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_start_global_event_stream( - port_, _api2wire_String(appType)), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "start_global_event_stream", - argNames: ["appType"], - ), - argValues: [appType], - hint: hint, - )); - - Future stopGlobalEventStream({required String appType, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_stop_global_event_stream( - port_, _api2wire_String(appType)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "stop_global_event_stream", - argNames: ["appType"], - ), - argValues: [appType], - hint: hint, - )); - - Future hostStopSystemKeyPropagate( - {required bool stopped, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_host_stop_system_key_propagate(port_, stopped), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "host_stop_system_key_propagate", - argNames: ["stopped"], - ), - argValues: [stopped], - hint: hint, - )); - - String sessionAddSync( - {required String id, - required bool isFileTransfer, - required bool isPortForward, - dynamic hint}) => - executeSync(FlutterRustBridgeSyncTask( - callFfi: () => inner.wire_session_add_sync( - _api2wire_String(id), isFileTransfer, isPortForward), - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_add_sync", - argNames: ["id", "isFileTransfer", "isPortForward"], - ), - argValues: [id, isFileTransfer, isPortForward], - hint: hint, - )); - - Stream sessionStart({required String id, dynamic hint}) => - executeStream(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_start(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_event_to_ui, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_start", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionGetRemember({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_get_remember(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_opt_box_autoadd_bool, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_remember", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionGetToggleOption( - {required String id, required String arg, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_get_toggle_option( - port_, _api2wire_String(id), _api2wire_String(arg)), - parseSuccessData: _wire2api_opt_box_autoadd_bool, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_toggle_option", - argNames: ["id", "arg"], - ), - argValues: [id, arg], - hint: hint, - )); - - bool sessionGetToggleOptionSync( - {required String id, required String arg, dynamic hint}) => - executeSync(FlutterRustBridgeSyncTask( - callFfi: () => inner.wire_session_get_toggle_option_sync( - _api2wire_String(id), _api2wire_String(arg)), - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_toggle_option_sync", - argNames: ["id", "arg"], - ), - argValues: [id, arg], - hint: hint, - )); - - Future sessionGetOption( - {required String id, required String arg, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_get_option( - port_, _api2wire_String(id), _api2wire_String(arg)), - parseSuccessData: _wire2api_opt_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_option", - argNames: ["id", "arg"], - ), - argValues: [id, arg], - hint: hint, - )); - - Future sessionLogin( - {required String id, - required String password, - required bool remember, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_login( - port_, _api2wire_String(id), _api2wire_String(password), remember), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_login", - argNames: ["id", "password", "remember"], - ), - argValues: [id, password, remember], - hint: hint, - )); - - Future sessionClose({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_close(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_close", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionRefresh({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_refresh(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_refresh", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionReconnect({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_reconnect(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_reconnect", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionToggleOption( - {required String id, required String value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_toggle_option( - port_, _api2wire_String(id), _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_toggle_option", - argNames: ["id", "value"], - ), - argValues: [id, value], - hint: hint, - )); - - Future sessionGetImageQuality({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_get_image_quality(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_opt_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_image_quality", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionSetImageQuality( - {required String id, required String value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_set_image_quality( - port_, _api2wire_String(id), _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_set_image_quality", - argNames: ["id", "value"], - ), - argValues: [id, value], - hint: hint, - )); - - Future sessionGetCustomImageQuality( - {required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_get_custom_image_quality( - port_, _api2wire_String(id)), - parseSuccessData: _wire2api_opt_int_32_list, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_custom_image_quality", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionSetCustomImageQuality( - {required String id, required int value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_set_custom_image_quality( - port_, _api2wire_String(id), _api2wire_i32(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_set_custom_image_quality", - argNames: ["id", "value"], - ), - argValues: [id, value], - hint: hint, - )); - - Future sessionLockScreen({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_lock_screen(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_lock_screen", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionCtrlAltDel({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_session_ctrl_alt_del(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_ctrl_alt_del", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionSwitchDisplay( - {required String id, required int value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_switch_display( - port_, _api2wire_String(id), _api2wire_i32(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_switch_display", - argNames: ["id", "value"], - ), - argValues: [id, value], - hint: hint, - )); - - Future sessionInputKey( - {required String id, - required String name, - required bool down, - required bool press, - required bool alt, - required bool ctrl, - required bool shift, - required bool command, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_input_key( - port_, - _api2wire_String(id), - _api2wire_String(name), - down, - press, - alt, - ctrl, - shift, - command), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_input_key", - argNames: [ - "id", - "name", - "down", - "press", - "alt", - "ctrl", - "shift", - "command" - ], - ), - argValues: [id, name, down, press, alt, ctrl, shift, command], - hint: hint, - )); - - Future sessionInputString( - {required String id, required String value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_input_string( - port_, _api2wire_String(id), _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_input_string", - argNames: ["id", "value"], - ), - argValues: [id, value], - hint: hint, - )); - - Future sessionSendChat( - {required String id, required String text, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_send_chat( - port_, _api2wire_String(id), _api2wire_String(text)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_send_chat", - argNames: ["id", "text"], - ), - argValues: [id, text], - hint: hint, - )); - - Future sessionPeerOption( - {required String id, - required String name, - required String value, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_peer_option( - port_, - _api2wire_String(id), - _api2wire_String(name), - _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_peer_option", - argNames: ["id", "name", "value"], - ), - argValues: [id, name, value], - hint: hint, - )); - - Future sessionGetPeerOption( - {required String id, required String name, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_get_peer_option( - port_, _api2wire_String(id), _api2wire_String(name)), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_peer_option", - argNames: ["id", "name"], - ), - argValues: [id, name], - hint: hint, - )); - - Future sessionInputOsPassword( - {required String id, required String value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_input_os_password( - port_, _api2wire_String(id), _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_input_os_password", - argNames: ["id", "value"], - ), - argValues: [id, value], - hint: hint, - )); - - Future sessionReadRemoteDir( - {required String id, - required String path, - required bool includeHidden, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_read_remote_dir( - port_, _api2wire_String(id), _api2wire_String(path), includeHidden), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_read_remote_dir", - argNames: ["id", "path", "includeHidden"], - ), - argValues: [id, path, includeHidden], - hint: hint, - )); - - Future sessionSendFiles( - {required String id, - required int actId, - required String path, - required String to, - required int fileNum, - required bool includeHidden, - required bool isRemote, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_send_files( - port_, - _api2wire_String(id), - _api2wire_i32(actId), - _api2wire_String(path), - _api2wire_String(to), - _api2wire_i32(fileNum), - includeHidden, - isRemote), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_send_files", - argNames: [ - "id", - "actId", - "path", - "to", - "fileNum", - "includeHidden", - "isRemote" - ], - ), - argValues: [id, actId, path, to, fileNum, includeHidden, isRemote], - hint: hint, - )); - - Future sessionSetConfirmOverrideFile( - {required String id, - required int actId, - required int fileNum, - required bool needOverride, - required bool remember, - required bool isUpload, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_set_confirm_override_file( - port_, - _api2wire_String(id), - _api2wire_i32(actId), - _api2wire_i32(fileNum), - needOverride, - remember, - isUpload), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_set_confirm_override_file", - argNames: [ - "id", - "actId", - "fileNum", - "needOverride", - "remember", - "isUpload" - ], - ), - argValues: [id, actId, fileNum, needOverride, remember, isUpload], - hint: hint, - )); - - Future sessionRemoveFile( - {required String id, - required int actId, - required String path, - required int fileNum, - required bool isRemote, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_remove_file( - port_, - _api2wire_String(id), - _api2wire_i32(actId), - _api2wire_String(path), - _api2wire_i32(fileNum), - isRemote), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_remove_file", - argNames: ["id", "actId", "path", "fileNum", "isRemote"], - ), - argValues: [id, actId, path, fileNum, isRemote], - hint: hint, - )); - - Future sessionReadDirRecursive( - {required String id, - required int actId, - required String path, - required bool isRemote, - required bool showHidden, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_read_dir_recursive( - port_, - _api2wire_String(id), - _api2wire_i32(actId), - _api2wire_String(path), - isRemote, - showHidden), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_read_dir_recursive", - argNames: ["id", "actId", "path", "isRemote", "showHidden"], - ), - argValues: [id, actId, path, isRemote, showHidden], - hint: hint, - )); - - Future sessionRemoveAllEmptyDirs( - {required String id, - required int actId, - required String path, - required bool isRemote, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_remove_all_empty_dirs( - port_, - _api2wire_String(id), - _api2wire_i32(actId), - _api2wire_String(path), - isRemote), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_remove_all_empty_dirs", - argNames: ["id", "actId", "path", "isRemote"], - ), - argValues: [id, actId, path, isRemote], - hint: hint, - )); - - Future sessionCancelJob( - {required String id, required int actId, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_cancel_job( - port_, _api2wire_String(id), _api2wire_i32(actId)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_cancel_job", - argNames: ["id", "actId"], - ), - argValues: [id, actId], - hint: hint, - )); - - Future sessionCreateDir( - {required String id, - required int actId, - required String path, - required bool isRemote, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_create_dir( - port_, - _api2wire_String(id), - _api2wire_i32(actId), - _api2wire_String(path), - isRemote), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_create_dir", - argNames: ["id", "actId", "path", "isRemote"], - ), - argValues: [id, actId, path, isRemote], - hint: hint, - )); - - Future sessionReadLocalDirSync( - {required String id, - required String path, - required bool showHidden, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_read_local_dir_sync( - port_, _api2wire_String(id), _api2wire_String(path), showHidden), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_read_local_dir_sync", - argNames: ["id", "path", "showHidden"], - ), - argValues: [id, path, showHidden], - hint: hint, - )); - - Future sessionGetPlatform( - {required String id, required bool isRemote, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_get_platform( - port_, _api2wire_String(id), isRemote), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_get_platform", - argNames: ["id", "isRemote"], - ), - argValues: [id, isRemote], - hint: hint, - )); - - Future sessionLoadLastTransferJobs( - {required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_load_last_transfer_jobs( - port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_load_last_transfer_jobs", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future sessionAddJob( - {required String id, - required int actId, - required String path, - required String to, - required int fileNum, - required bool includeHidden, - required bool isRemote, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_add_job( - port_, - _api2wire_String(id), - _api2wire_i32(actId), - _api2wire_String(path), - _api2wire_String(to), - _api2wire_i32(fileNum), - includeHidden, - isRemote), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_add_job", - argNames: [ - "id", - "actId", - "path", - "to", - "fileNum", - "includeHidden", - "isRemote" - ], - ), - argValues: [id, actId, path, to, fileNum, includeHidden, isRemote], - hint: hint, - )); - - Future sessionResumeJob( - {required String id, - required int actId, - required bool isRemote, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_resume_job( - port_, _api2wire_String(id), _api2wire_i32(actId), isRemote), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_resume_job", - argNames: ["id", "actId", "isRemote"], - ), - argValues: [id, actId, isRemote], - hint: hint, - )); - - Future> mainGetSoundInputs({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_sound_inputs(port_), - parseSuccessData: _wire2api_StringList, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_sound_inputs", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainChangeId({required String newId, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_change_id(port_, _api2wire_String(newId)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_change_id", - argNames: ["newId"], - ), - argValues: [newId], - hint: hint, - )); - - Future mainGetAsyncStatus({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_async_status(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_async_status", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetOption({required String key, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_get_option(port_, _api2wire_String(key)), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_option", - argNames: ["key"], - ), - argValues: [key], - hint: hint, - )); - - Future mainSetOption( - {required String key, required String value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_set_option( - port_, _api2wire_String(key), _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_set_option", - argNames: ["key", "value"], - ), - argValues: [key, value], - hint: hint, - )); - - Future mainGetOptions({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_options(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_options", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainSetOptions({required String json, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_set_options(port_, _api2wire_String(json)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_set_options", - argNames: ["json"], - ), - argValues: [json], - hint: hint, - )); - - Future mainTestIfValidServer( - {required String server, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_test_if_valid_server( - port_, _api2wire_String(server)), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_test_if_valid_server", - argNames: ["server"], - ), - argValues: [server], - hint: hint, - )); - - Future mainSetSocks( - {required String proxy, - required String username, - required String password, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_set_socks( - port_, - _api2wire_String(proxy), - _api2wire_String(username), - _api2wire_String(password)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_set_socks", - argNames: ["proxy", "username", "password"], - ), - argValues: [proxy, username, password], - hint: hint, - )); - - Future> mainGetSocks({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_socks(port_), - parseSuccessData: _wire2api_StringList, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_socks", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetAppName({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_app_name(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_app_name", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetLicense({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_license(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_license", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetVersion({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_version(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_version", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future> mainGetFav({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_fav(port_), - parseSuccessData: _wire2api_StringList, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_fav", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainStoreFav({required List favs, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_store_fav(port_, _api2wire_StringList(favs)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_store_fav", - argNames: ["favs"], - ), - argValues: [favs], - hint: hint, - )); - - Future mainGetPeer({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_get_peer(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_peer", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future mainGetLanPeers({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_lan_peers(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_lan_peers", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetConnectStatus({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_connect_status(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_connect_status", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainCheckConnectStatus({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_check_connect_status(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_check_connect_status", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainIsUsingPublicServer({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_is_using_public_server(port_), - parseSuccessData: _wire2api_bool, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_is_using_public_server", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainDiscover({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_discover(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_discover", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainHasRendezvousService({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_has_rendezvous_service(port_), - parseSuccessData: _wire2api_bool, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_has_rendezvous_service", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetApiServer({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_api_server(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_api_server", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainPostRequest( - {required String url, - required String body, - required String header, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_post_request( - port_, - _api2wire_String(url), - _api2wire_String(body), - _api2wire_String(header)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_post_request", - argNames: ["url", "body", "header"], - ), - argValues: [url, body, header], - hint: hint, - )); - - Future mainGetLocalOption({required String key, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_get_local_option(port_, _api2wire_String(key)), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_local_option", - argNames: ["key"], - ), - argValues: [key], - hint: hint, - )); - - Future mainSetLocalOption( - {required String key, required String value, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_set_local_option( - port_, _api2wire_String(key), _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_set_local_option", - argNames: ["key", "value"], - ), - argValues: [key, value], - hint: hint, - )); - - Future mainGetMyId({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_my_id(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_my_id", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetUuid({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_uuid(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_uuid", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetPeerOption( - {required String id, required String key, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_peer_option( - port_, _api2wire_String(id), _api2wire_String(key)), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_peer_option", - argNames: ["id", "key"], - ), - argValues: [id, key], - hint: hint, - )); - - Future mainSetPeerOption( - {required String id, - required String key, - required String value, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_set_peer_option( - port_, - _api2wire_String(id), - _api2wire_String(key), - _api2wire_String(value)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_set_peer_option", - argNames: ["id", "key", "value"], - ), - argValues: [id, key, value], - hint: hint, - )); - - Future mainForgetPassword({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_forget_password(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_forget_password", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future mainGetRecentPeers({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_recent_peers(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_recent_peers", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainLoadRecentPeers({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_load_recent_peers(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_load_recent_peers", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainLoadFavPeers({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_load_fav_peers(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_load_fav_peers", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainLoadLanPeers({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_load_lan_peers(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_load_lan_peers", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future sessionAddPortForward( - {required String id, - required int localPort, - required String remoteHost, - required int remotePort, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_add_port_forward( - port_, - _api2wire_String(id), - _api2wire_i32(localPort), - _api2wire_String(remoteHost), - _api2wire_i32(remotePort)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_add_port_forward", - argNames: ["id", "localPort", "remoteHost", "remotePort"], - ), - argValues: [id, localPort, remoteHost, remotePort], - hint: hint, - )); - - Future sessionRemovePortForward( - {required String id, required int localPort, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_remove_port_forward( - port_, _api2wire_String(id), _api2wire_i32(localPort)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_remove_port_forward", - argNames: ["id", "localPort"], - ), - argValues: [id, localPort], - hint: hint, - )); - - Future mainGetLastRemoteId({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_last_remote_id(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_last_remote_id", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetSoftwareUpdateUrl({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_software_update_url(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_software_update_url", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetHomeDir({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_home_dir(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_home_dir", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetLangs({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_langs(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_langs", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetTemporaryPassword({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_temporary_password(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_temporary_password", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetPermanentPassword({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_permanent_password(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_permanent_password", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetOnlineStatue({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_online_statue(port_), - parseSuccessData: _wire2api_i64, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_online_statue", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetClientsState({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_clients_state(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_clients_state", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainCheckClientsLength({required int length, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_check_clients_length( - port_, _api2wire_usize(length)), - parseSuccessData: _wire2api_opt_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_check_clients_length", - argNames: ["length"], - ), - argValues: [length], - hint: hint, - )); - - Future mainInit({required String appDir, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_init(port_, _api2wire_String(appDir)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_init", - argNames: ["appDir"], - ), - argValues: [appDir], - hint: hint, - )); - - Future mainDeviceId({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_device_id(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_device_id", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future mainDeviceName({required String name, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_device_name(port_, _api2wire_String(name)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_device_name", - argNames: ["name"], - ), - argValues: [name], - hint: hint, - )); - - Future mainRemovePeer({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_remove_peer(port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_remove_peer", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future mainHasHwcodec({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_has_hwcodec(port_), - parseSuccessData: _wire2api_bool, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_has_hwcodec", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future sessionSendMouse( - {required String id, required String msg, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_send_mouse( - port_, _api2wire_String(id), _api2wire_String(msg)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_send_mouse", - argNames: ["id", "msg"], - ), - argValues: [id, msg], - hint: hint, - )); - - Future sessionRestartRemoteDevice({required String id, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_session_restart_remote_device( - port_, _api2wire_String(id)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "session_restart_remote_device", - argNames: ["id"], - ), - argValues: [id], - hint: hint, - )); - - Future mainSetHomeDir({required String home, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_main_set_home_dir(port_, _api2wire_String(home)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_set_home_dir", - argNames: ["home"], - ), - argValues: [home], - hint: hint, - )); - - Future mainStopService({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_stop_service(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_stop_service", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainStartService({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_start_service(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_start_service", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainUpdateTemporaryPassword({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_update_temporary_password(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_update_temporary_password", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainSetPermanentPassword( - {required String password, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_set_permanent_password( - port_, _api2wire_String(password)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_set_permanent_password", - argNames: ["password"], - ), - argValues: [password], - hint: hint, - )); - - Future mainCheckSuperUserPermission({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_check_super_user_permission(port_), - parseSuccessData: _wire2api_bool, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_check_super_user_permission", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainCheckMouseTime({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_check_mouse_time(port_), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_check_mouse_time", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future mainGetMouseTime({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_mouse_time(port_), - parseSuccessData: _wire2api_f64, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_mouse_time", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future cmSendChat( - {required int connId, required String msg, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_cm_send_chat( - port_, _api2wire_i32(connId), _api2wire_String(msg)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "cm_send_chat", - argNames: ["connId", "msg"], - ), - argValues: [connId, msg], - hint: hint, - )); - - Future cmLoginRes( - {required int connId, required bool res, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_cm_login_res(port_, _api2wire_i32(connId), res), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "cm_login_res", - argNames: ["connId", "res"], - ), - argValues: [connId, res], - hint: hint, - )); - - Future cmCloseConnection({required int connId, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_cm_close_connection(port_, _api2wire_i32(connId)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "cm_close_connection", - argNames: ["connId"], - ), - argValues: [connId], - hint: hint, - )); - - Future cmCheckClickTime({required int connId, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_cm_check_click_time(port_, _api2wire_i32(connId)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "cm_check_click_time", - argNames: ["connId"], - ), - argValues: [connId], - hint: hint, - )); - - Future cmGetClickTime({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_cm_get_click_time(port_), - parseSuccessData: _wire2api_f64, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "cm_get_click_time", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future cmSwitchPermission( - {required int connId, - required String name, - required bool enabled, - dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_cm_switch_permission( - port_, _api2wire_i32(connId), _api2wire_String(name), enabled), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "cm_switch_permission", - argNames: ["connId", "name", "enabled"], - ), - argValues: [connId, name, enabled], - hint: hint, - )); - - Future mainGetIcon({dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => inner.wire_main_get_icon(port_), - parseSuccessData: _wire2api_String, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "main_get_icon", - argNames: [], - ), - argValues: [], - hint: hint, - )); - - Future queryOnlines({required List ids, dynamic hint}) => - executeNormal(FlutterRustBridgeTask( - callFfi: (port_) => - inner.wire_query_onlines(port_, _api2wire_StringList(ids)), - parseSuccessData: _wire2api_unit, - constMeta: const FlutterRustBridgeTaskConstMeta( - debugName: "query_onlines", - argNames: ["ids"], - ), - argValues: [ids], - hint: hint, - )); - - // Section: api2wire - ffi.Pointer _api2wire_String(String raw) { - return _api2wire_uint_8_list(utf8.encoder.convert(raw)); - } - - ffi.Pointer _api2wire_StringList(List raw) { - final ans = inner.new_StringList(raw.length); - for (var i = 0; i < raw.length; i++) { - ans.ref.ptr[i] = _api2wire_String(raw[i]); - } - return ans; - } - - int _api2wire_bool(bool raw) { - return raw ? 1 : 0; - } - - int _api2wire_i32(int raw) { - return raw; - } - - int _api2wire_u8(int raw) { - return raw; - } - - ffi.Pointer _api2wire_uint_8_list(Uint8List raw) { - final ans = inner.new_uint_8_list(raw.length); - ans.ref.ptr.asTypedList(raw.length).setAll(0, raw); - return ans; - } - - int _api2wire_usize(int raw) { - return raw; - } - - // Section: api_fill_to_wire - -} - -// Section: wire2api -String _wire2api_String(dynamic raw) { - return raw as String; -} - -List _wire2api_StringList(dynamic raw) { - return (raw as List).cast(); -} - -String _wire2api_SyncReturnString(dynamic raw) { - return raw as String; -} - -Uint8List _wire2api_ZeroCopyBuffer_Uint8List(dynamic raw) { - return raw as Uint8List; -} - -bool _wire2api_bool(dynamic raw) { - return raw as bool; -} - -bool _wire2api_box_autoadd_bool(dynamic raw) { - return raw as bool; -} - -EventToUI _wire2api_event_to_ui(dynamic raw) { - switch (raw[0]) { - case 0: - return Event( - _wire2api_String(raw[1]), - ); - case 1: - return Rgba( - _wire2api_ZeroCopyBuffer_Uint8List(raw[1]), - ); - default: - throw Exception("unreachable"); - } -} - -double _wire2api_f64(dynamic raw) { - return raw as double; -} - -int _wire2api_i32(dynamic raw) { - return raw as int; -} - -int _wire2api_i64(dynamic raw) { - return raw as int; -} - -Int32List _wire2api_int_32_list(dynamic raw) { - return raw as Int32List; -} - -String? _wire2api_opt_String(dynamic raw) { - return raw == null ? null : _wire2api_String(raw); -} - -bool? _wire2api_opt_box_autoadd_bool(dynamic raw) { - return raw == null ? null : _wire2api_box_autoadd_bool(raw); -} - -Int32List? _wire2api_opt_int_32_list(dynamic raw) { - return raw == null ? null : _wire2api_int_32_list(raw); -} - -int _wire2api_u8(dynamic raw) { - return raw as int; -} - -Uint8List _wire2api_uint_8_list(dynamic raw) { - return raw as Uint8List; -} - -void _wire2api_unit(dynamic raw) { - return; -} - -// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names - -// AUTO GENERATED FILE, DO NOT EDIT. -// -// Generated by `package:ffigen`. - -/// generated by flutter_rust_bridge -class RustdeskWire implements FlutterRustBridgeWireBase { - /// Holds the symbol lookup function. - final ffi.Pointer Function(String symbolName) - _lookup; - - /// The symbols are looked up in [dynamicLibrary]. - RustdeskWire(ffi.DynamicLibrary dynamicLibrary) - : _lookup = dynamicLibrary.lookup; - - /// The symbols are looked up with [lookup]. - RustdeskWire.fromLookup( - ffi.Pointer Function(String symbolName) - lookup) - : _lookup = lookup; - - void wire_rustdesk_core_main( - int port_, - ) { - return _wire_rustdesk_core_main( - port_, - ); - } - - late final _wire_rustdesk_core_mainPtr = - _lookup>( - 'wire_rustdesk_core_main'); - late final _wire_rustdesk_core_main = - _wire_rustdesk_core_mainPtr.asFunction(); - - void wire_start_global_event_stream( - int port_, - ffi.Pointer app_type, - ) { - return _wire_start_global_event_stream( - port_, - app_type, - ); - } - - late final _wire_start_global_event_streamPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_start_global_event_stream'); - late final _wire_start_global_event_stream = - _wire_start_global_event_streamPtr - .asFunction)>(); - - void wire_stop_global_event_stream( - int port_, - ffi.Pointer app_type, - ) { - return _wire_stop_global_event_stream( - port_, - app_type, - ); - } - - late final _wire_stop_global_event_streamPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_stop_global_event_stream'); - late final _wire_stop_global_event_stream = _wire_stop_global_event_streamPtr - .asFunction)>(); - - void wire_host_stop_system_key_propagate( - int port_, - ffi.Pointer stopped, - ) { - return _wire_host_stop_system_key_propagate( - port_, - stopped, - ); - } - - late final _wire_host_stop_system_key_propagatePtr = _lookup< - ffi.NativeFunction)>>( - 'wire_host_stop_system_key_propagate'); - late final _wire_host_stop_system_key_propagate = - _wire_host_stop_system_key_propagatePtr - .asFunction)>(); - - WireSyncReturnStruct wire_session_add_sync( - ffi.Pointer id, - ffi.Pointer is_file_transfer, - ffi.Pointer is_port_forward, - ) { - return _wire_session_add_sync( - id, - is_file_transfer, - is_port_forward, - ); - } - - late final _wire_session_add_syncPtr = _lookup< - ffi.NativeFunction< - WireSyncReturnStruct Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>('wire_session_add_sync'); - late final _wire_session_add_sync = _wire_session_add_syncPtr.asFunction< - WireSyncReturnStruct Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_start( - int port_, - ffi.Pointer id, - ) { - return _wire_session_start( - port_, - id, - ); - } - - late final _wire_session_startPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>('wire_session_start'); - late final _wire_session_start = _wire_session_startPtr - .asFunction)>(); - - void wire_session_get_remember( - int port_, - ffi.Pointer id, - ) { - return _wire_session_get_remember( - port_, - id, - ); - } - - late final _wire_session_get_rememberPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_session_get_remember'); - late final _wire_session_get_remember = _wire_session_get_rememberPtr - .asFunction)>(); - - void wire_session_get_toggle_option( - int port_, - ffi.Pointer id, - ffi.Pointer arg, - ) { - return _wire_session_get_toggle_option( - port_, - id, - arg, - ); - } - - late final _wire_session_get_toggle_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>( - 'wire_session_get_toggle_option'); - late final _wire_session_get_toggle_option = - _wire_session_get_toggle_optionPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - WireSyncReturnStruct wire_session_get_toggle_option_sync( - ffi.Pointer id, - ffi.Pointer arg, - ) { - return _wire_session_get_toggle_option_sync( - id, - arg, - ); - } - - late final _wire_session_get_toggle_option_syncPtr = _lookup< - ffi.NativeFunction< - WireSyncReturnStruct Function(ffi.Pointer, - ffi.Pointer)>>( - 'wire_session_get_toggle_option_sync'); - late final _wire_session_get_toggle_option_sync = - _wire_session_get_toggle_option_syncPtr.asFunction< - WireSyncReturnStruct Function( - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_get_option( - int port_, - ffi.Pointer id, - ffi.Pointer arg, - ) { - return _wire_session_get_option( - port_, - id, - arg, - ); - } - - late final _wire_session_get_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_session_get_option'); - late final _wire_session_get_option = _wire_session_get_optionPtr.asFunction< - void Function( - int, ffi.Pointer, ffi.Pointer)>(); - - void wire_session_login( - int port_, - ffi.Pointer id, - ffi.Pointer password, - ffi.Pointer remember, - ) { - return _wire_session_login( - port_, - id, - password, - remember, - ); - } - - late final _wire_session_loginPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_session_login'); - late final _wire_session_login = _wire_session_loginPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_close( - int port_, - ffi.Pointer id, - ) { - return _wire_session_close( - port_, - id, - ); - } - - late final _wire_session_closePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>('wire_session_close'); - late final _wire_session_close = _wire_session_closePtr - .asFunction)>(); - - void wire_session_refresh( - int port_, - ffi.Pointer id, - ) { - return _wire_session_refresh( - port_, - id, - ); - } - - late final _wire_session_refreshPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_session_refresh'); - late final _wire_session_refresh = _wire_session_refreshPtr - .asFunction)>(); - - void wire_session_reconnect( - int port_, - ffi.Pointer id, - ) { - return _wire_session_reconnect( - port_, - id, - ); - } - - late final _wire_session_reconnectPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_session_reconnect'); - late final _wire_session_reconnect = _wire_session_reconnectPtr - .asFunction)>(); - - void wire_session_toggle_option( - int port_, - ffi.Pointer id, - ffi.Pointer value, - ) { - return _wire_session_toggle_option( - port_, - id, - value, - ); - } - - late final _wire_session_toggle_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_session_toggle_option'); - late final _wire_session_toggle_option = - _wire_session_toggle_optionPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_get_image_quality( - int port_, - ffi.Pointer id, - ) { - return _wire_session_get_image_quality( - port_, - id, - ); - } - - late final _wire_session_get_image_qualityPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_session_get_image_quality'); - late final _wire_session_get_image_quality = - _wire_session_get_image_qualityPtr - .asFunction)>(); - - void wire_session_set_image_quality( - int port_, - ffi.Pointer id, - ffi.Pointer value, - ) { - return _wire_session_set_image_quality( - port_, - id, - value, - ); - } - - late final _wire_session_set_image_qualityPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>( - 'wire_session_set_image_quality'); - late final _wire_session_set_image_quality = - _wire_session_set_image_qualityPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_get_custom_image_quality( - int port_, - ffi.Pointer id, - ) { - return _wire_session_get_custom_image_quality( - port_, - id, - ); - } - - late final _wire_session_get_custom_image_qualityPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_session_get_custom_image_quality'); - late final _wire_session_get_custom_image_quality = - _wire_session_get_custom_image_qualityPtr - .asFunction)>(); - - void wire_session_set_custom_image_quality( - int port_, - ffi.Pointer id, - int value, - ) { - return _wire_session_set_custom_image_quality( - port_, - id, - value, - ); - } - - late final _wire_session_set_custom_image_qualityPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Int32)>>('wire_session_set_custom_image_quality'); - late final _wire_session_set_custom_image_quality = - _wire_session_set_custom_image_qualityPtr - .asFunction, int)>(); - - void wire_session_lock_screen( - int port_, - ffi.Pointer id, - ) { - return _wire_session_lock_screen( - port_, - id, - ); - } - - late final _wire_session_lock_screenPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_session_lock_screen'); - late final _wire_session_lock_screen = _wire_session_lock_screenPtr - .asFunction)>(); - - void wire_session_ctrl_alt_del( - int port_, - ffi.Pointer id, - ) { - return _wire_session_ctrl_alt_del( - port_, - id, - ); - } - - late final _wire_session_ctrl_alt_delPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_session_ctrl_alt_del'); - late final _wire_session_ctrl_alt_del = _wire_session_ctrl_alt_delPtr - .asFunction)>(); - - void wire_session_switch_display( - int port_, - ffi.Pointer id, - int value, - ) { - return _wire_session_switch_display( - port_, - id, - value, - ); - } - - late final _wire_session_switch_displayPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Int32)>>('wire_session_switch_display'); - late final _wire_session_switch_display = _wire_session_switch_displayPtr - .asFunction, int)>(); - - void wire_session_input_key( - int port_, - ffi.Pointer id, - ffi.Pointer name, - ffi.Pointer down, - ffi.Pointer press, - ffi.Pointer alt, - ffi.Pointer ctrl, - ffi.Pointer shift, - ffi.Pointer command, - ) { - return _wire_session_input_key( - port_, - id, - name, - down, - press, - alt, - ctrl, - shift, - command, - ); - } - - late final _wire_session_input_keyPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_session_input_key'); - late final _wire_session_input_key = _wire_session_input_keyPtr.asFunction< - void Function( - int, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_input_string( - int port_, - ffi.Pointer id, - ffi.Pointer value, - ) { - return _wire_session_input_string( - port_, - id, - value, - ); - } - - late final _wire_session_input_stringPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_session_input_string'); - late final _wire_session_input_string = - _wire_session_input_stringPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_send_chat( - int port_, - ffi.Pointer id, - ffi.Pointer text, - ) { - return _wire_session_send_chat( - port_, - id, - text, - ); - } - - late final _wire_session_send_chatPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_session_send_chat'); - late final _wire_session_send_chat = _wire_session_send_chatPtr.asFunction< - void Function( - int, ffi.Pointer, ffi.Pointer)>(); - - void wire_session_peer_option( - int port_, - ffi.Pointer id, - ffi.Pointer name, - ffi.Pointer value, - ) { - return _wire_session_peer_option( - port_, - id, - name, - value, - ); - } - - late final _wire_session_peer_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_session_peer_option'); - late final _wire_session_peer_option = - _wire_session_peer_optionPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_get_peer_option( - int port_, - ffi.Pointer id, - ffi.Pointer name, - ) { - return _wire_session_get_peer_option( - port_, - id, - name, - ); - } - - late final _wire_session_get_peer_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_session_get_peer_option'); - late final _wire_session_get_peer_option = - _wire_session_get_peer_optionPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_input_os_password( - int port_, - ffi.Pointer id, - ffi.Pointer value, - ) { - return _wire_session_input_os_password( - port_, - id, - value, - ); - } - - late final _wire_session_input_os_passwordPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>( - 'wire_session_input_os_password'); - late final _wire_session_input_os_password = - _wire_session_input_os_passwordPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_read_remote_dir( - int port_, - ffi.Pointer id, - ffi.Pointer path, - ffi.Pointer include_hidden, - ) { - return _wire_session_read_remote_dir( - port_, - id, - path, - include_hidden, - ); - } - - late final _wire_session_read_remote_dirPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_session_read_remote_dir'); - late final _wire_session_read_remote_dir = - _wire_session_read_remote_dirPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_send_files( - int port_, - ffi.Pointer id, - int act_id, - ffi.Pointer path, - ffi.Pointer to, - int file_num, - ffi.Pointer include_hidden, - ffi.Pointer is_remote, - ) { - return _wire_session_send_files( - port_, - id, - act_id, - path, - to, - file_num, - include_hidden, - is_remote, - ); - } - - late final _wire_session_send_filesPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Pointer)>>('wire_session_send_files'); - late final _wire_session_send_files = _wire_session_send_filesPtr.asFunction< - void Function( - int, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_set_confirm_override_file( - int port_, - ffi.Pointer id, - int act_id, - int file_num, - ffi.Pointer need_override, - ffi.Pointer remember, - ffi.Pointer is_upload, - ) { - return _wire_session_set_confirm_override_file( - port_, - id, - act_id, - file_num, - need_override, - remember, - is_upload, - ); - } - - late final _wire_session_set_confirm_override_filePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Int32, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_session_set_confirm_override_file'); - late final _wire_session_set_confirm_override_file = - _wire_session_set_confirm_override_filePtr.asFunction< - void Function(int, ffi.Pointer, int, int, - ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); - - void wire_session_remove_file( - int port_, - ffi.Pointer id, - int act_id, - ffi.Pointer path, - int file_num, - ffi.Pointer is_remote, - ) { - return _wire_session_remove_file( - port_, - id, - act_id, - path, - file_num, - is_remote, - ); - } - - late final _wire_session_remove_filePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Int32, - ffi.Pointer)>>('wire_session_remove_file'); - late final _wire_session_remove_file = - _wire_session_remove_filePtr.asFunction< - void Function(int, ffi.Pointer, int, - ffi.Pointer, int, ffi.Pointer)>(); - - void wire_session_read_dir_recursive( - int port_, - ffi.Pointer id, - int act_id, - ffi.Pointer path, - ffi.Pointer is_remote, - ffi.Pointer show_hidden, - ) { - return _wire_session_read_dir_recursive( - port_, - id, - act_id, - path, - is_remote, - show_hidden, - ); - } - - late final _wire_session_read_dir_recursivePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_session_read_dir_recursive'); - late final _wire_session_read_dir_recursive = - _wire_session_read_dir_recursivePtr.asFunction< - void Function( - int, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_remove_all_empty_dirs( - int port_, - ffi.Pointer id, - int act_id, - ffi.Pointer path, - ffi.Pointer is_remote, - ) { - return _wire_session_remove_all_empty_dirs( - port_, - id, - act_id, - path, - is_remote, - ); - } - - late final _wire_session_remove_all_empty_dirsPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Pointer)>>('wire_session_remove_all_empty_dirs'); - late final _wire_session_remove_all_empty_dirs = - _wire_session_remove_all_empty_dirsPtr.asFunction< - void Function(int, ffi.Pointer, int, - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_cancel_job( - int port_, - ffi.Pointer id, - int act_id, - ) { - return _wire_session_cancel_job( - port_, - id, - act_id, - ); - } - - late final _wire_session_cancel_jobPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Int32)>>('wire_session_cancel_job'); - late final _wire_session_cancel_job = _wire_session_cancel_jobPtr - .asFunction, int)>(); - - void wire_session_create_dir( - int port_, - ffi.Pointer id, - int act_id, - ffi.Pointer path, - ffi.Pointer is_remote, - ) { - return _wire_session_create_dir( - port_, - id, - act_id, - path, - is_remote, - ); - } - - late final _wire_session_create_dirPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Pointer)>>('wire_session_create_dir'); - late final _wire_session_create_dir = _wire_session_create_dirPtr.asFunction< - void Function(int, ffi.Pointer, int, - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_read_local_dir_sync( - int port_, - ffi.Pointer id, - ffi.Pointer path, - ffi.Pointer show_hidden, - ) { - return _wire_session_read_local_dir_sync( - port_, - id, - path, - show_hidden, - ); - } - - late final _wire_session_read_local_dir_syncPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_session_read_local_dir_sync'); - late final _wire_session_read_local_dir_sync = - _wire_session_read_local_dir_syncPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_session_get_platform( - int port_, - ffi.Pointer id, - ffi.Pointer is_remote, - ) { - return _wire_session_get_platform( - port_, - id, - is_remote, - ); - } - - late final _wire_session_get_platformPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_session_get_platform'); - late final _wire_session_get_platform = - _wire_session_get_platformPtr.asFunction< - void Function( - int, ffi.Pointer, ffi.Pointer)>(); - - void wire_session_load_last_transfer_jobs( - int port_, - ffi.Pointer id, - ) { - return _wire_session_load_last_transfer_jobs( - port_, - id, - ); - } - - late final _wire_session_load_last_transfer_jobsPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_session_load_last_transfer_jobs'); - late final _wire_session_load_last_transfer_jobs = - _wire_session_load_last_transfer_jobsPtr - .asFunction)>(); - - void wire_session_add_job( - int port_, - ffi.Pointer id, - int act_id, - ffi.Pointer path, - ffi.Pointer to, - int file_num, - ffi.Pointer include_hidden, - ffi.Pointer is_remote, - ) { - return _wire_session_add_job( - port_, - id, - act_id, - path, - to, - file_num, - include_hidden, - is_remote, - ); - } - - late final _wire_session_add_jobPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Pointer)>>('wire_session_add_job'); - late final _wire_session_add_job = _wire_session_add_jobPtr.asFunction< - void Function( - int, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(); - - void wire_session_resume_job( - int port_, - ffi.Pointer id, - int act_id, - ffi.Pointer is_remote, - ) { - return _wire_session_resume_job( - port_, - id, - act_id, - is_remote, - ); - } - - late final _wire_session_resume_jobPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, ffi.Int32, - ffi.Pointer)>>('wire_session_resume_job'); - late final _wire_session_resume_job = _wire_session_resume_jobPtr.asFunction< - void Function( - int, ffi.Pointer, int, ffi.Pointer)>(); - - void wire_main_get_sound_inputs( - int port_, - ) { - return _wire_main_get_sound_inputs( - port_, - ); - } - - late final _wire_main_get_sound_inputsPtr = - _lookup>( - 'wire_main_get_sound_inputs'); - late final _wire_main_get_sound_inputs = - _wire_main_get_sound_inputsPtr.asFunction(); - - void wire_main_change_id( - int port_, - ffi.Pointer new_id, - ) { - return _wire_main_change_id( - port_, - new_id, - ); - } - - late final _wire_main_change_idPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_change_id'); - late final _wire_main_change_id = _wire_main_change_idPtr - .asFunction)>(); - - void wire_main_get_async_status( - int port_, - ) { - return _wire_main_get_async_status( - port_, - ); - } - - late final _wire_main_get_async_statusPtr = - _lookup>( - 'wire_main_get_async_status'); - late final _wire_main_get_async_status = - _wire_main_get_async_statusPtr.asFunction(); - - void wire_main_get_option( - int port_, - ffi.Pointer key, - ) { - return _wire_main_get_option( - port_, - key, - ); - } - - late final _wire_main_get_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_get_option'); - late final _wire_main_get_option = _wire_main_get_optionPtr - .asFunction)>(); - - void wire_main_set_option( - int port_, - ffi.Pointer key, - ffi.Pointer value, - ) { - return _wire_main_set_option( - port_, - key, - value, - ); - } - - late final _wire_main_set_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_main_set_option'); - late final _wire_main_set_option = _wire_main_set_optionPtr.asFunction< - void Function( - int, ffi.Pointer, ffi.Pointer)>(); - - void wire_main_get_options( - int port_, - ) { - return _wire_main_get_options( - port_, - ); - } - - late final _wire_main_get_optionsPtr = - _lookup>( - 'wire_main_get_options'); - late final _wire_main_get_options = - _wire_main_get_optionsPtr.asFunction(); - - void wire_main_set_options( - int port_, - ffi.Pointer json, - ) { - return _wire_main_set_options( - port_, - json, - ); - } - - late final _wire_main_set_optionsPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_set_options'); - late final _wire_main_set_options = _wire_main_set_optionsPtr - .asFunction)>(); - - void wire_main_test_if_valid_server( - int port_, - ffi.Pointer server, - ) { - return _wire_main_test_if_valid_server( - port_, - server, - ); - } - - late final _wire_main_test_if_valid_serverPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_main_test_if_valid_server'); - late final _wire_main_test_if_valid_server = - _wire_main_test_if_valid_serverPtr - .asFunction)>(); - - void wire_main_set_socks( - int port_, - ffi.Pointer proxy, - ffi.Pointer username, - ffi.Pointer password, - ) { - return _wire_main_set_socks( - port_, - proxy, - username, - password, - ); - } - - late final _wire_main_set_socksPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_main_set_socks'); - late final _wire_main_set_socks = _wire_main_set_socksPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_main_get_socks( - int port_, - ) { - return _wire_main_get_socks( - port_, - ); - } - - late final _wire_main_get_socksPtr = - _lookup>( - 'wire_main_get_socks'); - late final _wire_main_get_socks = - _wire_main_get_socksPtr.asFunction(); - - void wire_main_get_app_name( - int port_, - ) { - return _wire_main_get_app_name( - port_, - ); - } - - late final _wire_main_get_app_namePtr = - _lookup>( - 'wire_main_get_app_name'); - late final _wire_main_get_app_name = - _wire_main_get_app_namePtr.asFunction(); - - void wire_main_get_license( - int port_, - ) { - return _wire_main_get_license( - port_, - ); - } - - late final _wire_main_get_licensePtr = - _lookup>( - 'wire_main_get_license'); - late final _wire_main_get_license = - _wire_main_get_licensePtr.asFunction(); - - void wire_main_get_version( - int port_, - ) { - return _wire_main_get_version( - port_, - ); - } - - late final _wire_main_get_versionPtr = - _lookup>( - 'wire_main_get_version'); - late final _wire_main_get_version = - _wire_main_get_versionPtr.asFunction(); - - void wire_main_get_fav( - int port_, - ) { - return _wire_main_get_fav( - port_, - ); - } - - late final _wire_main_get_favPtr = - _lookup>( - 'wire_main_get_fav'); - late final _wire_main_get_fav = - _wire_main_get_favPtr.asFunction(); - - void wire_main_store_fav( - int port_, - ffi.Pointer favs, - ) { - return _wire_main_store_fav( - port_, - favs, - ); - } - - late final _wire_main_store_favPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>('wire_main_store_fav'); - late final _wire_main_store_fav = _wire_main_store_favPtr - .asFunction)>(); - - void wire_main_get_peer( - int port_, - ffi.Pointer id, - ) { - return _wire_main_get_peer( - port_, - id, - ); - } - - late final _wire_main_get_peerPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>('wire_main_get_peer'); - late final _wire_main_get_peer = _wire_main_get_peerPtr - .asFunction)>(); - - void wire_main_get_lan_peers( - int port_, - ) { - return _wire_main_get_lan_peers( - port_, - ); - } - - late final _wire_main_get_lan_peersPtr = - _lookup>( - 'wire_main_get_lan_peers'); - late final _wire_main_get_lan_peers = - _wire_main_get_lan_peersPtr.asFunction(); - - void wire_main_get_connect_status( - int port_, - ) { - return _wire_main_get_connect_status( - port_, - ); - } - - late final _wire_main_get_connect_statusPtr = - _lookup>( - 'wire_main_get_connect_status'); - late final _wire_main_get_connect_status = - _wire_main_get_connect_statusPtr.asFunction(); - - void wire_main_check_connect_status( - int port_, - ) { - return _wire_main_check_connect_status( - port_, - ); - } - - late final _wire_main_check_connect_statusPtr = - _lookup>( - 'wire_main_check_connect_status'); - late final _wire_main_check_connect_status = - _wire_main_check_connect_statusPtr.asFunction(); - - void wire_main_is_using_public_server( - int port_, - ) { - return _wire_main_is_using_public_server( - port_, - ); - } - - late final _wire_main_is_using_public_serverPtr = - _lookup>( - 'wire_main_is_using_public_server'); - late final _wire_main_is_using_public_server = - _wire_main_is_using_public_serverPtr.asFunction(); - - void wire_main_discover( - int port_, - ) { - return _wire_main_discover( - port_, - ); - } - - late final _wire_main_discoverPtr = - _lookup>( - 'wire_main_discover'); - late final _wire_main_discover = - _wire_main_discoverPtr.asFunction(); - - void wire_main_has_rendezvous_service( - int port_, - ) { - return _wire_main_has_rendezvous_service( - port_, - ); - } - - late final _wire_main_has_rendezvous_servicePtr = - _lookup>( - 'wire_main_has_rendezvous_service'); - late final _wire_main_has_rendezvous_service = - _wire_main_has_rendezvous_servicePtr.asFunction(); - - void wire_main_get_api_server( - int port_, - ) { - return _wire_main_get_api_server( - port_, - ); - } - - late final _wire_main_get_api_serverPtr = - _lookup>( - 'wire_main_get_api_server'); - late final _wire_main_get_api_server = - _wire_main_get_api_serverPtr.asFunction(); - - void wire_main_post_request( - int port_, - ffi.Pointer url, - ffi.Pointer body, - ffi.Pointer header, - ) { - return _wire_main_post_request( - port_, - url, - body, - header, - ); - } - - late final _wire_main_post_requestPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_main_post_request'); - late final _wire_main_post_request = _wire_main_post_requestPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_main_get_local_option( - int port_, - ffi.Pointer key, - ) { - return _wire_main_get_local_option( - port_, - key, - ); - } - - late final _wire_main_get_local_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_get_local_option'); - late final _wire_main_get_local_option = _wire_main_get_local_optionPtr - .asFunction)>(); - - void wire_main_set_local_option( - int port_, - ffi.Pointer key, - ffi.Pointer value, - ) { - return _wire_main_set_local_option( - port_, - key, - value, - ); - } - - late final _wire_main_set_local_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_main_set_local_option'); - late final _wire_main_set_local_option = - _wire_main_set_local_optionPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - void wire_main_get_my_id( - int port_, - ) { - return _wire_main_get_my_id( - port_, - ); - } - - late final _wire_main_get_my_idPtr = - _lookup>( - 'wire_main_get_my_id'); - late final _wire_main_get_my_id = - _wire_main_get_my_idPtr.asFunction(); - - void wire_main_get_uuid( - int port_, - ) { - return _wire_main_get_uuid( - port_, - ); - } - - late final _wire_main_get_uuidPtr = - _lookup>( - 'wire_main_get_uuid'); - late final _wire_main_get_uuid = - _wire_main_get_uuidPtr.asFunction(); - - void wire_main_get_peer_option( - int port_, - ffi.Pointer id, - ffi.Pointer key, - ) { - return _wire_main_get_peer_option( - port_, - id, - key, - ); - } - - late final _wire_main_get_peer_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_main_get_peer_option'); - late final _wire_main_get_peer_option = - _wire_main_get_peer_optionPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer)>(); - - void wire_main_set_peer_option( - int port_, - ffi.Pointer id, - ffi.Pointer key, - ffi.Pointer value, - ) { - return _wire_main_set_peer_option( - port_, - id, - key, - value, - ); - } - - late final _wire_main_set_peer_optionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('wire_main_set_peer_option'); - late final _wire_main_set_peer_option = - _wire_main_set_peer_optionPtr.asFunction< - void Function(int, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); - - void wire_main_forget_password( - int port_, - ffi.Pointer id, - ) { - return _wire_main_forget_password( - port_, - id, - ); - } - - late final _wire_main_forget_passwordPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_forget_password'); - late final _wire_main_forget_password = _wire_main_forget_passwordPtr - .asFunction)>(); - - void wire_main_get_recent_peers( - int port_, - ) { - return _wire_main_get_recent_peers( - port_, - ); - } - - late final _wire_main_get_recent_peersPtr = - _lookup>( - 'wire_main_get_recent_peers'); - late final _wire_main_get_recent_peers = - _wire_main_get_recent_peersPtr.asFunction(); - - void wire_main_load_recent_peers( - int port_, - ) { - return _wire_main_load_recent_peers( - port_, - ); - } - - late final _wire_main_load_recent_peersPtr = - _lookup>( - 'wire_main_load_recent_peers'); - late final _wire_main_load_recent_peers = - _wire_main_load_recent_peersPtr.asFunction(); - - void wire_main_load_fav_peers( - int port_, - ) { - return _wire_main_load_fav_peers( - port_, - ); - } - - late final _wire_main_load_fav_peersPtr = - _lookup>( - 'wire_main_load_fav_peers'); - late final _wire_main_load_fav_peers = - _wire_main_load_fav_peersPtr.asFunction(); - - void wire_main_load_lan_peers( - int port_, - ) { - return _wire_main_load_lan_peers( - port_, - ); - } - - late final _wire_main_load_lan_peersPtr = - _lookup>( - 'wire_main_load_lan_peers'); - late final _wire_main_load_lan_peers = - _wire_main_load_lan_peersPtr.asFunction(); - - void wire_session_add_port_forward( - int port_, - ffi.Pointer id, - int local_port, - ffi.Pointer remote_host, - int remote_port, - ) { - return _wire_session_add_port_forward( - port_, - id, - local_port, - remote_host, - remote_port, - ); - } - - late final _wire_session_add_port_forwardPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, - ffi.Pointer, - ffi.Int32, - ffi.Pointer, - ffi.Int32)>>('wire_session_add_port_forward'); - late final _wire_session_add_port_forward = - _wire_session_add_port_forwardPtr.asFunction< - void Function(int, ffi.Pointer, int, - ffi.Pointer, int)>(); - - void wire_session_remove_port_forward( - int port_, - ffi.Pointer id, - int local_port, - ) { - return _wire_session_remove_port_forward( - port_, - id, - local_port, - ); - } - - late final _wire_session_remove_port_forwardPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Int32)>>('wire_session_remove_port_forward'); - late final _wire_session_remove_port_forward = - _wire_session_remove_port_forwardPtr - .asFunction, int)>(); - - void wire_main_get_last_remote_id( - int port_, - ) { - return _wire_main_get_last_remote_id( - port_, - ); - } - - late final _wire_main_get_last_remote_idPtr = - _lookup>( - 'wire_main_get_last_remote_id'); - late final _wire_main_get_last_remote_id = - _wire_main_get_last_remote_idPtr.asFunction(); - - void wire_main_get_software_update_url( - int port_, - ) { - return _wire_main_get_software_update_url( - port_, - ); - } - - late final _wire_main_get_software_update_urlPtr = - _lookup>( - 'wire_main_get_software_update_url'); - late final _wire_main_get_software_update_url = - _wire_main_get_software_update_urlPtr.asFunction(); - - void wire_main_get_home_dir( - int port_, - ) { - return _wire_main_get_home_dir( - port_, - ); - } - - late final _wire_main_get_home_dirPtr = - _lookup>( - 'wire_main_get_home_dir'); - late final _wire_main_get_home_dir = - _wire_main_get_home_dirPtr.asFunction(); - - void wire_main_get_langs( - int port_, - ) { - return _wire_main_get_langs( - port_, - ); - } - - late final _wire_main_get_langsPtr = - _lookup>( - 'wire_main_get_langs'); - late final _wire_main_get_langs = - _wire_main_get_langsPtr.asFunction(); - - void wire_main_get_temporary_password( - int port_, - ) { - return _wire_main_get_temporary_password( - port_, - ); - } - - late final _wire_main_get_temporary_passwordPtr = - _lookup>( - 'wire_main_get_temporary_password'); - late final _wire_main_get_temporary_password = - _wire_main_get_temporary_passwordPtr.asFunction(); - - void wire_main_get_permanent_password( - int port_, - ) { - return _wire_main_get_permanent_password( - port_, - ); - } - - late final _wire_main_get_permanent_passwordPtr = - _lookup>( - 'wire_main_get_permanent_password'); - late final _wire_main_get_permanent_password = - _wire_main_get_permanent_passwordPtr.asFunction(); - - void wire_main_get_online_statue( - int port_, - ) { - return _wire_main_get_online_statue( - port_, - ); - } - - late final _wire_main_get_online_statuePtr = - _lookup>( - 'wire_main_get_online_statue'); - late final _wire_main_get_online_statue = - _wire_main_get_online_statuePtr.asFunction(); - - void wire_main_get_clients_state( - int port_, - ) { - return _wire_main_get_clients_state( - port_, - ); - } - - late final _wire_main_get_clients_statePtr = - _lookup>( - 'wire_main_get_clients_state'); - late final _wire_main_get_clients_state = - _wire_main_get_clients_statePtr.asFunction(); - - void wire_main_check_clients_length( - int port_, - int length, - ) { - return _wire_main_check_clients_length( - port_, - length, - ); - } - - late final _wire_main_check_clients_lengthPtr = - _lookup>( - 'wire_main_check_clients_length'); - late final _wire_main_check_clients_length = - _wire_main_check_clients_lengthPtr.asFunction(); - - void wire_main_init( - int port_, - ffi.Pointer app_dir, - ) { - return _wire_main_init( - port_, - app_dir, - ); - } - - late final _wire_main_initPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>('wire_main_init'); - late final _wire_main_init = _wire_main_initPtr - .asFunction)>(); - - void wire_main_device_id( - int port_, - ffi.Pointer id, - ) { - return _wire_main_device_id( - port_, - id, - ); - } - - late final _wire_main_device_idPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_device_id'); - late final _wire_main_device_id = _wire_main_device_idPtr - .asFunction)>(); - - void wire_main_device_name( - int port_, - ffi.Pointer name, - ) { - return _wire_main_device_name( - port_, - name, - ); - } - - late final _wire_main_device_namePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_device_name'); - late final _wire_main_device_name = _wire_main_device_namePtr - .asFunction)>(); - - void wire_main_remove_peer( - int port_, - ffi.Pointer id, - ) { - return _wire_main_remove_peer( - port_, - id, - ); - } - - late final _wire_main_remove_peerPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_remove_peer'); - late final _wire_main_remove_peer = _wire_main_remove_peerPtr - .asFunction)>(); - - void wire_main_has_hwcodec( - int port_, - ) { - return _wire_main_has_hwcodec( - port_, - ); - } - - late final _wire_main_has_hwcodecPtr = - _lookup>( - 'wire_main_has_hwcodec'); - late final _wire_main_has_hwcodec = - _wire_main_has_hwcodecPtr.asFunction(); - - void wire_session_send_mouse( - int port_, - ffi.Pointer id, - ffi.Pointer msg, - ) { - return _wire_session_send_mouse( - port_, - id, - msg, - ); - } - - late final _wire_session_send_mousePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer, - ffi.Pointer)>>('wire_session_send_mouse'); - late final _wire_session_send_mouse = _wire_session_send_mousePtr.asFunction< - void Function( - int, ffi.Pointer, ffi.Pointer)>(); - - void wire_session_restart_remote_device( - int port_, - ffi.Pointer id, - ) { - return _wire_session_restart_remote_device( - port_, - id, - ); - } - - late final _wire_session_restart_remote_devicePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_session_restart_remote_device'); - late final _wire_session_restart_remote_device = - _wire_session_restart_remote_devicePtr - .asFunction)>(); - - void wire_main_set_home_dir( - int port_, - ffi.Pointer home, - ) { - return _wire_main_set_home_dir( - port_, - home, - ); - } - - late final _wire_main_set_home_dirPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, - ffi.Pointer)>>('wire_main_set_home_dir'); - late final _wire_main_set_home_dir = _wire_main_set_home_dirPtr - .asFunction)>(); - - void wire_main_stop_service( - int port_, - ) { - return _wire_main_stop_service( - port_, - ); - } - - late final _wire_main_stop_servicePtr = - _lookup>( - 'wire_main_stop_service'); - late final _wire_main_stop_service = - _wire_main_stop_servicePtr.asFunction(); - - void wire_main_start_service( - int port_, - ) { - return _wire_main_start_service( - port_, - ); - } - - late final _wire_main_start_servicePtr = - _lookup>( - 'wire_main_start_service'); - late final _wire_main_start_service = - _wire_main_start_servicePtr.asFunction(); - - void wire_main_update_temporary_password( - int port_, - ) { - return _wire_main_update_temporary_password( - port_, - ); - } - - late final _wire_main_update_temporary_passwordPtr = - _lookup>( - 'wire_main_update_temporary_password'); - late final _wire_main_update_temporary_password = - _wire_main_update_temporary_passwordPtr.asFunction(); - - void wire_main_set_permanent_password( - int port_, - ffi.Pointer password, - ) { - return _wire_main_set_permanent_password( - port_, - password, - ); - } - - late final _wire_main_set_permanent_passwordPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_main_set_permanent_password'); - late final _wire_main_set_permanent_password = - _wire_main_set_permanent_passwordPtr - .asFunction)>(); - - void wire_main_check_super_user_permission( - int port_, - ) { - return _wire_main_check_super_user_permission( - port_, - ); - } - - late final _wire_main_check_super_user_permissionPtr = - _lookup>( - 'wire_main_check_super_user_permission'); - late final _wire_main_check_super_user_permission = - _wire_main_check_super_user_permissionPtr - .asFunction(); - - void wire_main_check_mouse_time( - int port_, - ) { - return _wire_main_check_mouse_time( - port_, - ); - } - - late final _wire_main_check_mouse_timePtr = - _lookup>( - 'wire_main_check_mouse_time'); - late final _wire_main_check_mouse_time = - _wire_main_check_mouse_timePtr.asFunction(); - - void wire_main_get_mouse_time( - int port_, - ) { - return _wire_main_get_mouse_time( - port_, - ); - } - - late final _wire_main_get_mouse_timePtr = - _lookup>( - 'wire_main_get_mouse_time'); - late final _wire_main_get_mouse_time = - _wire_main_get_mouse_timePtr.asFunction(); - - void wire_cm_send_chat( - int port_, - int conn_id, - ffi.Pointer msg, - ) { - return _wire_cm_send_chat( - port_, - conn_id, - msg, - ); - } - - late final _wire_cm_send_chatPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Int32, - ffi.Pointer)>>('wire_cm_send_chat'); - late final _wire_cm_send_chat = _wire_cm_send_chatPtr - .asFunction)>(); - - void wire_cm_login_res( - int port_, - int conn_id, - ffi.Pointer res, - ) { - return _wire_cm_login_res( - port_, - conn_id, - res, - ); - } - - late final _wire_cm_login_resPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Int32, ffi.Pointer)>>('wire_cm_login_res'); - late final _wire_cm_login_res = _wire_cm_login_resPtr - .asFunction)>(); - - void wire_cm_close_connection( - int port_, - int conn_id, - ) { - return _wire_cm_close_connection( - port_, - conn_id, - ); - } - - late final _wire_cm_close_connectionPtr = - _lookup>( - 'wire_cm_close_connection'); - late final _wire_cm_close_connection = - _wire_cm_close_connectionPtr.asFunction(); - - void wire_cm_check_click_time( - int port_, - int conn_id, - ) { - return _wire_cm_check_click_time( - port_, - conn_id, - ); - } - - late final _wire_cm_check_click_timePtr = - _lookup>( - 'wire_cm_check_click_time'); - late final _wire_cm_check_click_time = - _wire_cm_check_click_timePtr.asFunction(); - - void wire_cm_get_click_time( - int port_, - ) { - return _wire_cm_get_click_time( - port_, - ); - } - - late final _wire_cm_get_click_timePtr = - _lookup>( - 'wire_cm_get_click_time'); - late final _wire_cm_get_click_time = - _wire_cm_get_click_timePtr.asFunction(); - - void wire_cm_switch_permission( - int port_, - int conn_id, - ffi.Pointer name, - ffi.Pointer enabled, - ) { - return _wire_cm_switch_permission( - port_, - conn_id, - name, - enabled, - ); - } - - late final _wire_cm_switch_permissionPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Int64, ffi.Int32, ffi.Pointer, - ffi.Pointer)>>('wire_cm_switch_permission'); - late final _wire_cm_switch_permission = - _wire_cm_switch_permissionPtr.asFunction< - void Function( - int, int, ffi.Pointer, ffi.Pointer)>(); - - void wire_main_get_icon( - int port_, - ) { - return _wire_main_get_icon( - port_, - ); - } - - late final _wire_main_get_iconPtr = - _lookup>( - 'wire_main_get_icon'); - late final _wire_main_get_icon = - _wire_main_get_iconPtr.asFunction(); - - void wire_query_onlines( - int port_, - ffi.Pointer ids, - ) { - return _wire_query_onlines( - port_, - ids, - ); - } - - late final _wire_query_onlinesPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int64, ffi.Pointer)>>('wire_query_onlines'); - late final _wire_query_onlines = _wire_query_onlinesPtr - .asFunction)>(); - - ffi.Pointer new_StringList( - int len, - ) { - return _new_StringList( - len, - ); - } - - late final _new_StringListPtr = _lookup< - ffi.NativeFunction Function(ffi.Int32)>>( - 'new_StringList'); - late final _new_StringList = _new_StringListPtr - .asFunction Function(int)>(); - - ffi.Pointer new_uint_8_list( - int len, - ) { - return _new_uint_8_list( - len, - ); - } - - late final _new_uint_8_listPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Int32)>>('new_uint_8_list'); - late final _new_uint_8_list = _new_uint_8_listPtr - .asFunction Function(int)>(); - - void free_WireSyncReturnStruct( - WireSyncReturnStruct val, - ) { - return _free_WireSyncReturnStruct( - val, - ); - } - - late final _free_WireSyncReturnStructPtr = - _lookup>( - 'free_WireSyncReturnStruct'); - late final _free_WireSyncReturnStruct = _free_WireSyncReturnStructPtr - .asFunction(); - - void store_dart_post_cobject( - int ptr, - ) { - return _store_dart_post_cobject( - ptr, - ); - } - - late final _store_dart_post_cobjectPtr = - _lookup>( - 'store_dart_post_cobject'); - late final _store_dart_post_cobject = - _store_dart_post_cobjectPtr.asFunction(); - - int rustdesk_core_main() { - return _rustdesk_core_main(); - } - - late final _rustdesk_core_mainPtr = - _lookup>('rustdesk_core_main'); - late final _rustdesk_core_main = - _rustdesk_core_mainPtr.asFunction(); -} - -class wire_uint_8_list extends ffi.Struct { - external ffi.Pointer ptr; - - @ffi.Int32() - external int len; -} - -class wire_StringList extends ffi.Struct { - external ffi.Pointer> ptr; - - @ffi.Int32() - external int len; -} - -typedef bool = ffi.NativeFunction)>; -typedef uintptr_t = ffi.UnsignedLong; - -const int GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 2; - -const int GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 4; diff --git a/flutter/lib/generated_bridge.freezed.dart b/flutter/lib/generated_bridge.freezed.dart deleted file mode 100644 index fbaa6105f..000000000 --- a/flutter/lib/generated_bridge.freezed.dart +++ /dev/null @@ -1,332 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target - -part of 'generated_bridge.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); - -/// @nodoc -mixin _$EventToUI { - @optionalTypeArgs - TResult when({ - required TResult Function(String field0) event, - required TResult Function(Uint8List field0) rgba, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult Function(String field0)? event, - TResult Function(Uint8List field0)? rgba, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String field0)? event, - TResult Function(Uint8List field0)? rgba, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(Event value) event, - required TResult Function(Rgba value) rgba, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult Function(Event value)? event, - TResult Function(Rgba value)? rgba, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Event value)? event, - TResult Function(Rgba value)? rgba, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $EventToUICopyWith<$Res> { - factory $EventToUICopyWith(EventToUI value, $Res Function(EventToUI) then) = - _$EventToUICopyWithImpl<$Res>; -} - -/// @nodoc -class _$EventToUICopyWithImpl<$Res> implements $EventToUICopyWith<$Res> { - _$EventToUICopyWithImpl(this._value, this._then); - - final EventToUI _value; - // ignore: unused_field - final $Res Function(EventToUI) _then; -} - -/// @nodoc -abstract class _$$EventCopyWith<$Res> { - factory _$$EventCopyWith(_$Event value, $Res Function(_$Event) then) = - __$$EventCopyWithImpl<$Res>; - $Res call({String field0}); -} - -/// @nodoc -class __$$EventCopyWithImpl<$Res> extends _$EventToUICopyWithImpl<$Res> - implements _$$EventCopyWith<$Res> { - __$$EventCopyWithImpl(_$Event _value, $Res Function(_$Event) _then) - : super(_value, (v) => _then(v as _$Event)); - - @override - _$Event get _value => super._value as _$Event; - - @override - $Res call({ - Object? field0 = freezed, - }) { - return _then(_$Event( - field0 == freezed - ? _value.field0 - : field0 // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// @nodoc - -class _$Event implements Event { - const _$Event(this.field0); - - @override - final String field0; - - @override - String toString() { - return 'EventToUI.event(field0: $field0)'; - } - - @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$Event && - const DeepCollectionEquality().equals(other.field0, field0)); - } - - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(field0)); - - @JsonKey(ignore: true) - @override - _$$EventCopyWith<_$Event> get copyWith => - __$$EventCopyWithImpl<_$Event>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(String field0) event, - required TResult Function(Uint8List field0) rgba, - }) { - return event(field0); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult Function(String field0)? event, - TResult Function(Uint8List field0)? rgba, - }) { - return event?.call(field0); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String field0)? event, - TResult Function(Uint8List field0)? rgba, - required TResult orElse(), - }) { - if (event != null) { - return event(field0); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Event value) event, - required TResult Function(Rgba value) rgba, - }) { - return event(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult Function(Event value)? event, - TResult Function(Rgba value)? rgba, - }) { - return event?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Event value)? event, - TResult Function(Rgba value)? rgba, - required TResult orElse(), - }) { - if (event != null) { - return event(this); - } - return orElse(); - } -} - -abstract class Event implements EventToUI { - const factory Event(final String field0) = _$Event; - - String get field0; - @JsonKey(ignore: true) - _$$EventCopyWith<_$Event> get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$$RgbaCopyWith<$Res> { - factory _$$RgbaCopyWith(_$Rgba value, $Res Function(_$Rgba) then) = - __$$RgbaCopyWithImpl<$Res>; - $Res call({Uint8List field0}); -} - -/// @nodoc -class __$$RgbaCopyWithImpl<$Res> extends _$EventToUICopyWithImpl<$Res> - implements _$$RgbaCopyWith<$Res> { - __$$RgbaCopyWithImpl(_$Rgba _value, $Res Function(_$Rgba) _then) - : super(_value, (v) => _then(v as _$Rgba)); - - @override - _$Rgba get _value => super._value as _$Rgba; - - @override - $Res call({ - Object? field0 = freezed, - }) { - return _then(_$Rgba( - field0 == freezed - ? _value.field0 - : field0 // ignore: cast_nullable_to_non_nullable - as Uint8List, - )); - } -} - -/// @nodoc - -class _$Rgba implements Rgba { - const _$Rgba(this.field0); - - @override - final Uint8List field0; - - @override - String toString() { - return 'EventToUI.rgba(field0: $field0)'; - } - - @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$Rgba && - const DeepCollectionEquality().equals(other.field0, field0)); - } - - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(field0)); - - @JsonKey(ignore: true) - @override - _$$RgbaCopyWith<_$Rgba> get copyWith => - __$$RgbaCopyWithImpl<_$Rgba>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(String field0) event, - required TResult Function(Uint8List field0) rgba, - }) { - return rgba(field0); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult Function(String field0)? event, - TResult Function(Uint8List field0)? rgba, - }) { - return rgba?.call(field0); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String field0)? event, - TResult Function(Uint8List field0)? rgba, - required TResult orElse(), - }) { - if (rgba != null) { - return rgba(field0); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Event value) event, - required TResult Function(Rgba value) rgba, - }) { - return rgba(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult Function(Event value)? event, - TResult Function(Rgba value)? rgba, - }) { - return rgba?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Event value)? event, - TResult Function(Rgba value)? rgba, - required TResult orElse(), - }) { - if (rgba != null) { - return rgba(this); - } - return orElse(); - } -} - -abstract class Rgba implements EventToUI { - const factory Rgba(final Uint8List field0) = _$Rgba; - - Uint8List get field0; - @JsonKey(ignore: true) - _$$RgbaCopyWith<_$Rgba> get copyWith => throw _privateConstructorUsedError; -} diff --git a/flutter/lib/generated_plugin_registrant.dart b/flutter/lib/generated_plugin_registrant.dart deleted file mode 100644 index eba9fb8cc..000000000 --- a/flutter/lib/generated_plugin_registrant.dart +++ /dev/null @@ -1,35 +0,0 @@ -// -// Generated file. Do not edit. -// - -// ignore_for_file: directives_ordering -// ignore_for_file: lines_longer_than_80_chars -// ignore_for_file: depend_on_referenced_packages - -import 'package:desktop_drop/desktop_drop_web.dart'; -import 'package:device_info_plus_web/device_info_plus_web.dart'; -import 'package:firebase_analytics_web/firebase_analytics_web.dart'; -import 'package:firebase_core_web/firebase_core_web.dart'; -import 'package:image_picker_for_web/image_picker_for_web.dart'; -import 'package:package_info_plus_web/package_info_plus_web.dart'; -import 'package:shared_preferences_web/shared_preferences_web.dart'; -import 'package:url_launcher_web/url_launcher_web.dart'; -import 'package:video_player_web/video_player_web.dart'; -import 'package:wakelock_web/wakelock_web.dart'; - -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - -// ignore: public_member_api_docs -void registerPlugins(Registrar registrar) { - DesktopDropWeb.registerWith(registrar); - DeviceInfoPlusPlugin.registerWith(registrar); - FirebaseAnalyticsWeb.registerWith(registrar); - FirebaseCoreWeb.registerWith(registrar); - ImagePickerPlugin.registerWith(registrar); - PackageInfoPlugin.registerWith(registrar); - SharedPreferencesPlugin.registerWith(registrar); - UrlLauncherPlugin.registerWith(registrar); - VideoPlayerPlugin.registerWith(registrar); - WakelockWeb.registerWith(registrar); - registrar.registerMessageHandler(); -} From c3fe407d5cfc0975ffaf6ba88b90ea0d779c2512 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 02:06:40 -0700 Subject: [PATCH 082/113] Check LLVM_HOME when build --- build.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build.rs b/build.rs index d9b7a5516..73f48ded2 100644 --- a/build.rs +++ b/build.rs @@ -78,18 +78,24 @@ fn install_oboe() { fn gen_flutter_rust_bridge() { // Get dependent of flutter - if !std::path::Path::new("./flutter/.packages").exists(){ + if !std::path::Path::new("./flutter/.packages").exists() { std::process::Command::new("flutter") - .args(["pub", "get"]) - .current_dir("./flutter") - .output() - .expect("failed to execute flutter pub get"); + .args(["pub", "get"]) + .current_dir("./flutter") + .output() + .expect("failed to execute flutter pub get"); }; - let llvm_path = match std::env::var("LLVM_HOME") { - Ok(path) => Some(vec![path]), - Err(_) => None, + Ok(path) => { + if !path.is_empty() { + Some(vec![path]) + } else { + panic!("Missing LVM_HOME environment variable"); + } + } + Err(_) => panic!("Failure to get environments"), }; + // Tell Cargo that if the given file changes, to rerun this build script. println!("cargo:rerun-if-changed=src/flutter_ffi.rs"); // settings for fbr_codegen From 34d7089a8e2c8c0260932b9992924467e1daf577 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 04:49:36 -0700 Subject: [PATCH 083/113] Refactor: map keyboard --- flutter/lib/desktop/pages/remote_page.dart | 8 ++-- flutter/lib/models/model.dart | 12 ++++-- src/flutter_ffi.rs | 31 ++++++++++---- src/ui_session_interface.rs | 50 ++++++++++++++++++---- 4 files changed, 75 insertions(+), 26 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index c3f4b3773..51225672b 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -291,13 +291,13 @@ class _RemotePageState extends State keyCode = -1; } - if (e is RawKeyDownEvent){ + if (e is RawKeyDownEvent) { down = true; - }else{ + } else { down = false; } - - _ffi.inputRawKey(keyCode, scanCode, down); + + _ffi.inputRawKey(e.character ?? "", keyCode, scanCode, down); } void legacyKeyboardMode(RawKeyEvent e) { diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 967a334e8..dcf9a7b22 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -993,10 +993,14 @@ class FFI { msg: json.encode(modify({'type': type, 'buttons': button.value}))); } - // Raw Key - void inputRawKey(int keyCode, int scanCode, bool down){ - debugPrint(scanCode.toString()); - // bind.sessionInputRawKey(id: id, keycode: keyCode, scancode: scanCode, down: down); + // Raw Key + void inputRawKey(String name, int keyCode, int scanCode, bool down) { + bind.sessionHandleFlutterKeyEvent( + id: id, + name: name, + keycode: keyCode, + scancode: scanCode, + downOrUp: down); } /// Send key stroke event. diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 78f53bf89..72ccbe603 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -7,20 +7,19 @@ use std::{ use flutter_rust_bridge::{StreamSink, SyncReturn, ZeroCopyBuffer}; use serde_json::json; +use hbb_common::ResultType; use hbb_common::{ config::{self, LocalConfig, PeerConfig, ONLINE}, fs, log, }; -use hbb_common::{ResultType}; -use crate::{client::file_trait::FileManager, flutter::{session_add, session_start_}}; use crate::common::make_fd_to_json; use crate::flutter::connection_manager::{self, get_clients_length, get_clients_state}; use crate::flutter::{self, SESSIONS}; use crate::start_server; use crate::ui_interface; #[cfg(not(any(target_os = "android", target_os = "ios")))] -use crate::ui_interface::{change_id}; +use crate::ui_interface::change_id; use crate::ui_interface::{ check_mouse_time, check_super_user_permission, discover, forget_password, get_api_server, get_app_name, get_async_job_status, get_connect_status, get_fav, get_id, get_lan_peers, @@ -30,6 +29,10 @@ use crate::ui_interface::{ set_peer_option, set_permanent_password, set_socks, store_fav, test_if_valid_server, update_temporary_password, using_public_server, }; +use crate::{ + client::file_trait::FileManager, + flutter::{session_add, session_start_}, +}; fn initialize(app_dir: &str) { *config::APP_DIR.write().unwrap() = app_dir.to_owned(); @@ -110,7 +113,11 @@ pub fn host_stop_system_key_propagate(stopped: bool) { // FIXME: -> ResultType<()> cannot be parsed by frb_codegen // thread 'main' panicked at 'Failed to parse function output type `ResultType<()>`', $HOME\.cargo\git\checkouts\flutter_rust_bridge-ddba876d3ebb2a1e\e5adce5\frb_codegen\src\parser\mod.rs:151:25 -pub fn session_add_sync(id: String, is_file_transfer: bool, is_port_forward: bool) -> SyncReturn { +pub fn session_add_sync( + id: String, + is_file_transfer: bool, + is_port_forward: bool, +) -> SyncReturn { if let Err(e) = session_add(&id, is_file_transfer, is_port_forward) { SyncReturn(format!("Failed to add session with id {}, {}", &id, e)) } else { @@ -228,11 +235,17 @@ pub fn session_switch_display(id: String, value: i32) { } } -// pub fn session_input_raw_key(id: String, keycode: i32, scancode:i32, down: bool){ -// if let Some(session) = SESSIONS.read().unwrap().get(&id) { -// session.input_raw_key(keycode, scancode, down); -// } -// } +pub fn session_handle_flutter_key_event( + id: String, + name: String, + keycode: i32, + scancode: i32, + down_or_up: bool, +) { + if let Some(session) = SESSIONS.read().unwrap().get(&id) { + session.handle_flutter_key_event(&name, keycode, scancode, down_or_up); + } +} pub fn session_input_key( id: String, diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 4f5ec55b8..7143ed97a 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -57,13 +57,13 @@ impl Session { self.lc.read().unwrap().custom_image_quality.clone() } - pub fn get_keyboard_mode(&mut self) -> String { + pub fn get_keyboard_mode(&self) -> String { return std::env::var("KEYBOARD_MODE") .unwrap_or(String::from("legacy")) .to_lowercase(); } - pub fn save_keyboard_mode(&mut self, value: String) { + pub fn save_keyboard_mode(&self, value: String) { std::env::set_var("KEYBOARD_MODE", value); } @@ -272,7 +272,7 @@ impl Session { } #[allow(dead_code)] - fn convert_numpad_keys(&mut self, key: RdevKey) -> RdevKey { + fn convert_numpad_keys(&self, key: RdevKey) -> RdevKey { if get_key_state(enigo::Key::NumLock) { return key; } @@ -292,7 +292,7 @@ impl Session { } } - fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, _evt: Option) { + fn map_keyboard_mode(&self, down_or_up: bool, key: RdevKey, _evt: Option) { // map mode(1): Send keycode according to the peer platform. #[cfg(target_os = "windows")] let key = if let Some(e) = _evt { @@ -328,11 +328,12 @@ impl Session { if get_key_state(enigo::Key::NumLock) { key_event.modifiers.push(ControlKey::NumLock.into()); } + log::info!("{:?}", get_key_state(enigo::Key::NumLock)); self.send_key_event(key_event, KeyboardMode::Map); } - fn translate_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { + fn translate_keyboard_mode(&self, down_or_up: bool, key: RdevKey, evt: Event) { // translate mode(2): locally generated characters are send to the peer. // get char @@ -423,7 +424,7 @@ impl Session { } } - fn legacy_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { + fn legacy_keyboard_mode(&self, down_or_up: bool, key: RdevKey, evt: Event) { // legacy mode(0): Generate characters locally, look for keycode on other side. let peer = self.peer_platform(); let is_win = peer == "Windows"; @@ -635,7 +636,7 @@ impl Session { self.send_key_event(key_event, KeyboardMode::Legacy) } - fn key_down_or_up(&mut self, down_or_up: bool, key: RdevKey, evt: Event) { + fn key_down_or_up(&self, down_or_up: bool, key: RdevKey, evt: Event) { // Call different functions according to keyboard mode. let mode = match self.get_keyboard_mode().as_str() { "map" => KeyboardMode::Map, @@ -724,6 +725,35 @@ impl Session { self.send_key_event(key_event, KeyboardMode::Legacy); } + pub fn handle_flutter_key_event(&self, name: &str, keycode: i32, scancode:i32, down_or_up: bool){ + if scancode < 0 || keycode < 0{ + return; + } + let keycode: u32 = keycode as u32; + let scancode: u32 = scancode as u32; + + #[cfg(not(target_os = "windows"))] + let key = rdev::key_from_scancode(scancode) as RdevKey; + // Windows requires special handling + #[cfg(target_os = "windows")] + let key = rdev::get_win_key(keycode, scancode); + + let event_type = if down_or_up{ + KeyPress(key) + }else{ + KeyRelease(key) + }; + let evt = Event{ + time: std::time::SystemTime::now(), + name: Option::Some(name.to_owned()), + code: keycode as _, + scan_code: scancode as _, + event_type: event_type, + }; + + self.key_down_or_up(down_or_up, key, evt) + } + // flutter only TODO new input pub fn input_key( &self, @@ -796,8 +826,10 @@ impl Session { } } } - // asur4s-todo - // self.key_down_or_up(v, key_event, alt, ctrl, shift, command); + + self.legacy_modifiers(&mut key_event, true, true, false, false); + key_event.press = down; + self.send_key_event(key_event, KeyboardMode::Legacy); } pub fn send_mouse( From 815d02b72875ffef3b6ec89b6d3a36476f5aaf06 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 04:54:04 -0700 Subject: [PATCH 084/113] Fix misspell --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 73f48ded2..14917ffd4 100644 --- a/build.rs +++ b/build.rs @@ -90,7 +90,7 @@ fn gen_flutter_rust_bridge() { if !path.is_empty() { Some(vec![path]) } else { - panic!("Missing LVM_HOME environment variable"); + panic!("Missing LLVM_HOME environment variable"); } } Err(_) => panic!("Failure to get environments"), From 15b8a5592d6f44408da4c2319ecb5d2c8cbee73b Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 05:41:50 -0700 Subject: [PATCH 085/113] Refactor: check env variable --- build.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build.rs b/build.rs index 14917ffd4..9b353b42e 100644 --- a/build.rs +++ b/build.rs @@ -41,6 +41,16 @@ fn build_rc_source() { .unwrap(); } +fn check_environment() { + // Check env variable + let env_list = vec!["LLVM_HOME", "VCPKG_ROOT"]; + for env in env_list.iter() { + if std::env::var(env).is_err() { + panic!("Missing environment variable: {:?}", env); + }; + } +} + fn install_oboe() { let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); if target_os != "android" { @@ -83,16 +93,10 @@ fn gen_flutter_rust_bridge() { .args(["pub", "get"]) .current_dir("./flutter") .output() - .expect("failed to execute flutter pub get"); + .expect("Failed to execute flutter pub get"); }; let llvm_path = match std::env::var("LLVM_HOME") { - Ok(path) => { - if !path.is_empty() { - Some(vec![path]) - } else { - panic!("Missing LLVM_HOME environment variable"); - } - } + Ok(path) => Some(vec![path]), Err(_) => panic!("Failure to get environments"), }; @@ -115,6 +119,8 @@ fn gen_flutter_rust_bridge() { } fn main() { + check_environment(); + hbb_common::gen_version(); install_oboe(); // there is problem with cfg(target_os) in build.rs, so use our workaround From bec8daafb95823ce17a704a8d2788cf5340127e9 Mon Sep 17 00:00:00 2001 From: asur4s Date: Fri, 2 Sep 2022 15:29:25 -0400 Subject: [PATCH 086/113] Fix simulate in wayland --- flutter/pubspec.lock | 38 ++++---- flutter/pubspec.yaml | 2 +- libs/hbb_common/src/platform/linux.rs | 5 + src/server/input_service.rs | 126 ++++++++++++++------------ 4 files changed, 93 insertions(+), 78 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index a6dade189..d9205b76c 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -49,7 +49,7 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.8.2" + version: "2.9.0" back_button_interceptor: dependency: "direct main" description: @@ -147,7 +147,7 @@ packages: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.1.1" code_builder: dependency: transitive description: @@ -324,7 +324,7 @@ packages: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: "direct main" description: @@ -621,14 +621,14 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.4" + version: "0.1.5" menu_base: dependency: transitive description: @@ -642,7 +642,7 @@ packages: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -719,7 +719,7 @@ packages: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.1" + version: "1.8.2" path_provider: dependency: "direct main" description: @@ -856,9 +856,11 @@ packages: screen_retriever: dependency: transitive description: - name: screen_retriever - url: "https://pub.flutter-io.cn" - source: hosted + path: "." + ref: "406b9b0" + resolved-ref: "406b9b038b2c1d779f1e7bf609c8c248be247372" + url: "https://github.com/Kingtous/rustdesk_screen_retriever.git" + source: git version: "0.1.2" scroll_pos: dependency: "direct main" @@ -969,7 +971,7 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.2" + version: "1.9.0" sqflite: dependency: transitive description: @@ -1011,7 +1013,7 @@ packages: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.1.1" synchronized: dependency: transitive description: @@ -1025,14 +1027,14 @@ packages: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.9" + version: "0.4.12" timing: dependency: transitive description: @@ -1242,11 +1244,11 @@ packages: dependency: "direct main" description: path: "." - ref: "799ef079e87938c3f4340591b4330c2598f38bb9" - resolved-ref: "799ef079e87938c3f4340591b4330c2598f38bb9" + ref: "4627ba808ed08ff0c08706b01a7f9cc8b747accd" + resolved-ref: "4627ba808ed08ff0c08706b01a7f9cc8b747accd" url: "https://github.com/Kingtous/rustdesk_window_manager" source: git - version: "0.2.6" + version: "0.2.7" xdg_directories: dependency: transitive description: diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index fecef77e6..f2d038af3 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -58,7 +58,7 @@ dependencies: window_manager: git: url: https://github.com/Kingtous/rustdesk_window_manager - ref: 799ef079e87938c3f4340591b4330c2598f38bb9 + ref: 4627ba808ed08ff0c08706b01a7f9cc8b747accd desktop_multi_window: git: url: https://github.com/Kingtous/rustdesk_desktop_multi_window diff --git a/libs/hbb_common/src/platform/linux.rs b/libs/hbb_common/src/platform/linux.rs index 865033204..1a41ebad6 100644 --- a/libs/hbb_common/src/platform/linux.rs +++ b/libs/hbb_common/src/platform/linux.rs @@ -1,4 +1,9 @@ use crate::ResultType; +use std::sync::Mutex; + +lazy_static::lazy_static! { + pub static ref IS_X11: Mutex = Mutex::new("x11" == get_display_server()); +} pub fn get_display_server() -> String { let session = get_value_of_seat0(0); diff --git a/src/server/input_service.rs b/src/server/input_service.rs index e0707bded..f8edef399 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -2,6 +2,7 @@ use super::*; #[cfg(target_os = "macos")] use dispatch::Queue; use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable}; +use hbb_common::platform::linux::IS_X11; use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown}; use rdev::{simulate, EventType, Key as RdevKey}; use std::{ @@ -673,13 +674,13 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { if let Key::Layout(chr) = key { log::info!("tfc_key_down_or_up :{:?}", chr); if down { - if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ + if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr) { log::error!("Failed to press char {:?}", chr); }; } if up { - if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){ - log::error!("Failed to press char {:?}",chr); + if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr) { + log::error!("Failed to press char {:?}", chr); }; } return; @@ -753,12 +754,12 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { log::info!("tfc_key_down_or_up: {:?}", key); if down { - if let Err(_) = TFC_CONTEXT.lock().unwrap().key_down(key){ + if let Err(_) = TFC_CONTEXT.lock().unwrap().key_down(key) { log::error!("Failed to press char {:?}", key); }; } if up { - if let Err(_) = TFC_CONTEXT.lock().unwrap().key_up(key){ + if let Err(_) = TFC_CONTEXT.lock().unwrap().key_up(key) { log::error!("Failed to press char {:?}", key); }; } @@ -771,16 +772,18 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { crate::platform::windows::try_change_desktop(); let mut en = ENIGO.lock().unwrap(); if click_capslock { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(Key::CapsLock, true, true); - #[cfg(not(target_os = "linux"))] - en.key_click(Key::CapsLock); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(Key::CapsLock, true, true); + } else { + en.key_click(Key::CapsLock); + } } if click_numlock { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(Key::NumLock, true, true); - #[cfg(not(target_os = "linux"))] - en.key_click(Key::NumLock); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(Key::NumLock, true, true); + } else { + en.key_click(Key::NumLock); + } } // disable numlock if press home etc when numlock is on, // because we will get numpad value (7,8,9 etc) if not @@ -834,10 +837,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } } else { if !get_modifier_state(key.clone(), &mut en) { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(key.clone(), true, false); - #[cfg(not(target_os = "linux"))] - en.key_down(key.clone()).ok(); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(key.clone(), true, false); + } else { + en.key_down(key.clone()).ok(); + } modifier_sleep(); to_release.push(key); } @@ -848,12 +852,12 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] if has_cap != en.get_key_state(Key::CapsLock) { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(Key::CapsLock, true, true); - #[cfg(not(target_os = "linux"))] - en.key_down(Key::CapsLock).ok(); - #[cfg(not(target_os = "linux"))] - en.key_up(Key::CapsLock); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(Key::CapsLock, true, true); + } else { + en.key_down(Key::CapsLock).ok(); + en.key_up(Key::CapsLock); + } } #[cfg(windows)] if crate::common::valid_for_numlock(evt) { @@ -874,19 +878,21 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } } if evt.down { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(key.clone(), true, false); - #[cfg(not(target_os = "linux"))] - allow_err!(en.key_down(key.clone())); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(key.clone(), true, false); + } else { + allow_err!(en.key_down(key.clone())); + } KEYS_DOWN .lock() .unwrap() .insert(ck.value() as _, Instant::now()); } else { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(key.clone(), false, true); - #[cfg(not(target_os = "linux"))] - en.key_up(key.clone()); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(key.clone(), false, true); + } else { + en.key_up(key.clone()); + } KEYS_DOWN.lock().unwrap().remove(&(ck.value() as _)); } } else if ck.value() == ControlKey::CtrlAltDel.value() { @@ -900,35 +906,36 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } Some(key_event::Union::Chr(chr)) => { if evt.down { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(get_layout(chr), true, false); - #[cfg(target_os = "linux")] + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(get_layout(chr), true, false); + } else { + if en.key_down(get_layout(chr)).is_ok() { + KEYS_DOWN + .lock() + .unwrap() + .insert(chr as u64 + KEY_CHAR_START, Instant::now()); + } else { + if let Ok(chr) = char::try_from(chr) { + let mut x = chr.to_string(); + if get_modifier_state(Key::Shift, &mut en) + || get_modifier_state(Key::CapsLock, &mut en) + { + x = x.to_uppercase(); + } + en.key_sequence(&x); + } + } + } KEYS_DOWN .lock() .unwrap() .insert(chr as u64 + KEY_CHAR_START, Instant::now()); - #[cfg(not(target_os = "linux"))] - if en.key_down(get_layout(chr)).is_ok() { - KEYS_DOWN - .lock() - .unwrap() - .insert(chr as u64 + KEY_CHAR_START, Instant::now()); - } else { - if let Ok(chr) = char::try_from(chr) { - let mut x = chr.to_string(); - if get_modifier_state(Key::Shift, &mut en) - || get_modifier_state(Key::CapsLock, &mut en) - { - x = x.to_uppercase(); - } - en.key_sequence(&x); - } - } } else { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(get_layout(chr), false, true); - #[cfg(not(target_os = "linux"))] - en.key_up(get_layout(chr)); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(get_layout(chr), false, true); + } else { + en.key_up(get_layout(chr)); + } KEYS_DOWN .lock() .unwrap() @@ -947,10 +954,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] for key in to_release { - #[cfg(target_os = "linux")] - tfc_key_down_or_up(key.clone(), false, true); - #[cfg(not(target_os = "linux"))] - en.key_up(key.clone()); + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(key.clone(), false, true); + } else { + en.key_up(key.clone()); + } } #[cfg(windows)] if disable_numlock { From 40534fd79f23f3b5879d15af1d28d420d70b5f4a Mon Sep 17 00:00:00 2001 From: asur4s Date: Fri, 2 Sep 2022 19:54:53 -0400 Subject: [PATCH 087/113] Fix ci --- build.rs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/build.rs b/build.rs index 9b353b42e..01fe8ada1 100644 --- a/build.rs +++ b/build.rs @@ -41,16 +41,6 @@ fn build_rc_source() { .unwrap(); } -fn check_environment() { - // Check env variable - let env_list = vec!["LLVM_HOME", "VCPKG_ROOT"]; - for env in env_list.iter() { - if std::env::var(env).is_err() { - panic!("Missing environment variable: {:?}", env); - }; - } -} - fn install_oboe() { let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); if target_os != "android" { @@ -87,19 +77,10 @@ fn install_oboe() { } fn gen_flutter_rust_bridge() { - // Get dependent of flutter - if !std::path::Path::new("./flutter/.packages").exists() { - std::process::Command::new("flutter") - .args(["pub", "get"]) - .current_dir("./flutter") - .output() - .expect("Failed to execute flutter pub get"); - }; let llvm_path = match std::env::var("LLVM_HOME") { Ok(path) => Some(vec![path]), - Err(_) => panic!("Failure to get environments"), + Err(_) => None, }; - // Tell Cargo that if the given file changes, to rerun this build script. println!("cargo:rerun-if-changed=src/flutter_ffi.rs"); // settings for fbr_codegen @@ -119,8 +100,6 @@ fn gen_flutter_rust_bridge() { } fn main() { - check_environment(); - hbb_common::gen_version(); install_oboe(); // there is problem with cfg(target_os) in build.rs, so use our workaround @@ -137,4 +116,4 @@ fn main() { build_windows(); #[cfg(target_os = "macos")] println!("cargo:rustc-link-lib=framework=ApplicationServices"); -} +} \ No newline at end of file From abf79ba61dcea5b3b45cad788949a3e2b75cc994 Mon Sep 17 00:00:00 2001 From: asur4s Date: Sat, 3 Sep 2022 11:07:55 -0400 Subject: [PATCH 088/113] Fix down and press of key_event in legacy --- src/ui_session_interface.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 7143ed97a..92a08ef3d 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -827,8 +827,13 @@ impl Session { } } - self.legacy_modifiers(&mut key_event, true, true, false, false); - key_event.press = down; + self.legacy_modifiers(&mut key_event, alt, ctrl, shift, command); + if v == 1 { + key_event.down = true; + } else if v == 3 { + key_event.press = true; + } + self.send_key_event(key_event, KeyboardMode::Legacy); } From 925a9e43cb442d1c462c1aea5477f315eb9ede55 Mon Sep 17 00:00:00 2001 From: asur4s Date: Sat, 3 Sep 2022 21:49:58 -0400 Subject: [PATCH 089/113] Refactor: env of keyboard mode --- src/common.rs | 11 +++++++++++ src/ui/remote.rs | 1 + src/ui_session_interface.rs | 7 +++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/common.rs b/src/common.rs index 81adebb0a..2be4b5295 100644 --- a/src/common.rs +++ b/src/common.rs @@ -711,3 +711,14 @@ pub fn make_fd_flutter(id: i32, entries: &Vec, only_count: bool) -> S m.insert("total_size".into(), json!(n as f64)); serde_json::to_string(&m).unwrap_or("".into()) } + + +pub fn get_keyboard_mode() -> String { + return std::env::var("KEYBOARD_MODE") + .unwrap_or(String::from("legacy")) + .to_lowercase(); +} + +pub fn save_keyboard_mode(value: String) { + std::env::set_var("KEYBOARD_MODE", value); +} \ No newline at end of file diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 093ad901e..26f323831 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1,3 +1,4 @@ +use crate::common::{get_keyboard_mode, save_keyboard_mode}; use std::{ collections::HashMap, ops::{Deref, DerefMut}, diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 92a08ef3d..05f34f37a 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -7,6 +7,7 @@ use crate::client::{ QualityStatus, KEY_MAP, SERVER_KEYBOARD_ENABLED, }; use crate::{client::Data, client::Interface}; +use crate::common::{get_keyboard_mode, save_keyboard_mode}; use async_trait::async_trait; use hbb_common::config::{Config, LocalConfig, PeerConfig}; @@ -58,13 +59,11 @@ impl Session { } pub fn get_keyboard_mode(&self) -> String { - return std::env::var("KEYBOARD_MODE") - .unwrap_or(String::from("legacy")) - .to_lowercase(); + return get_keyboard_mode(); } pub fn save_keyboard_mode(&self, value: String) { - std::env::set_var("KEYBOARD_MODE", value); + save_keyboard_mode(value); } pub fn save_view_style(&mut self, value: String) { From 071720fe8b7761684c977375e1da27b748c68d24 Mon Sep 17 00:00:00 2001 From: asur4s Date: Sat, 3 Sep 2022 23:30:41 -0400 Subject: [PATCH 090/113] Feat: Support map keyboard mode in wayland --- src/server/input_service.rs | 31 +++++++++++++++++++++++++------ src/server/uinput.rs | 12 +++++++++++- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index f8edef399..26806a7a5 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -8,7 +8,7 @@ use rdev::{simulate, EventType, Key as RdevKey}; use std::{ convert::TryFrom, sync::atomic::{AtomicBool, Ordering}, - time::Instant + time::Instant, }; use tfc::{traits::*, Context as TFC_Context, Key as TFC_Key}; @@ -648,6 +648,30 @@ fn map_keyboard_mode(evt: &KeyEvent) { // map mode(1): Send keycode according to the peer platform. let (click_capslock, click_numlock) = sync_status(evt); + // Wayland + if !*IS_X11.lock().unwrap() { + let mut en = ENIGO.lock().unwrap(); + let code = evt.chr() as u16; + + #[cfg(not(target_os = "macos"))] + if click_capslock { + en.key_click(enigo::Key::CapsLock); + } + #[cfg(not(target_os = "macos"))] + if click_numlock { + en.key_click(enigo::Key::NumLock); + } + #[cfg(target_os = "macos")] + en.key_down(enigo::Key::CapsLock); + + if evt.down { + en.key_down(enigo::Key::Raw(code)); + } else { + en.key_up(enigo::Key::Raw(code)); + } + return; + } + #[cfg(not(target_os = "macos"))] if click_capslock { rdev_key_click(RdevKey::CapsLock); @@ -660,11 +684,6 @@ fn map_keyboard_mode(evt: &KeyEvent) { if evt.down && click_capslock { rdev_key_down_or_up(RdevKey::CapsLock, evt.down); } - log::info!( - "click capslog {:?} click_numlock {:?}", - click_capslock, - click_numlock - ); rdev_key_down_or_up(RdevKey::Unknown(evt.chr()), evt.down); return; diff --git a/src/server/uinput.rs b/src/server/uinput.rs index 7a6d47cff..85b79ddb0 100644 --- a/src/server/uinput.rs +++ b/src/server/uinput.rs @@ -314,7 +314,7 @@ pub mod service { fn map_key(key: &enigo::Key) -> ResultType { if let Some(k) = KEY_MAP.get(&key) { - log::trace!("mapkey {:?}, get {:?}", &key, &k); + log::info!("mapkey {:?}, get {:?}", &key, &k); return Ok(k.clone()); } else { match key { @@ -350,6 +350,16 @@ pub mod service { DataKeyboard::Sequence(_seq) => { // ignore } + DataKeyboard::KeyDown(enigo::Key::Raw(code)) => { + log::info!("keycode {:?}", *code - 8); + let down_event = InputEvent::new(EventType::KEY, *code - 8, 1); + allow_err!(keyboard.emit(&[down_event])); + } + DataKeyboard::KeyUp(enigo::Key::Raw(code)) => { + log::info!("keycode {:?}", *code - 8); + let down_event = InputEvent::new(EventType::KEY, *code - 8, 0); + allow_err!(keyboard.emit(&[down_event])); + } DataKeyboard::KeyDown(key) => { if let Ok(k) = map_key(key) { let down_event = InputEvent::new(EventType::KEY, k.code(), 1); From 7c2f26eab261798445ab072cc129ce196d276cb2 Mon Sep 17 00:00:00 2001 From: asur4s Date: Sun, 4 Sep 2022 02:29:14 -0400 Subject: [PATCH 091/113] Fix numlock in wayland --- src/server/input_service.rs | 50 ++++++------------------------------- src/server/uinput.rs | 13 +++++++--- 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 26806a7a5..3765eb9e0 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -820,10 +820,7 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] let mut to_release = Vec::new(); - #[cfg(not(target_os = "macos"))] - let mut has_cap = false; - #[cfg(windows)] - let mut has_numlock = false; + if evt.down { let ck = if let Some(key_event::Union::ControlKey(ck)) = evt.union { ck.value() @@ -846,45 +843,19 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } } #[cfg(not(target_os = "macos"))] - { - if key == &Key::CapsLock { - has_cap = true; - } else if key == &Key::NumLock { - #[cfg(windows)] - { - has_numlock = true; - } + if !get_modifier_state(key.clone(), &mut en) { + if *IS_X11.lock().unwrap() { + tfc_key_down_or_up(key.clone(), true, false); } else { - if !get_modifier_state(key.clone(), &mut en) { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(key.clone(), true, false); - } else { - en.key_down(key.clone()).ok(); - } - modifier_sleep(); - to_release.push(key); - } + en.key_down(key.clone()).ok(); } + modifier_sleep(); + to_release.push(key); } } } } - #[cfg(not(target_os = "macos"))] - if has_cap != en.get_key_state(Key::CapsLock) { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(Key::CapsLock, true, true); - } else { - en.key_down(Key::CapsLock).ok(); - en.key_up(Key::CapsLock); - } - } - #[cfg(windows)] - if crate::common::valid_for_numlock(evt) { - if has_numlock != en.get_key_state(Key::NumLock) { - en.key_down(Key::NumLock).ok(); - en.key_up(Key::NumLock); - } - } + match evt.union { Some(key_event::Union::ControlKey(ck)) => { if let Some(key) = KEY_MAP.get(&ck.value()) { @@ -979,11 +950,6 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { en.key_up(key.clone()); } } - #[cfg(windows)] - if disable_numlock { - en.key_down(Key::NumLock).ok(); - en.key_up(Key::NumLock); - } } fn translate_keyboard_mode(evt: &KeyEvent) { diff --git a/src/server/uinput.rs b/src/server/uinput.rs index 85b79ddb0..5051d548d 100644 --- a/src/server/uinput.rs +++ b/src/server/uinput.rs @@ -314,7 +314,7 @@ pub mod service { fn map_key(key: &enigo::Key) -> ResultType { if let Some(k) = KEY_MAP.get(&key) { - log::info!("mapkey {:?}, get {:?}", &key, &k); + log::trace!("mapkey {:?}, get {:?}", &key, &k); return Ok(k.clone()); } else { match key { @@ -351,12 +351,10 @@ pub mod service { // ignore } DataKeyboard::KeyDown(enigo::Key::Raw(code)) => { - log::info!("keycode {:?}", *code - 8); let down_event = InputEvent::new(EventType::KEY, *code - 8, 1); allow_err!(keyboard.emit(&[down_event])); } DataKeyboard::KeyUp(enigo::Key::Raw(code)) => { - log::info!("keycode {:?}", *code - 8); let down_event = InputEvent::new(EventType::KEY, *code - 8, 0); allow_err!(keyboard.emit(&[down_event])); } @@ -388,6 +386,14 @@ pub mod service { false } } + } else if enigo::Key::NumLock == *key { + match keyboard.get_led_state() { + Ok(leds) => leds.contains(evdev::LedType::LED_NUML), + Err(_e) => { + // log::debug!("Failed to get led state {}", &_e); + false + } + } } else { match keyboard.get_key_state() { Ok(keys) => match key { @@ -403,7 +409,6 @@ pub mod service { keys.contains(evdev::Key::KEY_LEFTALT) || keys.contains(evdev::Key::KEY_RIGHTALT) } - enigo::Key::NumLock => keys.contains(evdev::Key::KEY_NUMLOCK), enigo::Key::Meta => { keys.contains(evdev::Key::KEY_LEFTMETA) || keys.contains(evdev::Key::KEY_RIGHTMETA) From 7a1b1d87e996bdf61b513550c3d269836d7e5dd7 Mon Sep 17 00:00:00 2001 From: asur4s Date: Sun, 4 Sep 2022 04:20:21 -0400 Subject: [PATCH 092/113] Fix uinput server in wayland clien --- src/client.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index 2bc60765a..9f330ea1c 100644 --- a/src/client.rs +++ b/src/client.rs @@ -154,7 +154,20 @@ impl Client { return Err(err); } } - Ok(x) => Ok(x), + Ok(x) => { + #[cfg(target_os = "linux")] + if !*IS_X11.lock().unwrap() { + let keyboard = super::uinput::client::UInputKeyboard::new().await?; + log::info!("UInput keyboard created"); + let mouse = super::uinput::client::UInputMouse::new().await?; + log::info!("UInput mouse created"); + + let mut en = ENIGO.lock().unwrap(); + en.set_uinput_keyboard(Some(Box::new(keyboard))); + en.set_uinput_mouse(Some(Box::new(mouse))); + } + + Ok(x)}, } } From 9f80202c798e7dd95285b5bc54aac8f1e853ef0d Mon Sep 17 00:00:00 2001 From: asur4s Date: Sun, 4 Sep 2022 04:25:34 -0400 Subject: [PATCH 093/113] Refactor is_x11 --- libs/hbb_common/src/platform/linux.rs | 4 ---- src/client.rs | 2 +- src/common.rs | 9 +++++++++ src/server/input_service.rs | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libs/hbb_common/src/platform/linux.rs b/libs/hbb_common/src/platform/linux.rs index 1a41ebad6..d4d44270a 100644 --- a/libs/hbb_common/src/platform/linux.rs +++ b/libs/hbb_common/src/platform/linux.rs @@ -1,10 +1,6 @@ use crate::ResultType; use std::sync::Mutex; -lazy_static::lazy_static! { - pub static ref IS_X11: Mutex = Mutex::new("x11" == get_display_server()); -} - pub fn get_display_server() -> String { let session = get_value_of_seat0(0); get_display_server_of_session(&session) diff --git a/src/client.rs b/src/client.rs index 9f330ea1c..6cda7f9ad 100644 --- a/src/client.rs +++ b/src/client.rs @@ -156,7 +156,7 @@ impl Client { } Ok(x) => { #[cfg(target_os = "linux")] - if !*IS_X11.lock().unwrap() { + if !*crate::common::IS_X11.lock().unwrap() { let keyboard = super::uinput::client::UInputKeyboard::new().await?; log::info!("UInput keyboard created"); let mouse = super::uinput::client::UInputMouse::new().await?; diff --git a/src/common.rs b/src/common.rs index 2be4b5295..58b456db9 100644 --- a/src/common.rs +++ b/src/common.rs @@ -721,4 +721,13 @@ pub fn get_keyboard_mode() -> String { pub fn save_keyboard_mode(value: String) { std::env::set_var("KEYBOARD_MODE", value); +} + +lazy_static::lazy_static! { + pub static ref IS_X11: Mutex = { + #[cfg(not(target_os = "linux"))] + Mutex::new("x11" == hbb_common::platform::linux::get_display_server()) + #[cfg(not(target_os = "linux"))] + false + }; } \ No newline at end of file diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 3765eb9e0..19be48b8e 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -2,7 +2,7 @@ use super::*; #[cfg(target_os = "macos")] use dispatch::Queue; use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable}; -use hbb_common::platform::linux::IS_X11; +use crate::common::IS_X11; use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown}; use rdev::{simulate, EventType, Key as RdevKey}; use std::{ From 7a35119d33e8aed30b41dd06baca0f45c3512a30 Mon Sep 17 00:00:00 2001 From: Asura Date: Sun, 4 Sep 2022 16:50:02 +0800 Subject: [PATCH 094/113] Fix misspell --- src/common.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.rs b/src/common.rs index 58b456db9..2e772118c 100644 --- a/src/common.rs +++ b/src/common.rs @@ -725,9 +725,9 @@ pub fn save_keyboard_mode(value: String) { lazy_static::lazy_static! { pub static ref IS_X11: Mutex = { + #[cfg(target_os = "linux")] + Mutex::new("x11" == hbb_common::platform::linux::get_display_server()); #[cfg(not(target_os = "linux"))] - Mutex::new("x11" == hbb_common::platform::linux::get_display_server()) - #[cfg(not(target_os = "linux"))] - false + Mutex::new(false) }; } \ No newline at end of file From 79aec0a63f3f965ee80c1c08c1cb2797d6219a3f Mon Sep 17 00:00:00 2001 From: Asura Date: Sun, 4 Sep 2022 16:50:25 +0800 Subject: [PATCH 095/113] Fix compile error --- Cargo.lock | 2 +- flutter/pubspec.lock | 24 ++++++++++++------------ src/client/io_loop.rs | 7 +++++++ src/ui_session_interface.rs | 2 ++ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62b412062..750ad4e8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4993,7 +4993,7 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/asur4s/The-Fat-Controller#a091f887edc2440b17d86c9ba580f2f35ce0cfcc" +source = "git+https://github.com/asur4s/The-Fat-Controller#48303c5dacded6ea1873bc5d69bdde3175cf336a" dependencies = [ "core-graphics 0.22.3", "unicode-segmentation", diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index d9205b76c..cee8975ee 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -49,7 +49,7 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.9.0" + version: "2.8.2" back_button_interceptor: dependency: "direct main" description: @@ -147,7 +147,7 @@ packages: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.1" + version: "1.2.0" charcode: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.1" + version: "1.1.0" code_builder: dependency: transitive description: @@ -324,7 +324,7 @@ packages: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.1" + version: "1.3.0" ffi: dependency: "direct main" description: @@ -621,14 +621,14 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.12" + version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.5" + version: "0.1.4" menu_base: dependency: transitive description: @@ -642,7 +642,7 @@ packages: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0" + version: "1.7.0" mime: dependency: transitive description: @@ -719,7 +719,7 @@ packages: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.2" + version: "1.8.1" path_provider: dependency: "direct main" description: @@ -971,7 +971,7 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.0" + version: "1.8.2" sqflite: dependency: transitive description: @@ -1013,7 +1013,7 @@ packages: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.1" + version: "1.1.0" synchronized: dependency: transitive description: @@ -1027,14 +1027,14 @@ packages: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.12" + version: "0.4.9" timing: dependency: transitive description: diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index e61690c32..f1a481a36 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -5,6 +5,13 @@ use crate::client::{ #[cfg(not(any(target_os = "android", target_os = "ios")))] use crate::common::{check_clipboard, update_clipboard, ClipboardContext, CLIPBOARD_INTERVAL}; +#[cfg(windows)] +use clipboard::{ + cliprdr::CliprdrClientContext, create_cliprdr_context as create_clipboard_file_context, + get_rx_clip_client, server_clip_file, +}; +#[cfg(windows)] +use crate::clipboard_file::*; use crate::ui_session_interface::{InvokeUi, Session}; use crate::{client::Data, client::Interface}; diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 05f34f37a..312a0d21d 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -26,6 +26,8 @@ use std::sync::{Arc, Mutex, RwLock}; pub static IS_IN: AtomicBool = AtomicBool::new(false); static KEYBOARD_HOOKED: AtomicBool = AtomicBool::new(false); +#[cfg(windows)] +static mut IS_ALT_GR: bool = false; #[cfg(not(any(target_os = "android", target_os = "ios")))] lazy_static::lazy_static! { From 8df3000b6bfbeca157b814c162b2732d36d9def4 Mon Sep 17 00:00:00 2001 From: asur4s Date: Sun, 4 Sep 2022 04:58:24 -0400 Subject: [PATCH 096/113] Fix syntax error --- src/common.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common.rs b/src/common.rs index 2e772118c..137352052 100644 --- a/src/common.rs +++ b/src/common.rs @@ -712,7 +712,6 @@ pub fn make_fd_flutter(id: i32, entries: &Vec, only_count: bool) -> S serde_json::to_string(&m).unwrap_or("".into()) } - pub fn get_keyboard_mode() -> String { return std::env::var("KEYBOARD_MODE") .unwrap_or(String::from("legacy")) @@ -723,11 +722,13 @@ pub fn save_keyboard_mode(value: String) { std::env::set_var("KEYBOARD_MODE", value); } +#[cfg(not(target_os = "linux"))] lazy_static::lazy_static! { - pub static ref IS_X11: Mutex = { - #[cfg(target_os = "linux")] - Mutex::new("x11" == hbb_common::platform::linux::get_display_server()); - #[cfg(not(target_os = "linux"))] - Mutex::new(false) - }; -} \ No newline at end of file + pub static ref IS_X11: Mutex = Mutex::new(false); + +} + +#[cfg(target_os = "linux")] +lazy_static::lazy_static! { + pub static ref IS_X11: Mutex = Mutex::new("x11" == hbb_common::platform::linux::get_display_server()); +} From abf78ab6f725a66d43ee7878b23abdfe80446cfe Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 05:55:31 -0400 Subject: [PATCH 097/113] Refacotr env of keyboard && enter view --- flutter/pubspec.lock | 24 +++++++++++----------- src/common.rs | 10 ---------- src/ui/remote.rs | 13 ------------ src/ui_session_interface.rs | 40 ++++++++++++++++++++++++++++--------- 4 files changed, 43 insertions(+), 44 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index cee8975ee..d9205b76c 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -49,7 +49,7 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.8.2" + version: "2.9.0" back_button_interceptor: dependency: "direct main" description: @@ -147,7 +147,7 @@ packages: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.1.1" code_builder: dependency: transitive description: @@ -324,7 +324,7 @@ packages: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: "direct main" description: @@ -621,14 +621,14 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.4" + version: "0.1.5" menu_base: dependency: transitive description: @@ -642,7 +642,7 @@ packages: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -719,7 +719,7 @@ packages: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.1" + version: "1.8.2" path_provider: dependency: "direct main" description: @@ -971,7 +971,7 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.2" + version: "1.9.0" sqflite: dependency: transitive description: @@ -1013,7 +1013,7 @@ packages: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.1.1" synchronized: dependency: transitive description: @@ -1027,14 +1027,14 @@ packages: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.9" + version: "0.4.12" timing: dependency: transitive description: diff --git a/src/common.rs b/src/common.rs index 137352052..3ffea492b 100644 --- a/src/common.rs +++ b/src/common.rs @@ -712,16 +712,6 @@ pub fn make_fd_flutter(id: i32, entries: &Vec, only_count: bool) -> S serde_json::to_string(&m).unwrap_or("".into()) } -pub fn get_keyboard_mode() -> String { - return std::env::var("KEYBOARD_MODE") - .unwrap_or(String::from("legacy")) - .to_lowercase(); -} - -pub fn save_keyboard_mode(value: String) { - std::env::set_var("KEYBOARD_MODE", value); -} - #[cfg(not(target_os = "linux"))] lazy_static::lazy_static! { pub static ref IS_X11: Mutex = Mutex::new(false); diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 26f323831..4fb6dd605 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1,4 +1,3 @@ -use crate::common::{get_keyboard_mode, save_keyboard_mode}; use std::{ collections::HashMap, ops::{Deref, DerefMut}, @@ -540,18 +539,6 @@ impl SciterSession { self.close_state.insert(k, v); } - fn enter(&mut self) { - #[cfg(windows)] - crate::platform::windows::stop_system_key_propagate(true); - IS_IN.store(true, Ordering::SeqCst); - } - - fn leave(&mut self) { - #[cfg(windows)] - crate::platform::windows::stop_system_key_propagate(false); - IS_IN.store(false, Ordering::SeqCst); - } - fn get_key_event(&self, down_or_up: i32, name: &str, code: i32) -> Option { let mut key_event = KeyEvent::new(); if down_or_up == 2 { diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 312a0d21d..676933ccc 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -7,7 +7,6 @@ use crate::client::{ QualityStatus, KEY_MAP, SERVER_KEYBOARD_ENABLED, }; use crate::{client::Data, client::Interface}; -use crate::common::{get_keyboard_mode, save_keyboard_mode}; use async_trait::async_trait; use hbb_common::config::{Config, LocalConfig, PeerConfig}; @@ -61,11 +60,13 @@ impl Session { } pub fn get_keyboard_mode(&self) -> String { - return get_keyboard_mode(); + return std::env::var("KEYBOARD_MODE") + .unwrap_or(String::from("legacy")) + .to_lowercase(); } pub fn save_keyboard_mode(&self, value: String) { - save_keyboard_mode(value); + std::env::set_var("KEYBOARD_MODE", value); } pub fn save_view_style(&mut self, value: String) { @@ -726,8 +727,29 @@ impl Session { self.send_key_event(key_event, KeyboardMode::Legacy); } - pub fn handle_flutter_key_event(&self, name: &str, keycode: i32, scancode:i32, down_or_up: bool){ - if scancode < 0 || keycode < 0{ + pub fn enter(&self) { + #[cfg(windows)] + crate::platform::windows::stop_system_key_propagate(true); + IS_IN.store(true, Ordering::SeqCst); + } + + pub fn leave(&self) { + for key in TO_RELEASE.lock().unwrap().iter() { + self.map_keyboard_mode(false, *key, None) + } + #[cfg(windows)] + crate::platform::windows::stop_system_key_propagate(false); + IS_IN.store(false, Ordering::SeqCst); + } + + pub fn handle_flutter_key_event( + &self, + name: &str, + keycode: i32, + scancode: i32, + down_or_up: bool, + ) { + if scancode < 0 || keycode < 0 { return; } let keycode: u32 = keycode as u32; @@ -739,12 +761,12 @@ impl Session { #[cfg(target_os = "windows")] let key = rdev::get_win_key(keycode, scancode); - let event_type = if down_or_up{ + let event_type = if down_or_up { KeyPress(key) - }else{ + } else { KeyRelease(key) }; - let evt = Event{ + let evt = Event { time: std::time::SystemTime::now(), name: Option::Some(name.to_owned()), code: keycode as _, @@ -827,7 +849,7 @@ impl Session { } } } - + self.legacy_modifiers(&mut key_event, alt, ctrl, shift, command); if v == 1 { key_event.down = true; From 5dfd041d8f08fcc146811c380513679caa4f9238 Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 06:19:05 -0400 Subject: [PATCH 098/113] Opt: enter or leave --- flutter/lib/desktop/pages/remote_page.dart | 24 ++++++++++++++-------- flutter/lib/models/model.dart | 4 ++++ src/flutter_ffi.rs | 10 +++++++++ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 51225672b..8c56f69d2 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -517,6 +517,19 @@ class _RemotePageState extends State } } + void enterView(PointerEnterEvent evt) { + if (!_imageFocused) { + _physicalFocusNode.requestFocus(); + } + _cursorOverImage.value = true; + _ffi.enterOrLeave(true); + } + + void leaveView(PointerExitEvent evt) { + _cursorOverImage.value = false; + _ffi.enterOrLeave(false); + } + Widget _buildImageListener(Widget child) { return Listener( onPointerHover: _onPointHoverImage, @@ -525,15 +538,8 @@ class _RemotePageState extends State onPointerMove: _onPointMoveImage, onPointerSignal: _onPointerSignalImage, child: MouseRegion( - onEnter: (evt) { - if (!_imageFocused) { - _physicalFocusNode.requestFocus(); - } - _cursorOverImage.value = true; - }, - onExit: (evt) { - _cursorOverImage.value = false; - }, + onEnter: enterView, + onExit: leaveView, child: child)); } diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index dcf9a7b22..bfa6f5297 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1003,6 +1003,10 @@ class FFI { downOrUp: down); } + void enterOrLeave(bool enter) { + bind.sessionEnterOrLeave(id: id, enter: enter); + } + /// Send key stroke event. /// [down] indicates the key's state(down or up). /// [press] indicates a click event(down and up). diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 72ccbe603..e5616bee6 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -247,6 +247,16 @@ pub fn session_handle_flutter_key_event( } } +pub fn session_enter_or_leave(id: String, enter: bool) { + if let Some(session) = SESSIONS.read().unwrap().get(&id) { + if enter { + session.enter(); + } else { + session.leave(); + } + } +} + pub fn session_input_key( id: String, name: String, From a105aff2aaecbf1214ef9b9c45ab310054627bce Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 07:52:38 -0400 Subject: [PATCH 099/113] Get key state by read file --- src/client.rs | 12 ------------ src/server/input_service.rs | 4 ++-- src/ui_session_interface.rs | 39 +++++++++++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/client.rs b/src/client.rs index 6cda7f9ad..37cea6b60 100644 --- a/src/client.rs +++ b/src/client.rs @@ -155,18 +155,6 @@ impl Client { } } Ok(x) => { - #[cfg(target_os = "linux")] - if !*crate::common::IS_X11.lock().unwrap() { - let keyboard = super::uinput::client::UInputKeyboard::new().await?; - log::info!("UInput keyboard created"); - let mouse = super::uinput::client::UInputMouse::new().await?; - log::info!("UInput mouse created"); - - let mut en = ENIGO.lock().unwrap(); - en.set_uinput_keyboard(Some(Box::new(keyboard))); - en.set_uinput_mouse(Some(Box::new(mouse))); - } - Ok(x)}, } } diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 19be48b8e..c2efb9947 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -665,7 +665,7 @@ fn map_keyboard_mode(evt: &KeyEvent) { en.key_down(enigo::Key::CapsLock); if evt.down { - en.key_down(enigo::Key::Raw(code)); + en.key_down(enigo::Key::Raw(code)).ok(); } else { en.key_up(enigo::Key::Raw(code)); } @@ -871,7 +871,7 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { if *IS_X11.lock().unwrap() { tfc_key_down_or_up(key.clone(), true, false); } else { - allow_err!(en.key_down(key.clone())); + en.key_down(key.clone()).ok(); } KEYS_DOWN .lock() diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 676933ccc..254db238a 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -8,7 +8,7 @@ use crate::client::{ }; use crate::{client::Data, client::Interface}; use async_trait::async_trait; - +use std::io::Read; use hbb_common::config::{Config, LocalConfig, PeerConfig}; use hbb_common::rendezvous_proto::ConnType; use hbb_common::tokio::{self, sync::mpsc}; @@ -416,10 +416,20 @@ impl Session { { key_event.modifiers.push(ControlKey::Meta.into()); } - if get_key_state(enigo::Key::CapsLock) { + #[cfg(target_os = "linux")] + if get_led_state(enigo::Key::CapsLock){ key_event.modifiers.push(ControlKey::CapsLock.into()); } + #[cfg(not(target_os = "linux"))] + if get_key_state(enigo::Key::CapsLock) { + key_event.modifiers.push(ControlKey::CapsLock.into()); + } if self.peer_platform() != "Mac OS" { + #[cfg(target_os = "linux")] + if get_led_state(enigo::Key::NumLock){ + key_event.modifiers.push(ControlKey::NumLock.into()); + } + #[cfg(not(target_os = "linux"))] if get_key_state(enigo::Key::NumLock) { key_event.modifiers.push(ControlKey::NumLock.into()); } @@ -1362,3 +1372,28 @@ async fn send_note(url: String, id: String, conn_id: i32, note: String) { let body = serde_json::json!({ "id": id, "Id": conn_id, "note": note }); allow_err!(crate::post_request(url, body.to_string(), "").await); } + +fn get_led_state(key: enigo::Key) -> bool{ + let led_file = match key{ + enigo::Key::CapsLock => { + "/sys/class/leds/input1::capslock/brightness" + } + enigo::Key::NumLock => { + "/sys/class/leds/input1::numlock/brightness" + } + _ => { + return false; + } + }; + + let status = if let Ok(mut file) = std::fs::File::open(&led_file) { + let mut content = String::new(); + file.read_to_string(&mut content).ok(); + let status = content.trim_end().to_string().parse::().unwrap_or(0); + status + }else{ + 0 + }; + log::info!("get led state: {}", status); + status == 1 +} \ No newline at end of file From 72d357e14b305e9186eb1a6c371a6899b50b9d22 Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 08:07:13 -0400 Subject: [PATCH 100/113] Refactor get led state --- libs/enigo/src/linux/nix_impl.rs | 27 ++++++++++++++++++++++- src/ui_session_interface.rs | 37 +------------------------------- 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/libs/enigo/src/linux/nix_impl.rs b/libs/enigo/src/linux/nix_impl.rs index 2e3fb8a24..895479481 100644 --- a/libs/enigo/src/linux/nix_impl.rs +++ b/libs/enigo/src/linux/nix_impl.rs @@ -1,5 +1,6 @@ use super::{xdo::EnigoXdo}; use crate::{Key, KeyboardControllable, MouseButton, MouseControllable}; +use std::io::Read; /// The main struct for handling the event emitting // #[derive(Default)] @@ -111,6 +112,30 @@ impl MouseControllable for Enigo { } } +fn get_led_state(key: Key) -> bool{ + let led_file = match key{ + Key::CapsLock => { + "/sys/class/leds/input1::capslock/brightness" + } + Key::NumLock => { + "/sys/class/leds/input1::numlock/brightness" + } + _ => { + return false; + } + }; + + let status = if let Ok(mut file) = std::fs::File::open(&led_file) { + let mut content = String::new(); + file.read_to_string(&mut content).ok(); + let status = content.trim_end().to_string().parse::().unwrap_or(0); + status + }else{ + 0 + }; + status == 1 +} + impl KeyboardControllable for Enigo { fn get_key_state(&mut self, key: Key) -> bool { if self.is_x11 { @@ -119,7 +144,7 @@ impl KeyboardControllable for Enigo { if let Some(keyboard) = &mut self.uinput_keyboard { keyboard.get_key_state(key) } else { - false + get_led_state(key) } } } diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 254db238a..d0142333d 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -330,7 +330,6 @@ impl Session { if get_key_state(enigo::Key::NumLock) { key_event.modifiers.push(ControlKey::NumLock.into()); } - log::info!("{:?}", get_key_state(enigo::Key::NumLock)); self.send_key_event(key_event, KeyboardMode::Map); } @@ -416,20 +415,11 @@ impl Session { { key_event.modifiers.push(ControlKey::Meta.into()); } - #[cfg(target_os = "linux")] - if get_led_state(enigo::Key::CapsLock){ - key_event.modifiers.push(ControlKey::CapsLock.into()); - } - #[cfg(not(target_os = "linux"))] + if get_key_state(enigo::Key::CapsLock) { key_event.modifiers.push(ControlKey::CapsLock.into()); } if self.peer_platform() != "Mac OS" { - #[cfg(target_os = "linux")] - if get_led_state(enigo::Key::NumLock){ - key_event.modifiers.push(ControlKey::NumLock.into()); - } - #[cfg(not(target_os = "linux"))] if get_key_state(enigo::Key::NumLock) { key_event.modifiers.push(ControlKey::NumLock.into()); } @@ -1371,29 +1361,4 @@ async fn start_one_port_forward( async fn send_note(url: String, id: String, conn_id: i32, note: String) { let body = serde_json::json!({ "id": id, "Id": conn_id, "note": note }); allow_err!(crate::post_request(url, body.to_string(), "").await); -} - -fn get_led_state(key: enigo::Key) -> bool{ - let led_file = match key{ - enigo::Key::CapsLock => { - "/sys/class/leds/input1::capslock/brightness" - } - enigo::Key::NumLock => { - "/sys/class/leds/input1::numlock/brightness" - } - _ => { - return false; - } - }; - - let status = if let Ok(mut file) = std::fs::File::open(&led_file) { - let mut content = String::new(); - file.read_to_string(&mut content).ok(); - let status = content.trim_end().to_string().parse::().unwrap_or(0); - status - }else{ - 0 - }; - log::info!("get led state: {}", status); - status == 1 } \ No newline at end of file From 3d7377f9b6322b6da9f78ab82d60ac35b2db4867 Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 10:18:29 -0400 Subject: [PATCH 101/113] Opt: Change keyboard mode by ui --- flutter/lib/desktop/pages/remote_page.dart | 15 +++--- .../lib/desktop/widgets/remote_menubar.dart | 46 +++++++++++++++++++ flutter/lib/models/model.dart | 4 ++ src/flutter_ffi.rs | 13 ++++++ 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 8c56f69d2..c2bf4ea5b 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -41,6 +41,7 @@ class _RemotePageState extends State Timer? _timer; bool _showBar = !isWebDesktop; String _value = ''; + String keyboardMode = "legacy"; final _cursorOverImage = false.obs; final FocusNode _mobileFocusNode = FocusNode(); @@ -254,8 +255,11 @@ class _RemotePageState extends State } KeyEventResult handleRawKeyEvent(FocusNode data, RawKeyEvent e) { - String? keyboardMode = Platform.environment['KEYBOARD_MODE']; - keyboardMode ??= 'legacy'; + bind.sessionGetKeyboardName(id: widget.id).then((result) { + setState(() { + keyboardMode = result.toString(); + }); + }); if (keyboardMode == 'map') { mapKeyboardMode(e); @@ -285,7 +289,6 @@ class _RemotePageState extends State RawKeyEventDataLinux newData = e.data as RawKeyEventDataLinux; scanCode = newData.scanCode; keyCode = newData.keyCode; - debugPrint(newData.unicodeScalarValues.toString()); } else { scanCode = -1; keyCode = -1; @@ -537,10 +540,8 @@ class _RemotePageState extends State onPointerUp: _onPointUpImage, onPointerMove: _onPointMoveImage, onPointerSignal: _onPointerSignalImage, - child: MouseRegion( - onEnter: enterView, - onExit: leaveView, - child: child)); + child: + MouseRegion(onEnter: enterView, onExit: leaveView, child: child)); } Widget getBodyForDesktop(BuildContext context, bool keyboard) { diff --git a/flutter/lib/desktop/widgets/remote_menubar.dart b/flutter/lib/desktop/widgets/remote_menubar.dart index 47536011d..4d27c107f 100644 --- a/flutter/lib/desktop/widgets/remote_menubar.dart +++ b/flutter/lib/desktop/widgets/remote_menubar.dart @@ -93,6 +93,7 @@ class _RemoteMenubarState extends State { menubarItems.add(_buildMonitor(context)); menubarItems.add(_buildControl(context)); menubarItems.add(_buildDisplay(context)); + menubarItems.add(_buildKeyboard(context)); if (!isWeb) { menubarItems.add(_buildChat(context)); } @@ -264,6 +265,29 @@ class _RemoteMenubarState extends State { ); } + Widget _buildKeyboard(BuildContext context) { + return mod_menu.PopupMenuButton( + padding: EdgeInsets.zero, + icon: const Icon( + Icons.keyboard, + color: _MenubarTheme.commonColor, + ), + tooltip: translate('Keyboard Settings'), + position: mod_menu.PopupMenuPosition.under, + onSelected: (String item) {}, + itemBuilder: (BuildContext context) => _getKeyboardMenu() + .map((entry) => entry.build( + context, + const MenuConfig( + commonColor: _MenubarTheme.commonColor, + height: _MenubarTheme.height, + dividerHeight: _MenubarTheme.dividerHeight, + ))) + .expand((i) => i) + .toList(), + ); + } + Widget _buildClose(BuildContext context) { return IconButton( tooltip: translate('Close'), @@ -555,6 +579,28 @@ class _RemoteMenubarState extends State { return displayMenu; } + List> _getKeyboardMenu() { + final keyboardMenu = [ + MenuEntryRadios( + text: translate('Ratio'), + optionsGetter: () => [ + MenuEntryRadioOption( + text: translate('Legacy mode'), value: 'legacy'), + MenuEntryRadioOption(text: translate('Map mode'), value: 'map'), + ], + curOptionGetter: () async { + return await bind.sessionGetKeyboardName(id: widget.id) ?? 'legacy'; + }, + optionSetter: (String oldValue, String newValue) async { + await bind.sessionSetKeyboardMode( + id: widget.id, keyboardMode: newValue); + widget.ffi.canvasModel.updateViewStyle(); + }) + ]; + + return keyboardMenu; + } + MenuEntrySwitch _createSwitchMenuEntry(String text, String option) { return MenuEntrySwitch( text: translate(text), diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index bfa6f5297..b1cc6192b 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1003,6 +1003,10 @@ class FFI { downOrUp: down); } + Future getKeyboardMode(){ + return bind.sessionGetKeyboardName(id: id); + } + void enterOrLeave(bool enter) { bind.sessionEnterOrLeave(id: id, enter: enter); } diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index e5616bee6..d2d49fff0 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -298,6 +298,19 @@ pub fn session_get_peer_option(id: String, name: String) -> String { "".to_string() } +pub fn session_get_keyboard_name(id: String) -> String { + if let Some(session) = SESSIONS.read().unwrap().get(&id) { + return session.get_keyboard_mode(); + } + "legacy".to_string() +} + +pub fn session_set_keyboard_mode(id: String, keyboard_mode: String) { + if let Some(session) = SESSIONS.read().unwrap().get(&id) { + session.save_keyboard_mode(keyboard_mode); + } +} + pub fn session_input_os_password(id: String, value: String) { if let Some(session) = SESSIONS.read().unwrap().get(&id) { session.input_os_password(value, true); From 2d7cd7c864fb57f14da68cccfb881597ac34f387 Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 11:50:42 -0400 Subject: [PATCH 102/113] Refactor: tfc --- Cargo.lock | 3 +- Cargo.toml | 2 - libs/enigo/Cargo.toml | 1 + libs/enigo/src/linux/nix_impl.rs | 135 ++++++++++++++++++++-- src/server/input_service.rs | 185 ++++--------------------------- 5 files changed, 147 insertions(+), 179 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 750ad4e8e..303d18f1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1381,6 +1381,7 @@ dependencies = [ "rdev", "serde 1.0.144", "serde_derive", + "tfc", "unicode-segmentation", "winapi 0.3.9", ] @@ -4241,7 +4242,6 @@ dependencies = [ "mouce", "num_cpus", "objc", - "once_cell", "parity-tokio-ipc", "rdev", "repng", @@ -4261,7 +4261,6 @@ dependencies = [ "sys-locale", "sysinfo", "system_shutdown", - "tfc", "tray-item", "trayicon", "uuid", diff --git a/Cargo.toml b/Cargo.toml index 708e6660b..bf5ab9669 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,8 +76,6 @@ sys-locale = "0.2" enigo = { path = "libs/enigo", features = [ "with_serde" ] } clipboard = { path = "libs/clipboard" } rdev = { git = "https://github.com/asur4s/rdev" } -tfc = { git = "https://github.com/asur4s/The-Fat-Controller" } -once_cell = "1.13.0" ctrlc = "3.2" arboard = "2.0" #minreq = { version = "2.4", features = ["punycode", "https-native"] } diff --git a/libs/enigo/Cargo.toml b/libs/enigo/Cargo.toml index fec03d34e..83c79e064 100644 --- a/libs/enigo/Cargo.toml +++ b/libs/enigo/Cargo.toml @@ -23,6 +23,7 @@ serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } log = "0.4" rdev = { git = "https://github.com/asur4s/rdev" } +tfc = { git = "https://github.com/asur4s/The-Fat-Controller" } hbb_common = { path = "../hbb_common" } [features] diff --git a/libs/enigo/src/linux/nix_impl.rs b/libs/enigo/src/linux/nix_impl.rs index 895479481..5fb67c5ee 100644 --- a/libs/enigo/src/linux/nix_impl.rs +++ b/libs/enigo/src/linux/nix_impl.rs @@ -1,12 +1,14 @@ -use super::{xdo::EnigoXdo}; +use super::xdo::EnigoXdo; use crate::{Key, KeyboardControllable, MouseButton, MouseControllable}; use std::io::Read; +use tfc::{traits::*, Context as TFC_Context, Key as TFC_Key}; /// The main struct for handling the event emitting // #[derive(Default)] pub struct Enigo { xdo: EnigoXdo, is_x11: bool, + tfc: TFC_Context, uinput_keyboard: Option>, uinput_mouse: Option>, } @@ -31,12 +33,48 @@ impl Enigo { pub fn set_uinput_mouse(&mut self, uinput_mouse: Option>) { self.uinput_mouse = uinput_mouse } + + fn tfc_key_down_or_up(&mut self, key: Key, down: bool, up: bool) -> bool { + if let Key::Layout(chr) = key { + if down { + if let Err(_) = self.tfc.unicode_char_down(chr) { + return false; + } + } + if up { + if let Err(_) = self.tfc.unicode_char_up(chr) { + return false; + } + } + return true; + } + + let key = match convert_to_tfc_key(key) { + Some(key) => key, + None => { + return false; + } + }; + + if down { + if let Err(_) = self.tfc.key_down(key) { + return false; + } + }; + if up { + if let Err(_) = self.tfc.key_up(key) { + return false; + } + }; + return true; + } } impl Default for Enigo { fn default() -> Self { Self { is_x11: "x11" == hbb_common::platform::linux::get_display_server(), + tfc: TFC_Context::new().expect("kbd context error"), uinput_keyboard: None, uinput_mouse: None, xdo: EnigoXdo::default(), @@ -112,14 +150,10 @@ impl MouseControllable for Enigo { } } -fn get_led_state(key: Key) -> bool{ - let led_file = match key{ - Key::CapsLock => { - "/sys/class/leds/input1::capslock/brightness" - } - Key::NumLock => { - "/sys/class/leds/input1::numlock/brightness" - } +fn get_led_state(key: Key) -> bool { + let led_file = match key { + Key::CapsLock => "/sys/class/leds/input1::capslock/brightness", + Key::NumLock => "/sys/class/leds/input1::numlock/brightness", _ => { return false; } @@ -130,7 +164,7 @@ fn get_led_state(key: Key) -> bool{ file.read_to_string(&mut content).ok(); let status = content.trim_end().to_string().parse::().unwrap_or(0); status - }else{ + } else { 0 }; status == 1 @@ -161,7 +195,12 @@ impl KeyboardControllable for Enigo { fn key_down(&mut self, key: Key) -> crate::ResultType { if self.is_x11 { - self.xdo.key_down(key) + let has_down = self.tfc_key_down_or_up(key, true, false); + if !has_down { + self.xdo.key_down(key) + } else { + Ok(()) + } } else { if let Some(keyboard) = &mut self.uinput_keyboard { keyboard.key_down(key) @@ -172,7 +211,10 @@ impl KeyboardControllable for Enigo { } fn key_up(&mut self, key: Key) { if self.is_x11 { - self.xdo.key_up(key) + let has_down = self.tfc_key_down_or_up(key, false, true); + if !has_down { + self.xdo.key_up(key) + } } else { if let Some(keyboard) = &mut self.uinput_keyboard { keyboard.key_up(key) @@ -184,3 +226,72 @@ impl KeyboardControllable for Enigo { self.key_up(key); } } + +fn convert_to_tfc_key(key: Key) -> Option { + let key = match key { + Key::Alt => TFC_Key::Alt, + Key::Backspace => TFC_Key::DeleteOrBackspace, + Key::CapsLock => TFC_Key::CapsLock, + Key::Control => TFC_Key::Control, + Key::Delete => TFC_Key::ForwardDelete, + Key::DownArrow => TFC_Key::DownArrow, + Key::End => TFC_Key::End, + Key::Escape => TFC_Key::Escape, + Key::F1 => TFC_Key::F1, + Key::F10 => TFC_Key::F10, + Key::F11 => TFC_Key::F11, + Key::F12 => TFC_Key::F12, + Key::F2 => TFC_Key::F2, + Key::F3 => TFC_Key::F3, + Key::F4 => TFC_Key::F4, + Key::F5 => TFC_Key::F5, + Key::F6 => TFC_Key::F6, + Key::F7 => TFC_Key::F7, + Key::F8 => TFC_Key::F8, + Key::F9 => TFC_Key::F9, + Key::Home => TFC_Key::Home, + Key::LeftArrow => TFC_Key::LeftArrow, + Key::PageDown => TFC_Key::PageDown, + Key::PageUp => TFC_Key::PageUp, + Key::Return => TFC_Key::ReturnOrEnter, + Key::RightArrow => TFC_Key::RightArrow, + Key::Shift => TFC_Key::Shift, + Key::Space => TFC_Key::Space, + Key::Tab => TFC_Key::Tab, + Key::UpArrow => TFC_Key::UpArrow, + Key::Numpad0 => TFC_Key::N0, + Key::Numpad1 => TFC_Key::N1, + Key::Numpad2 => TFC_Key::N2, + Key::Numpad3 => TFC_Key::N3, + Key::Numpad4 => TFC_Key::N4, + Key::Numpad5 => TFC_Key::N5, + Key::Numpad6 => TFC_Key::N6, + Key::Numpad7 => TFC_Key::N7, + Key::Numpad8 => TFC_Key::N8, + Key::Numpad9 => TFC_Key::N9, + Key::Decimal => TFC_Key::NumpadDecimal, + Key::Clear => TFC_Key::NumpadClear, + Key::Pause => TFC_Key::PlayPause, + Key::Print => TFC_Key::Print, + Key::Snapshot => TFC_Key::PrintScreen, + Key::Insert => TFC_Key::Insert, + Key::Scroll => TFC_Key::ScrollLock, + Key::NumLock => TFC_Key::NumLock, + Key::RWin => TFC_Key::Meta, + Key::Apps => TFC_Key::Apps, + Key::Multiply => TFC_Key::NumpadMultiply, + Key::Add => TFC_Key::NumpadPlus, + Key::Subtract => TFC_Key::NumpadMinus, + Key::Divide => TFC_Key::NumpadDivide, + Key::Equals => TFC_Key::NumpadEquals, + Key::NumpadEnter => TFC_Key::NumpadEnter, + Key::RightShift => TFC_Key::RightShift, + Key::RightControl => TFC_Key::RightControl, + Key::RightAlt => TFC_Key::RightAlt, + Key::Command | Key::Super | Key::Windows | Key::Meta => TFC_Key::Meta, + _ => { + return None; + } + }; + Some(key) +} diff --git a/src/server/input_service.rs b/src/server/input_service.rs index c2efb9947..70af1e581 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -1,8 +1,8 @@ use super::*; +use crate::common::IS_X11; #[cfg(target_os = "macos")] use dispatch::Queue; use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable}; -use crate::common::IS_X11; use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown}; use rdev::{simulate, EventType, Key as RdevKey}; use std::{ @@ -10,7 +10,6 @@ use std::{ sync::atomic::{AtomicBool, Ordering}, time::Instant, }; -use tfc::{traits::*, Context as TFC_Context, Key as TFC_Key}; #[derive(Default)] struct StateCursor { @@ -172,7 +171,6 @@ lazy_static::lazy_static! { }; static ref KEYS_DOWN: Arc>> = Default::default(); static ref LATEST_INPUT: Arc> = Default::default(); - static ref TFC_CONTEXT: Mutex = Mutex::new(TFC_Context::new().expect("kbd context error")); } static EXITING: AtomicBool = AtomicBool::new(false); @@ -689,101 +687,6 @@ fn map_keyboard_mode(evt: &KeyEvent) { return; } -fn tfc_key_down_or_up(key: Key, down: bool, up: bool) { - if let Key::Layout(chr) = key { - log::info!("tfc_key_down_or_up :{:?}", chr); - if down { - if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr) { - log::error!("Failed to press char {:?}", chr); - }; - } - if up { - if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr) { - log::error!("Failed to press char {:?}", chr); - }; - } - return; - } - - let key = match key { - Key::Alt => TFC_Key::Alt, - Key::Backspace => TFC_Key::DeleteOrBackspace, - Key::CapsLock => TFC_Key::CapsLock, - Key::Control => TFC_Key::Control, - Key::Delete => TFC_Key::ForwardDelete, - Key::DownArrow => TFC_Key::DownArrow, - Key::End => TFC_Key::End, - Key::Escape => TFC_Key::Escape, - Key::F1 => TFC_Key::F1, - Key::F10 => TFC_Key::F10, - Key::F11 => TFC_Key::F11, - Key::F12 => TFC_Key::F12, - Key::F2 => TFC_Key::F2, - Key::F3 => TFC_Key::F3, - Key::F4 => TFC_Key::F4, - Key::F5 => TFC_Key::F5, - Key::F6 => TFC_Key::F6, - Key::F7 => TFC_Key::F7, - Key::F8 => TFC_Key::F8, - Key::F9 => TFC_Key::F9, - Key::Home => TFC_Key::Home, - Key::LeftArrow => TFC_Key::LeftArrow, - Key::PageDown => TFC_Key::PageDown, - Key::PageUp => TFC_Key::PageUp, - Key::Return => TFC_Key::ReturnOrEnter, - Key::RightArrow => TFC_Key::RightArrow, - Key::Shift => TFC_Key::Shift, - Key::Space => TFC_Key::Space, - Key::Tab => TFC_Key::Tab, - Key::UpArrow => TFC_Key::UpArrow, - Key::Numpad0 => TFC_Key::N0, - Key::Numpad1 => TFC_Key::N1, - Key::Numpad2 => TFC_Key::N2, - Key::Numpad3 => TFC_Key::N3, - Key::Numpad4 => TFC_Key::N4, - Key::Numpad5 => TFC_Key::N5, - Key::Numpad6 => TFC_Key::N6, - Key::Numpad7 => TFC_Key::N7, - Key::Numpad8 => TFC_Key::N8, - Key::Numpad9 => TFC_Key::N9, - Key::Decimal => TFC_Key::NumpadDecimal, - Key::Clear => TFC_Key::NumpadClear, - Key::Pause => TFC_Key::PlayPause, - Key::Print => TFC_Key::Print, - Key::Snapshot => TFC_Key::PrintScreen, - Key::Insert => TFC_Key::Insert, - Key::Scroll => TFC_Key::ScrollLock, - Key::NumLock => TFC_Key::NumLock, - Key::RWin => TFC_Key::Meta, - Key::Apps => TFC_Key::Apps, - Key::Multiply => TFC_Key::NumpadMultiply, - Key::Add => TFC_Key::NumpadPlus, - Key::Subtract => TFC_Key::NumpadMinus, - Key::Divide => TFC_Key::NumpadDivide, - Key::Equals => TFC_Key::NumpadEquals, - Key::NumpadEnter => TFC_Key::NumpadEnter, - Key::RightShift => TFC_Key::RightShift, - Key::RightControl => TFC_Key::RightControl, - Key::RightAlt => TFC_Key::RightAlt, - Key::Command | Key::Super | Key::Windows | Key::Meta => TFC_Key::Meta, - _ => { - return; - } - }; - - log::info!("tfc_key_down_or_up: {:?}", key); - if down { - if let Err(_) = TFC_CONTEXT.lock().unwrap().key_down(key) { - log::error!("Failed to press char {:?}", key); - }; - } - if up { - if let Err(_) = TFC_CONTEXT.lock().unwrap().key_up(key) { - log::error!("Failed to press char {:?}", key); - }; - } -} - fn legacy_keyboard_mode(evt: &KeyEvent) { let (click_capslock, click_numlock) = sync_status(evt); @@ -791,18 +694,10 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { crate::platform::windows::try_change_desktop(); let mut en = ENIGO.lock().unwrap(); if click_capslock { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(Key::CapsLock, true, true); - } else { - en.key_click(Key::CapsLock); - } + en.key_click(Key::CapsLock); } if click_numlock { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(Key::NumLock, true, true); - } else { - en.key_click(Key::NumLock); - } + en.key_click(Key::NumLock); } // disable numlock if press home etc when numlock is on, // because we will get numpad value (7,8,9 etc) if not @@ -820,7 +715,7 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] let mut to_release = Vec::new(); - + if evt.down { let ck = if let Some(key_event::Union::ControlKey(ck)) = evt.union { ck.value() @@ -844,11 +739,7 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] if !get_modifier_state(key.clone(), &mut en) { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(key.clone(), true, false); - } else { - en.key_down(key.clone()).ok(); - } + en.key_down(key.clone()).ok(); modifier_sleep(); to_release.push(key); } @@ -868,21 +759,13 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } } if evt.down { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(key.clone(), true, false); - } else { - en.key_down(key.clone()).ok(); - } + en.key_down(key.clone()).ok(); KEYS_DOWN .lock() .unwrap() .insert(ck.value() as _, Instant::now()); } else { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(key.clone(), false, true); - } else { - en.key_up(key.clone()); - } + en.key_up(key.clone()); KEYS_DOWN.lock().unwrap().remove(&(ck.value() as _)); } } else if ck.value() == ControlKey::CtrlAltDel.value() { @@ -896,24 +779,20 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } Some(key_event::Union::Chr(chr)) => { if evt.down { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(get_layout(chr), true, false); + if en.key_down(get_layout(chr)).is_ok() { + KEYS_DOWN + .lock() + .unwrap() + .insert(chr as u64 + KEY_CHAR_START, Instant::now()); } else { - if en.key_down(get_layout(chr)).is_ok() { - KEYS_DOWN - .lock() - .unwrap() - .insert(chr as u64 + KEY_CHAR_START, Instant::now()); - } else { - if let Ok(chr) = char::try_from(chr) { - let mut x = chr.to_string(); - if get_modifier_state(Key::Shift, &mut en) - || get_modifier_state(Key::CapsLock, &mut en) - { - x = x.to_uppercase(); - } - en.key_sequence(&x); + if let Ok(chr) = char::try_from(chr) { + let mut x = chr.to_string(); + if get_modifier_state(Key::Shift, &mut en) + || get_modifier_state(Key::CapsLock, &mut en) + { + x = x.to_uppercase(); } + en.key_sequence(&x); } } KEYS_DOWN @@ -921,11 +800,7 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { .unwrap() .insert(chr as u64 + KEY_CHAR_START, Instant::now()); } else { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(get_layout(chr), false, true); - } else { - en.key_up(get_layout(chr)); - } + en.key_up(get_layout(chr)); KEYS_DOWN .lock() .unwrap() @@ -944,23 +819,7 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { } #[cfg(not(target_os = "macos"))] for key in to_release { - if *IS_X11.lock().unwrap() { - tfc_key_down_or_up(key.clone(), false, true); - } else { - en.key_up(key.clone()); - } - } -} - -fn translate_keyboard_mode(evt: &KeyEvent) { - let chr = char::from_u32(evt.chr()).unwrap_or_default(); - // down(true)->press && press(false)-> release - if evt.down && !evt.press { - TFC_CONTEXT - .lock() - .unwrap() - .unicode_char(chr) - .expect("unicode_char_down error"); + en.key_up(key.clone()); } } @@ -977,7 +836,7 @@ fn handle_key_(evt: &KeyEvent) { map_keyboard_mode(evt); } KeyboardMode::Translate => { - translate_keyboard_mode(evt); + legacy_keyboard_mode(evt); } _ => { legacy_keyboard_mode(evt); From b6e0cc8e74188dc2ccc084adbe2bc49401518abb Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 12:39:11 -0400 Subject: [PATCH 103/113] Fix warning --- libs/hbb_common/src/platform/linux.rs | 1 - src/client/io_loop.rs | 1 + src/flutter.rs | 10 +++++++--- src/flutter_ffi.rs | 8 ++++---- src/rendezvous_mediator.rs | 3 ++- src/ui.rs | 1 + src/ui/remote.rs | 4 ++-- src/ui_interface.rs | 3 ++- src/ui_session_interface.rs | 3 +-- 9 files changed, 20 insertions(+), 14 deletions(-) diff --git a/libs/hbb_common/src/platform/linux.rs b/libs/hbb_common/src/platform/linux.rs index d4d44270a..865033204 100644 --- a/libs/hbb_common/src/platform/linux.rs +++ b/libs/hbb_common/src/platform/linux.rs @@ -1,5 +1,4 @@ use crate::ResultType; -use std::sync::Mutex; pub fn get_display_server() -> String { let session = get_value_of_seat0(0); diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index f1a481a36..d33e7b5ef 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -276,6 +276,7 @@ impl Remote { } // TODO + #[allow(dead_code)] fn load_last_jobs(&mut self) { log::info!("start load last jobs"); self.handler.clear_all_jobs(); diff --git a/src/flutter.rs b/src/flutter.rs index 7316dd2ed..ed42fbedb 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -12,7 +12,9 @@ use crate::ui_session_interface::{io_loop, InvokeUi, Session}; use crate::{client::*, flutter_ffi::EventToUI}; pub(super) const APP_TYPE_MAIN: &str = "main"; +#[allow(dead_code)] pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote"; +#[allow(dead_code)] pub(super) const APP_TYPE_DESKTOP_FILE_TRANSFER: &str = "file transfer"; lazy_static::lazy_static! { @@ -117,7 +119,7 @@ impl InvokeUi for FlutterHandler { ); } - fn job_error(&self, id: i32, err: String, file_num: i32) { + fn job_error(&self, id: i32, err: String, _file_num: i32) { self.push_event("job_error", vec![("id", &id.to_string()), ("err", &err)]); } @@ -132,6 +134,7 @@ impl InvokeUi for FlutterHandler { // todo!() } + #[allow(unused_variables)] fn add_job( &self, id: i32, @@ -148,6 +151,7 @@ impl InvokeUi for FlutterHandler { // todo!() } + #[allow(unused_variables)] fn confirm_delete_files(&self, id: i32, i: i32, name: String) { // todo!() } @@ -337,7 +341,7 @@ pub mod connection_manager { protobuf::Message as _, tokio::{ self, - sync::mpsc::{self, UnboundedReceiver, UnboundedSender}, + sync::mpsc::{self, UnboundedSender}, task::spawn_blocking, }, }; @@ -432,7 +436,7 @@ pub mod connection_manager { } Ok(Some(data)) => { match data { - Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled, restart} => { + Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled: _file_transfer_enabled, restart} => { log::debug!("conn_id: {}", id); conn_id = id; // tx_file.send(ClipboardFileData::Enable((id, file_transfer_enabled))).ok(); diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index d2d49fff0..be4cadc7e 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -106,9 +106,9 @@ pub fn stop_global_event_stream(app_type: String) { .remove(&app_type); } -pub fn host_stop_system_key_propagate(stopped: bool) { +pub fn host_stop_system_key_propagate(_stopped: bool) { #[cfg(windows)] - crate::platform::windows::stop_system_key_propagate(stopped); + crate::platform::windows::stop_system_key_propagate(_stopped); } // FIXME: -> ResultType<()> cannot be parsed by frb_codegen @@ -388,7 +388,7 @@ pub fn session_create_dir(id: String, act_id: i32, path: String, is_remote: bool } pub fn session_read_local_dir_sync(id: String, path: String, show_hidden: bool) -> String { - if let Some(session) = SESSIONS.read().unwrap().get(&id) { + if let Some(_) = SESSIONS.read().unwrap().get(&id) { if let Ok(fd) = fs::read_dir(&fs::get_path(&path), show_hidden) { return make_fd_to_json(fd); } @@ -404,7 +404,7 @@ pub fn session_get_platform(id: String, is_remote: bool) -> String { } pub fn session_load_last_transfer_jobs(id: String) { - if let Some(session) = SESSIONS.read().unwrap().get(&id) { + if let Some(_) = SESSIONS.read().unwrap().get(&id) { // return session.load_last_jobs(); } else { // a tip for flutter dev diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 802fed1de..9fc59816f 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -568,6 +568,7 @@ pub fn get_mac() -> String { "".to_owned() } +#[allow(dead_code)] fn lan_discovery() -> ResultType<()> { let addr = SocketAddr::from(([0, 0, 0, 0], get_broadcast_port())); let socket = std::net::UdpSocket::bind(addr)?; @@ -637,7 +638,7 @@ pub async fn query_online_states, Vec)>(ids: Vec ResultType { - let (mut rendezvous_server, _servers, _contained) = crate::get_rendezvous_server(1_000).await; + let (rendezvous_server, _servers, _contained) = crate::get_rendezvous_server(1_000).await; let tmp: Vec<&str> = rendezvous_server.split(":").collect(); if tmp.len() != 2 { bail!("Invalid server address: {}", rendezvous_server); diff --git a/src/ui.rs b/src/ui.rs index 0e754e622..f71ff8601 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -763,6 +763,7 @@ fn get_sound_inputs() -> Vec { .collect() } +#[allow(dead_code)] fn check_connect_status( reconnect: bool, ) -> ( diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 4fb6dd605..4d2be50ed 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -2,7 +2,6 @@ use std::{ collections::HashMap, ops::{Deref, DerefMut}, sync::{ - atomic::{Ordering}, Arc, Mutex, }, }; @@ -29,7 +28,7 @@ use hbb_common::{allow_err, log, message_proto::*, rendezvous_proto::ConnType}; use crate::clipboard_file::*; use crate::{ client::*, - ui_session_interface::{InvokeUi, Session, IS_IN}, + ui_session_interface::{InvokeUi, Session}, }; type Video = AssetPtr; @@ -155,6 +154,7 @@ impl InvokeUi for SciterHandler { self.call("clearAllJobs", &make_args!()); } + #[allow(unused_variables)] fn add_job( &self, id: i32, diff --git a/src/ui_interface.rs b/src/ui_interface.rs index a8e3be980..75dead204 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -69,7 +69,7 @@ pub fn goto_install() { allow_err!(crate::run_me(vec!["--install"])); } -pub fn install_me(_options: String, _path: String, silent: bool, debug: bool) { +pub fn install_me(_options: String, _path: String, _silent: bool, _debug: bool) { #[cfg(windows)] std::thread::spawn(move || { allow_err!(crate::platform::windows::install_me( @@ -682,6 +682,7 @@ pub fn check_super_user_permission() -> bool { true } +#[allow(dead_code)] pub fn check_zombie(childs: Childs) { let mut deads = Vec::new(); loop { diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index d0142333d..3c6c21c3f 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -8,7 +8,6 @@ use crate::client::{ }; use crate::{client::Data, client::Interface}; use async_trait::async_trait; -use std::io::Read; use hbb_common::config::{Config, LocalConfig, PeerConfig}; use hbb_common::rendezvous_proto::ConnType; use hbb_common::tokio::{self, sync::mpsc}; @@ -1157,7 +1156,7 @@ impl Session { return; } log::info!("keyboard hooked"); - let mut me = self.clone(); + let me = self.clone(); #[cfg(windows)] crate::platform::windows::enable_lowlevel_keyboard(std::ptr::null_mut() as _); std::thread::spawn(move || { From d3d31ff0149a72949c5ec35ad40658753da927b7 Mon Sep 17 00:00:00 2001 From: asur4s Date: Mon, 5 Sep 2022 23:39:01 -0400 Subject: [PATCH 104/113] Fix modifier key status --- flutter/lib/models/model.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index b1cc6192b..811608847 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1003,11 +1003,18 @@ class FFI { downOrUp: down); } - Future getKeyboardMode(){ + Future getKeyboardMode() { return bind.sessionGetKeyboardName(id: id); } void enterOrLeave(bool enter) { + // Fix status + if (!enter) { + alt = false; + shift = false; + ctrl = false; + command = false; + } bind.sessionEnterOrLeave(id: id, enter: enter); } From afbdbe11fc2bafc3435198a4c06e354096d3dc57 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 6 Sep 2022 14:02:12 +0800 Subject: [PATCH 105/113] Opt: wayland map mode --- src/server/input_service.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 70af1e581..0088f7dad 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -595,6 +595,7 @@ pub fn handle_key(evt: &KeyEvent) { QUEUE.exec_async(move || handle_key_(&evt)); return; } + log::info!("{:?}", evt); handle_key_(evt); } @@ -647,6 +648,7 @@ fn map_keyboard_mode(evt: &KeyEvent) { let (click_capslock, click_numlock) = sync_status(evt); // Wayland + #[cfg(target_os = "linux")] if !*IS_X11.lock().unwrap() { let mut en = ENIGO.lock().unwrap(); let code = evt.chr() as u16; From f20587cbc091f6b858aec2d8d47e7e19c01cdd44 Mon Sep 17 00:00:00 2001 From: asur4s Date: Tue, 6 Sep 2022 04:38:51 -0400 Subject: [PATCH 106/113] Fix release super key --- flutter/lib/desktop/pages/remote_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index c2bf4ea5b..381c6e54b 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -332,7 +332,7 @@ class _RemotePageState extends State key == LogicalKeyboardKey.shiftLeft) { _ffi.shift = false; } else if (key == LogicalKeyboardKey.metaLeft || - key == LogicalKeyboardKey.metaRight) { + key == LogicalKeyboardKey.metaRight || key == LogicalKeyboardKey.superKey) { _ffi.command = false; } sendRawKey(e); From 4eaa17017ce55dc86e6ba1bd295843032e8cad63 Mon Sep 17 00:00:00 2001 From: asur4s Date: Tue, 6 Sep 2022 04:39:24 -0400 Subject: [PATCH 107/113] Refacotr enter or leave --- flutter/lib/models/model.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 811608847..81827fb81 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1010,10 +1010,7 @@ class FFI { void enterOrLeave(bool enter) { // Fix status if (!enter) { - alt = false; - shift = false; - ctrl = false; - command = false; + resetModifiers(); } bind.sessionEnterOrLeave(id: id, enter: enter); } From cc4e6b591d90285c51d385ca4525dae99efc08ea Mon Sep 17 00:00:00 2001 From: asur4s Date: Tue, 6 Sep 2022 07:09:24 -0400 Subject: [PATCH 108/113] Convet numpad --- src/ui_session_interface.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 3c6c21c3f..d5ed36665 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -60,8 +60,8 @@ impl Session { pub fn get_keyboard_mode(&self) -> String { return std::env::var("KEYBOARD_MODE") - .unwrap_or(String::from("legacy")) - .to_lowercase(); + .unwrap_or(String::from("legacy")) + .to_lowercase(); } pub fn save_keyboard_mode(&self, value: String) { @@ -301,16 +301,15 @@ impl Session { } else { key }; + #[cfg(not(windows))] + let key = self.convert_numpad_keys(key); let peer = self.peer_platform(); - let mut key_event = KeyEvent::new(); // According to peer platform. let keycode: u32 = if peer == "Linux" { rdev::linux_keycode_from_key(key).unwrap_or_default().into() } else if peer == "Windows" { - #[cfg(not(windows))] - let key = self.convert_numpad_keys(key); rdev::win_keycode_from_key(key).unwrap_or_default().into() } else { // Without Clear Key on Mac OS @@ -417,7 +416,7 @@ impl Session { if get_key_state(enigo::Key::CapsLock) { key_event.modifiers.push(ControlKey::CapsLock.into()); - } + } if self.peer_platform() != "Mac OS" { if get_key_state(enigo::Key::NumLock) { key_event.modifiers.push(ControlKey::NumLock.into()); @@ -1360,4 +1359,4 @@ async fn start_one_port_forward( async fn send_note(url: String, id: String, conn_id: i32, note: String) { let body = serde_json::json!({ "id": id, "Id": conn_id, "note": note }); allow_err!(crate::post_request(url, body.to_string(), "").await); -} \ No newline at end of file +} From f1c8b59a91ea1f7fe2a36bc21e53c78061ef4934 Mon Sep 17 00:00:00 2001 From: asur4s Date: Wed, 7 Sep 2022 04:04:07 -0400 Subject: [PATCH 109/113] Update lock file --- flutter/pubspec.lock | 4 ++-- rust-toolchain.toml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index d9205b76c..08af15b8d 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -250,8 +250,8 @@ packages: dependency: "direct main" description: path: "." - ref: e0368a023ba195462acc00d33ab361b499f0e413 - resolved-ref: e0368a023ba195462acc00d33ab361b499f0e413 + ref: fee851fa43116e0b91c39acd0ec37063dc6015f8 + resolved-ref: fee851fa43116e0b91c39acd0ec37063dc6015f8 url: "https://github.com/Kingtous/rustdesk_desktop_multi_window" source: git version: "0.1.0" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..24c182fd3 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.62.0" \ No newline at end of file From 4d3fa6955b6d52f64c19a4c4da09054ff2c8a19f Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 7 Sep 2022 16:57:27 +0800 Subject: [PATCH 110/113] Fix windows compile error --- flutter/pubspec.lock | 24 ++++++++++++------------ src/ui.rs | 23 ++++++++++++++++++++++- src/ui_interface.rs | 4 ++-- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 08af15b8d..586187be2 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -49,7 +49,7 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.9.0" + version: "2.8.2" back_button_interceptor: dependency: "direct main" description: @@ -147,7 +147,7 @@ packages: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.1" + version: "1.2.0" charcode: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.1" + version: "1.1.0" code_builder: dependency: transitive description: @@ -324,7 +324,7 @@ packages: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.1" + version: "1.3.0" ffi: dependency: "direct main" description: @@ -621,14 +621,14 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.12" + version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.5" + version: "0.1.4" menu_base: dependency: transitive description: @@ -642,7 +642,7 @@ packages: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0" + version: "1.7.0" mime: dependency: transitive description: @@ -719,7 +719,7 @@ packages: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.2" + version: "1.8.1" path_provider: dependency: "direct main" description: @@ -971,7 +971,7 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.0" + version: "1.8.2" sqflite: dependency: transitive description: @@ -1013,7 +1013,7 @@ packages: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.1" + version: "1.1.0" synchronized: dependency: transitive description: @@ -1027,14 +1027,14 @@ packages: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.12" + version: "0.4.9" timing: dependency: transitive description: diff --git a/src/ui.rs b/src/ui.rs index 30cbec9c4..25ad18521 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -58,6 +58,27 @@ lazy_static::lazy_static! { struct UIHostHandler; +fn check_connect_status( + reconnect: bool, +) -> ( + Arc>, + Arc>>, + mpsc::UnboundedSender, + Arc>, +) { + let status = Arc::new(Mutex::new((0, false, 0, "".to_owned()))); + let options = Arc::new(Mutex::new(Config::get_options())); + let cloned = status.clone(); + let cloned_options = options.clone(); + let (tx, rx) = mpsc::unbounded_channel::(); + let password = Arc::new(Mutex::new(String::default())); + let cloned_password = password.clone(); + std::thread::spawn(move || { + crate::ui_interface::check_connect_status_(reconnect, rx) + }); + (status, options, tx, password) +} + pub fn start(args: &mut [String]) { #[cfg(target_os = "macos")] if args.len() == 1 && args[0] == "--server" { @@ -86,7 +107,7 @@ pub fn start(args: &mut [String]) { } #[cfg(windows)] if args.len() > 0 && args[0] == "--tray" { - let options = crate::ui_interface::check_connect_status(false).1; + let options = check_connect_status(false).1; crate::tray::start_tray(options); return; } diff --git a/src/ui_interface.rs b/src/ui_interface.rs index f239cc54e..186381ce4 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -69,7 +69,7 @@ pub fn goto_install() { allow_err!(crate::run_me(vec!["--install"])); } -pub fn install_me(_options: String, _path: String, _silent: bool, _debug: bool) { +pub fn install_me(_options: String, _path: String, silent: bool, debug: bool) { #[cfg(windows)] std::thread::spawn(move || { allow_err!(crate::platform::windows::install_me( @@ -715,7 +715,7 @@ pub(crate) fn check_connect_status(reconnect: bool) -> mpsc::UnboundedSender) { +pub(crate) async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver) { let mut key_confirmed = false; let mut rx = rx; let mut mouse_time = 0; From afa9cda9bd68eca009bc3b659e30b3fe6915dc92 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 7 Sep 2022 16:58:44 +0800 Subject: [PATCH 111/113] Hide translate mode --- src/ui/header.tis | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ui/header.tis b/src/ui/header.tis index 870167eae..b274b0464 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -151,7 +151,6 @@ class Header: Reactor.Component {
  • {svg_checkmark}{translate('Legacy mode')}
  • {svg_checkmark}{translate('Map mode')}
  • -
  • {svg_checkmark}{translate('Translate mode')}
  • ; } From a3279de93a8bcce1675605ebfa83547e67545cf5 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 7 Sep 2022 17:07:36 +0800 Subject: [PATCH 112/113] Remove unnecessary log --- src/server/input_service.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 0088f7dad..d78441a18 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -595,7 +595,6 @@ pub fn handle_key(evt: &KeyEvent) { QUEUE.exec_async(move || handle_key_(&evt)); return; } - log::info!("{:?}", evt); handle_key_(evt); } From 09ad5e134cc575cf8d1357c1ed2f4505d26de8c7 Mon Sep 17 00:00:00 2001 From: Asura Date: Wed, 7 Sep 2022 18:04:43 +0800 Subject: [PATCH 113/113] doc: Add wayland instructions --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6598dd51c..8abfbc9d3 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,9 @@ Please download sciter dynamic library yourself. ### Ubuntu 18 (Debian 10) ```sh -sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake +sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev \ + libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake \ + libclang-dev ninja-build libayatana-appindicator3-1 libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libayatana-appindicator3-dev ``` ### Fedora 28 (CentOS 8) @@ -122,6 +124,30 @@ VCPKG_ROOT=$HOME/vcpkg cargo run RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) to configuring Xorg as the default GNOME session. +## Wayland support + +Wayland does not seem to provide any API for sending keypresses to other windows. Therefore, the rustdesk uses an API from a lower level, namely the `/dev/uinput` device (Linux kernel level). + +When wayland is the controlled side, you have to start in the following way: +```bash +# Start uinput service +$ sudo rustdesk --service +$ rustdesk +``` +**Notice**: Wayland screen recording uses different interfaces, currently currently only supports org.freedesktop.portal.ScreenCast. +```bash +$ dbus-send --session --print-reply \ + --dest=org.freedesktop.portal.Desktop \ + /org/freedesktop/portal/desktop \ + org.freedesktop.DBus.Properties.Get \ + string:org.freedesktop.portal.ScreenCast string:version +# Not support +Error org.freedesktop.DBus.Error.InvalidArgs: No such interface “org.freedesktop.portal.ScreenCast” +# Support +method return time=1662544486.931020 sender=:1.54 -> destination=:1.139 serial=257 reply_serial=2 + variant uint32 4 +``` + ## How to build with Docker Begin by cloning the repository and building the docker container: