mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Merge pull request #5489 from fufesou/fix/enable_menu_before_image
Fix/enable menu before image
This commit is contained in:
@@ -57,7 +57,10 @@ use scrap::{
|
||||
ImageFormat, ImageRgb,
|
||||
};
|
||||
|
||||
use crate::is_keyboard_mode_supported;
|
||||
use crate::{
|
||||
common::input::{MOUSE_BUTTON_LEFT, MOUSE_TYPE_DOWN, MOUSE_TYPE_UP},
|
||||
is_keyboard_mode_supported,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
@@ -2057,13 +2060,20 @@ pub fn send_pointer_device_event(
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `interface` - The interface for sending data.
|
||||
fn activate_os(interface: &impl Interface) {
|
||||
/// * `send_click` - Whether to send a click event.
|
||||
fn activate_os(interface: &impl Interface, send_click: bool) {
|
||||
let left_down = MOUSE_BUTTON_LEFT << 3 | MOUSE_TYPE_DOWN;
|
||||
let left_up = MOUSE_BUTTON_LEFT << 3 | MOUSE_TYPE_UP;
|
||||
send_mouse(left_up, 0, 0, false, false, false, false, interface);
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
send_mouse(0, 0, 0, false, false, false, false, interface);
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
send_mouse(0, 3, 3, false, false, false, false, interface);
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
send_mouse(1 | 1 << 3, 0, 0, false, false, false, false, interface);
|
||||
send_mouse(2 | 1 << 3, 0, 0, false, false, false, false, interface);
|
||||
if send_click {
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
send_mouse(left_down, 0, 0, false, false, false, false, interface);
|
||||
send_mouse(left_up, 0, 0, false, false, false, false, interface);
|
||||
}
|
||||
/*
|
||||
let mut key_event = KeyEvent::new();
|
||||
// do not use Esc, which has problem with Linux
|
||||
@@ -2096,10 +2106,15 @@ pub fn input_os_password(p: String, activate: bool, interface: impl Interface) {
|
||||
/// * `activate` - Whether to activate OS.
|
||||
/// * `interface` - The interface for sending data.
|
||||
fn _input_os_password(p: String, activate: bool, interface: impl Interface) {
|
||||
let input_password = !p.is_empty();
|
||||
if activate {
|
||||
activate_os(&interface);
|
||||
// Click event is used to bring up the password input box.
|
||||
activate_os(&interface, input_password);
|
||||
std::thread::sleep(Duration::from_millis(1200));
|
||||
}
|
||||
if !input_password {
|
||||
return;
|
||||
}
|
||||
let mut key_event = KeyEvent::new();
|
||||
key_event.press = true;
|
||||
let mut msg_out = Message::new();
|
||||
|
||||
@@ -25,7 +25,7 @@ use hbb_common::{
|
||||
protobuf::Enum,
|
||||
protobuf::Message as _,
|
||||
rendezvous_proto::*,
|
||||
sleep, socket_client,
|
||||
socket_client,
|
||||
tcp::FramedStream,
|
||||
tokio, ResultType,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user