RFR: 8353548: [macOS] DragEvent.getScreenY() returns incorrect value in secondary monitor
Andy Goryachev
angorya at openjdk.org
Wed Apr 2 18:02:54 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.
The fix works on macOS 15.3.2 M1, using the secondary monitor at different position relative to the primary retina one, as well as at different resolutions.
Also, noticing `objectAtIndex: 0]`, tried with three monitors, all good:

-------------
Marked as reviewed by angorya (Reviewer).
PR Review: https://git.openjdk.org/jfx/pull/1756#pullrequestreview-2737136576
More information about the openjfx-dev
mailing list