RFR: 8280991: [XWayland] No displayChanged event after setDisplayMode call

Mikhail Yankelevich duke at openjdk.org
Tue Feb 25 16:02:54 UTC 2025


On Tue, 25 Feb 2025 12:07:11 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

> Wayland clients are by design not allowed to change the resolution in Wayland.
> XRandR in Xwayland is just an emulation, it doesn't actually change the desktop resolution. This emulation is per window/x11 client, so different clients can have different emulated resolutions at the same time.
> 
> Any request to get the current display mode from the system will always return the original screen resolution, even if we are in emulated resolution.
> So with this fix, we store the last display mode set so that we can react correctly to the displayChanged event later.
> 
> ---
> 
> There are two system side fixes related to this issue, which causes missing ConfigureNotify events to be emitted when an emulated resolution change occurs:
> 
> 1. https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/731 - emits when the resolution changes to an emulated one 
> 2. https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/890 - emits when the resolution changes to a native one 
> 
> The second one is only available in GnomeShell 43+ (e.g. Ubuntu 22.10+), so one of the tests is excluded for versions below that.
> 
> ---
> 
> Testing looks good (manual + automated).

test/jdk/java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java line 60:

> 58: 
> 59:     public static void main(String[] args) {
> 60:         if (Platform.isOnWayland() && getGnomeShellMajorVersion() < 43) {

Do you think this might be easier to read if the method is changed to `isFixDelivered` or something similar? I think if it would detect the version and compare it inside and just output true or false. This would also remove the version 1000 if there is no gnome-shell installed on the system,  which is a bit confusing imo

test/jdk/java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java line 256:

> 254:                             .start();
> 255:             try (InputStreamReader isr = new InputStreamReader(process.getInputStream());
> 256:                  BufferedReader reader = new BufferedReader(isr)) {

Wouldn't it be simpler if the reader is retrieved with `process.inputReader()`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23774#discussion_r1970074838
PR Review Comment: https://git.openjdk.org/jdk/pull/23774#discussion_r1970074977


More information about the client-libs-dev mailing list