[quake2] x rendering problem

Brendan Burns brendanburns at attbi.com
Tue Apr 2 20:16:34 EST 2002


> Hello there,
> I'm experiencing a problem with any X renderer and both sdl and normal quake2 
> binary.
> I've binded the hook as:
> bind q +hook
> but when i press "q" (and don't release it), if I move the mouse it will 
> react as if i released and pressed it again (it looks like if it resets the 
> keyboard keys).

Hey,
I duplicated this problem, actually it has nothing to do with moving the
mouse, it has everything to do with the fact that when X repeats keys it
fires both XKeyPress and XKeyRelease events over and over again like:

<press and hold q>
XKeyPress
XKeyRelease
XKeyPress
XKeyRelease
...
XKeyPress
<let go of q>
XKeyRelease

which I think is wicked stupid, but I guess it helps programs that
aren't smart enough to handle a whole string of XKeyPress events...

Anyway, the good news is that the nice folks over at SDL figured out
(well copied actually) some code which figures out if the key is
repeating, turn-about being fair play, I copied the code from them *I
love open source* into the rw_x11.c renderer.  This appears to have
fixed the problem.  Now if you:
bind q say "foobar"
if you press and hold 'q', you will only say something once.

To get this change, update to the latest version in CVS, and let me know
if it breaks anything!

--brendan





More information about the quake2 mailing list