Closed GoogleCodeExporter closed 9 years ago
The following script is a quick way to reproduce the problem. Just run it and
type
some recognizable text, like the sequence "one two three four ..." and observe
the
console output. After some time (depending maybe on your machine and how fast
you
type), you'll start missing presses.
import time
from pyglet.window import key, Window
w = Window()
keynames = dict((v, k)
for k, v in key.__dict__.iteritems()
if isinstance(v, int)
and not k.startswith("MOD"))
sleep_time = 0.0
def on_key_press(k, mods):
print "Pressed", keynames.get(k, "??")
global sleep_time
sleep_time += 0.05
time.sleep(sleep_time)
w.on_key_press = on_key_press
while not w.has_exit:
w.dispatch_events()
Original comment by euccas...@gmail.com
on 6 Oct 2007 at 5:14
Fixed (as much as possible) in r1317.
The error was in the key-repeat detection. Because of the way this works (X11
doesn't tell us which key events are soft repeats and which are actual keyboard
presses), you will still find repeated key presses dropped (because they will be
assumed to be soft repeats). For example, typing "three little bears" in your
program above may result in "thre litle bears".
The only workarounds I can think of are to correlate the key events with the
text
events (thus recovering soft repeats -- but I don't think you want this), or
overriding the low-level X11 key handler (_event_key in
pyglet/window/xlib/__init__.py).
Original comment by Alex.Hol...@gmail.com
on 7 Oct 2007 at 2:31
Original issue reported on code.google.com by
euccas...@gmail.com
on 6 Oct 2007 at 3:44