patch: make linux build ok
Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
parent
7aee76f5de
commit
30e85c8654
@ -40,7 +40,6 @@ use utf16string::WStr;
|
|||||||
|
|
||||||
use crate::{send_data, ClipboardFile, CliprdrError};
|
use crate::{send_data, ClipboardFile, CliprdrError};
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
use super::LDAP_EPOCH_DELTA;
|
use super::LDAP_EPOCH_DELTA;
|
||||||
|
|
||||||
/// fuse server ready retry max times
|
/// fuse server ready retry max times
|
||||||
|
@ -21,7 +21,7 @@ pub mod fuse;
|
|||||||
#[cfg(feature = "unix-file-copy-paste")]
|
#[cfg(feature = "unix-file-copy-paste")]
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
pub mod unix;
|
pub mod unix;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
pub fn create_cliprdr_context(
|
pub fn create_cliprdr_context(
|
||||||
_enable_files: bool,
|
_enable_files: bool,
|
||||||
_enable_others: bool,
|
_enable_others: bool,
|
||||||
@ -52,11 +52,11 @@ pub fn create_cliprdr_context(
|
|||||||
log::warn!("umount {:?} may fail: {:?}", mnt_path, e);
|
log::warn!("umount {:?} may fail: {:?}", mnt_path, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
let linux_ctx = unix::ClipboardContext::new(timeout, mnt_path.parse().unwrap())?;
|
let unix_ctx = unix::ClipboardContext::new(timeout, mnt_path.parse().unwrap())?;
|
||||||
log::debug!("start cliprdr FUSE");
|
log::debug!("start cliprdr FUSE");
|
||||||
linux_ctx.run().expect("failed to start cliprdr FUSE");
|
unix_ctx.run().expect("failed to start cliprdr FUSE");
|
||||||
|
|
||||||
Ok(Box::new(linux_ctx) as Box<_>)
|
Ok(Box::new(unix_ctx) as Box<_>)
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "unix-file-copy-paste"))]
|
#[cfg(not(feature = "unix-file-copy-paste"))]
|
||||||
return Ok(Box::new(DummyCliprdrContext {}) as Box<_>);
|
return Ok(Box::new(DummyCliprdrContext {}) as Box<_>);
|
||||||
@ -83,5 +83,4 @@ impl CliprdrServiceContext for DummyCliprdrContext {
|
|||||||
#[cfg(feature = "unix-file-copy-paste")]
|
#[cfg(feature = "unix-file-copy-paste")]
|
||||||
// begin of epoch used by microsoft
|
// begin of epoch used by microsoft
|
||||||
// 1601-01-01 00:00:00 + LDAP_EPOCH_DELTA*(100 ns) = 1970-01-01 00:00:00
|
// 1601-01-01 00:00:00 + LDAP_EPOCH_DELTA*(100 ns) = 1970-01-01 00:00:00
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
const LDAP_EPOCH_DELTA: u64 = 116444772610000000;
|
const LDAP_EPOCH_DELTA: u64 = 116444772610000000;
|
||||||
|
@ -19,14 +19,17 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use self::local_file::LocalFile;
|
use self::local_file::LocalFile;
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
use self::url::{encode_path_to_uri, parse_plain_uri_list};
|
use self::url::{encode_path_to_uri, parse_plain_uri_list};
|
||||||
|
|
||||||
use super::fuse::FuseServer;
|
use super::fuse::FuseServer;
|
||||||
|
|
||||||
#[cfg(not(feature = "wayland"))]
|
#[cfg(target_os = "linux")]
|
||||||
pub mod x11;
|
pub mod x11;
|
||||||
|
|
||||||
pub mod local_file;
|
pub mod local_file;
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
pub mod url;
|
pub mod url;
|
||||||
|
|
||||||
// not actual format id, just a placeholder
|
// not actual format id, just a placeholder
|
||||||
@ -66,6 +69,7 @@ trait SysClipboard: Send + Sync {
|
|||||||
fn get_file_list(&self) -> Vec<PathBuf>;
|
fn get_file_list(&self) -> Vec<PathBuf>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn get_sys_clipboard(ignore_path: &PathBuf) -> Result<Box<dyn SysClipboard>, CliprdrError> {
|
fn get_sys_clipboard(ignore_path: &PathBuf) -> Result<Box<dyn SysClipboard>, CliprdrError> {
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
{
|
{
|
||||||
@ -79,6 +83,11 @@ fn get_sys_clipboard(ignore_path: &PathBuf) -> Result<Box<dyn SysClipboard>, Cli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
fn get_sys_clipboard(ignore_path: &PathBuf) -> Result<Box<dyn SysClipboard>, CliprdrError> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum FileContentsRequest {
|
enum FileContentsRequest {
|
||||||
Size {
|
Size {
|
||||||
|
@ -7,14 +7,14 @@ use std::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
use clipboard::ContextSend;
|
use clipboard::ContextSend;
|
||||||
use crossbeam_queue::ArrayQueue;
|
use crossbeam_queue::ArrayQueue;
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
use hbb_common::sleep;
|
use hbb_common::sleep;
|
||||||
#[cfg(not(target_os = "ios"))]
|
#[cfg(not(target_os = "ios"))]
|
||||||
use hbb_common::tokio::sync::mpsc::error::TryRecvError;
|
use hbb_common::tokio::sync::mpsc::error::TryRecvError;
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
use hbb_common::tokio::sync::Mutex as TokioMutex;
|
use hbb_common::tokio::sync::Mutex as TokioMutex;
|
||||||
use hbb_common::{
|
use hbb_common::{
|
||||||
allow_err,
|
allow_err,
|
||||||
@ -66,7 +66,7 @@ pub struct Remote<T: InvokeUiSession> {
|
|||||||
last_update_jobs_status: (Instant, HashMap<i32, u64>),
|
last_update_jobs_status: (Instant, HashMap<i32, u64>),
|
||||||
is_connected: bool,
|
is_connected: bool,
|
||||||
first_frame: bool,
|
first_frame: bool,
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
client_conn_id: i32, // used for file clipboard
|
client_conn_id: i32, // used for file clipboard
|
||||||
data_count: Arc<AtomicUsize>,
|
data_count: Arc<AtomicUsize>,
|
||||||
frame_count_map: Arc<RwLock<HashMap<usize, usize>>>,
|
frame_count_map: Arc<RwLock<HashMap<usize, usize>>>,
|
||||||
@ -101,7 +101,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
last_update_jobs_status: (Instant::now(), Default::default()),
|
last_update_jobs_status: (Instant::now(), Default::default()),
|
||||||
is_connected: false,
|
is_connected: false,
|
||||||
first_frame: false,
|
first_frame: false,
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
client_conn_id: 0,
|
client_conn_id: 0,
|
||||||
data_count: Arc::new(AtomicUsize::new(0)),
|
data_count: Arc::new(AtomicUsize::new(0)),
|
||||||
frame_count_map,
|
frame_count_map,
|
||||||
@ -146,14 +146,14 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// just build for now
|
// just build for now
|
||||||
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
|
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
|
||||||
let (_tx_holder, mut rx_clip_client) = mpsc::unbounded_channel::<i32>();
|
let (_tx_holder, mut rx_clip_client) = mpsc::unbounded_channel::<i32>();
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
let (_tx_holder, rx) = mpsc::unbounded_channel();
|
let (_tx_holder, rx) = mpsc::unbounded_channel();
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
let mut rx_clip_client_lock = Arc::new(TokioMutex::new(rx));
|
let mut rx_clip_client_lock = Arc::new(TokioMutex::new(rx));
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
{
|
{
|
||||||
let is_conn_not_default = self.handler.is_file_transfer()
|
let is_conn_not_default = self.handler.is_file_transfer()
|
||||||
|| self.handler.is_port_forward()
|
|| self.handler.is_port_forward()
|
||||||
@ -164,7 +164,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
clipboard::get_rx_cliprdr_client(&self.handler.id);
|
clipboard::get_rx_cliprdr_client(&self.handler.id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
let mut rx_clip_client = rx_clip_client_lock.lock().await;
|
let mut rx_clip_client = rx_clip_client_lock.lock().await;
|
||||||
|
|
||||||
let mut status_timer = time::interval(Duration::new(1, 0));
|
let mut status_timer = time::interval(Duration::new(1, 0));
|
||||||
@ -210,7 +210,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_msg = rx_clip_client.recv() => {
|
_msg = rx_clip_client.recv() => {
|
||||||
#[cfg(any(target_os="windows", target_os="linux"))]
|
#[cfg(any(target_os="windows", target_os="linux", target_os = "macos"))]
|
||||||
self.handle_local_clipboard_msg(&mut peer, _msg).await;
|
self.handle_local_clipboard_msg(&mut peer, _msg).await;
|
||||||
}
|
}
|
||||||
_ = self.timer.tick() => {
|
_ = self.timer.tick() => {
|
||||||
@ -278,7 +278,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
Client::try_stop_clipboard(&self.handler.id);
|
Client::try_stop_clipboard(&self.handler.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
if _set_disconnected_ok {
|
if _set_disconnected_ok {
|
||||||
let conn_id = self.client_conn_id;
|
let conn_id = self.client_conn_id;
|
||||||
log::debug!("try empty cliprdr for conn_id {}", conn_id);
|
log::debug!("try empty cliprdr for conn_id {}", conn_id);
|
||||||
@ -289,7 +289,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
async fn handle_local_clipboard_msg(
|
async fn handle_local_clipboard_msg(
|
||||||
&self,
|
&self,
|
||||||
peer: &mut crate::client::FramedStream,
|
peer: &mut crate::client::FramedStream,
|
||||||
@ -1143,7 +1143,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
Some(message::Union::Cliprdr(clip)) => {
|
Some(message::Union::Cliprdr(clip)) => {
|
||||||
self.handle_cliprdr_msg(clip);
|
self.handle_cliprdr_msg(clip);
|
||||||
}
|
}
|
||||||
@ -1718,7 +1718,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
fn handle_cliprdr_msg(&self, clip: hbb_common::message_proto::Cliprdr) {
|
fn handle_cliprdr_msg(&self, clip: hbb_common::message_proto::Cliprdr) {
|
||||||
log::debug!("handling cliprdr msg from server peer");
|
log::debug!("handling cliprdr msg from server peer");
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
|
@ -58,7 +58,7 @@ mod ui_session_interface;
|
|||||||
|
|
||||||
mod hbbs_http;
|
mod hbbs_http;
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
pub mod clipboard_file;
|
pub mod clipboard_file;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::{input_service::*, *};
|
use super::{input_service::*, *};
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
use crate::clipboard_file::*;
|
use crate::clipboard_file::*;
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
use crate::common::update_clipboard;
|
use crate::common::update_clipboard;
|
||||||
@ -192,7 +192,7 @@ pub struct Connection {
|
|||||||
// by peer
|
// by peer
|
||||||
disable_audio: bool,
|
disable_audio: bool,
|
||||||
// by peer
|
// by peer
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
enable_file_transfer: bool,
|
enable_file_transfer: bool,
|
||||||
// by peer
|
// by peer
|
||||||
audio_sender: Option<MediaSender>,
|
audio_sender: Option<MediaSender>,
|
||||||
@ -330,7 +330,7 @@ impl Connection {
|
|||||||
show_remote_cursor: false,
|
show_remote_cursor: false,
|
||||||
ip: "".to_owned(),
|
ip: "".to_owned(),
|
||||||
disable_audio: false,
|
disable_audio: false,
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
enable_file_transfer: false,
|
enable_file_transfer: false,
|
||||||
disable_clipboard: false,
|
disable_clipboard: false,
|
||||||
disable_keyboard: false,
|
disable_keyboard: false,
|
||||||
@ -1032,7 +1032,7 @@ impl Connection {
|
|||||||
pi.hostname = DEVICE_NAME.lock().unwrap().clone();
|
pi.hostname = DEVICE_NAME.lock().unwrap().clone();
|
||||||
pi.platform = "Android".into();
|
pi.platform = "Android".into();
|
||||||
}
|
}
|
||||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
|
||||||
let mut platform_additions = serde_json::Map::new();
|
let mut platform_additions = serde_json::Map::new();
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
@ -1247,7 +1247,7 @@ impl Connection {
|
|||||||
self.audio && !self.disable_audio
|
self.audio && !self.disable_audio
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
fn file_transfer_enabled(&self) -> bool {
|
fn file_transfer_enabled(&self) -> bool {
|
||||||
self.file && self.enable_file_transfer
|
self.file && self.enable_file_transfer
|
||||||
}
|
}
|
||||||
@ -1817,7 +1817,7 @@ impl Connection {
|
|||||||
}
|
}
|
||||||
Some(message::Union::Cliprdr(_clip)) =>
|
Some(message::Union::Cliprdr(_clip)) =>
|
||||||
{
|
{
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
if let Some(clip) = msg_2_clip(_clip) {
|
if let Some(clip) = msg_2_clip(_clip) {
|
||||||
log::debug!("got clipfile from client peer");
|
log::debug!("got clipfile from client peer");
|
||||||
self.send_to_cm(ipc::Data::ClipboardFile(clip))
|
self.send_to_cm(ipc::Data::ClipboardFile(clip))
|
||||||
@ -2401,7 +2401,7 @@ impl Connection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
if let Ok(q) = o.enable_file_transfer.enum_value() {
|
if let Ok(q) = o.enable_file_transfer.enum_value() {
|
||||||
if q != BoolOption::NotSet {
|
if q != BoolOption::NotSet {
|
||||||
self.enable_file_transfer = q == BoolOption::Yes;
|
self.enable_file_transfer = q == BoolOption::Yes;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
@ -15,11 +15,11 @@ use std::{
|
|||||||
use crate::ipc::Connection;
|
use crate::ipc::Connection;
|
||||||
#[cfg(not(any(target_os = "ios")))]
|
#[cfg(not(any(target_os = "ios")))]
|
||||||
use crate::ipc::{self, Data};
|
use crate::ipc::{self, Data};
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
use clipboard::ContextSend;
|
use clipboard::ContextSend;
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
use hbb_common::tokio::sync::mpsc::unbounded_channel;
|
use hbb_common::tokio::sync::mpsc::unbounded_channel;
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
use hbb_common::tokio::sync::Mutex as TokioMutex;
|
use hbb_common::tokio::sync::Mutex as TokioMutex;
|
||||||
use hbb_common::{
|
use hbb_common::{
|
||||||
allow_err,
|
allow_err,
|
||||||
@ -70,9 +70,9 @@ struct IpcTaskRunner<T: InvokeUiCM> {
|
|||||||
close: bool,
|
close: bool,
|
||||||
running: bool,
|
running: bool,
|
||||||
conn_id: i32,
|
conn_id: i32,
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
file_transfer_enabled: bool,
|
file_transfer_enabled: bool,
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
file_transfer_enabled_peer: bool,
|
file_transfer_enabled_peer: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
fn is_authorized(&self, id: i32) -> bool {
|
fn is_authorized(&self, id: i32) -> bool {
|
||||||
CLIENTS
|
CLIENTS
|
||||||
.read()
|
.read()
|
||||||
@ -186,7 +186,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
|
|||||||
.map(|c| c.disconnected = true);
|
.map(|c| c.disconnected = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
{
|
{
|
||||||
let _ = ContextSend::proc(|context| -> ResultType<()> {
|
let _ = ContextSend::proc(|context| -> ResultType<()> {
|
||||||
context.empty_clipboard(id)?;
|
context.empty_clipboard(id)?;
|
||||||
@ -330,14 +330,14 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
// for tmp use, without real conn id
|
// for tmp use, without real conn id
|
||||||
let mut write_jobs: Vec<fs::TransferJob> = Vec::new();
|
let mut write_jobs: Vec<fs::TransferJob> = Vec::new();
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
let is_authorized = self.cm.is_authorized(self.conn_id);
|
let is_authorized = self.cm.is_authorized(self.conn_id);
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
let rx_clip1;
|
let rx_clip1;
|
||||||
let mut rx_clip;
|
let mut rx_clip;
|
||||||
let _tx_clip;
|
let _tx_clip;
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
if self.conn_id > 0 && is_authorized {
|
if self.conn_id > 0 && is_authorized {
|
||||||
log::debug!("Clipboard is enabled from client peer: type 1");
|
log::debug!("Clipboard is enabled from client peer: type 1");
|
||||||
rx_clip1 = clipboard::get_rx_cliprdr_server(self.conn_id);
|
rx_clip1 = clipboard::get_rx_cliprdr_server(self.conn_id);
|
||||||
@ -349,12 +349,12 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
rx_clip1 = Arc::new(TokioMutex::new(rx_clip2));
|
rx_clip1 = Arc::new(TokioMutex::new(rx_clip2));
|
||||||
rx_clip = rx_clip1.lock().await;
|
rx_clip = rx_clip1.lock().await;
|
||||||
}
|
}
|
||||||
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
|
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
|
||||||
{
|
{
|
||||||
(_tx_clip, rx_clip) = unbounded_channel::<i32>();
|
(_tx_clip, rx_clip) = unbounded_channel::<i32>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
{
|
{
|
||||||
if ContextSend::is_enabled() {
|
if ContextSend::is_enabled() {
|
||||||
log::debug!("Clipboard is enabled");
|
log::debug!("Clipboard is enabled");
|
||||||
@ -382,7 +382,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
log::debug!("conn_id: {}", id);
|
log::debug!("conn_id: {}", id);
|
||||||
self.cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, from_switch,self.tx.clone());
|
self.cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, from_switch,self.tx.clone());
|
||||||
self.conn_id = id;
|
self.conn_id = id;
|
||||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
|
||||||
{
|
{
|
||||||
self.file_transfer_enabled = _file_transfer_enabled;
|
self.file_transfer_enabled = _file_transfer_enabled;
|
||||||
}
|
}
|
||||||
@ -425,7 +425,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
}
|
}
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
Data::ClipboardFile(_clip) => {
|
Data::ClipboardFile(_clip) => {
|
||||||
#[cfg(any(target_os = "windows", target_os="linux"))]
|
#[cfg(any(target_os = "windows", target_os="linux", target_os = "macos"))]
|
||||||
{
|
{
|
||||||
let is_stopping_allowed = _clip.is_stopping_allowed_from_peer();
|
let is_stopping_allowed = _clip.is_stopping_allowed_from_peer();
|
||||||
let is_clipboard_enabled = ContextSend::is_enabled();
|
let is_clipboard_enabled = ContextSend::is_enabled();
|
||||||
@ -504,7 +504,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
},
|
},
|
||||||
clip_file = rx_clip.recv() => match clip_file {
|
clip_file = rx_clip.recv() => match clip_file {
|
||||||
Some(_clip) => {
|
Some(_clip) => {
|
||||||
#[cfg(any(target_os = "windows", target_os ="linux"))]
|
#[cfg(any(target_os = "windows", target_os ="linux", target_os = "macos"))]
|
||||||
{
|
{
|
||||||
let is_stopping_allowed = _clip.is_stopping_allowed();
|
let is_stopping_allowed = _clip.is_stopping_allowed();
|
||||||
let is_clipboard_enabled = ContextSend::is_enabled();
|
let is_clipboard_enabled = ContextSend::is_enabled();
|
||||||
@ -543,9 +543,9 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
close: true,
|
close: true,
|
||||||
running: true,
|
running: true,
|
||||||
conn_id: 0,
|
conn_id: 0,
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
file_transfer_enabled: false,
|
file_transfer_enabled: false,
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
file_transfer_enabled_peer: false,
|
file_transfer_enabled_peer: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
|||||||
let mut mouse_time = 0;
|
let mut mouse_time = 0;
|
||||||
#[cfg(not(feature = "flutter"))]
|
#[cfg(not(feature = "flutter"))]
|
||||||
let mut id = "".to_owned();
|
let mut id = "".to_owned();
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
#[allow(unused_mut, dead_code)]
|
#[allow(unused_mut, dead_code)]
|
||||||
let mut enable_file_transfer = "".to_owned();
|
let mut enable_file_transfer = "".to_owned();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user