On Tue, 26 Jan 2021 04:08:44 GMT, Sergey Bylokhov <[email protected]> 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.
src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java line 113:
> 111: }
> 112:
> 113: public int scaleUp(int x) {
This is copied not moved from the X11GraphicsConfig, just to minimize the
change in the fix. I Will clean up this later.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2230