RFR: 8281384: Random chars on paste from Windows clipboard [v4]

Oliver Schmidtmer oschmidtmer at openjdk.org
Thu Feb 27 10:02:17 UTC 2025


On Thu, 27 Feb 2025 03:40:47 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> Oliver Schmidtmer has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   cleanup
>
> modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp line 406:
> 
>> 404:                 cdata = 0;
>> 405:             }
>> 406:         } else if(CF_TEXT == cf || CF_UNICODETEXT == cf){
> 
> Instead of doing that, consider always requesting `CF_UNICODETEXT` from the clipboard. Windows will then convert both `CF_TEXT` and `CF_OEMTEXT` to unicode (see [Synthesized Clipboard Formats](https://learn.microsoft.com/en-us/windows/win32/dataxchg/clipboard-formats)).

As the existing code was already pretty optimistic about 2 byte chars, is it possible that is already handled somewhere else?
I'm not sure whether this is done explicitly somewhere or if CF_UNICODETEXT is just tried first.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r1973256648


More information about the openjfx-dev mailing list