On Sat, 14 Nov 2026 23:26:49 GMT, Alexander Zuev <[email protected]> wrote:
> On macOS 27 window animation takes a bit longer and if we attempt to perform > the mouse event on the window at this moment the coordinates conversion can > be incorrect. Uncommenting the one second delay before mouse click fixing the > problem. > > > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). test/jdk/java/awt/event/MouseEvent/FrameMouseEventAbsoluteCoordsTest/FrameMouseEventAbsoluteCoordsTest.java line 79: > 77: robot.mouseMove(mousePositionAbsolute.x, > 78: mousePositionAbsolute.y ); > 79: robot.delay(1000); **[suggestion] Consider moving the delay ahead of the coordinate computation** As written, the delay sits between `mouseMove()` and `mousePress()`, so `button.getLocationOnScreen()` and the `mouseMove()` itself still execute while the window may be in the middle of the show animation — only the press is deferred. That is consistent with the failure in the bug (the absolute screen-coordinate check passed; only the component-relative conversion was off), so this does fix the reported problem. Still, moving the delay to right after `setAutoWaitForIdle(true)` would be strictly more robust and easier to reason about: both the geometry read and the mouse interaction would then happen only after the animation has settled, so the fix no longer depends on the window's screen position being stable while it animates. The cost is identical. robot = new Robot(); robot.setAutoWaitForIdle(true); robot.delay(1000); // let the macOS window show animation settle mousePositionAbsolute = new Point(button.getLocationOnScreen().x + button.getWidth()/2, button.getLocationOnScreen().y + button.getHeight()/2); mousePosition = new Point(button.getWidth()/2, button.getHeight()/2); robot.mouseMove(mousePositionAbsolute.x, mousePositionAbsolute.y); robot.mousePress(InputEvent.BUTTON1_MASK); Not blocking — the current placement is fine if you prefer the minimal diff. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33910#discussion_r4577125087
