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

Monocle MouseInput doesn't send keyboard modifiers in events.

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux

      Description

      A DESCRIPTION OF THE PROBLEM :
      The com.sun.glass.ui.monocle.MouseInput class doesn't send the keyboard modifiers in events, which results in being unable to select multiple entries in a ListBox.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Select two components in a ListBox by holding down CTRL.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Selecting two listbox items.
      ACTUAL -
      Ctrl modifier button isn't registered, so only one listbox item can be selected at once.

      CUSTOMER SUBMITTED WORKAROUND :
      This is a patch that fixes the issue for http://hg.openjdk.java.net/openjfx/8u-dev/rt

      diff -r f2e7f7967966 modules/graphics/src/main/java/com/sun/glass/ui/monocle/MouseInput.java
      --- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/MouseInput.java Sat Apr 21 06:04:00 2018 -0700
      +++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/MouseInput.java Thu Apr 26 00:39:42 2018 +1200
      @@ -87,6 +87,9 @@
               int y = Math.max(0, Math.min(newState.getY(), screen.getHeight() - 1));
               newState.setX(x);
               newState.setY(y);
      + // Gets the keyboard state to be used for keyboard modifiers
      + KeyState keyState = new KeyState();
      + KeyInput.getInstance().getState(keyState);
               // Get the cached window for the old state and compute the window for
               // the new state
               MonocleWindow oldWindow = state.getWindow(false);
      @@ -105,7 +108,7 @@
                       MonocleView oldView = (MonocleView) oldWindow.getView();
                       if (oldView != null) {
                           // send exit event
      - int modifiers = state.getModifiers(); // TODO: include key modifiers
      + int modifiers = state.getModifiers() | keyState.getModifiers();
                           int button = state.getButton();
                           boolean isPopupTrigger = false; // TODO
                           int oldX = state.getX();
      @@ -145,7 +148,7 @@
               int relY = y - window.getY();
               // send enter event
               if (oldWindow != window && view != null) {
      - int modifiers = state.getModifiers(); // TODO: include key modifiers
      + int modifiers = state.getModifiers() | keyState.getModifiers();
                   int button = state.getButton();
                   boolean isPopupTrigger = false; // TODO
                   postMouseEvent(view, MouseEvent.ENTER, button,
      @@ -156,7 +159,7 @@
               if (oldWindow != window | newAbsoluteLocation) {
                   boolean isDrag = !state.getButtonsPressed().isEmpty();
                   int eventType = isDrag ? MouseEvent.DRAG : MouseEvent.MOVE;
      - int modifiers = state.getModifiers(); // TODO: include key modifiers
      + int modifiers = state.getModifiers() | keyState.getModifiers();
                   int button = state.getButton();
                   boolean isPopupTrigger = false; // TODO
                   postMouseEvent(view, eventType, button,
      @@ -173,10 +176,11 @@
                       int button = buttons.get(i);
                       pressState.pressButton(button);
                       // send press event
      + int modifiers = pressState.getModifiers() | keyState.getModifiers();
                       boolean isPopupTrigger = false; // TODO
                       postMouseEvent(view, MouseEvent.DOWN, button,
                                      relX, relY, x, y,
      - pressState.getModifiers(), isPopupTrigger,
      + modifiers, isPopupTrigger,
                                      synthesized);
                   }
               }
      @@ -191,10 +195,11 @@
                       int button = buttons.get(i);
                       releaseState.releaseButton(button);
                       // send release event
      + int modifiers = releaseState.getModifiers() | keyState.getModifiers();
                       boolean isPopupTrigger = false; // TODO
                       postMouseEvent(view, MouseEvent.UP, button,
                                      relX, relY, x, y,
      - releaseState.getModifiers(), isPopupTrigger,
      + modifiers, isPopupTrigger,
                                      synthesized);
                   }
               }
      @@ -208,7 +213,7 @@
                       default: dY = 0.0; break;
                   }
                   if (dY != 0.0) {
      - int modifiers = newState.getModifiers();
      + int modifiers = newState.getModifiers() | keyState.getModifiers();
                       RunnableProcessor.runLater(() -> {
                           view.notifyScroll(relX, relY, x, y, 0.0, dY,
                                             modifiers, 1, 0, 0, 0, 1.0, 1.0);

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: