RFR: 8281384: Random chars on paste from Windows clipboard [v7]
Lukasz Kostyra
lkostyra at openjdk.org
Fri Mar 28 14:57:21 UTC 2025
On Thu, 27 Mar 2025 13:14:27 GMT, Oliver Schmidtmer <oschmidtmer at openjdk.org> wrote:
>> 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.
I did give it some tries and it did indeed seem to prioritize `CF_UNICODETEXT`. I suspect we could leave it be without any extra conditions or changes then.
Let's revert the mime_stuff changes then, because they do break something, and then leave it as it is.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r2018831343
More information about the openjfx-dev
mailing list