[gpm]Can I alter mouse orientation?
Jerry Seutter
yello@thegeeks.net
Sun, 17 Nov 2002 15:27:50 -0700 (MST)
>
>> The orientation of the trackball however, is off. When I try to move the
>> pointer "up" it goes up and about 45 degrees to the left. This sucks.
>
> I'm very upset at mouse vendors, as all of them feel they must
> introduce incompatibilities in protocols or behaviour. It sounds to me
> like «my device is so better that it can't use standard protocols».
>
> This time they probably advertise that «by default people move the mouse
> with the wrist rotated by 45deg, so this is ergonomics (and all other
> suck)».
>
> Obviously, there is no support for changing orientation in gpm. And now we
> are forced to add that «feature». Good luck Nico :)
Yeah, tell me about it. I think it must have a been a "nobody uses anything
but windows so we can just fix it in the driver" sort of decision. A 5
minute sanity check when they prototyped the mouse would have shown the
problem.
>> In the meantime I am hacking gpm to do this for me. The solution I am
>> working on (which is just to do trigonometry on the x and y bytes read
>> from the mouse) will suffer from rounding error when moving the mouse
>> slowly.
>
> I think the best approach is creating a new mouse type (we have
> dozens, it's a complete mess -- for the reasons above, mainly). If you
> rotate each individual movement you should have no rounding error; but
> you'll probably need to keep track of partial pixels in your mouse type.
> Partial char-cells are already taken care by the gpm core.
>
> Mouse types are defined in mice.c, you won't need to touch any other file.
> Obivously, if someone wants to implement rotation, that won't be in mice.c
> but in the core.
>
> BTW: if your X doesn't offer rotation, you should repeat gpm packets using
> another protocol (not "raw" repeating), that should work fine as gpm
> re-encodes data packets after the mouse type decoded them. Raw repeating,
> instead, repeats the exact data bytes, so you your gpm hack won't have any
> effect.
>
> Hope this helps
> /alessandro, no more gpm maintainer after seeing new mouse protocols --
I finished the hack and it is messy, but it works. I stuck the code into
getMouseData() in gpm.c because I could get at the bytes coming from the
mouse easily. I took your advice and keep track of partial pixels so
rounding/truncating error is no longer an issue.
Right now the rotation angle is hardcoded and has to be calculated by hand.
I tried adding the sin() and cos() functions but that created an math
library dependency and I couldn't figure out how the linker command works in
the makefiles.
I primarily use my mouse in X, but I decided to hack gpm because it is
smaller and because if anyone else wants it it might help more people.
The mouse autodetects with autops2 as an exps2 mouse and it works quite
well. I get 3 working buttons with it. I still need to delve into
configuring a scroll wheel in X so that I can test that. The other 2
buttons I can live without at the moment, in windows they are mapped to the
browser forward and back buttons.
The other 3 buttons (for a total of 8, geez...) appear to be managed inside
the mouse, 2 of them appear to be auto-scroll-up and auto-scroll-down and
the third button is a scroll lock button in windows so that you can use the
trackball to scroll up and down. The lock button doesn't generate any
packets when pressed, so I'm not sure exactly how it works.
Jerry Seutter