On Tue, 17 Dec 2024 01:01:55 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. This pull request has now been integrated. Changeset: 461cb842 Author: Alisen Chung <ach...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/461cb84277b40d01c5d04be3c74f25d8667a207c Stats: 121 lines in 2 files changed: 119 ins; 0 del; 2 mod 8345538: Robot.mouseMove doesn't clamp bounds on macOS when trying to move mouse off screen Reviewed-by: honkar, prr ------------- PR: https://git.openjdk.org/jdk/pull/22781