[SDL] Mouse wheel in SDL??
tullmann at cs.utah.edu
Tue Mar 12 12:37:01 PST 2002
> > How does SDL know which "buttons" are mouse wheel up/down on X? (If
> > they're hardcoded to 4/5), changing the X config would indeed break the
> > wheel input.)
> If you change them from 4/5, wheel input breaks.
> You can, however, remap any mouse button in your XF86Config, so that when
> the hardware sends the REAL mouse button 4, XFree reports to the
> application that button 6 (or whatever) was touched instead. This is also
> handy if the mouse wheel is reported as something other than 4/5 by the
Ryan's exactly right. See:
(BTW, In Xfree86 3.x, a max of 5 buttons are supported.)
All X apps which say they support the "mouse wheel", actually support
buttons 4/5 acting like a wheel. So 5-button+1-wheel (like my
IntelliMouse Explorer) need the xmodmap hackery (detailed on the above
page to map the wheel to the right place).
You can use 'xev' to see which events get through, so Xfree86 4.x does
support buttons 6/7 (which I, for example, have my mouse's thumb
buttons mapped to). However, I've yet to find an X application that
does anything with these buttons.
In terms of SDL and games, I think the best that can be done on the X
side is to assume buttons 4/5 are the wheel, since that's now the
defacto standard that X apps use. Unless there is some way to query
the X server to ask which buttons have the "ZAxisMapping" hack
associated with them (which I doubt since no X app that I know of can
handle a wheel on buttons 6/7 --- I tried a bunch.)
Perhaps SDL could hide this grossness a bit by (1) mapping the wheel
to buttons on X and Windows (which I gather is what it already does),
and (2) providing an API to say which buttons are the wheel buttons
(the implementation could default to reporting 4/5 on X, but use real
information on Windows). That's at least backwards compatible.
----- ----- ---- --- --- -- - - - - -
Pat Tullmann tullmann at cs.utah.edu
That which does not kill you merely postpones the inevitable.
More information about the SDL