| Summary: | The percent key is missing its keysym | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Evil Mr Henry <evilmrhenry> |
| Component: | events | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 1.2.9 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
|
Description
Evil Mr Henry
2006-03-25 03:20:37 UTC
If the way to generate a % character on your keyboard is pressing shift-5, then the corresponding keysym is SDLK_5. The SDLK_* constants used in SDL_keysym.sym represent keys, not characters. If you need the characters, use SDL_keysym.unicode (enable it by calling SDL_EnableUNICODE(SDL_ENABLE) first). This is still inconsistant with !, @, #, $, ^, &, *, (, and ). Plus, SDLK_5 is *not* generated in Pygame when hitting %. For reference, these are the numbers generated in pygame when hitting 1-5, then !-%: 49 1 50 2 51 3 52 4 53 5 304 (shift) 33 ! 64 @ 35 # 36 $ 37 % Is this correct on the part of Pygame, or should ! generate the 49 keycode? (And so on.) I've worked around the problem for now with unicode, but this is still wierd. Shift-5 = '%' is not a keysym, it is a shifted state on the 5 keysym. The other symbols actually appear unshifted on different international keyboards. As far as I know, '%' isn't an unshifted key on any keyboard. Enabling Unicode is the right way to handle shift/modifier states on a keyboard. |