[SDL] Unicode key and AltGr support
Elden Armbrust
earmbrust at xero-soft.com
Fri Sep 30 19:58:51 PDT 2005
So I wasn't wrong in my assumption that AltGr is interpereted as two
actual key events...even though it's somewhat silly to do things that way.
I think the best way to do this would be (programming using sdl, not sdl
dev itself) to check for the control key event press, then check the
next event to see if it is the Alt keypress, then upon the Control keys
release event, check if the alt key is still in the pressed state. It's
somewhat of a hack, but seems like it SHOULD work on any platform...but
who knows? It's worth a shot at least.
-Elden
Christophe Cavalaria wrote:
>The thread about the AltGr got me to test the feature with the uncommon keys
>in the French keyboard I'm using. I've tried the AltGr + a few keys
>combinations to see the result and I found that a lot of times, SDL didn't
>give me back a correct unicode value. Here's the results for the AltGr +
>azertyuiop keys :
>
>$ ./sdlkeytest-1.2.9
>Keyname, (alt gr), Scancode (113), keysym (313), mod (4096), unicode (0)
>Keyname, (a), Scancode (24), keysym (97), mod (20480), unicode (230)
>Keyname, (z), Scancode (25), keysym (122), mod (20480), unicode (171)
>Keyname, (e), Scancode (26), keysym (101), mod (20480), unicode (0)
>Keyname, (r), Scancode (27), keysym (114), mod (20480), unicode (182)
>Keyname, (t), Scancode (28), keysym (116), mod (20480), unicode (0)
>Keyname, (y), Scancode (29), keysym (121), mod (20480), unicode (0)
>Keyname, (u), Scancode (30), keysym (117), mod (20480), unicode (0)
>Keyname, (i), Scancode (31), keysym (105), mod (20480), unicode (0)
>Keyname, (o), Scancode (32), keysym (111), mod (20480), unicode (0)
>Keyname, (p), Scancode (33), keysym (112), mod (20480), unicode (254)
>
>Here's the expected result :
>
>
>
>>>>s = u"æ«€¶ŧ←↓→œþ"
>>>>[ord(c) for c in s]
>>>>
>>>>
>[230, 171, 8364, 182, 359, 8592, 8595, 8594, 339, 254]
>
>I hope the utf8 message will display correctly for all of you. In the list
>there's the corresponding expected unicode values. You can see that no
>keypoint above 254 got through the system.
>
>The systems is a Mandrive 2005 with a custom built SDL version 1.2.9.
>
>On a side note, you can see than I get the correct event for the altgr key
>so that one isn't an issue for Unix users I guess ;)
>
>
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl
>
>
>
>
>
More information about the SDL
mailing list