Last Comment Bug 134583 - no way to rebind mouse buttons
: no way to rebind mouse buttons
Status: NEW
Product: Core
Classification: Components
Component: Keyboard: Navigation (show other bugs)
: Trunk
: All All
-- normal with 7 votes (vote)
: ---
Assigned To: Christopher Blizzard (:blizzard)
: Andrew Overholt [:overholt]
: 152951 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2002-03-31 20:48 PST by Jamie Zawinski
Modified: 2009-08-23 11:34 PDT (History)
15 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

gpm patch (308 bytes, patch)
2002-05-21 15:29 PDT, Robert Ginda
no flags Details | Diff | Splinter Review
patch (4.58 KB, patch)
2002-05-22 15:13 PDT, Christopher Blizzard (:blizzard)
no flags Details | Diff | Splinter Review
sample munger module (2.30 KB, application/octet-stream)
2002-05-22 15:14 PDT, Christopher Blizzard (:blizzard)
no flags Details

Description User image Jamie Zawinski 2002-03-31 20:48:14 PST
(Guessing at the component.)

For the kiosks at DNA Lounge, I need to re-bind all three mouse
buttons to behave as button1.  You can read the rationale for
this at

With NS4, this is easy: I just edit the Motif resources like so:

With GTK programs, this is easy: I just use $GTK_MODULES like so:

I'm told that there's no way to accomplish this simple task
with Mozilla.  

Please rectify.
Comment 1 User image Akkana Peck 2002-04-01 10:12:01 PST
This is probably a dup -- certainly a much wished-for feature -- but I don't
know the other bug number offhand.  Mouse events weren't included in either the
XUL key handling or the XBL key handling.  As a workaround, you could explode
the jar files and edit the JS to add mouse handlers, e.g. see contentAreaClick.js.
Comment 2 User image Zach Lipton [:zach] 2002-04-01 10:40:03 PST
This looks like a dup of 133529, but I'm not sure. Would using a one-
button mouse be an option for the short-term?
Comment 3 User image Jamie Zawinski 2002-04-01 15:50:32 PST
> Would using a one-button mouse be an option for the short-term?

Unfortunately, no.  There are no one-button trackballs, let alone
one-button trackballs that are both inexpensive and sufficiently
hardened that they can be bolted down in a public place and last
longer than a day when drunk people are about.  The trackballs
I found are pretty nice -- they're $20, they light up when you
press the buttons, and it's impossible to remove the ball without
taking screws out.  With most trackballs, the balls aren't really
attached, which means they'd be bouncing around the room all
night long.

Using Netscape 4.78 forevermore is a perfectly acceptable
workaround, however.  I reported this bug because this is
a showstopper for me even *trying* to use Mozilla on my

"you could explode the jar files and edit the JS to add
mouse handlers" sounds hard/intimidating/fragile/not-fun,
so I think I'll pass on that.
Comment 4 User image Gervase Markham [:gerv] 2002-04-04 14:12:03 PST
You could explode the trackballs and wire each button to send the same
electrical signal as mouse1. Does that also sound
hard/intimidating/fragile/not-fun ?

Comment 5 User image Aaron Leventhal 2002-04-04 14:24:43 PST
I like the idea of putting duct tape over the other buttons.

Good ol' duct tape.
Comment 6 User image Jamie Zawinski 2002-04-04 16:33:58 PST
> You could explode the trackballs and wire each button
> to send the same electrical signal as mouse1.

