how-to block ads
XFree 3.3.2 (and later)
XFree 3.3.2, natively supports a lot of mouse wheel devices. Its support is quite complete and customizable, it even supports the 4th button (side thumb button) on some mice, such as the logitech MouseMan+. Upgrading to at least XFree 3.3.2 is thus the recommended solution.
Normally, all that is needed is to declare a bindtag in your XF86Config, add the following line in the Pointer section:
ZAxisMapping 4 5
We map the wheel to buttons instead of using it as an axis, as buttons is the only way to support it via just changing resources without recompiling or patching applications and toolkits
If you have a 4-button mouse, if you want to use the 4th button, I recommend rebinding the button4 to button6 to be able to use the resources in this page directly, rather than using 5 and 6 for the wheel. Alas, X only supports 5 buttons officially (thus you cannot use button 6 in Xt and Motif applications) so, depending on the application you may not use anymore the side button. And as the X server seems more unstable this way, I don't recommend you use the side button at all.
Just use "Protocol IMPS/2" and "ZAxisMapping 4 5" as above or "Protocol ExplorerPS/2" and "ZAxisMapping 4 5" if you have an IntelliMouse Explorer. If you want to have a 6th button, you can re-map the side button to button6 by this command:
xmodmap -e "pointer = 1 2 3 6 4 5"
add the lines (for IntelliMouse Explorer):
Note that this command may prompt you interactively to press and release buttons to perform its initialization process, so I use the following code in my X startup script:
## rebind mouse buttons
xmodmap -e "pointer = 1 2 3 6 4 5"' >/tmp/x$$
chmod a+x /tmp/x$$
xterm -bg pink2 -fg blue4 -fn 9x15 -name "Pointer Remap" -e /tmp/x$$
rm -f /tmp/x$$
In your XF86Config file, you should then use one of these protocols:
Protocol "imps/2" # for ps/2 wheel mouse
Protocol "intellimouse" # for serial wheel mouse
... see the Xfree docs
WARNING! These patches or servers do not work if Emulate3Buttons is defined in the X Config file.
Wheel will scroll the saved output lines. Add to your ~/.Xresources the following lines:
!# Scrolling on wheel mouse: half a page normally, line per line with shift
!# In the scrollbar we map buttons 5 & 4 to 1 and 2 otherwise, core dump
!# This will move proportionally to cursor position but we dont know how to
!# program the same exact behavior as in the text widget.
After you have done all this, restart X server and have fun with your, now working, scroll wheel.