PATCH: windows mousewheel

well all you unix users have for long enough been able to
unofficially get wheelmouse messages with SDL. since i wanted
it for windows too, i went and wrote up the code for it.

from what i understand, under unix SDL, when the mouse wheel
spins up it generates an SDL_MOUSEBUTTONDOWN for button #4.
when the mouse wheel spins down generates this event for
button #5.

i’ve duplicated this behaviour on windows. this attached
patch adds the feature to the standard window message event
handler and the directinput handler (used when working with
fullscreen directx).

the patch was created with “cvs diff -c” from my working SDL12
src directory. if you look at the changes i think you’ll find
it pretty much straightforward.

on another note, there is a small problem with the “SDL12"
cvs repository. the “VisualC.zip” file is not flagged as
"binary” in cvs, which breaks things when my cvs on
windows attempts to reinterpret the line feeds in the .ZIP :]
i believe adding the file into the repository with the "-kb"
flag will do the trick?

begin 666 win_mousewheel.patch
M/R!W:6Y?;6]U<V5W:&5E;"YP871C: T*/R!V:61E;R]W:6YC;VUM;VXO=FED
M96]?=VEN8V]M;6]N7U-$3%]S>7-E=F5N=’,N8U]P871C: T26YD97 at Z(‘9I
M9&5O+W=I;F-O;6UO;B]31$Q?<WES979E;G1S+F,-"CT]/3T]/3T]/3T]/3T]
M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]
M/3T]/3T]/3T-"E)#4R!F:6QE.B O8W9S+U-$3#$R+W-R8R]V:61E;R]W:6YC
M;VUM;VXO4T1,7W-Y<V5V96YT<RYC+‘8-"G)E=’)I979I;F<@<F5V:7-I;VX@
M,2XT#0ID:69F("UC("UR,2XT(%-$3%]S>7-E=F5N=’,N8PT**BHJ('9I9&5O
M+W=I;F-O;6UO;B]31$Q?<WES979E;G1S+F,),C P,2\P-2\R,R R,SHS-3HP
M.0DQ+C0-"BTM+2!V:61E;R]W:6YC;VUM;VXO4T1,7W-Y<V5V96YT<RYC"3(P
M,#$O,#8O,34@,#<Z,C at Z,34-"BHJ
BHJBHJBHJBHJ@TBHJ(#,R,2PS
M,C8@BHJ@T*+2TM(#,R,2PS-30 at +2TM+0T*(" )"7T-"B @"0ER971U<FXH
M,"D[#0H@( T
R -"BL@(VEF(“A?5TE.,S)?5TE.3E0@/CT@,’@P-# P2!
M?" H7U=)3C,R7U=)3D1/5U,@/B P># T,# I#0HK( D)8V%S92!735]-3U53
M15=(145,.B -"BL@"0D):68@
”!31$Q?5FED96]3=7)F86-E(“8F(”$@1$E.
M4%547T953$Q30U)%14XH2 I('L-"BL@"0D)“5-I;G0Q-B!X+”!Y.PT**R )
M"0D)56EN=#@@8G5T=&]N(#T@,#L-"BL@"0D)“6EN=”!M;W9E(#T@
’-H;W)T
M4A)5T]21"AW4&%R86TI.PT**R )"0D):68H;6]V92 ^(# I#0HK( D)"0D)
M8G5T=&]N(#T at -#L-"BL@"0D)"65L<V4@:68H;6]V92 (# I#0HK( D)"0D)
M8G5T=&]N(#T at -3L-"BL@"0D)"6EF
&)U='1O;BD-"BL@"0D)"7L-"BL@"0D)
M"0EI9B H(&UO=7-E7W)E;&%T:79E("D@>PTR )"0D)"2\J"5)*4CH at 36%R
M8V@@,C at L(#(P,# -"BL@"0D)“0D)<F5P;W)T(&EN=&5R;F%L(&UO=7-E(’!O
MVET:6]N(&EF(&EN(’)E;&%T:79E(&UO9&4@*B\-"BL@"0D)"0D)” ](# [
M('D@/2 P.PT
R )"0D)"7T at 96QS92![#0HK( D)"0D)"7@@/2 H4VEN=#$V
M4Q/5T]21"AL4&%R86TI.PT**R )"0D)"0EY(#T@%-I;G0Q-BE(25=/4D0H
M;%!A<F%M3L-"BL@"0D)"0E]#0HK( D)"0D)<&]S=&5D(#T at 4T1,7U!R:79A
M=&5-;W5S94)U='1O;B at -"BL@"0D)“0D)“0E31$Q?4%)%4U-%1"P at 8G5T=&]N
M+”!X+”!Y
3L-"BL@"0D)"7T-"BL@"0D)?0TR )"0ER971U<FXH,“D[#0HK
M(”-E;F1I9 at T
R -"B @(VEF9&5F(%=-7T=%5$U)3DU!6$E.1D-"B @"0DO
MB!4:&ES(&UE<W-A9V4@:7,@<V5N="!A<R!A(’=A>2!F;W(@=7,@=&@(F-H
M96-K(B!T:&4@=F%L=65S#0H@( D)(“H@;V8 at 82!P;W-I=&EO;B!C:&%N9V4N
M(”!)9B!W92!D;VXG="!L:6ME(&ET+"!W92!C86X at 861J=7-T#0I);F1E>#H@
M=FED96\O=VEN9’@U+U-$3%]D>#5E=F5N=’,N8PT
/3T]/3T]/3T]/3T]/3T]
M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]
M/3T]/3T]/0T4D-3(&9I;&4Z("]C=G,O4T1,3(O<W)C+W9I9&5O+W=I;F1X
M-2]31$Q?9’@U979E;G1S+F,L=@T
<F5T<FEE=FEN9R!R979I<VEO;B Q+C(-
M"F1I9F8 at +6, at +7(Q+C(@4T1,7V1X-65V96YT<RYC#0HJBH@=FED96\O=VEN
M9’@U+U-$3%]D>#5E=F5N=’,N8PDR,# Q+S T+S(V(#$V.C4P.C$Y"3$N, at T

M+2TM(‘9I9&5O+W=I;F1X-2]31$Q?9’@U979E;G1S+F,),C P,2\P-B\Q-2 P
M-SHR.#HQ- at TBHJBHJBHJBHJBHJ#0HJBH@,S<Y+#,X-" JBHJ#0HM
M+2T@,S<Y+#,Y." M+2TM#0H@( D)"6-A<V4 at 1$E-3T937UDZ#0H@( D)"0EY
M<F5L("L]("A3:6YT,38I<'1R8G5F6VE=+F1W1&%T83L-"B @"0D)"6)R96%K
M.PT
R )"0EC87-E($1)34]&4U]:. at TR )“0D):68@*”!X<F5L('Q('ER
M96P@*2![#0HK( D)"0D)<&]S=&5D(#T at 4T1,7U!R:79A=&5-;W5S94UO=&EO
M;B at -"BL@"0D)"0D)"3 L(#$L('AR96PL('ER96PI.PT
R )"0D)"7AR96P@
M/2 P.PTR )"0D)"7ER96P@/2 P.PTR )"0D)?0TR )"0D):68H*&EN
M="EP=’)B=69;:5TN9’=$871A(#X@,"D-"BL@"0D)"0EP;W-T960@/2!31$Q?
M4’)I=F%T94UO=7-E0G5T=&]N* T
R )"0D)"0D)4T1,7U!215-3140L(#0L
M(# L(# I.PTR )"0D)96QS92!I9B at H:6YT7!T<F)U9EMI72YD=T1A=&$@
M/" P
0T
R )“0D)“7!O<W1E9” ](%-$3%]0<FEV871E36]U<V5”=71T;VXH
M#0HK( D)"0D)"0E31$Q?4%)%4U-%1"P at -2P@,"P@,"D[#0HK( D)"0EB<F5A
M:SL-"B @"0D)8V%S92!$24U/1E-?0E545$].,#H-"B @"0D)8V%S92!$24U/
H1E-?0E545$].,3H-"B @“0D)8V%S92!$24U/1E-?0E545$].,CH-”@``
`
end

i did not test the patch, but i have a 5 buttons mouse (+ mousewheel) so
i 'd better have a SDL_MOUSEWHEEL_(UP | DOWN) event integrated in sdl.
and more : a SDL_MOUSEWHEELi for the 2 or 3 wheeled mice.

maybe it should become part of the spec for sdl 1.3

Antoine

Pete Shinners wrote:> well all you unix users have for long enough been able to

unofficially get wheelmouse messages with SDL. since i wanted
it for windows too, i went and wrote up the code for it.

from what i understand, under unix SDL, when the mouse wheel
spins up it generates an SDL_MOUSEBUTTONDOWN for button #4.
when the mouse wheel spins down generates this event for
button #5.

i’ve duplicated this behaviour on windows. this attached
patch adds the feature to the standard window message event
handler and the directinput handler (used when working with
fullscreen directx).

the patch was created with “cvs diff -c” from my working SDL12
src directory. if you look at the changes i think you’ll find
it pretty much straightforward.

on another note, there is a small problem with the “SDL12"
cvs repository. the “VisualC.zip” file is not flagged as
"binary” in cvs, which breaks things when my cvs on
windows attempts to reinterpret the line feeds in the .ZIP :]
i believe adding the file into the repository with the "-kb"
flag will do the trick?

                       Name: win_mousewheel.patch

win_mousewheel.patch Type: unspecified type (application/octet-stream)
Encoding: x-uuencode

i did not test the patch, but i have a 5 buttons mouse (+ mousewheel) so
i 'd better have a SDL_MOUSEWHEEL_(UP | DOWN) event integrated in sdl.
and more : a SDL_MOUSEWHEELi for the 2 or 3 wheeled mice.

maybe it should become part of the spec for sdl 1.3

Yes, it will.

See ya,
-Sam Lantinga, Lead Programmer, Loki Software, Inc.

“Sam Lantinga” wrote

i did not test the patch, but i have a 5 buttons mouse (+ mousewheel) so
i 'd better have a SDL_MOUSEWHEEL_(UP | DOWN) event integrated in sdl.
and more : a SDL_MOUSEWHEELi for the 2 or 3 wheeled mice.

maybe it should become part of the spec for sdl 1.3

Yes, it will.

having extra mouse buttons was the only thing i wondered about
for this. my guess is that the linux stuff doesn’t handle more
than 3 mouse buttons?

obviously 1.3 and on will have a much better handle on this,
but in my mind that is still over a year away before it’s ready.
can we get something like this in and working for 1.2, or is it
a little too frozen?

the code should be quite simple to modify if we want different
messages or whatnot. i just thought i’d make it match the linux
code and have it instantly work with any code that did deal with
those wheels.

hmm, 5 mouse buttons? for awhile i didn’t think SDL even handled
more than 3. any way to query the total number of mouse buttons in
SDL? any way we can get something simple that at least works in 1.2?

obviously 1.3 and on will have a much better handle on this,
but in my mind that is still over a year away before it’s ready.
can we get something like this in and working for 1.2, or is it
a little too frozen?

Nope, I’m adding it now…

See ya!
-Sam Lantinga, Lead Programmer, Loki Software, Inc.