On Wed, 30 Apr 2025 21:17:41 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
> > So this seems to be a bug in macOS, as the reported mouse location is > > incorrect while it is actually positioned at the edge? > > Probably, there are other macOS APIs that could be used to implement > > Java_sun_lwawt_macosx_CCursorManager_nativeGetCursorPosition. Or perhaps > > the methods within it should be called on the appkit thread - I see a > > potential race, since the mouse is moved asynchronously on appkit, but the > > coordinates are fetched on the current thread. > > Did you have a chance to check our implementation of setting and getting the > cursor? I took a look at the cocoa documentation and I wasn't able to find any APIs that handle clamping. I also looked at our implementation: we create an empty mouse event then grab the location of that event. Since macOS doesn't do clamping, we would need to add clamping code to nativeGetCursorPosition after we grab the location of that empty event. I think it's easier to just do the clamping in CRobot on mouseMove instead since that would be the only way for the mouse to initially reach out of bounds. What do you think? ------------- PR Comment: https://git.openjdk.org/jdk/pull/22781#issuecomment-2849412199