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

Negative coordinates do not work on Linux(Gnome), but on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • jfx12, 8
    • javafx

      A DESCRIPTION OF THE PROBLEM :
      I found that negative coordinates do not work on my Linux system (Debian, running Gnome). On Windows, it works as expected.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the provided source code and either change the starting position or simply drag around the visible window. The Java version does not matter, it can be anything from 8 to 12.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The behavior should be uniform all all platforms. So far, on Windows, I can move the application window as far as the mouse pointer hits the screen edge, effectively moving the Window over the visual bounds of the screen.

      ACTUAL -
      But on Linux, I can only move the window as long as none of the window boarders hits the screen edge. In effect, I can never move a window over the screen edge, making it only partly visible.

      ---------- BEGIN SOURCE ----------
      package sample;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class Main extends Application {
          Double deltaX = 0.0;
          Double deltaY = 0.0;

          @Override
          public void start(Stage primaryStage) {

              StackPane root = new StackPane();

              Scene s = new Scene(root, 800, 800);
              primaryStage.setScene(s);

              primaryStage.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
                  deltaX = event.getScreenX();
                  deltaY = event.getScreenY();
              });

              primaryStage.addEventHandler(MouseEvent.MOUSE_DRAGGED, event -> {
                  s.getWindow().setX(event.getScreenX() - deltaX);
                  s.getWindow().setY(event.getScreenY() - deltaY);
              });


              primaryStage.show();
              primaryStage.getScene().getWindow().setX(-10);
          }


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

      ---------- END SOURCE ----------

      FREQUENCY : always


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: