JDK-8280990 : [XWayland] XTest emulated mouse click does not bring window to front
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 21,22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-01-31
  • Updated: 2024-10-01
  • Resolved: 2024-06-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 23 JDK 8
11.0.26-oracleFixed 17.0.13-oracleFixed 21.0.5-oracleFixed 23 b26Fixed 8u441Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
Window does not come to front on emulated mouse click.
Affected tests:

    FAIL: java/awt/Modal/OnTop/OnTopDocModal1Test.java
    FAIL: java/awt/Modal/OnTop/OnTopDocModal2Test.java
    FAIL: java/awt/Modal/OnTop/OnTopDocModal3Test.java
    FAIL: java/awt/Modal/OnTop/OnTopDocModal4Test.java
    FAIL: java/awt/Modal/OnTop/OnTopDocModal5Test.java
    FAIL: java/awt/Modal/OnTop/OnTopDocModal6Test.java
    FAIL: java/awt/Modal/OnTop/OnTopModeless1Test.java
    FAIL: java/awt/Modal/OnTop/OnTopModeless2Test.java
    FAIL: java/awt/Modal/OnTop/OnTopModeless3Test.java
    FAIL: java/awt/Modal/OnTop/OnTopModeless4Test.java
    FAIL: java/awt/Modal/OnTop/OnTopModeless5Test.java
    FAIL: java/awt/Modal/OnTop/OnTopModeless6Test.java
    FAIL: java/awt/Modal/ToFront/FrameToFrontModeless1Test.java
    FAIL: java/awt/Modal/ToFront/FrameToFrontNonModalTest.java

Root cause and possible solutions:

"""
Yes, the reason is this is using XTEST, an X11 protocol which will not work outside of X11.

In other words, the emulated input event reaches the X11 clients, but not the Wayland compositor which is the actual display server but also the X11 window manager in Wayland, the component which is in charge of moving/resizing/stacking the windows.

You can easily observe this using xdotool and xev in Xwayland. If the emulated click occurs within the xev window, the X11 event is logged by xev, but the window is not restacked by the Wayland compositor.

We've been working an a separate protocol to make this work, it's libEI driven by Peter Hutterer:

https://gitlab.freedesktop.org/libinput/libei
"""
Comments
Fix request [17u] I backport this for parity with 17.0.13-oracle. No risk, only tests change. Clean backport. Test pass. SAP nightly testing passed.
24-07-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/2740 Date: 2024-07-23 06:56:32 +0000
23-07-2024

Fix request [21u] I backport this for parity with 21.0.5-oracle. No risk, only a test change. Clean backport. Test pass. SAP nightly testing passed.
28-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/800 Date: 2024-06-27 08:56:34 +0000
27-06-2024

Changeset: d2d78ad1 Author: Alexander Zvegintsev <azvegint@openjdk.org> Date: 2024-06-03 07:12:06 +0000 URL: https://git.openjdk.org/jdk/commit/d2d78ad18e0b5d2a6a62f9c97ceec5592fa1de2e
03-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19417 Date: 2024-05-28 02:25:46 +0000
28-05-2024

After the JDK-8307779 specification change, this issue became a test bug.
04-10-2023

Specification change may be required to reflect actual behavior of Robot.
08-02-2023