This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 226785 - horizontal scroll actions activate right-click menu instead of scrolling
Summary: horizontal scroll actions activate right-click menu instead of scrolling
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Key bindings (show other bugs)
Version: 7.0.1
Hardware: PC Linux
: P3 normal with 3 votes (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-27 13:05 UTC by dhardy
Modified: 2015-05-19 04:18 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
example mouse event listener (6.67 KB, text/plain)
2013-03-20 08:37 UTC, dhardy
Details
Logitech scrolling "workaround" (27.31 KB, image/png)
2014-12-08 12:43 UTC, necromncr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dhardy 2013-02-27 13:05:23 UTC
On linux, horizontal scroll actions are reported as mouse buttons 6 and 7 (both my touchpad and mouse do this, and many applications support it; for reference vertical scrolling is reported as button 4/5 actions). In netbeans, however, horizontal scroll actions cause the right-click menu to open.

This was already reported on launchpad by the way: https://bugs.launchpad.net/ugr-seeds/+bug/815028
Comment 1 Svata Dedic 2013-03-19 10:10:48 UTC
Sorry - do you use some special mouse that supports horizontal scroll (e.g. more wheels on the mouse), or do you scroll by ordinary mousewheel with just some additional button/key pressed ?
Comment 2 Svata Dedic 2013-03-19 10:58:14 UTC
I am afraid that the feature is not supported by JDK, at least on Ubuntu Linux. While two-finger vertical scrolling generates events for MouseWheelListener, no such events are generated when scrolling horizontally. 

Rapid clicks were generated for button #5. The 'popup menu trigger' is set to true by JDK, so popup menu is displayed.

If unhappy, please file a RFE/defect against the JDK (if so, please publish its number also here, please).
Comment 3 dhardy 2013-03-20 08:37:51 UTC
Created attachment 132819 [details]
example mouse event listener

I think it's more a case of not knowing how to interpret the information available. The attached application reports the following, when pressing and releasing, in order, the left mouse button, the right button, scrolling left (two units), and scrolling right:

javax.swing.JTextArea: button 1 pressed 1 times
javax.swing.JTextArea: button 1 released 1 times
javax.swing.JTextArea: button 1 clicked 1 times
javax.swing.JTextArea: button 3 pressed 1 times
javax.swing.JTextArea: button 3 released 1 times
javax.swing.JTextArea: button 3 clicked 1 times
javax.swing.JTextArea: button 4 pressed 1 times
javax.swing.JTextArea: button 4 released 1 times
javax.swing.JTextArea: button 4 clicked 1 times
javax.swing.JTextArea: button 4 pressed 2 times
javax.swing.JTextArea: button 4 released 2 times
javax.swing.JTextArea: button 4 clicked 2 times
javax.swing.JTextArea: button 5 pressed 1 times
javax.swing.JTextArea: button 5 released 1 times
javax.swing.JTextArea: button 5 clicked 1 times

In case you're wondering whether reporting scroll events as buttons is standard behaviour, it is in libraries I've used before, e.g. SDL: http://www.libsdl.org/cgi/docwiki.fcg/SDL_MouseButtonEvent (only mentions vertical scrolling). As for which button numbers correspond to scrolling events, I think these are correct, though be aware that some devices report different numbers by default (just a configuration issue).

As to your question about hardware, many mice support side-scrolling by tilting the wheel (look at the Logitech catalogue), while touchpads (at least, all the ones I've tried on) can be configured to support it. OS handling is probably the not uniform though; I have a feeling some Windows devices use special drivers to support horizontal scrolling which only work in a few applications — not so in Linux, where most non-Java apps seem to support it in a reasonably standard (if not perfect) way.
Comment 4 Svata Dedic 2013-03-20 08:57:01 UTC
> I think it's more a case of not knowing how to interpret the information
> available. The attached application reports the following, when pressing and
> releasing, in order, the left mouse button, the right button, scrolling left
> (two units), and scrolling right:

I agree, and I obviously run a similar example to determine what's wrong in the two-finger horizontal gesture, which works in my KDE/Ubuntu, but not NB.
Each task should be solved by appropriate tools; otherwise we would not develop an application, but a spaghetti heap.

NetBeans (as all other Java applications) are built on top of Java Runtime Environment, whose task is to interpret the physical events - and for vertical wheel scrolling it already defines a dedicated Listener interface specifically designed for scroll-like events. Although named MouseWheelListener, it well captures touchpad scroll area as well as two-finger 'scroll down' gesture.

Fixing the behaviour in NetBeans would not fix the other Java applications. It's also very inconvenient and error prone to demand that every and all applications interpret (on their own) button clicks and their positions to recreate the semantics of a system-defined gesture. An application library such as SDL should do it - it's sad to see that SDL does not offer relevant abstraction. For example, Qt does a better job - see http://qt-project.org/doc/qt-4.8/qwheelevent.html, orientation() and for a good reason: the algorithm to interpret the gesture will be consistent across all applications.

So to repeat - if you see the issue important enough, for you, or for (not necessarily just Netbeans) application usability in general, please file a defect for JRE/JDK, so the support becomes available for all scrollable JComponents, in all Java application. It's not effective to code just in Netbeans, and handle platform compatibility issues: that's what is JRE for.
Comment 5 dhardy 2013-03-20 09:05:04 UTC
Fair reason, but practically speaking that means it's going to be several years down the line, and by the time they get around to it they may not bother since presumably smooth scrolling will be the norm.

Is a simple ad-hoc solution really so much to ask? In any case, please fix the right-click menu to only open on button 3 events, not also what I presume is reported as buttons 4/5.
Comment 6 dobs 2014-03-18 17:12:18 UTC
Have same bug on logitech t400, netbeans 7.4, OS: Fedora 20 x64
Comment 7 remi 2014-09-13 18:56:55 UTC
I'll reopen the bug as I really think this can drive users away and it might be an easy fix (not showing the context menu on button 4 and 5). Feel free to close it again if it is not so easy.

I have the same problem (Netbeans 8.0.1, Linux) : I don't really need the horizontal scrolling in Netbeans but I'm disturbed by the context menu popping up every time.

I am actually to the point where I can't use Netbeans like this with my laptop.

I tested and as mentioned in other comments, buttons 4 and 5 are currently generated by the jre.
As dhardy, I think that Netbeans could and should show the context menu when buttons 4 and 5 are pressed.
Comment 8 mostacholoco 2014-10-13 00:12:35 UTC
Definitely bothering. I'm experiencing this issue in Debian Linux 8 x64.
Comment 9 kaha6uc 2014-10-16 12:36:38 UTC
I experienced just the same on my laptop running Kubuntu 14.04 w/ KDE, Netbeans 8.0.1 and Java 1.8.0_20 - not the crappy jre that comes with Kubuntu, but the JDK downloaded from Oracle.

I had both horizontal and vertical two-finger scrolling enabled and anytime I scrolled in Netbeans either vertically or horizontally, the right-click menu appeared, disrupting the scroll.

It's more like a workaround and I can't guarantee that it will work for you, but I disabled all scrolling with the touchpad in systemsettings, [Apply], opened systemsettings again and enabled only vertical two-finger scrolling and vertical edge scrolling. The context menu no longer showed when I two-finger scrolled in Netbeans. I even restarted Netbeans to see if it was just temporary, but it's consistent.

Hope this helps.
Comment 10 necromncr 2014-12-08 12:43:58 UTC
Created attachment 150956 [details]
Logitech scrolling "workaround"

Just to add my 2c to this subject:

Using Ubuntu 14.04 with Cinnamon desktop and Oracle java with Logitech M705 mouse. Enabling the "Side Scrolling" feature for this mouse makes the problem really, REALLY hard to reproduce while with additionally enabled "Smooth Scrolling" I can not reproduce popups anymore. 

This last one really speeds up scrolling in other applications.
Comment 11 Svata Dedic 2015-05-18 10:12:30 UTC
Starting with JDK7, you may disable the
Comment 12 mostacholoco 2015-05-18 12:45:33 UTC
So the status is RESOLVED and WONTFIX. Being unable to use netbeans and a touchpad requires AT LEAST a detailed explanation about why this has been decided. Thanks.
Comment 13 Svata Dedic 2015-05-18 13:00:07 UTC
ouch. Sorry, the most important part of the comment was cut out. 

Since JDK 7, you can disable the extra buttons by adding 
-J-Dsun.awt.enableExtraMouseButtons=false 
to the startup NB options (etc/netbeans.conf).

This will disable ALL events from "extra buttons" so no popup menu will appear.

See http://docs.oracle.com/javase/7/docs/api/java/awt/Toolkit.html#areExtraMouseButtonsEnabled() for more details.

---

According to bug process set up for NetBeans, issues caused by JDK (lack of support, buggy support, ...) are closed as WONTFIX until JDK implements at least something which permits stable workaround.

Sure I could implement some fancy options, e.g. "ignore mouse buttons: 4, 5, 6, 7, 8, 9, 10, 11, ..." preferrably with a testpad to determine which button numbers are the gestures mapped on this and that OS. IMHO it's not good to duplicate the OS configuration in a Java app :)
Anyway, anyone is welcome to implement such a thing - NB is O/S. Can be put on [stable] Autoupdate for any affected user to download and use.

I still believe it's better to solve at JDK level for all Java desktop applications.
Comment 14 mostacholoco 2015-05-19 04:18:27 UTC
Tried the suggestion. The result is I can scroll vertically but I can't scroll horizontally. The result is OK, IMO. Now I'd accept the RESOLVED WONTFIX :) BTW, I think most people would agree with you on not fixing JDK's issues at the application level.

Thank you for your valuable support.