[AD] keyboard autorepeat timer

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


In order to fix the Win2k keyboard bug, I was forced to disable the
multi-threaded Win32 timer driver. After thinking a little about that and
after some reports on mouse pointer problem and poor accuracy, it appears to
me that the single-threaded driver is not as good a solution as the former
one: calls to timer proc are of course chained, hence risks of blocking and
loss of accuracy.

The MT driver doesn't work under Win2k because of the keyboard autorepeat
timer code (src/keyboard.c): each time a single key is pressed, a timer is
*installed* and then *removed* as soon as the key is released. Moreover,
when a new key is struck while another one is still being held down, the
timer is *removed* and immediately *re-installed*.

I'm thinking of two possible solutions:
- install the keyboard autorepeat timer the first time a key is struck and
keep it with a fixed period (250 ms is currently the default) until
remove_keyboard() is called. When no keys are pressed, the timer proc simply
does nothing.
- install the keyboard autorepeat timer the first time a key is struck and
change its period on demand: when keys are pressed, set the period according
to the autorepeat rate, otherwise set it to a lengthy one in order to waste
as few cycles as possible.

What do you think about that ?

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



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