mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
This reverts commit 011647511c.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
pub use crate::clipboard::{
|
||||
check_clipboard, get_cache_msg, ClipboardContext, ClipboardSide,
|
||||
CLIPBOARD_INTERVAL as INTERVAL, CLIPBOARD_NAME as NAME,
|
||||
check_clipboard, ClipboardContext, CLIPBOARD_INTERVAL as INTERVAL, CLIPBOARD_NAME as NAME,
|
||||
CONTENT,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -11,7 +11,7 @@ struct State {
|
||||
|
||||
impl super::service::Reset for State {
|
||||
fn reset(&mut self) {
|
||||
crate::clipboard::reset_cache();
|
||||
*CONTENT.lock().unwrap() = Default::default();
|
||||
self.ctx = None;
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ pub fn new() -> GenericService {
|
||||
}
|
||||
|
||||
fn run(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> {
|
||||
if let Some(msg) = check_clipboard(&mut state.ctx, ClipboardSide::Host) {
|
||||
if let Some(msg) = check_clipboard(&mut state.ctx, None) {
|
||||
sp.send(msg);
|
||||
}
|
||||
sp.snapshot(|sps| {
|
||||
// Just create a message with multi clipboards here
|
||||
// The actual peer version and peer platform will be checked again before sending.
|
||||
if let Some(msg) = get_cache_msg("1.2.7", "Windows") {
|
||||
sps.send_shared(Arc::new(msg));
|
||||
let data = CONTENT.lock().unwrap().clone();
|
||||
if !data.is_empty() {
|
||||
let msg_out = data.create_msg();
|
||||
sps.send_shared(Arc::new(msg_out));
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::{input_service::*, *};
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
use crate::clipboard::{update_clipboard, ClipboardSide};
|
||||
use crate::clipboard::update_clipboard;
|
||||
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||
use crate::clipboard_file::*;
|
||||
#[cfg(target_os = "android")]
|
||||
@@ -685,19 +685,8 @@ impl Connection {
|
||||
msg = Arc::new(new_msg);
|
||||
}
|
||||
}
|
||||
Some(message::Union::MultiClipboards(_multi_clipboards)) => {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if let Some(msg_out) = crate::clipboard::get_msg_if_not_support_multi_clip(&conn.lr.version, &conn.lr.my_platform, _multi_clipboards) {
|
||||
if let Err(err) = conn.stream.send(&msg_out).await {
|
||||
conn.on_close(&err.to_string(), false).await;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let msg: &Message = &msg;
|
||||
if let Err(err) = conn.stream.send(msg).await {
|
||||
conn.on_close(&err.to_string(), false).await;
|
||||
@@ -2064,14 +2053,7 @@ impl Connection {
|
||||
{
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if self.clipboard {
|
||||
update_clipboard(vec![_cb], ClipboardSide::Host);
|
||||
}
|
||||
}
|
||||
Some(message::Union::MultiClipboards(_mcb)) =>
|
||||
{
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if self.clipboard {
|
||||
update_clipboard(_mcb.clipboards, ClipboardSide::Host);
|
||||
update_clipboard(_cb, None);
|
||||
}
|
||||
}
|
||||
Some(message::Union::Cliprdr(_clip)) =>
|
||||
|
||||
Reference in New Issue
Block a user