mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-03 19:39:20 +08:00
opt: catch error of grab
This commit is contained in:
parent
bdd0fbbe6c
commit
941b7a365b
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -1533,7 +1533,7 @@ dependencies = [
|
||||
"log",
|
||||
"objc",
|
||||
"pkg-config",
|
||||
"rdev 0.5.0-2 (git+https://github.com/asur4s/rdev)",
|
||||
"rdev",
|
||||
"serde 1.0.147",
|
||||
"serde_derive",
|
||||
"tfc",
|
||||
@ -4229,29 +4229,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rdev"
|
||||
version = "0.5.0-2"
|
||||
source = "git+https://github.com/asur4s/rdev#4051761e7ccf434a443b8e9592c23160c9cace56"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-foundation 0.9.3",
|
||||
"core-foundation-sys 0.8.3",
|
||||
"core-graphics 0.22.3",
|
||||
"enum-map",
|
||||
"epoll",
|
||||
"inotify",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"mio 0.8.5",
|
||||
"strum 0.24.1",
|
||||
"strum_macros 0.24.3",
|
||||
"widestring 1.0.2",
|
||||
"winapi 0.3.9",
|
||||
"x11 2.20.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rdev"
|
||||
version = "0.5.0-2"
|
||||
source = "git+https://github.com/rustdesk/rdev#25c29f61bfdf5d8ec50f0a8a7743bc1d85eb2c04"
|
||||
source = "git+https://github.com/asur4s/rdev#3d6d413a9b2ab703edc22071acea31826b0efce3"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-foundation 0.9.3",
|
||||
@ -4540,7 +4518,7 @@ dependencies = [
|
||||
"num_cpus",
|
||||
"objc",
|
||||
"parity-tokio-ipc",
|
||||
"rdev 0.5.0-2 (git+https://github.com/rustdesk/rdev)",
|
||||
"rdev",
|
||||
"repng",
|
||||
"reqwest",
|
||||
"rpassword 7.1.0",
|
||||
|
@ -63,7 +63,7 @@ default-net = "0.11.0"
|
||||
wol-rs = "0.9.1"
|
||||
flutter_rust_bridge = { git = "https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge", optional = true }
|
||||
errno = "0.2.8"
|
||||
rdev = { git = "https://github.com/rustdesk/rdev" }
|
||||
rdev = { git = "https://github.com/asur4s/rdev" }
|
||||
url = { version = "2.1", features = ["serde"] }
|
||||
|
||||
reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls"], default-features=false }
|
||||
|
@ -7,7 +7,7 @@ use crate::flutter::FlutterHandler;
|
||||
use crate::ui::remote::SciterHandler;
|
||||
use crate::ui_session_interface::Session;
|
||||
use hbb_common::{log, message_proto::*};
|
||||
use rdev::{Event, EventType, Key};
|
||||
use rdev::{Event, EventType, Key, GrabError};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
sync::{
|
||||
@ -79,7 +79,7 @@ pub mod client {
|
||||
KEYBOARD_HOOKED.swap(true, Ordering::SeqCst);
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
rdev::enable_grab().ok();
|
||||
rdev::enable_grab();
|
||||
}
|
||||
GrabState::Wait => {
|
||||
release_remote_keys();
|
||||
@ -88,11 +88,11 @@ pub mod client {
|
||||
KEYBOARD_HOOKED.swap(false, Ordering::SeqCst);
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
rdev::disable_grab().ok();
|
||||
rdev::disable_grab();
|
||||
}
|
||||
GrabState::Exit => {
|
||||
#[cfg(target_os = "linux")]
|
||||
rdev::exit_grab_listen().ok();
|
||||
rdev::exit_grab_listen();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ pub fn start_grab_loop() {
|
||||
});
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
rdev::start_grab_listen(move |event: Event| match event.event_type {
|
||||
if let Err(err) = rdev::start_grab_listen(move |event: Event| match event.event_type {
|
||||
EventType::KeyPress(key) | EventType::KeyRelease(key) => {
|
||||
if let Key::Unknown(keycode) = key {
|
||||
log::error!("rdev get unknown key, keycode is : {:?}", keycode);
|
||||
@ -224,7 +224,9 @@ pub fn start_grab_loop() {
|
||||
None
|
||||
}
|
||||
_ => Some(event),
|
||||
});
|
||||
}) {
|
||||
log::error!("Failed to init rdev grab thread: {:?}", err);
|
||||
};
|
||||
}
|
||||
|
||||
pub fn is_long_press(event: &Event) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user