Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8353548

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • jfx25
    • 8
    • javafx
    • None

      Note: This is the same issue as JDK-8119983, which was fixed for JavaFX8, but probably for one single monitor and not for two.

      The issue can be reproduced on macOS with any setup of two monitors, regardless their arrangement (left or right), providing they just have different resolution/size.

      For instance, apply the following setup:

      - MacBook Pro Retina display to the left, as Extended Display, with Default resolution (1728x1117)

      - LG HDR 4K to the right, as Main display, with any resolution like 1920x1080, 2560x1440, 3008x1692, 3360x1890 or 3840x2160 (not matching the Retina one)

      and run the attached sample, which is a simplification of the test in JDK-8119983.

      Steps:
      - Run the sample in the main screen, and do a drag gesture, the dialog will show up in the expected position (see ExpectedDialogPosition.png)
      - Close the dialog, and move the stage to the secondary monitor.
      - Do a drag gesture, the dialog will show up in the unexpected position (see UnexpectedDialogPosition.png), with a big offset in the Y coordinate, which is probably depending on the difference of screen sizes.


      Workaround: as it can be seen from the test case, don't use DragEvent::screenY, but calculate it from the main Stage, main Scene and DragEvent::sceneY coordinates.

        1. DragAndDropTest.java
          2 kB
          Jose Pereda
        2. ExpectedDialogPosition.png
          81 kB
          Jose Pereda
        3. UnexpectedDialogPosition.png
          34 kB
          Jose Pereda

            jpereda Jose Pereda
            jpereda Jose Pereda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: