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

Oliver Schmidtmer oschmidtmer at openjdk.org
Thu Mar 27 13:17:29 UTC 2025


On Thu, 27 Mar 2025 10:06:02 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:

>> Oliver Schmidtmer has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   readding flavors with changed mapping
>
> modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp line 207:
> 
>> 205: {
>> 206:     addPair(GLASS_TEXT_PLAIN, CF_UNICODETEXT);
>> 207:     addPair(GLASS_TEXT_PLAIN_LOCALE, CF_UNICODETEXT);
> 
> Seems like those changes made JFX unaware of text data ready to be pasted from "outside" - running your test program and trying to paste something to a TextBox (ex. in `HelloTextBoxClipboard`) doesn't work anymore (Paste popup menu option is disabled, Ctrl+V does nothing, whereas both were possible to do on master). I checked that these mime stuff changes are at fault.
> 
> My guess now would be that these mime_stuff changes have to be reverted and the actual change should happen as we request Clipboard data - probably a condition changing clipboard format `cf` from `CF_TEXT` and `CF_OEMTEXT` to `CF_UNICODETEXT` right before we call `me.Load()` in `PopMemory()`. Please check if that is in fact the case before committing though, I'm not 100% sure if that would work.
> 
> If that works, a comment explaining why we do this clipboard format swap would also come in handy for future generations.

I can't check if replacing cf with CF_UNICODETEXT there works, as probably that flavor is already always prioritized.

My test for the early NUL terminator explicitly only sets CF_TEXT, but is converted to unicode.

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

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


More information about the openjfx-dev mailing list