Re: [AD] set_mouse_speed for X |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] set_mouse_speed for X
- From: Elias Pschernig <elias@xxxxxxxxxx>
- Date: Fri, 22 Dec 2006 13:54:31 +0100
On Wed, 2006-12-13 at 09:58 -0700, Trent Gamblin wrote:
>
> I used xset because that's what was written in xmouse.c originally. It
> said "use xset with m option" or something similar. It does not affect
> existing Allegro programs. And I have attached a new patch that uses the
> X11 API directly instead of xset. I know you may not use it as it does
> affect all the other programs the user is running at the time too,
> although it resets the mouse to the original speed at the end of the
> program. Adjusting the speed for just one program has proven too
> difficult for me as I'm not very familiar with the Allegro internals.
I'm not so sure it won't change existing programs. There's apparently a
call to set_mouse_speed(2, 2) in install_mouse(), so..
speed = MAX(0, (xspeed + yspeed) / 2);
tenths = (mouse_mult / mouse_div * 10) + (mouse_mult % mouse_div);
tenths -= (speed-2) * 5;
tenths = MIN(100, MAX(0, tenths));
E.g. assume, the speed initially is 5/2 (that's what I actually do get).
Now, by the above code:
speed = (2+2)/2 = 2
tenths = (5/2*10) + (5%2) = 21
So, instead of 5/2 (2.5) before, not we get (21/10) (2.1). Not a big
change, but all existing Allegro programs would now have a slightly
slower mouse.
Also, I don't understand why 5/2 isn't converted to 25/10, and what the
MIN/MAX is for.
--
Elias Pschernig