RFR: 8345538: Robot.mouseMove doesn't clamp bounds on macOS when trying to move mouse off screen [v3]

Harshitha Onkar honkar at openjdk.org
Fri Dec 20 22:14:36 UTC 2024


On Fri, 20 Dec 2024 21:33:20 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Interesting. Does this also happen after the fix with Robot clamping coordinates in shared code?
>
> @alisenchung @honkar-jdk @prrace Things align: if the main monitor is on the right, and the secondary monitor is to the left of the main one, `Robot.mouseMove(20_000, 200)`, the following call to `MouseInfo.getPointerInfo()` returns `null`.
> 
> Both Harshitha and I see `null` in such a configuration both with and without the fix… on Windows and Mac.

@aivanov-jdk 
> Why is it? Harshitha's screen 1 bounds are: [x=0,y=0,width=2293,height=960], so (0, 200) lies within the bounds of the screen.

You are right, I'm able to see the mouse pointer on my [screen=1] and it lies within screen bounds with this configuration.

Left screen [screen=0]:java.awt.Rectangle[x=-1920,y=363,width=1280,height=720]
**[Primary]** Right side screen [screen=1]:java.awt.Rectangle[x=0,y=0,width=2293,height=960]

> I don't know where mouse pointer is in Harshitha's case.
> Harshitha has her secondary monitor on the left, I presume. Where is the mouse cursor on the screen?

Yes, I have the secondary screen on left and primary on right. And with Robot.mouseMove(200, 200) , the mouse cursor is on the primary screen (right hand-side)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22781#discussion_r1894428352


More information about the client-libs-dev mailing list