[PD] Behavoir of [keyup] in Linux

Claude Heiland-Allen claudiusmaximus at goto10.org
Tue May 29 05:05:11 CEST 2007


ugur guney wrote:
> # Hi!
> # I started to write an answer to a question on list about using keyboard
> input in a patch. Then I realized that a patch which I written in Windows
> does not work well under Linux, to which I have switched weeks ago.
> # When I press and hold a key, after a short time [keyup] starts to output
> the number of that key repeatedly (before releasing it). In Windows it only
> outputs the key no when a key is released. Do you have any idea why 
> there is
> a difference between two platforms?

It's just the way X11 works, as far as I understand it.  I did a test 
with GridFlow, and the same thing happens (console log from attached patch):

("y" key pressed and held)
print: 10960 keypress 129 106 0 y
print: 520 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 20 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 40 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 20 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 60 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 20 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 20 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 40 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 40 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 40 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 40 keyrelease 129 106 0 y
print: 0 keypress 129 106 0 y
print: 0 keyrelease 129 106 0 y
("y" key really released)

Here the first number is the elapsed time since the previous event 
(measured in Pd logical time).  It would be possible to patch up 
something that would discard any "keyrelease immediately-followed-by 
keypress for the same key" pairs that occur with an elapsed time of 0 
(hint: it would use [delay 0.1] or so, maybe even [delay 0] would work). 
  The last keyrelease would be delayed a little, but it would either be 
unnoticeable with [delay 0.1] or at exactly the same logical time with 
[delay 0]

> # I'm using canonical Pd version 0.40-2 under Ubuntu Feisty.
> -ugur guney-

Pd 0.40-2 under pure:dyne 2.3.57 here.


Claude
-- 
http://claudiusmaximus.goto10.org


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gridflow-key-repeat-test.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070529/3f77d2bd/attachment.txt>


More information about the Pd-list mailing list