> You want the KeyRelease event. Note that, by default, X11 > will generate > spurious repeat KeyPress events. Years ago I read the > relevant SDL code > (which maintains a vector of which keys are currently down) to > see if it > had a nice way of handling these events. It turns out it > just had > a heuristic for detecting them and ignoring them; iirc, the > synthetic repeat > events look like a KeyRelease followed by a KeyPress, where the only > difference between the two events is the type (i.e. Release then > Press), > and the time, which is off by one. These are pushed onto > the X event > queue simultaneously, so a reliable test is, when encountering > KeyRelease, also call XPeekEvent to see if the follow-up KeyPress > exists. In this case, the KeyRelease/KeyPress pair can be > interpretedas a repeat event, and ignored.
That would suck. Good to know it can be done tho. I have heard of a way to turn off repeats, and I'll look into that before I do any nasty race-condition hacks. I guess the SDL is a good source. (haha pun) Is there anything in dwm that depends on repeats that would be broken if I changed it somehow? I'll get hacking and post a patch if I ever finish. Thanks for your help.