[PD-dev] autorepeat with [key], [keyup], and [keyname]

Mathieu Bouchard matju at sympatico.ca
Sun Nov 28 02:29:28 CET 2004


On Sat, 27 Nov 2004, Mathieu Bouchard wrote:

> On Sat, 27 Nov 2004, Hans-Christoph Steiner wrote:
> 
> > How then can you detect a key being held down in X?  I mean it would
> > be possible by tracking the auto-repeated values, but that seems
> > needlessly complicated.
> 
> There is a way to turn off autorepeat for all keys (xset r off) or on a
> key-by-key basis (eg: xset -r 42)
> 
> But that is a global setting for the xserver, it's not on a
> window-per-window basis.
> 
> The only way to make it local is to register for Enter/Leave events and
> change the key settings every time and keep a backup of the default
> settings.
> 
> This is AFAIK. I've read the X11 spec a few years ago; I may have
> forgotten some segments of it.

woops, i had deleted the first paragraph i wrote, and forgot to rewrite
it. It read pretty much like this:

If you don't want to disable autorepeat, then you would have to track the
auto-repeated values, which requires matching a KeyRelease with a
subsequent KeyPress of the same timestamp, so a real KeyRelease can only
be confirmed after you have received a message with a later timestamp
(!!!) or use some kind of timeout that may or may not work (e.g. if remote
X11 is in use and there's a bit of lag on the network). So yes it's
complicated to do it right.

_____________________________________________________________________
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju





More information about the Pd-dev mailing list