First, I modified the /etc/X11/xorg.conf to have a section like this for the mouse:
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "Resolution" "1200"
Option "Buttons" "8"
Option "ZAxisMapping" "7 8"
EndSection
Then, I added the following to the Xmodmap-file read upon login:
(If running GDM under Gentoo, this would be /etc/X11/Xmodmap.)
pointer = 1 8 3 6 2 7 4 5
This makes:
Button 1 and 3 - left and right click - (left and right click).
Button 4 and 5 - scrollwheel up and down - (scroll up and down).
Button 4+6 and 5 - buttons above and below scrollwheel - (scroll up + back and scroll down)
Button 8 - pressing the wheel - (?)
Button 2 - little thumbbutton on the side - (paste)
Button 6 - big thumbbutton on the side - (back in mozilla, for example)
Button 1 - "window"-button on top of the mouse - (left click)
If anyone have a better way of configuring this, I'd be happy to know about it.