Skip to content

Commit

Permalink
Merge branch 'rustdesk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo8418 authored Dec 25, 2024
2 parents bdfc19b + 1c62a28 commit 6dc2684
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
24 changes: 24 additions & 0 deletions src/client/io_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,28 @@ impl<T: InvokeUiSession> Remote<T> {
}

pub async fn io_loop(&mut self, key: &str, token: &str, round: u32) {
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
let _file_clip_context_holder = {
// `is_port_forward()` will not reach here, but we still check it for clarity.
if !self.handler.is_file_transfer() && !self.handler.is_port_forward() {
// It is ok to call this function multiple times.
ContextSend::enable(true);
Some(crate::SimpleCallOnReturn {
b: true,
f: Box::new(|| {
// No need to call `enable(false)` for sciter version, because each client of sciter version is a new process.
// It's better to check if the peers are windows(support file copy&paste), but it's not necessary.
#[cfg(feature = "flutter")]
if !crate::flutter::sessions::has_sessions_running(ConnType::DEFAULT_CONN) {
ContextSend::enable(false);
};
}),
})
} else {
None
}
};

let mut last_recv_time = Instant::now();
let mut received = false;
let conn_type = if self.handler.is_file_transfer() {
Expand Down Expand Up @@ -1199,6 +1221,7 @@ impl<T: InvokeUiSession> Remote<T> {
let peer_platform = pi.platform.clone();
self.set_peer_info(&pi);
self.handler.handle_peer_info(pi);
#[cfg(not(feature = "flutter"))]
self.check_clipboard_file_context();
if !(self.handler.is_file_transfer() || self.handler.is_port_forward()) {
#[cfg(feature = "flutter")]
Expand Down Expand Up @@ -1898,6 +1921,7 @@ impl<T: InvokeUiSession> Remote<T> {
true
}

#[cfg(not(feature = "flutter"))]
fn check_clipboard_file_context(&self) {
#[cfg(any(
target_os = "windows",
Expand Down
12 changes: 0 additions & 12 deletions src/ui_session_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,18 +1739,6 @@ impl<T: InvokeUiSession> Session<T> {

#[tokio::main(flavor = "current_thread")]
pub async fn io_loop<T: InvokeUiSession>(handler: Session<T>, round: u32) {
// It is ok to call this function multiple times.
#[cfg(any(
target_os = "windows",
all(
any(target_os = "linux", target_os = "macos"),
feature = "unix-file-copy-paste"
)
))]
if !handler.is_file_transfer() && !handler.is_port_forward() {
clipboard::ContextSend::enable(true);
}

#[cfg(any(target_os = "android", target_os = "ios"))]
let (sender, receiver) = mpsc::unbounded_channel::<Data>();
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Expand Down

0 comments on commit 6dc2684

Please sign in to comment.