<AWT Dev> RFR: 8255880: UI of Swing components is not redrawn after their internal state changed

Phil Race prr at openjdk.java.net
Fri Dec 11 19:23:55 UTC 2020

On Wed, 9 Dec 2020 20:14:01 GMT, Anton Litvinov <alitvinov at openjdk.org> wrote:

> Hello colleagues,
> Could you please review the fix for the bug specific to Linux OS and Solaris OS, which consists in the fact that, if Swing components are changed through standard public API of these components, while the frame containing these components is in "Frame.ICONIFIED" state or in other words minimized, then, when the frame becomes deiconified the UI of the Swing components does not reflect those changes.
> "javax.swing.RepaintManager.addDirtyRegion0(Container, int, int, int, int)" by design prevents updating regions of containers, when the containers are inside a frame with "Frame.ICONIFIED" state. And at the same time Linux OS specific JDK code does not initiate repaint of the frame, when the frame's peer is notified about change of state from "Frame.ICONIFIED" to other state. More details are available in the bug record.
> The fix adds code to the method "sun.awt.X11.XFramePeer.handlePropertyNotify(XEvent)" which calls "repaint()" for instance of "XFramePeer", if its state changed from "Frame.ICONIFIED". The fix repeats the approach already existing in macOS specific code, which is in the method "sun.lwawt.LWWindowPeer.notifyIconify(boolean)".
> Thank you,
> Anton

The fix looks reasonable although I am surprised such an issue has existed for what I suppose is a long time.
One nit about the test regarding the requires.
It can't require solaris because there is no solaris support in JDK 16.
So unless you think this test will fail on other platforms (I hope not) it may be best to just remove this line.


PR: https://git.openjdk.java.net/jdk/pull/1722

More information about the awt-dev mailing list