05-01-2013 04:05 PM - edited 05-01-2013 04:14 PM
I started playing with a dev alpha C today and decided to immediately try to use the keyboard as buttons. The keyboard flags in keycodes.h seem limited with only KEY_DOWN, KEY_REPEAT(which didn't fire for me, barely checked), and a few others, but no KEY_UP.
I dropped a breakpoint in code and releasing a key always gave me either:
int 224 <-> binary 1110 0000
int 736 <-> binary 10 1110 0000
depending on the key.
Essentially bits 6, 7, and 8 are always set on release. I can easily write the functionality I need based on this behaviour, but since it's not in the header, I'm hesitating.
So, I guess I have a few questions.
Am I using the right header?
Is there an official way to get a "KEY_UP" event?
Is there any way to poll for key states? I'd prefer this as I can avoid coding around things like Hold key -> Swipe up to minimize app -> Release key with no release message ever arriving.
just did the math and noticed those 3 bits are:
KEY_SCAN_VALID, KEY_SYM_VALID and KEY_CAP_VALID
I guess that works as a "documented" key_up, I'll use them for now I guess, the 10th bit on certain keys is still a mystery.