| Summary: | X11 keyboard handling for 1.3 - WIP & call for help | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Christian Walther <cwalther> |
| Component: | events | Assignee: | Christian Walther <cwalther> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
Patch against http://svn.libsdl.org/trunk/SDL r3452
New patch against http://svn.libsdl.org/trunk/SDL r3501 |
||
|
Description
Christian Walther
2007-12-20 12:35:24 UTC
Created attachment 238 [details] Patch against http://svn.libsdl.org/trunk/SDL r3452 Christian, can you get in touch with Bob to help address your main point with input methods? Key repeat is now defined as handled by the OS, since the SDL implementation worked by saving the last key down event and re-sending it at specified intervals, which doesn't make sense in SDL 1.3. Created attachment 242 [details] New patch against http://svn.libsdl.org/trunk/SDL r3501 Thanks to Bob Pendleton who pointed me to "imKStoUCS", I found out that: - we're not the first ones to have this problem, and - everyone has solved it using the "giant look-up table" approach. I have found two basic varieties of such tables out in the wild: - http://webcvs.freedesktop.org/xorg/xc/lib/X11/imKStoUCS.c?view=markup (libX11.6.dylib here on Mac OS X 10.5.1 even exports the KeySymToUcs4() function defined there, but as it doesn't seem to be part of any official API, I don't think we can rely on it.) - http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c They have 819 entries in common, 377 are in the former only, 46 in the latter only, and 84 conflict. Unable to judge the quality of the mappings (particularly with respect to the conflicting entries, most of which appear in the Korean range (0x0Exx)), I decided to go with the numbers and choose the former. In the hope that this helps avoid a mess, I integrated that file as-is, except for the addition of the license header (which lives in a central file in the X.org source) and modification of #include statements. So, here is an updated patch that should now work properly in all cases (after some minor tweaking, I expect). Bob, what do you think about this? Some of the caveats mentioned above still stand: - No text inputs are generated yet. - encodeUtf8() still needs to be reconciled with SDL_iconv() (but decodeUtf8() is gone). I think this is resolved in the current SDL 1.3 code. Christian, can you confirm? I haven't followed SDL development for a while (as you may have noticed), but from a cursory glance at the current source, it looks like it. imKStoUCS.c, which was the solution for the original problem, is still used. |