mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -1177,14 +1177,39 @@ pub fn session_send_pointer(session_id: SessionID, msg: String) {
|
||||
let ctrl = m.get("ctrl").is_some();
|
||||
let shift = m.get("shift").is_some();
|
||||
let command = m.get("command").is_some();
|
||||
if let Some(touch_event) = m.get("touch") {
|
||||
if let Some(scale) = touch_event.get("scale") {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&session_id) {
|
||||
if let Some(scale) = scale.as_i64() {
|
||||
session.send_touch_scale(scale as _, alt, ctrl, shift, command);
|
||||
}
|
||||
}
|
||||
}
|
||||
match (m.get("k"), m.get("v")) {
|
||||
(Some(k), Some(v)) => match k.as_str() {
|
||||
Some("touch") => match v.as_str() {
|
||||
Some("scale") => match v.get("v") {
|
||||
Some(scale) => {
|
||||
if let Some(scale) = scale.as_i64() {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&session_id) {
|
||||
session.send_touch_scale(scale as _, alt, ctrl, shift, command);
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {}
|
||||
},
|
||||
Some(pan_event) => match (v.get("x"), v.get("y")) {
|
||||
(Some(x), Some(y)) => {
|
||||
if let Some(x) = x.as_i64() {
|
||||
if let Some(y) = y.as_i64() {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&session_id)
|
||||
{
|
||||
session.send_touch_pan_event(
|
||||
pan_event, x as _, y as _, alt, ctrl, shift, command,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,20 +1573,20 @@ impl Connection {
|
||||
pan_start.y,
|
||||
)
|
||||
}
|
||||
Some(touch_event::Union::PanUpdate(pan_start)) => {
|
||||
Some(touch_event::Union::PanUpdate(pan_update)) => {
|
||||
call_main_service_pointer_input(
|
||||
"touch".to_string(),
|
||||
5,
|
||||
pan_start.x,
|
||||
pan_start.y,
|
||||
pan_update.x,
|
||||
pan_update.y,
|
||||
)
|
||||
}
|
||||
Some(touch_event::Union::PanEnd(pan_start)) => {
|
||||
Some(touch_event::Union::PanEnd(pan_end)) => {
|
||||
call_main_service_pointer_input(
|
||||
"touch".to_string(),
|
||||
6,
|
||||
pan_start.x,
|
||||
pan_start.y,
|
||||
pan_end.x,
|
||||
pan_end.y,
|
||||
)
|
||||
}
|
||||
_ => Ok(()),
|
||||
|
||||
@@ -724,6 +724,49 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
send_pointer_device_event(evt, alt, ctrl, shift, command, self);
|
||||
}
|
||||
|
||||
pub fn send_touch_pan_event(
|
||||
&self,
|
||||
event: &str,
|
||||
x: i32,
|
||||
y: i32,
|
||||
alt: bool,
|
||||
ctrl: bool,
|
||||
shift: bool,
|
||||
command: bool,
|
||||
) {
|
||||
let mut touch_evt = TouchEvent::new();
|
||||
match event {
|
||||
"pan_start" => {
|
||||
touch_evt.set_pan_start(TouchPanStart {
|
||||
x,
|
||||
y,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
"pan_update" => {
|
||||
touch_evt.set_pan_update(TouchPanUpdate {
|
||||
x,
|
||||
y,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
"pan_end" => {
|
||||
touch_evt.set_pan_end(TouchPanEnd {
|
||||
x,
|
||||
y,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
_ => {
|
||||
log::warn!("unknown touch pan event: {}", event);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let mut evt = PointerDeviceEvent::new();
|
||||
evt.set_touch_event(touch_evt);
|
||||
send_pointer_device_event(evt, alt, ctrl, shift, command, self);
|
||||
}
|
||||
|
||||
pub fn send_mouse(
|
||||
&self,
|
||||
mask: i32,
|
||||
|
||||
Reference in New Issue
Block a user