patch: linux fuse unmount

todo: grosely exit

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
ClSlaid
2023-09-09 19:24:38 +08:00
parent e5bcfeaad5
commit 3a21efbaae
11 changed files with 185 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
use super::{input_service::*, *};
#[cfg(windows)]
#[cfg(any(target_os = "windows", target_os = "linux"))]
use crate::clipboard_file::*;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::common::update_clipboard;
@@ -175,7 +175,7 @@ pub struct Connection {
// by peer
disable_audio: bool,
// by peer
#[cfg(windows)]
#[cfg(any(target_os = "windows", target_os = "linux"))]
enable_file_transfer: bool,
// by peer
audio_sender: Option<MediaSender>,
@@ -310,7 +310,7 @@ impl Connection {
show_remote_cursor: false,
ip: "".to_owned(),
disable_audio: false,
#[cfg(windows)]
#[cfg(any(target_os = "windows", target_os = "linux"))]
enable_file_transfer: false,
disable_clipboard: false,
disable_keyboard: false,
@@ -457,7 +457,7 @@ impl Connection {
ipc::Data::RawMessage(bytes) => {
allow_err!(conn.stream.send_raw(bytes).await);
}
#[cfg(windows)]
#[cfg(any(target_os="windows", target_os="linux"))]
ipc::Data::ClipboardFile(clip) => {
allow_err!(conn.stream.send(&clip_2_msg(clip)).await);
}
@@ -1156,7 +1156,7 @@ impl Connection {
self.audio && !self.disable_audio
}
#[cfg(windows)]
#[cfg(any(target_os = "windows", target_os = "linux"))]
fn file_transfer_enabled(&self) -> bool {
self.file && self.enable_file_transfer
}
@@ -1706,7 +1706,7 @@ impl Connection {
}
Some(message::Union::Cliprdr(_clip)) =>
{
#[cfg(windows)]
#[cfg(any(target_os = "windows", target_os = "linux"))]
if let Some(clip) = msg_2_clip(_clip) {
self.send_to_cm(ipc::Data::ClipboardFile(clip))
}
@@ -2156,7 +2156,7 @@ impl Connection {
}
}
}
#[cfg(windows)]
#[cfg(any(target_os = "windows", target_os = "linux"))]
if let Ok(q) = o.enable_file_transfer.enum_value() {
if q != BoolOption::NotSet {
self.enable_file_transfer = q == BoolOption::Yes;

View File

@@ -570,7 +570,7 @@ pub async fn start_ipc<T: InvokeUiCM>(cm: ConnectionManager<T>) {
}
});
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_os = "linux"))]
ContextSend::enable(Config::get_option("enable-file-transfer").is_empty());
match ipc::new_listener("_cm").await {

View File

@@ -594,7 +594,13 @@ pub fn current_is_wayland() -> bool {
#[inline]
pub fn get_new_version() -> String {
(*SOFTWARE_UPDATE_URL.lock().unwrap().rsplit('/').next().unwrap_or("")).to_string()
(*SOFTWARE_UPDATE_URL
.lock()
.unwrap()
.rsplit('/')
.next()
.unwrap_or(""))
.to_string()
}
#[inline]
@@ -999,7 +1005,7 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
let mut mouse_time = 0;
#[cfg(not(feature = "flutter"))]
let mut id = "".to_owned();
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_os = "linux"))]
let mut enable_file_transfer = "".to_owned();
loop {
@@ -1022,7 +1028,7 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
*OPTIONS.lock().unwrap() = v;
*OPTION_SYNCED.lock().unwrap() = true;
#[cfg(target_os="windows")]
#[cfg(any(target_os="windows", target_os="linux"))]
{
let b = OPTIONS.lock().unwrap().get("enable-file-transfer").map(|x| x.to_string()).unwrap_or_default();
if b != enable_file_transfer {

View File

@@ -1254,7 +1254,7 @@ impl<T: InvokeUiSession> Session<T> {
#[tokio::main(flavor = "current_thread")]
pub async fn io_loop<T: InvokeUiSession>(handler: Session<T>) {
// It is ok to call this function multiple times.
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_os = "linux"))]
if !handler.is_file_transfer() && !handler.is_port_forward() {
clipboard::ContextSend::enable(true);
}