<AWT Dev> RFR: 8076313: GraphicsEnvironment does not detect changes in count of monitors on Linux OS

Alexander Zuev kizune at openjdk.java.net
Tue Feb 2 12:56:47 UTC 2021

On Tue, 26 Jan 2021 04:08:44 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> This fix enables display change detection on Linux when the number of monitors is changed in the Xinerama mode.
> The fix itself is straightforward:
> 1. When we get an event that the root window is changed we assume that it could be caused by some screen manipulation like screen resolution change or adding/removing a monitor.
> 2. We rebuild the native data structure for the x11 screens, and then mirror this data on the java level in the X11GraphicsEnvironment.
> 3. While we updating the data, we block all access to it in the native -> after the fix all access to the native x11 screens should be done under awt-lock.
> Notes:
>  - This fix has a long chain of pre-fixes where we dropped the native access to the x11 screens, to minimize the places we need to synchronize.
>  - In the current version we rebuild the screens more often than needed, for example, we rebuild it even if resolution changed in a single monitor config. It is done intentionally to increase the test code coverage for now.
>  - The current implementation is based on the Xinerama, while the better solution will be use XRandr 1.5, but it does not support AIX, and is not supported in the current devkit.

Looks good.


Marked as reviewed by kizune (Reviewer).

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

More information about the awt-dev mailing list