<AWT Dev> Usage of new clipboard APIs in Windows

Daniel Kamil Kozar dkk089 at gmail.com
Wed Jul 22 08:51:56 UTC 2020

Hello, AWT developers.
I seem to have hit an issue with the clipboard's FlavorListener
interface that's related to how this functionality is implemented in
OpenJDK on Windows. Notably, the clipboard classes use the "old"
clipboard monitoring API called SetClipboardViewer. Vista introduced
new functions to do the same thing, called
{Add,Remove}ClipboardFormatListener, and using them in my raw WinAPI
test applications makes my issue go away.
The issue at hand is that, when a certain application is running, the
FlavorListeners attached to the clipboard object do not fire at all.
My test application shows that there is no notification received from
the system at all. It is important to note that, while this
undoubtedly shows a bug in how the unnamed application handles
clipboard messages on Windows, the same might be true with just any
application (as noted in
). OpenJDK should thus use the new APIs in order to avoid this problem
Is there any reason why OpenJDK still sticks to the old API, seeing
how the oldest supported Windows version by latest OpenJDK 8 builds is
Windows 7? Is there a chance that this such a change will be
incorporated to OpenJDK 8, given that I provide a patch?

Thanks in advance.

More information about the awt-dev mailing list