Read any clipboard type for a program, off the window thread #26
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wayfinder:map
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
Reference
jeff/harrier#26
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #23
A program's read (OSC 52 or 5522) is answered by
Window.answerRead. It callsplatform.readClipboard, which is synchronous on the window thread, always asks for the text type, polls up to 3 s at a time, and silently truncates at 64 MiB. A request forimage/pnggets nothing even when the clipboard has one.What done looks like
offer.receive(type, fd)for each type asked for, all at once. The read ends join the main loop's poll and are read a bounded chunk a turn, without blocking, asDndreads a drop, in aClipboardTransfersof their own. The deferred read is answered when the last type finishes. A large image from a slow source freezes no pane, and a read whose pane has gone simply stops.status=OK), and a type with no data is how it says "not available". Never truncated data.readClipboard(that it "dispatches while it reads", "a second at a time") are corrected or gone.wl-copy -t image/png, reads it with 5522, and compares the bytes.Done in
3a587f1. The newsrc/ClipboardTransfers.zigasks for every requested type at once over non-blocking pipes in the main loop's poll, reading up to 1 MiB of each type per turn. The sway VM test copies 1 MiB withwl-copy -t image/png, readsimage/png text/plain, and gets the image back byte for byte, in 256 packets, with no text. Found along the way:receiveClipboardmust flush before closing the pipe's write end, because the flush is what sends the fd.