mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-17 01:00:41 +01:00
fix(viewer): exchange text clipboard with the official Mac host
The Mac host offers pasteboard text as format 0 "public.utf8-plain-text" (UTF-8), not CF_UNICODETEXT, so the viewer never requested it. Accept and request that format, and offer it next to CF_UNICODETEXT from the viewer. Host-side offers to official clients are unchanged. Mac -> viewer verified live; viewer -> Mac not yet. Adds format-name/echo diagnostics (no data). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
aafc17e626
commit
94ff1f1c02
4 files changed
+77
-14
No files matched your search
@@ -111,7 +111,7 @@ impl SyncState {
|
||||
/// ignores the other form.
|
||||
fn local(&mut self,value:String)->Result<Option<Vec<Vec<u8>>>,&'static str>{
|
||||
if self.last.as_ref()==Some(&value){return Ok(None)}
|
||||
let id=self.next();let payload=self.rich.offer(id,value.clone())?;
|
||||
let id=self.next();let payload=self.rich.offer_any_host(id,value.clone())?;
|
||||
let rich=wire::envelope(self.next(),21,&payload);
|
||||
let text=wire::envelope(self.next(),21,&crate::clipboard_protocol::text_request(self.next(),&value));
|
||||
self.last=Some(value);Ok(Some(vec![rich,text]))
|
||||
|
||||
+2
-1
@@ -195,7 +195,8 @@ impl Peer {
|
||||
if state.chroma.swap(chroma,Ordering::AcqRel)!=chroma {log::info!("Viewer capture sync: chroma={chroma}");}
|
||||
}
|
||||
let count=state.control_messages.fetch_add(1,Ordering::Relaxed);
|
||||
if wire::echo_matches(&message.data,1) {state.clipboard_supported.store(wire::echo_clipboard_supported(&message.data),Ordering::Release);state.echo_received.store(true,Ordering::Release);}
|
||||
if wire::echo_matches(&message.data,1) {let supported=wire::echo_clipboard_supported(&message.data);
|
||||
if state.clipboard_supported.swap(supported,Ordering::AcqRel)!=supported || !state.echo_received.load(Ordering::Acquire) {log::info!("Viewer echo: clipboard_supported={supported}");}state.echo_received.store(true,Ordering::Release);}
|
||||
if let Some(request)=wire::echo_request_seq(&message.data) {
|
||||
if let Some(control)=control_for_echo.upgrade() {let _=control.send(&bytes::Bytes::from(wire::echo_response_with_clipboard(1_000_000+request,request,clipboard_enabled))).await;}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ impl Window {
|
||||
use super::clipboard::ClipboardRequest;
|
||||
match request {
|
||||
ClipboardRequest::Read(reply)=>{
|
||||
if self.clipboard_dirty {log::debug!("Viewer clipboard read: focused={} has_text={}",self.focused,self.clipboard.has_clipboard_text());}
|
||||
let result=if self.focused && std::mem::take(&mut self.clipboard_dirty) && self.clipboard.has_clipboard_text(){read_clipboard()}else{Ok(None)};
|
||||
let _=reply.send(result);
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user