I thought about that, but it looks like it would be
pretty difficult (I'd have to solder directly on the
circuitboard, and it's pretty tight in there.)

Plus, we *do* have to replace these things every now
and then, and it's already a big hassle to get them
in and out (lots of threading of cables through tight
spaces) and I don't need to add another hour of labor
on top of that each time one breaks.

Besides which -- come on, man!  It's solvable in 
software with both GTK and Motif.  Your honor is at
stake here.  Do you want all the kids on the playground
to laugh at you because Mozilla so worthless and weak
that it requires hardware support?
Comment 7 User image Brian Ryner (not reading) 2002-04-04 17:11:47 PST
blizzard, how hard would it be for us to properly support emission hooks such as
onebutton.c uses?  It looks like the reason it doesn't work as-is is that we
hook directly into the gdk mainloop for event processing (before gtk has had a
chance to run the event through the hook function).

Comment 8 User image Christopher Blizzard (:blizzard) 2002-04-04 21:11:22 PST
The problem is that the inner windows aren't attached to any particular widget.
 That's why the theming solution doesn't work out of the box.

Let me look into the emission hook - that's a decent idea.  It might be possible.
Comment 9 User image Adam D. Moss 2002-04-08 00:49:34 PDT
Can you use a variant of this?

xinput set-button-map Mouse1 1 1 1
Comment 10 User image Jamie Zawinski 2002-04-08 17:39:01 PDT
> Can you use a variant of this?
> xinput set-button-map Mouse1 1 1 1

I don't know what xinput is (I have no such program)
but the very first thing I tried was:

    xmodmap -e 'pointer = 1 1 1 1 1'

which causes a BadValue in XSetPointerMapping.
Apparently the X server believes that the pointer
map must contain only 1:1 values: you can't use
it to map N buttons to <N.
Comment 11 User image Aaron Leventhal 2002-04-08 17:44:14 PDT
-> blizzard, reassign as needed
Comment 12 User image Sven Neuhaus 2002-04-20 06:14:22 PDT
Jamie, try mapping button 2 to button 4 and button 3 to button 5 (mousewheel).
If it works, maybe that is an acceptable workaround...?
Comment 13 User image Sean Graham 2002-04-25 20:43:47 PDT
> Jamie, try mapping button 2 to button 4 and button 3 to button 5 (mousewheel).
> If it works, maybe that is an acceptable workaround...?

Not to speak for Jamie, but he needs all 3 buttons to behave as button one for
his kiosks...  Binding mid/right buttons to 4/5 would just make those two
buttons not work (or scroll the window, depending).
Comment 14 User image John "AntiTuX" Dee 2002-05-13 15:46:05 PDT
have you tried ?
supposedly it works for mice too.
Comment 15 User image Jamie Zawinski 2002-05-13 15:49:42 PDT
I don't see how xbindkeys could possibly help.
Comment 16 User image Robert Ginda 2002-05-21 15:29:51 PDT
Created attachment 84533 [details] [diff] [review]
gpm patch

Here is a small patch to add "111", "222", and "333" to the list of legal
button sequences in gpm.  The seq[] array (in gpn.c) maps the value of the -B
argument to what amounts to a button translation table.  The new entries
translate any button state (except "all up") into a single button.

With this patch, I can start gpm with...
$ gpm -t ps/2 -m /dev/mouse -B 111 -R msc
... to map all buttons to the first, and repeat in Mouse Systems speak on

after changing my mouse settings in XF86Config-4 to...
Protocol "MouseSystems"
Device	 "/dev/gpmdata/"
... I was able to start X and have my three button mouse act like one of those
expensive ones from Apple.

The catch is that *sometimes* the cursor wouldn't move *at all* after starting
X.  I don't think this has anything to do with the patch.  Could have something
to do with the version of gpm I hacked vs. the version of X I'm using, 4.1.0,
or something.  In any case, once I got it to start ok, it seemed to stay ok.
Comment 17 User image 2002-05-21 15:37:14 PDT
still it would be *very* nice to have a way to redefine mouse buttons
(well and keyboard shortcuts) freely - similar to how it was possible with NS4.
Is there the technical possibility to do that or was this completely 
ignored when mozilla was designed?
Comment 18 User image Christopher Blizzard (:blizzard) 2002-05-22 15:13:05 PDT
Created attachment 84683 [details] [diff] [review]

Patch that adds a call to a sniffer module.
Comment 19 User image Christopher Blizzard (:blizzard) 2002-05-22 15:14:59 PDT
Created attachment 84685 [details]
sample munger module

Sample module that will munge events properly.
Comment 20 User image Jamie Zawinski 2002-05-26 03:45:00 PDT
Ok, I worked around this Mozilla deficiency by using a hacked version of gpm to
re-map the mouse buttons before X sees them (thanks to everyone who helped with
that.)  So I have a solution for my kiosks.  But I still think it's extra, extra
silly that Mozilla has no user-accessible mouse keymap, so don't go closing this
on my account!
Comment 21 User image Akkana Peck 2002-06-20 16:14:46 PDT
*** Bug 152951 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.