Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop horizontal scroll mouse button events on Linux #6644

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@
<bind actionName="jump-list-next" key="O-RIGHT"/>
<bind actionName="jump-list-next" key="O-KP_RIGHT"/>
<bind actionName="jump-list-next" key="MOUSE_BUTTON5"/>
<bind actionName="jump-list-next" key="MOUSE_BUTTON7"/>
<bind actionName="jump-list-prev" key="O-LEFT"/>
<bind actionName="jump-list-prev" key="O-KP_LEFT"/>
<bind actionName="jump-list-prev" key="MOUSE_BUTTON4"/>
<bind actionName="jump-list-prev" key="MOUSE_BUTTON6"/>
<bind actionName="page-down" key="PAGE_DOWN"/>
<bind actionName="page-up" key="PAGE_UP"/>
<bind actionName="paste-formated" key="DS-V"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 7 additions & 1 deletion platform/openide.util.ui/src/org/openide/util/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,13 @@ public static int mouseWheelDownKeyCode() {
* {@link KeyEvent#VK_UNDEFINED} if not available.
* <p>
* 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
Expand Down