Re: [AD] keyboard autorepeat timer

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> I like this one, no overloading creating and deleting more and more timers
> just because a key is pressed

That's the very idea !

> I don't see why we should await for a key to be pressed to install a timer
> since we all be can almost sure the user will press a key sonner or later

I want to modify as little as possible the keyboard code, but you're right,
it would be more consistent to launch the timer by install_keyboard() and
kill it by remove_keyboard().

> sooo, i would go with option number 1

But then the timer proc would be called each 250 ms for nothing. With Option
#2, when the keyboard is asleep, the period could be set to, say, 10 s or
whatever lengthy period is supported by all the platforms.

> maybe there could be something done to enable the pause between
> first keystroke and repetitions?
> think that we want the key to wait for repetitions until 250msecs have
> passed and we want to repeat the keystroke after each 50msecs
> maybe we could install a timer for each 50msecs and have a counter
> that when the key is on hold and the counter have reached 5 (50 * 5 =
> 250msecs) then repeat the keystroke.

Again I don't want to change many things. There are already two parameters:
'delay' and 'rate'; the first time is key is struck, the timer is installed
with 'delay' as the period; and the first time the timer proc is called, the
period is changed to 'rate'.

I just want to add a third period 'idle', so that a typical working sequence
for the timer would be: idle - delay - rate - rate - rate... - idle.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/