RFR: 8353548: [macOS] DragEvent.getScreenY() returns incorrect value in secondary monitor

Ambarish Rapte arapte at openjdk.org
Thu Apr 3 08:33:59 UTC 2025


On Wed, 2 Apr 2025 17:05:58 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> This PR fixes an issue when dragEvents occur in a secondary screen which doesn't have the same height or (macOS) origin as the main screen.
> 
> The calculations for `xAbs, yAbs` are defined from the main screen macOS absolute origin, an in order to flip the coordinates defined from the JavaFX origin, the height from the main screen should be used, and not the height from secondary screens, which was the case in `GlassViewDelegate::sendJavaDndEvent`.
> 
> The PR doesn't include tests because it needs a complex setup (two monitors), but the change has been tested on macOS 15.3.2 with the test case from https://bugs.openjdk.org/browse/JDK-8353548, using two monitors (built-in Retina and external 4K display), rearranging their layout (left-bottom-right from main screen), and relative resolution.

Looks safe from documentation of [[NSScreen screens]](https://developer.apple.com/documentation/appkit/nsscreen/screens?language=objc).
Tested with 2 external monitors, tried several combinations and samples. LGTM.

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

Marked as reviewed by arapte (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1756#pullrequestreview-2738961436


More information about the openjfx-dev mailing list