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 618

Summary: Windows dead key behaviour inconsistent with other platforms
Product: SDL Reporter: Tim Angus <tim>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: amanieu, simos.bugzilla, tjw
Version: HG 1.2   
Hardware: x86   
OS: Windows (All)   
Attachments: Patch which makes win32 dead key behaviour consistent with other platforms
Patch which makes win32 dead key behaviour consistent with other platforms and correctly respects the state of numlock key
Only set the unicode, not the keysym

Description Tim Angus 2008-08-30 12:23:56 UTC
As we all know SDL 1.2 doesn't handle dead keys well since one key press potentially equals two (or more) characters. For example, on many layouts, keying <backquote>,<space> results in <no character>,<backquote><space>. Since the unicode member of the SDL_keysym struct only has room for one character, only one can be returned.

On Linux, the first character is returned. On Windows however, unless the exact number of characters generated by the keypress is 1, nothing is returned. The following patch addresses this inconsistency.
Comment 1 Tim Angus 2008-08-30 12:24:42 UTC
Created attachment 268 [details]
Patch which makes win32 dead key behaviour consistent with other platforms

Aforementioned patch.
Comment 2 Tim Angus 2009-04-02 08:33:00 UTC
Created attachment 314 [details]
Patch which makes win32 dead key behaviour consistent with other platforms and correctly respects the state of numlock key

Updated patch which includes a further fix to the handling of the numpad when numlock is on. This further fix is courtesy Amanieu d'Antras.
Comment 3 Amanieu d'Antras 2009-04-02 09:54:07 UTC
That patch was really only intended for use in ioq3, since it make numpad keys return the same keysym as normal number keys when numlock is on. This was done because ioq3 will still interpret the keysym and therefore cause a HOME while typing a 7 on the numpad. The clean way to do this is to make a separate keysym for numpad keys when numlock is on or off.
Comment 4 Tim Angus 2009-04-02 10:05:12 UTC
OK, lets stick to the original patch then.
Comment 5 Amanieu d'Antras 2009-04-02 10:12:55 UTC
Created attachment 317 [details]
Only set the unicode, not the keysym

This patch doesn't override the keysym, and therefore should be appropriate for SDL.
Comment 6 Sam Lantinga 2009-04-13 01:42:28 UTC
This was checked in as revision 4484.

Thanks!