Menu

#805 Ctrl+click does not activate context menu on OS X

4.0
closed-fixed
None
5
2016-09-06
2016-03-18
No

Macs historically have not shipped with multibutton mice, so on OS X it is expected to be able to open context menus with Ctrl+click. However this does not work in OmegaT.

The way we are detecting the context menu trigger is not correct for proper cross-platform behavior:

new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
        if (e.isPopupTrigger() || e.getButton() == MouseEvent.BUTTON3) {
            // show context menu
        }
    }
}

Documentation for MouseEvent.isPopupTrigger() says:

Note: Popup menus are triggered differently on different systems. Therefore, isPopupTrigger should be checked in both mousePressed and mouseReleased for proper cross-platform functionality.

Corrected behavior:

new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
        if (e.isPopupTrigger()) {
            // show context menu
        }
    }

    public void mouseReleased(MouseEvent e) {
        if (e.isPopupTrigger()) {
            // show context menu
        }
    }
}

This correctly detects context menu triggers on all platforms, including OS X.

Discussion

  • Didier Briel

    Didier Briel - 2016-09-06
    • status: open-fixed --> closed-fixed
     
  • Didier Briel

    Didier Briel - 2016-09-06

    Fixed in the released version 4.0 of OmegaT.

    Didier

     

Log in to post a comment.

MongoDB Logo MongoDB