Open
Bug 930711
Opened 11 years ago
Updated 5 months ago
Cannot get events for 4th and 5th mouse button.
Categories
(Core :: DOM: Events, defect)
Tracking
()
NEW
People
(Reporter: jujjyl, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [games])
Attachments
(1 file)
10.99 KB,
patch
|
Details | Diff | Splinter Review |
The DOM events spec https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#events-mouseevents says that in mouse events, the .button and .buttons field may contain information about more than three mouse buttons, in particular Window&sLinux have default support for up to five button mouses. This does not seem to be currently implemented, but would be a desired feature for hardcore gamers that utilize customized bindings and gaming mouses when playing. Visit this page to test the support: https://dl.dropboxusercontent.com/u/40949268/emcc/bugs/extra_buttons.html on Windows/Linux/OSX, and click the fourth and fifth buttons on your mouse. On Windows and Linux, no event is posted, but the browser back/forward navigation is instead accessed. On OSX, clicking fourth or fifth button produces a mouse event for the mouse middle button instead. Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646245(v=vs.85).aspx Linux: http://tronche.com/gui/x/xlib/events/keyboard-pointer/keyboard-pointer.html OSX is an odd case, I don't know if it's possible without custom drivers.
Reporter | ||
Updated•11 years ago
|
Whiteboard: [games]
Reporter | ||
Comment 1•11 years ago
|
||
Here is a patch that implements the support for reading 4th and 5th button on Windows. This is actually my first patch to Firefox, so bear with me if I did something off here. Thanks!
Reporter | ||
Comment 2•11 years ago
|
||
Here is another test page (an Emscripten-compiled application) https://dl.dropboxusercontent.com/u/40949268/emcc/InputTest/InputTest.html After the above patch, both this test and the extra_buttons.html test above successfully report 4th and 5th button events.
Comment 3•11 years ago
|
||
On Windows, we support 4th button and 5th button for buttons. buttons: http://mxr.mozilla.org/mozilla-central/source/widget/windows/KeyboardLayout.cpp?rev=55c6ec50d580#213 If you don't see expected result of MouseEvent.buttons, it's environment dependent issue. I think that most mouse drivers/utilities hide them from application. On Linux, button: http://mxr.mozilla.org/mozilla-central/source/widget/gtk/nsWindow.cpp#2747 We dispatch Back/Forward command directly. Although, GdkButtonEvent doesn't have constants for 4th and 5th button: https://developer.gnome.org/gdk/stable/gdk-Event-Structures.html#GdkEventButton I think that if we'd like to support it, dispatch mouse event first. After that, if mouse button event is consumed by the content, we shouldn't dispatch the command event after that. buttons: http://mxr.mozilla.org/mozilla-central/source/widget/gtk/nsGtkKeyUtils.cpp?rev=42dda6ce6ec8#563 We've not supported the 4th button and 5th button yet. Looks like GDK already supports them. https://developer.gnome.org/gdk/stable/gdk-Windows.html#GdkModifierType However, I worry about that some web pages handle click event without checking .button value. In such web pages, users may not be able to use 4th or 5th button as Back/Forward if we support 4th/5th button press/release as mousedown/mouseup event.
Comment 4•11 years ago
|
||
(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #3) > However, I worry about that some web pages handle click event without > checking .button value. In such web pages, users may not be able to use 4th > or 5th button as Back/Forward if we support 4th/5th button press/release as > mousedown/mouseup event. You should change here against this issue: http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsEventStateManager.cpp?rev=b122fa9825ee#4677 # It's better to make an inline methods of WidgetMouseEvent in widget/MouseEvents.h for this check.
Comment 5•11 years ago
|
||
And it's better you to create patches separately; XP part (WidgetMouseEvent, nsEventStateManager), Windows part, Metro part and GTK part; then, each patch needs only one reviewer.
Comment 6•11 years ago
|
||
(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #3) > However, I worry about that some web pages handle click event without > checking .button value. In such web pages, users may not be able to use 4th > or 5th button as Back/Forward if we support 4th/5th button press/release as > mousedown/mouseup event. FYI Flash Player already disturbs my navigation when I click 4th button on Flash area. It's really annoying.
Updated•11 years ago
|
Blocks: gecko-games
Comment 7•9 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (Mozilla Japan) (offline: 4/29-5/8) from comment #3) > On Windows, we support 4th button and 5th button for buttons. > > buttons: > http://mxr.mozilla.org/mozilla-central/source/widget/windows/KeyboardLayout. > cpp?rev=55c6ec50d580#213 > > If you don't see expected result of MouseEvent.buttons, it's environment > dependent issue. I think that most mouse drivers/utilities hide them from > application. Are there tests to ensure this works correctly? I've never been able to see the relevant events no matter how much I mess with drivers on Windows.
Flags: needinfo?(masayuki)
Comment 8•9 years ago
|
||
(In reply to Jim Porter (:squib) from comment #7) > (In reply to Masayuki Nakano [:masayuki] (Mozilla Japan) (offline: 4/29-5/8) > from comment #3) > > On Windows, we support 4th button and 5th button for buttons. > > > > buttons: > > http://mxr.mozilla.org/mozilla-central/source/widget/windows/KeyboardLayout. > > cpp?rev=55c6ec50d580#213 > > > > If you don't see expected result of MouseEvent.buttons, it's environment > > dependent issue. I think that most mouse drivers/utilities hide them from > > application. > > Are there tests to ensure this works correctly? What did you mean? Even if we have such automated tests (i.e., generating native events via SendInput() API or something), the result may depend on the environment. > I've never been able to see > the relevant events no matter how much I mess with drivers on Windows. Buy expensive mice of Logitech or Microsoft. (Probably, Logitech's mice are better for now because Microsoft stopped releasing expensive mice...) I can see this bug with MX Master of Logitech: http://www.logitech.com/en-us/product/mx-master
Flags: needinfo?(masayuki)
Comment 9•9 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (Mozilla Japan) (offline: 4/29-5/8) from comment #8) > What did you mean? Even if we have such automated tests (i.e., generating > native events via SendInput() API or something), the result may depend on > the environment. Sure, but automated tests would help to ensure that, if someone has problems, it's on their machine. Without automated tests, we can't be sure if the code in Firefox is actually broken unless we test manually. > Buy expensive mice of Logitech or Microsoft. (Probably, Logitech's mice are > better for now because Microsoft stopped releasing expensive mice...) I've tried a few different mice in the past, but none have worked. I think I have an old Microsoft and Logitech mouse somewhere, so I'll try them and see if they work. Currently, I'm using a Razer DeathAdder and it doesn't work. (It has a silly name, but it's the closest I could find to a new version of the old Microsoft Intellimouse Explorer.)
Comment 10•9 years ago
|
||
(In reply to Jim Porter (:squib) from comment #9) > (In reply to Masayuki Nakano [:masayuki] (Mozilla Japan) (offline: 4/29-5/8) > from comment #8) > > Buy expensive mice of Logitech or Microsoft. (Probably, Logitech's mice are > > better for now because Microsoft stopped releasing expensive mice...) > > I've tried a few different mice in the past, but none have worked. I think I > have an old Microsoft and Logitech mouse somewhere, so I'll try them and see > if they work. Oh, do you try to reproduce the normal case? Then, you can test it with uninstalling the utility of your mouse. (But according to the patch, we don't handle 4th/5th button event on Windows)
Comment 11•9 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (Mozilla Japan) (offline: 4/29-5/8) from comment #10) > Oh, do you try to reproduce the normal case? Then, you can test it with > uninstalling the utility of your mouse. (But according to the patch, we > don't handle 4th/5th button event on Windows) I tried disabling the mouse utility, but there was no change. Based on your comment 3, it sounds like Firefox should already handle the 4th/5th button events. Is it necessary to apply the patch to make things work? I don't know if it matters, but I really only care about getting the 4th/5th button events in a chrome context, since I want to handle those events for an add-on. I don't need them to work from a web page.
Comment 12•9 years ago
|
||
(In reply to Jim Porter (:squib) from comment #11) > (In reply to Masayuki Nakano [:masayuki] (Mozilla Japan) (offline: 4/29-5/8) > from comment #10) > > Oh, do you try to reproduce the normal case? Then, you can test it with > > uninstalling the utility of your mouse. (But according to the patch, we > > don't handle 4th/5th button event on Windows) > > I tried disabling the mouse utility, but there was no change. Based on your > comment 3, it sounds like Firefox should already handle the 4th/5th button > events. Is it necessary to apply the patch to make things work? Yes, it is. You can check the mouse button behavior only with Spy++. > I don't know if it matters, but I really only care about getting the 4th/5th > button events in a chrome context, since I want to handle those events for > an add-on. I don't need them to work from a web page. Cannot you to use onAppCommand event? (I don't remember if this event is exposed to JS in chrome.) Although, this isn't a physical device event of mouse buttons: https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/widget/windows/KeyboardLayout.cpp#1215,1219-1220,1222-1223,1285-1286
Comment 13•9 years ago
|
||
I wonder, if Google Chrome already supports these buttons, we should support them too even if some users hate this feature (perhaps, should be able to disable with a pref).
Comment 14•9 years ago
|
||
> I can see this bug with MX Master of Logitech:
> http://www.logitech.com/en-us/product/mx-master
Sorry, this is wrong. I doublechecked with Spy++, then, I see WM_XBUTTON(DOWN|UP) with MX Master.
Comment 15•9 years ago
|
||
I tested with other browsers: Google Chrome for Windows and IE don't support 4th and 5th button event.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•