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

ContextMenu always uses MouseRelease

XMLWordPrintable

      On the Mac and some other platforms, the menu comes up on mouse press. On Windows,. Shift+F10 shows a context menu. On the Mac, Ctrl+LeftClick requests a menu while on a a Laptop, Fn+Ctrl+i requests the popup menu.

      The right way to do this is to have a menu detect event that abstracts the platform, but if there is no time to make the changes in Glass, we can add the event and implement Windows behavior, then fix it to use the platform later.

      Found this code in Fx:

              this.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
                  @Override public void handle(MouseEvent event) {
                      if (event.getButton() != MouseButton.SECONDARY) return;
                          
                      ContextMenu menu = getSkinnable().getContextMenu();
                      if (menu == null) return;
                      
                      menu.show(control, event.getScreenX(), event.getScreenY());
                  }
              });

      Justification: Without this event, Fx applications will hard code Windows behavior then need to change when Fx ships for OS X.

            snorthov Steve Northover (Inactive)
            snorthov Steve Northover (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: