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

[hidpi] Multi-Monitor issue with HiDpi scaling and undecorated stages

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u65, 9
    • Fix Version/s: 9
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      There's an issue with how the coordinate system works in JavaFx using 150% displays and multiple monitors. When we use an undecorated stage, we manually add a mouse dragged listener to get drag support. When using 2 1080p display screens at 100% display the javaFX X-Coordinate system goes from 0 to 3840(1920*2). When the display is set to 150% display, the X-Coordinate system goes from 0 to 2560(1280*2).

      I believe there's an issue with how JavaFX calculates where the first monitor ends and the second monitor begins. scaling primaryStage.setX(1200) and primaryStage.setX(1735) are both placed on the first monitor. primaryStage.SetX(1735) most certainly should be placed on the second monitor. This works correctly at 100% display.

      Here's an image of what I think is happening: http://imgur.com/FRj7MFP

      REGRESSION. Last worked in version 8u45

      ADDITIONAL REGRESSION INFORMATION:
      There's no dropdown for this, but the regression version is 8 update 40, not update 45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See sample source code. Attempt to drag the box to your second monitor and the stage will "jump" back to the first monitor and continue. Notice how the X-Coordinate of the stage keeps increasing after the jump

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The box should smoothly transition to the second monitor without a "jump".
      ACTUAL -
      The box reaches the end of screen 1 then jumps backwards and continues.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Main extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              Label label = new Label();
              StackPane root = new StackPane();
              root.getChildren().add(label);
              Scene scene = new Scene(root, 300, 250);

              AtomicLong xOff = new AtomicLong(0);
              AtomicLong yOff = new AtomicLong(0);
              root.setOnMousePressed(event -> {
                  xOff.set((long)event.getX());
                  yOff.set((long)event.getY());
              });
              
              root.setOnMouseDragged(event -> {
                  primaryStage.setX(event.getScreenX() - xOff.get());
                  primaryStage.setY(event.getScreenY() - yOff.get());
                  label.setText(String.format("X Cord %s\nY Cord %s", primaryStage.getX(), primaryStage.getY()));
                  System.out.println(String.format("X Cord %s\nY Cord %s", primaryStage.getX(), primaryStage.getY()));
              });
              
              primaryStage.initStyle(StageStyle.TRANSPARENT);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Set jvm argument to -Dglass.win.minHiDPI=6 to prevent HiDpi scaling

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                flar Jim Graham
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: