Draft
Conversation
c9cc875 to
3c52506
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support bi-directional image clipboard synchronization.
The core concept is from my other project, but the code here is maybe 60% AI generated. Especially for the client, I don't know why it copies the data so many times.
Asynchronous Clipboard
SDL3
SDL_SetClipboardDatasupports asynchronous clipboard, meaning it can first give OS the metadata, then when OS wants to paste, supply the actual full data. In our case, the server can just tell the client about clipboard content changed, then when OS request the data, client sends another command to server to get the actual image data. But I haven't implemented that, so it now sends every image from server clipboard to the client.Android has a similar concept, but requires a custom FileProvider. Since we can only use the standard file system FileProvider that's already in com.android.shell package, it now also requires sending every image from client device clipboard to server.
Protocol change
AI choose to use different command/message types for text and image clipboard, I think it's more clear on the protocol, but at the cost of some code duplication.
I didn't change the 256k max message size limit, both client and server will skip images larger than that with a warning.
Demo
Only tested on Linux
2026-02-13.17-48-28.mp4