Re: [dev] [dwm] tagging interface

From: matus, <>
Date: Mon, 20 Sep 2010 22:42:04 -0700

On Mon, Sep 20, 2010 at 08:44:18PM -0700, Wolf Tivy wrote:
> [..]
> So does anyone know how to change the mode or something so that we can
> get the paired events instead of just 'keypress'? I know this is
> possible somewhere because that's how SDL does it.

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 interpreted
as a repeat event, and ignored.

This is rather grotesque, and I suggest you look at SDL code to see if
there's maybe some shinier way to do it in the newer versions. (I would
be happy to hear that I am out of date--I used this 5 years ago.)
Received on Tue Sep 21 2010 - 07:42:04 CEST

This archive was generated by hypermail 2.2.0 : Tue Sep 21 2010 - 07:48:02 CEST