diff --git a/ide/editor/src/org/netbeans/modules/editor/resources/NetBeans-keybindings.xml b/ide/editor/src/org/netbeans/modules/editor/resources/NetBeans-keybindings.xml index 9181a8ec6a2f..fcb9bc4caad6 100644 --- a/ide/editor/src/org/netbeans/modules/editor/resources/NetBeans-keybindings.xml +++ b/ide/editor/src/org/netbeans/modules/editor/resources/NetBeans-keybindings.xml @@ -97,11 +97,9 @@ - - diff --git a/platform/core.windows/src/org/netbeans/core/windows/ShortcutAndMenuKeyEventProcessor.java b/platform/core.windows/src/org/netbeans/core/windows/ShortcutAndMenuKeyEventProcessor.java index 4d8eea21ad1d..f26e59f59b7e 100644 --- a/platform/core.windows/src/org/netbeans/core/windows/ShortcutAndMenuKeyEventProcessor.java +++ b/platform/core.windows/src/org/netbeans/core/windows/ShortcutAndMenuKeyEventProcessor.java @@ -318,11 +318,20 @@ private void processMouseEvent(MouseEvent mev) { || mev.isConsumed()) { return; } + int button = mev.getButton(); + if (Utilities.getOperatingSystem() == Utilities.OS_LINUX) { + // the JDK drops buttons for vertical scroll + // drop buttons for horizontal scroll here. + button -= 2; + if (button <= 3) { + return; + } + } //ignore when the IDE is shutting down if (NbLifecycleManager.isExiting()) { return; } - int keycode = Utilities.mouseButtonKeyCode(mev.getButton()); + int keycode = Utilities.mouseButtonKeyCode(button); if (keycode == KeyEvent.VK_UNDEFINED) { return; } diff --git a/platform/openide.util.ui/src/org/openide/util/Utilities.java b/platform/openide.util.ui/src/org/openide/util/Utilities.java index faf0d04f8872..29402965a749 100644 --- a/platform/openide.util.ui/src/org/openide/util/Utilities.java +++ b/platform/openide.util.ui/src/org/openide/util/Utilities.java @@ -842,7 +842,13 @@ public static int mouseWheelDownKeyCode() { * {@link KeyEvent#VK_UNDEFINED} if not available. *

* Implementation note : only extended mouse buttons in the range BUTTON4 to - * BUTTON9 are currently mapped to keycodes. + * BUTTON9 are currently mapped to keycodes. The caller may pass in values + * that best reflect the desired mouse button rather than the actual value + * from the OS or MouseEvent. eg. on Linux, the JDK excludes X button values + * for vertical scrolling when generating the range of buttons, and the + * default NetBeans window system further excludes the horizontal scroll + * button values - button 4 passed in here might be JDK button 6 and X event + * button 8. * * @param button mouse button * @return keycode if defined