We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 181

Summary: The percent key is missing its keysym
Product: SDL Reporter: Evil Mr Henry <evilmrhenry>
Component: eventsAssignee: 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
Basically, SDL has a keysym for every single key on a standard 104-key keyboard except for % (Shift-5), which I actually need to use. This is quite strange.
Comment 1 Christian Walther 2006-03-25 03:43:34 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).
Comment 2 Evil Mr Henry 2006-03-25 22:48:10 UTC
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.
Comment 3 Sam Lantinga 2006-04-12 10:23:19 UTC
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.