Bug#730405: libois-1.3.0: ignores keypresses that are falsely detected as key repeats

Markus Koschany apo at gambaru.de
Thu Dec 12 17:49:37 UTC 2013


Hello,

Javier Cantero found out more about this issue and reported his findings
to FreeOrion's upstream forum.

So that this won't get lost, I'm quoting here his original remarks

http://www.freeorion.org/forum/viewtopic.php?f=25&t=7719&start=15#p64812

"I don't know if you are interested in this (being a libois and not a FO
related bug) but I've done some X event traces of FreeOrion with xtrace,
and now I understand what is going on. The traces are here:

xtrace of FreeOrion over Xfce 4.10 (using libois 1.3.0 from debian jessie)
https://gist.github.com/javiercantero/7752527

xtrace of FreeOrion over Xfce 4.10 (using patched libois)

https://gist.github.com/javiercantero/7752792

xtrace of FreeOrion over plain X, without Desktop Environment (using
libois 1.3.0)

https://gist.github.com/javiercantero/7753292

xtrace of FreeOrion over plain X, without Desktop Environment (using
patched libois)

https://gist.github.com/javiercantero/7753316

The bug triggers when the X Server (or whatever is tweaking with these
events) starts to send an additional KeyRelease event before the
KeyPress event.

KeyPress(K1) -> KeyRelease(K1) -> KeyPress(K2) -> KeyRelease(K2) ->
KeyPress(K3) -> KeyRelease(K3) -> ...
becomes at certain moment

KeyRelease(K4) -> KeyPress(K4) -> KeyRelease(K4) -> KeyRelease(K5) ->
KeyPress(K5) -> KeyRelease(K5) -> KeyRelease(K6) -> KeyPress(K6) ->
KeyRelease(K6) -> ...

The _isKeyRepeat() function
(https://gist.github.com/javiercantero/7753445) finds the sequence
KeyRelease(Kn) -> KeyPress(Kn), and "eats" the KeyPress event, because
that is its job: convert a secuence of repeated keystrokes KeyPress(Ki)
-> KeyRelease(Kn) -> KeyPress(Kn) -> KeyRelease(Kn) -> ... ->
KeyPress(Kn) -> KeyRelease(Kn) to a unique KeyPress(Kn) ->
KeyRelease(Kn), and that is done filtering the KeyRelease(Ki) events
with a KeyEvent(Ki) after it (with only 2 units of time of delay).

So the proposed patch prevents that the _isKeyRepeat() function removes
the KeyPress events, but also destroys the purpose of _isKeyRepeat().
With the patch applied (2nd trace) the "ghosts" KeyReleases still are
there, but now the KeyPress events are processed by the right code of
libois, instead of being lost.

The third and 4th traces proves that this weird behaviour with the
keyboard events doesn't happen if Xfce DE is not launched. With a setup
of X and a simple window manager (OpenBox), the keyboard traces are as
intended (KeyPress -> KeyRelease -> KeyPress -> KeyRelease -> ...).

Now I'm trying to reproduce the wrong behaviour of the keyboard events
from another program launched within Xfce. I've written a simple Xlib
example that reads the keyboard events: xreadkeys.c. But the showed
events and xtraces of xreadkeys are completely normal. If Xfce is
triggering something inside FreeOrion that messes up the keyboard
events, I don't see what or how it can be. The only thing I know is it's
not inmediate, there is a delay to the instant it happens."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/attachments/20131212/38301189/attachment.sig>


More information about the pkg-multimedia-maintainers mailing list