mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-12 04:01:29 +03:00
add cursor active logic for portable service
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -245,10 +245,19 @@ pub mod server {
|
||||
threads.push(std::thread::spawn(|| {
|
||||
run_exit_check();
|
||||
}));
|
||||
let record_pos_handle = crate::input_service::try_start_record_cursor_pos();
|
||||
for th in threads.drain(..) {
|
||||
th.join().unwrap();
|
||||
log::info!("thread joined");
|
||||
}
|
||||
|
||||
crate::input_service::try_stop_record_cursor_pos();
|
||||
if let Some(handle) = record_pos_handle {
|
||||
match handle.join() {
|
||||
Ok(_) => log::info!("record_pos_handle joined"),
|
||||
Err(e) => log::error!("record_pos_handle join error {:?}", &e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn run_exit_check() {
|
||||
@@ -452,9 +461,9 @@ pub mod server {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Mouse(v) => {
|
||||
Mouse((v, conn)) => {
|
||||
if let Ok(evt) = MouseEvent::parse_from_bytes(&v) {
|
||||
crate::input_service::handle_mouse_(&evt, 0);
|
||||
crate::input_service::handle_mouse_(&evt, conn);
|
||||
}
|
||||
}
|
||||
Key(v) => {
|
||||
@@ -847,10 +856,12 @@ pub mod client {
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_mouse_(evt: &MouseEvent) -> ResultType<()> {
|
||||
fn handle_mouse_(evt: &MouseEvent, conn: i32) -> ResultType<()> {
|
||||
let mut v = vec![];
|
||||
evt.write_to_vec(&mut v)?;
|
||||
ipc_send(Data::DataPortableService(DataPortableService::Mouse(v)))
|
||||
ipc_send(Data::DataPortableService(DataPortableService::Mouse((
|
||||
v, conn,
|
||||
))))
|
||||
}
|
||||
|
||||
fn handle_key_(evt: &KeyEvent) -> ResultType<()> {
|
||||
@@ -890,11 +901,11 @@ pub mod client {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_mouse(evt: &MouseEvent) {
|
||||
pub fn handle_mouse(evt: &MouseEvent, conn: i32) {
|
||||
if RUNNING.lock().unwrap().clone() {
|
||||
handle_mouse_(evt).ok();
|
||||
handle_mouse_(evt, conn).ok();
|
||||
} else {
|
||||
crate::input_service::handle_mouse_(evt, 0);
|
||||
crate::input_service::handle_mouse_(evt, conn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user