From: Michael Kjorling on
I have been trying to get the thumb button of my mouse to act as a
middle button (paste, in most applications). So far I haven't had much
luck in Squeeze (it was much easier in Lenny), but earlier today I had
a flash of inspiration and tried clicking the wheel, which worked.
However, it's pretty hard to click (high physical resistance), and the
thumb button is really convenient for this purpose, so I started
looking. xev to the rescue; the mouse wheel click (first) is button 2,
and the thumb button (second) is button 8:

ButtonPress event, serial 31, synthetic NO, window 0x1c00001,
root 0x124, subw 0x1c00002, time 763702, (47,35), root:(918,556),
state 0x10, button 2, same_screen YES

ButtonPress event, serial 31, synthetic NO, window 0x1c00001,
root 0x124, subw 0x1c00002, time 784661, (34,30), root:(905,551),
state 0x10, button 8, same_screen YES

(Obviously, there's a lot more messages there, but I believe these are
the most interesting.)

So, the natural next step is to try to use xmodmap to remap physical
button 8 to logical button 2. However, xmodmap doesn't quite like
that, or maybe I'm getting the syntax wrong (saying 1 8 3 ... 7 8 9
gives the same output):

$ xmodmap -e "pointer = 1 2 3 4 5 6 7 2 9"
Warning: Only changing the first 9 of 13 buttons.
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 116 (X_SetPointerMapping)
Value in failed request: 0x2
Serial number of failed request: 9
Current serial number in output stream: 9
$

...and the buttons still show up as a straight 1:1 mapping in the
"xmodmap -pp" output, with 13 pointer buttons defined. The funny thing
is, if I list all 13 supposed buttons in sequential order, xmodmap has
no complaints. (If I list 9, it warns me that I didn't list all of
them, but otherwise has no complaints.)

I put the following into the pointer section of my xorg.conf for a
short while (inspired by the Xorg.0.log snippet below), but it didn't
seem to make any difference:

Option "Buttons" "9"

The weird thing is in /var/log/Xorg.0.log; it is current, and "grep -i
buttons" gives me:

$ grep -i buttons /var/log/Xorg.0.log
(II) ImExPS/2 Generic Explorer Mouse: Found 9 mouse buttons
(**) ImExPS/2 Generic Explorer Mouse: YAxisMapping: buttons 4 and 5
(II) Macintosh mouse button emulation: Found 3 mouse buttons
(**) Macintosh mouse button emulation: YAxisMapping: buttons 4 and 5
$

I have a Wacom tablet hooked up over USB but it seems to be unrelated
to this, as I get the same log entries with it disconnected through a
reboot. So what's up with this "Macintosh mouse button emulation", and
could it be related to my difficulties? If so, how do I disable it to
test that hypothesis? I tried Googling but didn't come across anything
that looked particularly helpful, mostly people posting their own Xorg
logs that happen to include the same lines.

Any suggestions for what to try would be greatly appreciated, as this
is starting to bug me somewhat.

--
Michael Kjörling .. michael(a)kjorling.se .. http://michael.kjorling.se
* ..... No bird soars too high if he soars with his own wings ..... *
* ENCRYPTED email preferred -- OpenPGP keys: 0x32D6B8C6, 0xBDE9ADA6 *
* ASCII Ribbon Campaign: Against HTML mail, proprietary attachments *