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

Robot.mouseMove uses scaling factor of main display on unscaled second display

    Details

    • Subcomponent:
    • Resolved In Build:
      b18
    • CPU:
      x86
    • OS:
      other

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "9"
        Java(TM) SE Runtime Environment (build 9+181)
        Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 10.0.15063]

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        I have two displays. My laptop display has a 3840x2160 display scaled at 175% and my external display has a 1920x1080 display scaled at 100%

        A DESCRIPTION OF THE PROBLEM :
        I have my 2nd display logically to the right of the hi-res laptop display.
        Using Robot.mouseMove to move my mouse I find that values in the range
        0 -2193 put the mouse on the main, left, hi-res display and values in
        2194 - 3290 cover all horizontal positions on the 2nd, right, low-res display.

        The 175% scaling on the main display should make the first range 0 - 2181 and the second range at 100% scaling should be 2182 - 4102, give or take a pixel.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        You will need a PC with an external monitor. Scale the PC to 175% and the external monitor to 100%. In the Dispay control panel place them side by side. I have the second, external monitor to the right.

        Using your favorite Java application compile it in Java 9 and run it in a debugger using Java 9. Stop at a breakpoint and use the debugger's expression evaluator to evaluate (new Robot()).mouseMove(<X>, <Y>), for a Y value that the two displays share (to avoid another bug with Robot.mouseMove reported in issue 9051169) and various values of X.

        You will notice that the mouse gets to the right side of the right hand monitor for much lower values of X than it should.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Referring to the "Description" section above:

        The 175% scaling on the main display should make the first range 0 - 2181 and the second range at 100% scaling should be 2182 - 4102, give or take a pixel.
        ACTUAL -
        The 175% scaling on the main display makes the X values raneg on the main display 0 - 2193 and on the second the range of X values, 100% scaling, is 2194 - 3290.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        Any Java application that will compile with Java 9 will do.
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        I don't know of any.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  serb Sergey Bylokhov
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: