RFR: 8345538: Robot.mouseMove doesn't clamp bounds on macOS when trying to move mouse off screen [v3]
Harshitha Onkar
honkar at openjdk.org
Wed Jan 8 22:23:40 UTC 2025
On Fri, 20 Dec 2024 19:22:35 GMT, Alisen Chung <achung at openjdk.org> wrote:
>> @aivanov-jdk
>> I see your point. But I'm running into NPE at `MouseInfo.getPointerInfo().getLocation()` without the fix as well (dual monitor, extended display setup)
>>
>> Is it expected of MouseInfo.getPointerInfo() to return null for off-screen coordinates (meaning does it consider it as mouse not available if it is outside the screen devices)?
>>
>> PointerInfo has two things associated with it - screen device and a location, so if it is not able to associate the coordinate with any of the screen device (off-screen coordinate) is it suppose to return null in this case?
>
> Interesting. Does this also happen after the fix with Robot clamping coordinates in shared code?
@alisenchung
> By looking at the numbers, I infer Harshitha has a scale on her screens. Scaling down what's received from Windows could trim a pixel on the right, and it could be the reason why the point isn't within the bounds of any screen in her case.
I think @aivanov-jdk intuition was right. I checked with different uiScales.
With this configuration: Left side: Secondary & Right side: Primary screen
The test passes on uiScale: 1, 1.25, 1.75, 2 .. and so on...
It fails on uiScale: 1.5, 2.5 and every other 0.5 scale increment. Surely looks like a pixel rounding error ..
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22781#discussion_r1907929765
More information about the client-libs-dev
mailing list