On Ubuntu, when I right-click a TreeViewer or TextViewer to display the context menu, the first menu item is automatically clicked. The mouse click that brings up the context menu must be passed on to the menu itself. At any rate, if the first item in a context menu is enabled, it is implicitly clicked.
Here's the workaround, my application moves the cursor one pixel up, and one pixel to the left, to avoid clicking on the first menu item:
... getControl().setMenu(menuManager.createContextMenu(parent)); getControl().getMenu().addMenuListener(new MenuListener() { @Override public void menuHidden(MenuEvent e) { } @Override public void menuShown(MenuEvent e) { // Move the cursor over a bit to avoid selecting the first menu item on Ubuntu. Point cursorLocation = e.display.getCursorLocation(); Display.getCurrent().setCursorLocation(cursorLocation.x + 1, cursorLocation.y + 1); } }); ...
This is a bit of a kludge, but it seems to look and work well on Ubuntu and Windows too.
Title | Date |
EBTCalc (Android) Version 1.53 is now available | May 19, 2024 |
Vault 3 Security Enhancements | October 24, 2023 |
Vault 3 is now available for Apple OSX M2 Mac Computers! | September 18, 2023 |
Vault (for Desktop) Version 0.77 Released | March 26, 2023 |
EBTCalc (Android) Version 1.44 is now available | October 12, 2021 |
Vault (Desktop) Version 0.72 Released | October 6, 2021 |
EBT Compass is Now Available for Android Devices | June 2, 2021 |