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:32:35 UTC 2024
On Fri, 20 Dec 2024 22:12:25 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
>> @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)
> 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.
@aivanov-jdk You are right. I tested by switching the primary monitor and the test passed.
With Robot.mouseMove(20000, 200)
**Left side: Secondary & Right side: Primary screen --> Test fails**
Win32GraphicsDevice[screen=0]:java.awt.Rectangle[x=-1920,y=363,width=1280,height=720]
**[Primary]** Win32GraphicsDevice[screen=1]:java.awt.Rectangle[x=0,y=0,width=2293,height=960]
**Left side: Primary & Right: Secondary --> Test passes**
**[Primary]** Win32GraphicsDevice[screen=0]:java.awt.Rectangle[x=0,y=0,width=1280,height=720]
Win32GraphicsDevice[screen=1]:java.awt.Rectangle[x=1920,y=-363,width=2293,height=960]
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22781#discussion_r1894462619
More information about the client-libs-dev
mailing list