Re: [AD] X11 key repeat fix

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


> here's something which has been bothering me for some time, but I always
> just thought it's another symptom of the not-quite-optimal X11 driver of
> Allegro: I noticed how in many games where you have to hold a key
> pressed, for example to jump, they wouldn't work in X11, especially if
> there was some load (not much, maybe 1% CPU, is usually enough).
>
> Here's a testcase to demonstrate it:
> http://allefant.sf.net/allegro/kbtest.c
>
> With the XWIN driver, and if your system is affected by it (if not,
> compiling allegro in the background might help), it's impossible to move
> the circle to the top of the screen. If it would be a platform game
> written with Allegro, but in Windows, and there was a high jump, you'd
> be stuck.

The testcase clearly demonstrates that there is a problem, so we really must 
tackle it.

> The attached patch fixes is, but unfortunately I'm not quite sure how
> hackish it is. Maybe there's a better way to distinguish repeated key
> releases from real releases, or Allegro could switch off key repeat for
> its X11 window somehow? And of course, getting the X11 driver to run
> smoother in general, it would probably fix it as well. Someone should
> look like SDL does it :)

We could maybe also use the 'time' field of the XKeyEvent structure, in 
conjunction with your approach.  It could even be required if 'autorepeat' 
is disabled in the X server, because otherwise we could discard the only 
KeyRelease event.

Would you mind experimenting with it on top of your approach?  Could you also 
replace the magic numbers in _xwin_private_handle_input with a CPP symbol?

I think the result would be acceptable for mainline at least, maybe even for 
the branch.

-- 
Eric Botcazou




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