RFR: 8006421: GraphicsConfiguration of a frame is changed when the frame is moved to another screen

Damon Nguyen dnguyen at openjdk.org
Fri Jun 2 16:29:09 UTC 2023


On Thu, 1 Jun 2023 16:15:24 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> When a frame is dragged from one screen to another screen, the `GraphicsConfigurations` may vary depending on screen/monitor. However, transparency has to be maintained since it is expected as it is set. So the fix addresses in maintaining the translucency capability when frame is moved from one screen to another screen. For main screen, translucency is set when `setBackground` is called, but for second screen the same is not taken care. Hence setting of Translucency Capable `GC` is taken care when screen switch happens. The fix handles only for non-opaque windows alone retaining the behavior for opaque windows. 
>> The fix is verified in CI for regression check, which is Green.
>
> src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java line 698:
> 
>> 696:                         newGC = gds[i].getDefaultConfiguration();
>> 697:                         if (target != null
>> 698:                                 && target.getBackground() != SystemColor.window
> 
> This doesn't seem right, it'll change to a translucent gc even for opaque windows that has some non standard color as a background.
> 
> Probably it is better to check if previous gc was translucent capable 
> `&& target.getGraphicsConfiguration().isTranslucencyCapable()`

I agree. I recently worked on a bug involving window backgrounds and translucency is only one aspect of it. The color itself may be different and this conditional looks like it would definitely trigger in the case where the window changes color between screens.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14246#discussion_r1214578709



More information about the client-libs-dev mailing list