Wheel Mouse support for Solaris: Part 3: Configuring the mouse events
By Alanc-Oracle on Jul 16, 2004
In my previous two posts I've described how to get the software to support the mouse scroll wheel and how to use it with applications. This post finishes up the series on the new wheel mouse support with a description of how to change the way the Xsun server reports the scroll wheel rolls to the applications. For almost all users, the default configuration will be what they want and there will be no need to change it.
However, if the default settings don't quite match what you want, there are a variety of changes you can make to the scroll wheel handling by editing the
class="XINPUT" entries in the OWconfig file. (Note that these instructions only cover the wheel mouse support in Xsun for directly connected PS/2 & USB mice, not Sun Rays or other X servers.)
For example, to make the mouse on a SPARC system roll in the opposite direction
of the usual, you would change the "IMOUSE" entry in
/usr/openwin/server/etc/OWconfig to look like this:
# Sun Mouse module class="XINPUT" name="IMOUSE" wheelmaps="1=buttons 5 4" ddxHandler="ddxSUNWmouse.so.1" ddxInitFunc="ddxSUNWmouseProc";
On x86, the mouse XINPUT entry is usually found in
/etc/openwin/server/etc/OWconfig and would be changed in a similar fashion.
The format of the wheelmaps option is:
wheelmaps="wheel id=[times x ]action[,wheel id2=[times2 x ]action2...]mappings"
wheel id is an integer in the range 1-255 to specify a specific wheel or a \* to match all wheels without a specific entry.
An action of "axis X" or "axis Y" maps wheel rolls to movement along the specified axis. An action of "buttons A B " maps negative deltas to presses & releases of button A, and positive deltas to presses & releases of button B. A value of "keycodes A B " maps negative deltas to presses & releases of a key with keycode A, and positive deltas to presses & releases of a key with keycode B. (Mapping these keycodes to keysyms is left to the user, sysadmin, and/or desktop defaults.) An action of "discard" discards the events.
The optional times modifier specifies number of times a button or keyboard event should be generated for each delta unit of wheel motion, or the number of pixels the delta should be multiplied by when generating motion events. The value must be a positive number for button and keyboard events, but may be negative for motion events. (Normally rolling the wheel "up" generates motion towards the origin, so specifying a negative pixels value reverses the direction of the motion.) If the times modifier is not specifed, the default value of 1.0 is used for all types of event. If a non-integer value is specified, events may be buffered until enough are accumulated to represent a whole event. For example, if a value of 0.25 is specified, only one out of every 4 single-delta wheel events will be reported.
If not specified for a given mouse device, the default is equivalent to:
wheelmaps="\*=1.0 x buttons 4 5"for compatibility with the XFree86 defaults, Sun Ray implementation, and existing wheel mouse aware X applications. When one or more wheels on a mouse device are mapped to buttons, the mouse DDX will, if necessary, increase the number of buttons the mouse is reported as having to at least as many as the highest button id assigned to a wheel action.
For example, when testing with the Logitech MouseMan Wheel, I found it worked better with a slightly modified configuration. This mouse has 3 buttons plus a wheel, which can also be pressed as a button. In the default configuration, pressing the wheel button is reported as button 2, while the button on the side where the thumb normally rests is button 4. The default configuration resulted in the thumb button presses scrolling up, just as rolling the scroll wheel up did. To make the buttons more usable it was simply necessary to set the wheelmap action to "buttons 5 6" and then run
xmodmap -e "pointer = 1 6 3 2 4 5"which mapped the "thumb" button to button id 2, the wheel as a button to button 6, and the turns of the wheel to buttons 4 & 5 where the clients expect them.