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

MouseMove event generated by two overlapping windows

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      os_x

      Description

      ADDITIONAL SYSTEM INFORMATION :
      System OS X 10.15.2, OpenJDK 11, JavaFX 11 to 16

      A DESCRIPTION OF THE PROBLEM :
      When the mouse is hovered over two partially overlapped JavaFX windows, the MouseMove events are generated alternately for the two windows.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Launch the source provided below which opens two windows.
      Place one of the two windows in front of half of the other so that half of the one below is visible.
      Drag the mouse so that it hovers over the two windows starting with the window below and making sure that the mouse hovers over the two windows when it passes over the window above.
      Note in the console that from the moment the mouse hovers over the top window (and the one below in superposition) the two windows generate the MouseMove event.
      If we click on the top window or if we start the mouse over starting with the top window then this phenomenon does not occur. Even if the mouse hovers over both windows, only MouseMove events from the top window are generated, as normal behavior.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When the mouse hovers over the places where the two windows overlap, only the events of the window above are generated :
      ...
      MOVE MAIN WINDOW
      MOVE MAIN WINDOW
      MOVE MAIN WINDOW
      ...
      ACTUAL -
      When the mouse hovers over the places where the two windows overlap, the events of the two windows are generated :
      ...
      MOVE MAIN WINDOW
      MOVE additional 2
      MOVE MAIN WINDOW
      MOVE additional 2
      MOVE MAIN WINDOW
      MOVE additional 2
      ...

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class TestMouseEvent extends Application {

      private static class AdditionalWindow extends Stage {
      public AdditionalWindow() {
      super();

      final Scene scene = new Scene(new StackPane(), 300, 300);
      setTitle("Additional");
      scene.setOnMouseEntered((event) -> System.out.println("ENTERED additional window"));
      scene.setOnMouseMoved((event) -> System.out.println("MOVE additional window"));
      scene.setOnMouseExited((event) -> System.out.println("EXITED additional window"));

      setScene(scene);
      show();
      }
      }

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

      @Override
          public void start(Stage primaryStage) {
              primaryStage.setTitle("Test");
              Pane root = new Pane();
              Scene scene = new Scene(root);
              
              scene.setOnMouseEntered((event) -> System.out.println("ENTERED MAIN WINDOW"));
              scene.setOnMouseMoved((event) -> System.out.println("MOVE MAIN WINDOW"));
              scene.setOnMouseExited((event) -> System.out.println("EXITED MAIN WINDOW"));
              
              primaryStage.setScene(scene);
              
              new AdditionalWindow();
              
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Not for the moment.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pnarayanaswa Praveen Narayanaswamy
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: