On Tue, 28 Jan 2025 22:37:08 GMT, Alisen Chung <ach...@openjdk.org> wrote:

>> Currently on macOS when mouseMove is given an offscreen coordinate to move 
>> the mouse to, mouseMove will physically clamp to the edge of the screen, but 
>> if you try to grab the mouse location immediately after by using 
>> MouseInfo.getPointerInfo().getLocation() you will get the value of the 
>> offscreen point.
>> 
>> Windows and linux do this clamping and coordinate handling for us, but new 
>> distributions may not necessarily handle clamping the same way, so Robot 
>> should be checking for clamping rather than delegating it to native.
>> 
>> This fix updates shared code to cache the screen bounds and adds a check to 
>> not exceed the bounds in mouseMove. The caching is done in the Robot 
>> constructor, so if the screen bounds changes the constructor must be called 
>> again to update to the new bounds.
>
> Alisen Chung has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   peer.mouseMove

src/java.desktop/share/classes/java/awt/Robot.java line 176:

> 174: 
> 175:         for (int i = 0; i < gs.length; i++) {
> 176:             allScreenBounds[i] = 
> gs[i].getDefaultConfiguration().getBounds();

This data cannot be cached, it can be modified at runtime.

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

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

Reply via email to