Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: build (#10364)

fufesou1c62a28ef390
diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs
index 24cc60eb4..bdfa8f1e2 100644
--- a/src/client/io_loop.rs
+++ b/src/client/io_loop.rs
@@ -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() {
@@ -310,12 +332,6 @@ impl<T: InvokeUiSession> Remote<T> {
Ok(())
});
}
-
- // It's better to check if the peers are windows, but it's not necessary.
- #[cfg(feature = "flutter")]
- if !crate::flutter::sessions::has_sessions_running(ConnType::DEFAULT_CONN) {
- ContextSend::enable(false);
- }
}
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs
index 14baa6946..f76bd4e94 100644
--- a/src/ui_session_interface.rs
+++ b/src/ui_session_interface.rs
@@ -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")))]