Bypass events and get the physical keyboard state directly

Bryan Baldwin bryan at katofiad.co.nz
Sun Feb 19 22:19:20 UTC 2017


Hello all,

I've been writing game code, and have gone adrift with a big problem
with keyboard input.

The properties I'm getting through SDL2 contain key up/down,
pressed/released, and repeat. I've read either that the pressed/released
properties are only set with the key actually physically down, or that a
keyboard event will at least have the repeat property set if the key is
a repeat. I can't confirm that any of this is true in code.

No matter what I do, if I hold down a key I get the first key down +
pressed event, a subsequent event flagged as a repeat at the delay
threshold (500ms), and then a deluge of *unflagged* key down+pressed /
key up+released event pairs for the rate interval that continue
repeating well after the key is actually released. I tried using SDL2's
GetKeyboardState instead, but this produces identical results. Its the
same data as events with a different interface.

The documentation I've read for keyboard input with X11 also follows a
very similar event-based model, but what I want is a way to check the
keyboard and literally only see exactly what the state of the keys at
the instant that that call is made, and by-pass any and all other
processing entirely, including auto-repeat.

Can anyone point me in the right direction?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 862 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20170220/96fbbbbd/attachment.sig>


More information about the xdg mailing list