mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-12 15:51:10 +03:00
fix: clipboard, cmd ipc (#9270)
1. Send raw contents if `content_len` > 1024*3. 2. Send raw contents if it is not empty. 3. Try read clipboard again if no data from cm. Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -95,25 +95,30 @@ impl Handler {
|
||||
log::error!("Failed to read clipboard from cm: {}", e);
|
||||
}
|
||||
Ok(data) => {
|
||||
let mut msg = Message::new();
|
||||
let multi_clipboards = MultiClipboards {
|
||||
clipboards: data
|
||||
.into_iter()
|
||||
.map(|c| Clipboard {
|
||||
compress: c.compress,
|
||||
content: c.content,
|
||||
width: c.width,
|
||||
height: c.height,
|
||||
format: ClipboardFormat::from_i32(c.format)
|
||||
.unwrap_or(ClipboardFormat::Text)
|
||||
.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.collect(),
|
||||
..Default::default()
|
||||
};
|
||||
msg.set_multi_clipboards(multi_clipboards);
|
||||
return Some(msg);
|
||||
// Skip sending empty clipboard data.
|
||||
// Maybe there's something wrong reading the clipboard data in cm, but no error msg is returned.
|
||||
// The clipboard data should not be empty, the last line will try again to get the clipboard data.
|
||||
if !data.is_empty() {
|
||||
let mut msg = Message::new();
|
||||
let multi_clipboards = MultiClipboards {
|
||||
clipboards: data
|
||||
.into_iter()
|
||||
.map(|c| Clipboard {
|
||||
compress: c.compress,
|
||||
content: c.content,
|
||||
width: c.width,
|
||||
height: c.height,
|
||||
format: ClipboardFormat::from_i32(c.format)
|
||||
.unwrap_or(ClipboardFormat::Text)
|
||||
.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.collect(),
|
||||
..Default::default()
|
||||
};
|
||||
msg.set_multi_clipboards(multi_clipboards);
|
||||
return Some(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user