On Thu, 13 Mar 2025 16:27:48 GMT, Alexander Zvegintsev <[email protected]>
wrote:
>> src/java.desktop/share/classes/java/awt/Robot.java line 258:
>>
>>> 256:
>>> 257: if (leastXDiff > leastYDiff) {
>>> 258: peer.mouseMove(finX2, finY2);
>>
>> Let's say I have the following display configuration on Linux. Since it uses
>> Xinerama, it shares the same coordinate system.
>>
>> java.awt.Rectangle[x=0,y=0,width=3440,height=1440]
>> java.awt.Rectangle[x=3440,y=0,width=1440,height=2560]
>>
>> 
>>
>> When I try to move the mouse to `x=20000,y=200`, I see that it clamps to
>> `x=3439,y=200` (a point between 2 screens), while before it was
>> `x=4879,y=200`(a rightmost point).
>>
>> The old behavior seems more logical to me.
>
> Here are a few cases where it still seems to fail after the update:
>
>
> Title: secondary above the primary
> Cmd: xrandr --output DP-0 --primary --pos 0x1440 --rotate normal --preferred
> --output DP-2 --pos 0x0 --rotate normal --preferred
>
> screen #0 java.awt.Rectangle[x=0,y=1440,width=3440,height=1440]
> screen #1 java.awt.Rectangle[x=0,y=0,width=2560,height=1440]
>
>
>
> x 20000 y 200 [moving to]
> - x 2559 y 200 [actual location] # before fix
> + x 3439 y 1440 [actual location] # after fix
>
>
> ---
>
>
> Title: primary above the secondary, right side aligned
> Cmd: xrandr --output DP-0 --primary --pos 0x0 --rotate normal --preferred
> --output DP-2 --pos 880x1440 --rotate normal --preferred
>
> screen #0 java.awt.Rectangle[x=0,y=0,width=3440,height=1440]
> screen #1 java.awt.Rectangle[x=880,y=1440,width=2560,height=1440]
>
>
>
> x 200 y 20000 [moving to]
> - x 200 y 1439 [actual location]
> + x 880 y 2879 [actual location]
>
>
> ---
>
>
> Title: secondary above the primary, right side aligned
> Cmd: xrandr --output DP-0 --primary --pos 0x1440 --rotate normal --preferred
> --output DP-2 --pos 880x0 --rotate normal --preferred
>
> screen #0 java.awt.Rectangle[x=0,y=1440,width=3440,height=1440]
> screen #1 java.awt.Rectangle[x=880,y=0,width=2560,height=1440]
>
>
>
> x -20000 y 200 [moving to]
> - x 880 y 200 [actual location]
> + x 0 y 1440 [actual location]
>
> x 200 y -20000 [moving to]
> - x 200 y 1440 [actual location]
> + x 880 y 0 [actual location]
These failures when moving to the offscreen point are actually because the new
onscreen point being moved to is closer distance-wise than the onscreen point
it would have moved to before the fix.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22781#discussion_r2067372976