Clipboard: rich formats (image + HTML/MIME) beyond plain text#38
Open
codymullins wants to merge 1 commit into
Open
Clipboard: rich formats (image + HTML/MIME) beyond plain text#38codymullins wants to merge 1 commit into
codymullins wants to merge 1 commit into
Conversation
Add AppWindow.GetClipboardData / SetClipboardData / ClipboardFormats so a browser can copy and paste images and HTML, not only text. ClipboardText stays as the text convenience. - AppKit backend maps text/plain, text/html, and image/png to NSPasteboard types and reads/writes typed data. - GLFW backend stores text only; other MIME types are dropped, and it reports text/plain alone when text is present. Closes #21
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.
Closes #21.
The clipboard was plain text only. A browser needs to copy/paste images and HTML. This adds typed clipboard read/write while keeping
ClipboardTextas the text convenience.What changed
AppWindow.GetClipboardData(mimeType)/SetClipboardData(mimeType, data)/ClipboardFormats→IWindowBackend.text/plain,text/html, andimage/pngto theirNSPasteboardUTIs and reads/writes typedNSData.ClipboardFormatsenumerates which of those are present.text/plainround-trips through the GLFW clipboard string; other MIME types are dropped on write and return null on read;ClipboardFormatsreportstext/plainwhen text is present.Tests
Skyline.WindowedTests— typed text round-trip on a real GLFW window, null for an unsupported type, a dropped non-text write (no throw), andClipboardFormats. Covers every GLFW clipboard branch.Verification
dotnet build Skyline.slnxclean (0 warnings);Skyline.Applebuilds clean on the macos workload.format-check.shclean.GlfwWindowBackend100%;AppWindow96.9% (matchesmain). Overall 98.1% unchanged.Notes
IWindowBackend/AppWindow/GLFW/AppKit/FakeBackend), so it overlaps the open PRs in distinct regions — trivial rebases as they land.