[SDL] Key release handling
Steve Fink
sphink at gmail.com
Tue Jun 12 16:22:13 PDT 2007
I have an application that catches SDL key events. It works fine with
SDL 1.2.7. I recently upgraded to SDL 1.2.11, and key release events
are no longer working.
The problem seems to be that I was relying on the unicode character to
be filled in for both keypress and key release events. According to
the SDL docs, the key release is not guaranteed to fill in the unicode
character. The actual behavior seems to have changed between 1.2.7 and
1.2.11.
How can I get that information back? In particular, I want to handle
shifted keys and control keys. So I can't use the scancode or the SDL
key sym, because neither of those take the modifiers into account. I
don't want to do it myself, because my first attempt was toupper(ch)
which really doesn't work so well when somebody presses anything other
than a letter. Should I assume that a shifted f will always be shifted
on both the press and release, and keep a lookup table of every key
seen so far, together with its modifiers, to its unicode value? (If
so, why can't SDL do that for me?) Is there something simple I'm
missing?
More information about the SDL
mailing list