Repository navigation
Conversation
gpbs only passed text (CF_UNICODETEXT) between the Windows clipboard and the general pasteboard, so an image copied in a Windows program could not be pasted into a GNUstep app, nor the reverse. Windows to GNUstep: when the clipboard holds a DIB, a bitmap (which Windows turns into a DIB) or a "PNG", NSTIFFPboardType is declared, and NSPasteboardTypePNG as well for a PNG. The data is made when asked for: a PNG is passed through or converted to TIFF; otherwise the CF_DIB is converted, 32 bit DIBs directly and other depths and compressions through GDI. CF_DIB is read rather than CF_DIBV5, as the CF_DIBV5 Windows synthesizes can carry colour masks after its header. GNUstep to Windows: when the general pasteboard holds TIFF or PNG, CF_DIB (32 bit, alpha in the fourth byte) and "PNG" are published with delayed rendering, as the text is. WM_RENDERFORMAT now renders the format it is asked for, WM_RENDERALLFORMATS renders the image formats too, and CF_UNICODETEXT is only published when the pasteboard holds a string. Tests/win32/pasteboard.m checks both directions for images and text. This change was written with the help of an AI assistant (Claude); the code was reviewed and tested by the author before submission. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
On Windows, gpbs (
Tools/win32pbs.m) bridged only text, so images couldn't be copied or pasted between GNUstep apps and other Windows apps (for example a screenshot tool's "paste from the clipboard"). This bridges images both ways.Windows → GNUstep
CF_DIBV5,CF_DIB,CF_BITMAPor the registered "PNG" format is offered asNSTIFFPboardType, and also asNSPasteboardTypePNGwhen "PNG" is there.CF_DIBis converted: 32-bit DIBs (BI_RGB/BI_BITFIELDS) are read directly, and other depths and compressions go through GDI.CF_DIBis used rather thanCF_DIBV5. TheCF_DIBV5Windows synthesises from a bitmap puts masks after its header, which makes the pixel offset ambiguous.GNUstep → Windows
CF_DIB(32-bit, alpha in the fourth byte) and "PNG", with delayed rendering, as the text is.WM_RENDERFORMATnow renders the format it's asked for, andWM_RENDERALLFORMATSrenders the image formats too.Tools/GNUmakefilelinks gpbs with-lgdi32on Windows.Behaviour changes
CF_UNICODETEXTis published only when the pasteboard holds a string. Before, it was always advertised, so an image-only copy looked like text to Windows.Testing
Tests/win32/pasteboard.madds 16 checks: images and text in both directions, and which formats are published. They pass with the patched gpbs, and 10 of them fail with the unpatched one.Clipboard.SetImage, a palettized DIB, PNG, and a 1920x1080 DIB, read back with the right pixels; GNUstep TIFF and PNG pasteboards pasted into Windows apps; non-ASCII text both ways.-fsyntax-only -Wall, onwin32pbs.mand the test. No diagnostics. No Apple-only syntax is used: no literals, blocks or ARC.This change was written with the help of an AI assistant (Claude); I reviewed and tested it before submission, as the AI policy asks.
🤖 Generated with Claude Code