sdl12-compat: Support SDLK_WORLD_* keys

From 3600c872531ddead438446cb4c725cd49eff5871 Mon Sep 17 00:00:00 2001
From: Daniel Gibson <[EMAIL REDACTED]>
Date: Sun, 7 Nov 2021 22:08:18 +0100
Subject: [PATCH] Support SDLK_WORLD_* keys

The corresponding keys (should) have UCS-4 codes as SDL2-KeyCodes,
so match UCS-4-codes to the low byte of the corresponding X11 KeySym,
which is what SDL1.2 did, at least on X11, see
https://github.com/libsdl-org/SDL-1.2/blob/15f4b475f70cb71be5e8e96a032ce2874723d524/src/video/x11/SDL_x11events.c#L1177-L1192
(and for other platforms it's at least better than nothing).
---
 src/SDL12_compat.c | 657 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 655 insertions(+), 2 deletions(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 297ca4e..fde1a4d 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -2581,7 +2581,9 @@ SDL_GetKeyName(SDL12Key key)
 static SDL12Key
 Keysym20to12(const SDL_Keycode keysym20)
 {
-    if (((int) keysym20) < 127) {  /* (most of) low-ASCII maps directly */
+    if (((int) keysym20) <= 255) {
+        /* (most of) low-ASCII maps directly,
+         * and so does the Latin-1 range (128-255) */
         if (keysym20 == SDLK_PAUSE) {
             return SDLK12_PAUSE;
         } else if (keysym20 == SDLK_CLEAR) {
@@ -2657,11 +2659,662 @@ Keysym20to12(const SDL_Keycode keysym20)
     CASEKEYSYM20TO12(POWER);
     CASEKEYSYM20TO12(UNDO);
     #undef CASEKEYSYM20TO12
+
+    /* Map the "World Keys" (SDLK_WORLD_0 = 0xA0 to SDLK_WORLD_95 = 0xFF).
+     * In SDL2 they're the UCS-4 (32bit unicode) code for the key,
+     * in SDL1.2 (on X11 at least) they were the X11_KeySym & 0xFF,
+     * if (X11_KeySym >> 8)) was either 0 to 8 or 0x0A or 0x0C or 0x0E
+     * So map all those used UCS-4 codes to the corresponding SDLK12_WORLD_* codes
+     * Note that the Latin-1 range (keysym20 <= 255) is already handled at the top of this function
+     * Luckily X11's keysymdef.h lists both the values of the constants and their UCS4-value, like
+     * #define XK_Aogonek                       0x01a1  / * U+0104 LATIN CAPITAL LETTER A WITH OGONEK * /
+     * So I'm using that as a reference for our mappings, which only use
+     * the lowest byte of the XK_* value, because of X11_KeySym & 0xFF in SDL1.2
+     *
+     * case UTC4_code: return (SDL12Key)lowest_byte_of_corresponding_X11_KeySym; */
+
+    /* Latin-2 */
+    case 0x0104: return (SDL12Key)0xa1;
+    case 0x02D8: return (SDL12Key)0xa2;
+    case 0x0141: return (SDL12Key)0xa3;
+    case 0x013D: return (SDL12Key)0xa5;
+    case 0x015A: return (SDL12Key)0xa6;
+    case 0x0160: return (SDL12Key)0xa9;
+    case 0x015E: return (SDL12Key)0xaa;
+    case 0x0164: return (SDL12Key)0xab;
+    case 0x0179: return (SDL12Key)0xac;
+    case 0x017D: return (SDL12Key)0xae;
+    case 0x017B: return (SDL12Key)0xaf;
+    case 0x0105: return (SDL12Key)0xb1;
+    case 0x02DB: return (SDL12Key)0xb2;
+    case 0x0142: return (SDL12Key)0xb3;
+    case 0x013E: return (SDL12Key)0xb5;
+    case 0x015B: return (SDL12Key)0xb6;
+    case 0x02C7: return (SDL12Key)0xb7;
+    case 0x0161: return (SDL12Key)0xb9;
+    case 0x015F: return (SDL12Key)0xba;
+    case 0x0165: return (SDL12Key)0xbb;
+    case 0x017A: return (SDL12Key)0xbc;
+    case 0x02DD: return (SDL12Key)0xbd;
+    case 0x017E: return (SDL12Key)0xbe;
+    case 0x017C: return (SDL12Key)0xbf;
+    case 0x0154: return (SDL12Key)0xc0;
+    case 0x0102: return (SDL12Key)0xc3;
+    case 0x0139: return (SDL12Key)0xc5;
+    case 0x0106: return (SDL12Key)0xc6;
+    case 0x010C: return (SDL12Key)0xc8;
+    case 0x0118: return (SDL12Key)0xca;
+    case 0x011A: return (SDL12Key)0xcc;
+    case 0x010E: return (SDL12Key)0xcf;
+    case 0x0110: return (SDL12Key)0xd0;
+    case 0x0143: return (SDL12Key)0xd1;
+    case 0x0147: return (SDL12Key)0xd2;
+    case 0x0150: return (SDL12Key)0xd5;
+    case 0x0158: return (SDL12Key)0xd8;
+    case 0x016E: return (SDL12Key)0xd9;
+    case 0x0170: return (SDL12Key)0xdb;
+    case 0x0162: return (SDL12Key)0xde;
+    case 0x0155: return (SDL12Key)0xe0;
+    case 0x0103: return (SDL12Key)0xe3;
+    case 0x013A: return (SDL12Key)0xe5;
+    case 0x0107: return (SDL12Key)0xe6;
+    case 0x010D: return (SDL12Key)0xe8;
+    case 0x0119: return (SDL12Key)0xea;
+    case 0x011B: return (SDL12Key)0xec;
+    case 0x010F: return (SDL12Key)0xef;
+    case 0x0111: return (SDL12Key)0xf0;
+    case 0x0144: return (SDL12Key)0xf1;
+    case 0x0148: return (SDL12Key)0xf2;
+    case 0x0151: return (SDL12Key)0xf5;
+    case 0x0159: return (SDL12Key)0xf8;
+    case 0x016F: return (SDL12Key)0xf9;
+    case 0x0171: return (SDL12Key)0xfb;
+    case 0x0163: return (SDL12Key)0xfe;
+    case 0x02D9: return (SDL12Key)0xff;
+    /* Latin-3 */
+    case 0x0126: return (SDL12Key)0xa1;
+    case 0x0124: return (SDL12Key)0xa6;
+    case 0x0130: return (SDL12Key)0xa9;
+    case 0x011E: return (SDL12Key)0xab;
+    case 0x0134: return (SDL12Key)0xac;
+    case 0x0127: return (SDL12Key)0xb1;
+    case 0x0125: return (SDL12Key)0xb6;
+    case 0x0131: return (SDL12Key)0xb9;
+    case 0x011F: return (SDL12Key)0xbb;
+    case 0x0135: return (SDL12Key)0xbc;
+    case 0x010A: return (SDL12Key)0xc5;
+    case 0x0108: return (SDL12Key)0xc6;
+    case 0x0120: return (SDL12Key)0xd5;
+    case 0x011C: return (SDL12Key)0xd8;
+    case 0x016C: return (SDL12Key)0xdd;
+    case 0x015C: return (SDL12Key)0xde;
+    case 0x010B: return (SDL12Key)0xe5;
+    case 0x0109: return (SDL12Key)0xe6;
+    case 0x0121: return (SDL12Key)0xf5;
+    case 0x011D: return (SDL12Key)0xf8;
+    case 0x016D: return (SDL12Key)0xfd;
+    case 0x015D: return (SDL12Key)0xfe;
+    /* Latin 4 */
+    case 0x0138: return (SDL12Key)0xa2;
+    case 0x0156: return (SDL12Key)0xa3;
+    case 0x0128: return (SDL12Key)0xa5;
+    case 0x013B: return (SDL12Key)0xa6;
+    case 0x0112: return (SDL12Key)0xaa;
+    case 0x0122: return (SDL12Key)0xab;
+    case 0x0166: return (SDL12Key)0xac;
+    case 0x0157: return (SDL12Key)0xb3;
+    case 0x0129: return (SDL12Key)0xb5;
+    case 0x013C: return (SDL12Key)0xb6;
+    case 0x0113: return (SDL12Key)0xba;
+    case 0x0123: return (SDL12Key)0xbb;
+    case 0x0167: return (SDL12Key)0xbc;
+    case 0x014A: return (SDL12Key)0xbd;
+    case 0x014B: return (SDL12Key)0xbf;
+    case 0x0100: return (SDL12Key)0xc0;
+    case 0x012E: return (SDL12Key)0xc7;
+    case 0x0116: return (SDL12Key)0xcc;
+    case 0x012A: return (SDL12Key)0xcf;
+    case 0x0145: return (SDL12Key)0xd1;
+    case 0x014C: return (SDL12Key)0xd2;
+    case 0x0136: return (SDL12Key)0xd3;
+    case 0x0172: return (SDL12Key)0xd9;
+    case 0x0168: return (SDL12Key)0xdd;
+    case 0x016A: return (SDL12Key)0xde;
+    case 0x0101: return (SDL12Key)0xe0;
+    case 0x012F: return (SDL12Key)0xe7;
+    case 0x0117: return (SDL12Key)0xec;
+    case 0x012B: return (SDL12Key)0xef;
+    case 0x0146: return (SDL12Key)0xf1;
+    case 0x014D: return (SDL12Key)0xf2;
+    case 0x0137: return (SDL12Key)0xf3;
+    case 0x0173: return (SDL12Key)0xf9;
+    case 0x0169: return (SDL12Key)0xfd;
+    case 0x016B: return (SDL12Key)0xfe;
+    /* Katakana */
+    case 0x203E: return (SDL12Key)0x7e;
+    case 0x3002: return (SDL12Key)0xa1;
+    case 0x300C: return (SDL12Key)0xa2;
+    case 0x300D: return (SDL12Key)0xa3;
+    case 0x3001: return (SDL12Key)0xa4;
+    case 0x30FB: return (SDL12Key)0xa5;
+    case 0x30F2: return (SDL12Key)0xa6;
+    case 0x30A1: return (SDL12Key)0xa7;
+    case 0x30A3: return (SDL12Key)0xa8;
+    case 0x30A5: return (SDL12Key)0xa9;
+    case 0x30A7: return (SDL12Key)0xaa;
+    case 0x30A9: return (SDL12Key)0xab;
+    case 0x30E3: return (SDL12Key)0xac;
+    case 0x30E5: return (SDL12Key)0xad;
+    case 0x30E7: return (SDL12Key)0xae;
+    case 0x30C3: return (SDL12Key)0xaf;
+    case 0x30FC: return (SDL12Key)0xb0;
+    case 0x30A2: return (SDL12Key)0xb1;
+    case 0x30A4: return (SDL12Key)0xb2;
+    case 0x30A6: return (SDL12Key)0xb3;
+    case 0x30A8: return (SDL12Key)0xb4;
+    case 0x30AA: return (SDL12Key)0xb5;
+    case 0x30AB: return (SDL12Key)0xb6;
+    case 0x30AD: return (SDL12Key)0xb7;
+    case 0x30AF: return (SDL12Key)0xb8;
+    case 0x30B1: return (SDL12Key)0xb9;
+    case 0x30B3: return (SDL12Key)0xba;
+    case 0x30B5: return (SDL12Key)0xbb;
+    case 0x30B7: return (SDL12Key)0xbc;
+    case 0x30B9: return (SDL12Key)0xbd;
+    case 0x30BB: return (SDL12Key)0xbe;
+    case 0x30BD: return (SDL12Key)0xbf;
+    case 0x30BF: return (SDL12Key)0xc0;
+    case 0x30C1: return (SDL12Key)0xc1;
+    case 0x30C4: return (SDL12Key)0xc2;
+    case 0x30C6: return (SDL12Key)0xc3;
+    case 0x30C8: return (SDL12Key)0xc4;
+    case 0x30CA: return (SDL12Key)0xc5;
+    case 0x30CB: return (SDL12Key)0xc6;
+    case 0x30CC: return (SDL12Key)0xc7;
+    case 0x30CD: return (SDL12Key)0xc8;
+    case 0x30CE: return (SDL12Key)0xc9;
+    case 0x30CF: return (SDL12Key)0xca;
+    case 0x30D2: return (SDL12Key)0xcb;
+    case 0x30D5: return (SDL12Key)0xcc;
+    case 0x30D8: return (SDL12Key)0xcd;
+    case 0x30DB: return (SDL12Key)0xce;
+    case 0x30DE: return (SDL12Key)0xcf;
+    case 0x30DF: return (SDL12Key)0xd0;
+    case 0x30E0: return (SDL12Key)0xd1;
+    case 0x30E1: return (SDL12Key)0xd2;
+    case 0x30E2: return (SDL12Key)0xd3;
+    case 0x30E4: return (SDL12Key)0xd4;
+    case 0x30E6: return (SDL12Key)0xd5;
+    case 0x30E8: return (SDL12Key)0xd6;
+    case 0x30E9: return (SDL12Key)0xd7;
+    case 0x30EA: return (SDL12Key)0xd8;
+    case 0x30EB: return (SDL12Key)0xd9;
+    case 0x30EC: return (SDL12Key)0xda;
+    case 0x30ED: return (SDL12Key)0xdb;
+    case 0x30EF: return (SDL12Key)0xdc;
+    case 0x30F3: return (SDL12Key)0xdd;
+    case 0x309B: return (SDL12Key)0xde;
+    case 0x309C: return (SDL12Key)0xdf;
+    /* Arabic */
+    case 0x060C: return (SDL12Key)0xac;
+    case 0x061B: return (SDL12Key)0xbb;
+    case 0x061F: return (SDL12Key)0xbf;
+    case 0x0621: return (SDL12Key)0xc1;
+    case 0x0622: return (SDL12Key)0xc2;
+    case 0x0623: return (SDL12Key)0xc3;
+    case 0x0624: return (SDL12Key)0xc4;
+    case 0x0625: return (SDL12Key)0xc5;
+    case 0x0626: return (SDL12Key)0xc6;
+    case 0x0627: return (SDL12Key)0xc7;
+    case 0x0628: return (SDL12Key)0xc8;
+    case 0x0629: return (SDL12Key)0xc9;
+    case 0x062A: return (SDL12Key)0xca;
+    case 0x062B: return (SDL12Key)0xcb;
+    case 0x062C: return (SDL12Key)0xcc;
+    case 0x062D: return (SDL12Key)0xcd;
+    case 0x062E: return (SDL12Key)0xce;
+    case 0x062F: return (SDL12Key)0xcf;
+    case 0x0630: return (SDL12Key)0xd0;
+    case 0x0631: return (SDL12Key)0xd1;
+    case 0x0632: return (SDL12Key)0xd2;
+    case 0x0633: return (SDL12Key)0xd3;
+    case 0x0634: return (SDL12Key)0xd4;
+    case 0x0635: return (SDL12Key)0xd5;
+    case 0x0636: return (SDL12Key)0xd6;
+    case 0x0637: return (SDL12Key)0xd7;
+    case 0x0638: return (SDL12Key)0xd8;
+    case 0x0639: return (SDL12Key)0xd9;
+    case 0x063A: return (SDL12Key)0xda;
+    case 0x0640: return (SDL12Key)0xe0;
+    case 0x0641: return (SDL12Key)0xe1;
+    case 0x0642: return (SDL12Key)0xe2;
+    case 0x0643: return (SDL12Key)0xe3;
+    case 0x0644: return (SDL12Key)0xe4;
+    case 0x0645: return (SDL12Key)0xe5;
+    case 0x0646: return (SDL12Key)0xe6;
+    case 0x0647: return (SDL12Key)0xe7;
+    case 0x0648: return (SDL12Key)0xe8;
+    case 0x0649: return (SDL12Key)0xe9;
+    case 0x064A: return (SDL12Key)0xea;
+    case 0x064B: return (SDL12Key)0xeb;
+    case 0x064C: return (SDL12Key)0xec;
+    case 0x064D: return (SDL12Key)0xed;
+    case 0x064E: return (SDL12Key)0xee;
+    case 0x064F: return (SDL12Key)0xef;
+    case 0x0650: return (SDL12Key)0xf0;
+    case 0x0651: return (SDL12Key)0xf1;
+    case 0x0652: return (SDL12Key)0xf2;
+    /* Cyrillic */
+    case 0x0452: return (SDL12Key)0xa1;
+    case 0x0453: return (SDL12Key)0xa2;
+    case 0x0451: return (SDL12Key)0xa3;
+    case 0x0454: return (SDL12Key)0xa4;
+    case 0x0455: return (SDL12Key)0xa5;
+    case 0x0456: return (SDL12Key)0xa6;
+    case 0x0457: return (SDL12Key)0xa7;
+    case 0x0458: return (SDL12Key)0xa8;
+    case 0x0459: return (SDL12Key)0xa9;
+    case 0x045A: return (SDL12Key)0xaa;
+    case 0x045B: return (SDL12Key)0xab;
+    case 0x045C: return (SDL12Key)0xac;
+    case 0x0491: return (SDL12Key)0xad;
+    case 0x045E: return (SDL12Key)0xae;
+    case 0x045F: return (SDL12Key)0xaf;
+    case 0x2116: return (SDL12Key)0xb0;
+    case 0x0402: return (SDL12Key)0xb1;
+    case 0x0403: return (SDL12Key)0xb2;
+    case 0x0401: return (SDL12Key)0xb3;
+    case 0x0404: return (SDL12Key)0xb4;
+    case 0x0405: return (SDL12Key)0xb5;
+    case 0x0406: return (SDL12Key)0xb6;
+    case 0x0407: return (SDL12Key)0xb7;
+    case 0x0408: return (SDL12Key)0xb8;
+    case 0x0409: return (SDL12Key)0xb9;
+    case 0x040A: return (SDL12Key)0xba;
+    case 0x040B: return (SDL12Key)0xbb;
+    case 0x040C: return (SDL12Key)0xbc;
+    case 0x0490: return (SDL12Key)0xbd;
+    case 0x040E: return (SDL12Key)0xbe;
+    case 0x040F: return (SDL12Key)0xbf;
+    case 0x044E: return (SDL12Key)0xc0;
+    case 0x0430: return (SDL12Key)0xc1;
+    case 0x0431: return (SDL12Key)0xc2;
+    case 0x0446: return (SDL12Key)0xc3;
+    case 0x0434: return (SDL12Key)0xc4;
+    case 0x0435: return (SDL12Key)0xc5;
+    case 0x0444: return (SDL12Key)0xc6;
+    case 0x0433: return (SDL12Key)0xc7;
+    case 0x0445: return (SDL12Key)0xc8;
+    case 0x0438: return (SDL12Key)0xc9;
+    case 0x0439: return (SDL12Key)0xca;
+    case 0x043A: return (SDL12Key)0xcb;
+    case 0x043B: return (SDL12Key)0xcc;
+    case 0x043C: return (SDL12Key)0xcd;
+    case 0x043D: return (SDL12Key)0xce;
+    case 0x043E: return (SDL12Key)0xcf;
+    case 0x043F: return (SDL12Key)0xd0;
+    case 0x044F: return (SDL12Key)0xd1;
+    case 0x0440: return (SDL12Key)0xd2;
+    case 0x0441: return (SDL12Key)0xd3;
+    case 0x0442: return (SDL12Key)0xd4;
+    case 0x0443: return (SDL12Key)0xd5;
+    case 0x0436: return (SDL12Key)0xd6;
+    case 0x0432: return (SDL12Key)0xd7;
+    case 0x044C: return (SDL12Key)0xd8;
+    case 0x044B: return (SDL12Key)0xd9;
+    case 0x0437: return (SDL12Key)0xda;
+    case 0x0448: return (SDL12Key)0xdb;
+    case 0x044D: return (SDL12Key)0xdc;
+    case 0x0449: return (SDL12Key)0xdd;
+    case 0x0447: return (SDL12Key)0xde;
+    case 0x044A: return (SDL12Key)0xdf;
+    case 0x042E: return (SDL12Key)0xe0;
+    case 0x0410: return (SDL12Key)0xe1;
+    case 0x0411: return (SDL12Key)0xe2;
+    case 0x0426: return (SDL12Key)0xe3;
+    case 0x0414: return (SDL12Key)0xe4;
+    case 0x0415: return (SDL12Key)0xe5;
+    case 0x0424: return (SDL12Key)0xe6;
+    case 0x0413: return (SDL12Key)0xe7;
+    case 0x0425: return (SDL12Key)0xe8;
+    case 0x0418: return (SDL12Key)0xe9;
+    case 0x0419: return (SDL12Key)0xea;
+    case 0x041A: return (SDL12Key)0xeb;
+    case 0x041B: return (SDL12Key)0xec;
+    case 0x041C: return (SDL12Key)0xed;
+    case 0x041D: return (SDL12Key)0xee;
+    case 0x041E: return (SDL12Key)0xef;
+    case 0x041F: return (SDL12Key)0xf0;
+    case 0x042F: return (SDL12Key)0xf1;
+    case 0x0420: return (SDL12Key)0xf2;
+    case 0x0421: return (SDL12Key)0xf3;
+    case 0x0422: return (SDL12Key)0xf4;
+    case 0x0423: return (SDL12Key)0xf5;
+    case 0x0416: return (SDL12Key)0xf6;
+    case 0x0412: return (SDL12Key)0xf7;
+    case 0x042C: return (SDL12Key)0xf8;
+    case 0x042B: return (SDL12Key)0xf9;
+    case 0x0417: return (SDL12Key)0xfa;
+    case 0x0428: return (SDL12Key)0xfb;
+    case 0x042D: return (SDL12Key)0xfc;
+    case 0x0429: return (SDL12Key)0xfd;
+    case 0x0427: return (SDL12Key)0xfe;
+    case 0x042A: return (SDL12Key)0xff;
+    /* Greek */
+    case 0x0386: return (SDL12Key)0xa1;
+    case 0x0388: return (SDL12Key)0xa2;
+    case 0x0389: return (SDL12Key)0xa3;
+    case 0x038A: return (SDL12Key)0xa4;
+    case 0x03AA: return (SDL12Key)0xa5;
+    case 0x038C: return (SDL12Key)0xa7;
+    case 0x038E: return (SDL12Key)0xa8;
+    case 0x03AB: return (SDL12Key)0xa9;
+    case 0x038F: return (SDL12Key)0xab;
+    case 0x0385: return (SDL12Key)0xae;
+    case 0x2015: return (SDL12Key)0xaf;
+    case 0x03AC: return (SDL12Key)0xb1;
+    case 0x03AD: return (SDL12Key)0xb2;
+    case 0x03AE: return (SDL12Key)0xb3;
+    case 0x03AF: return (SDL12Key)0xb4;
+    case 0x03CA: return (SDL12Key)0xb5;
+    case 0x0390: return (SDL12Key)0xb6;
+    case 0x03CC: return (SDL12Key)0xb7;
+    case 0x03CD: return (SDL12Key)0xb8;
+    case 0x03CB: return (SDL12Key)0xb9;
+    case 0x03B0: return (SDL12Key)0xba;
+    case 0x03CE: return (SDL12Key)0xbb;
+    case 0x0391: return (SDL12Key)0xc1;
+    case 0x0392: return (SDL12Key)0xc2;
+    case 0x0393: return (SDL12Key)0xc3;
+    case 0x0394: return (SDL12Key)0xc4;
+    case 0x0395: return (SDL12Key)0xc5;
+    case 0x0396: return (SDL12Key)0xc6;
+    case 0x0397: return (SDL12Key)0xc7;
+    case 0x0398: return (SDL12Key)0xc8;
+    case 0x0399: return (SDL12Key)0xc9;
+    case 0x039A: return (SDL12Key)0xca;
+    case 0x039B: return (SDL12Key)0xcb;
+    case 0x039C: return (SDL12Key)0xcc;
+    case 0x039D: return (SDL12Key)0xcd;
+    case 0x039E: return (SDL12Key)0xce;
+    case 0x039F: return (SDL12Key)0xcf;
+    case 0x03A0: return (SDL12Key)0xd0;
+    case 0x03A1: return (SDL12Key)0xd1;
+    case 0x03A3: return (SDL12Key)0xd2;
+    case 0x03A4: return (SDL12Key)0xd4;
+    case 0x03A5: return (SDL12Key)0xd5;
+    case 0x03A6: return (SDL12Key)0xd6;
+    case 0x03A7: return (SDL12Key)0xd7;
+    case 0x03A8: return (SDL12Key)0xd8;
+    case 0x03A9: return (SDL12Key)0xd9;
+    case 0x03B1: return (SDL12Key)0xe1;
+    case 0x03B2: return (SDL12Key)0xe2;
+    case 0x03B3: return (SDL12Key)0xe3;
+    case 0x03B4: return (SDL12Key)0xe4;
+    case 0x03B5: return (SDL12Key)0xe5;
+    case 0x03B6: return (SDL12Key)0xe6;
+    case 0x03B7: return (SDL12Key)0xe7;
+    case 0x03B8: return (SDL12Key)0xe8;
+    case 0x03B9: return (SDL12Key)0xe9;
+    case 0x03BA: return (SDL12Key)0xea;
+    case 0x03BB: return (SDL12Key)0xeb;
+    case 0x03BC: return (SDL12Key)0xec;
+    case 0x03BD: return (SDL12Key)0xed;
+    case 0x03BE: return (SDL12Key)0xee;
+    case 0x03BF: return (SDL12Key)0xef;
+    case 0x03C0: return (SDL12Key)0xf0;
+    case 0x03C1: return (SDL12Key)0xf1;
+    case 0x03C3: return (SDL12Key)0xf2;
+    case 0x03C2: return (SDL12Key)0xf3;
+    case 0x03C4: return (SDL12Key)0xf4;
+    case 0x03C5: return (SDL12Key)0xf5;
+    case 0x03C6: return (SDL12Key)0xf6;
+    case 0x03C7: return (SDL12Key)0xf7;
+    case 0x03C8: return (SDL12Key)0xf8;
+    case 0x03C9: return (SDL12Key)0xf9;
+    /* Technical */
+    case 0x23B7: return (SDL12Key)0xa1;
+    case 0x250C: return (SDL12Key)0xa2;
+    case 0x2500: return (SDL12Key)0xa3;
+    case 0x2320: return (SDL12Key)0xa4;
+    case 0x2321: return (SDL12Key)0xa5;
+    case 0x2502: return (SDL12Key)0xa6;
+    case 0x23A1: return (SDL12Key)0xa7;
+    case 0x23A3: return (SDL12Key)0xa8;
+    case 0x23A4: return (SDL12Key)0xa9;
+    case 0x23A6: return (SDL12Key)0xaa;
+    case 0x239B: return (SDL12Key)0xab;
+    case 0x239D: return (SDL12Key)0xac;
+    case 0x239E: return (SDL12Key)0xad;
+    case 0x23A0: return (SDL12Key)0xae;
+    case 0x23A8: return (SDL12Key)0xaf;
+    case 0x23AC: return (SDL12Key)0xb0;
+    case 0x2264: return (SDL12Key)0xbc;
+    case 0x2260: return (SDL12Key)0xbd;
+    case 0x2265: return (SDL12Key)0xbe;
+    case 0x222B: return (SDL12Key)0xbf;
+    case 0x2234: return (SDL12Key)0xc0;
+    case 0x221D: return (SDL12Key)0xc1;
+    case 0x221E: return (SDL12Key)0xc2;
+    case 0x2207: return (SDL12Key)0xc5;
+    case 0x223C: return (SDL12Key)0xc8;
+    case 0x2243: return (SDL12Key)0xc9;
+    case 0x21D4: return (SDL12Key)0xcd;
+    case 0x21D2: return (SDL12Key)0xce;
+    case 0x2261: return (SDL12Key)0xcf;
+    case 0x221A: return (SDL12Key)0xd6;
+    case 0x2282: return (SDL12Key)0xda;
+    case 0x2283: return (SDL12Key)0xdb;
+    case 0x2229: return (SDL12Key)0xdc;
+    case 0x222A: return (SDL12Key)0xdd;
+    case 0x2227: return (SDL12Key)0xde;
+    case 0x2228: return (SDL12Key)0xdf;
+    case 0x2202: return (SDL12Key)0xef;
+    case 0x0192: return (SDL12Key)0xf6;
+    case 0x2190: return (SDL12Key)0xfb;
+    case 0x2191: return (SDL12Key)0xfc;
+    case 0x2192: return (SDL12Key)0xfd;
+    case 0x2193: return (SDL12Key)0xfe;
+    /* Publishing */
+    case 0x2003: return (SDL12Key)0xa1;
+    case 0x2002: return (SDL12Key)0xa2;
+    case 0x2004: return (SDL12Key)0xa3;
+    case 0x2005: return (SDL12Key)0xa4;
+    case 0x2007: return (SDL12Key)0xa5;
+    case 0x2008: return (SDL12Key)0xa6;
+    case 0x2009: return (SDL12Key)0xa7;
+    case 0x200A: return (SDL12Key)0xa8;
+    case 0x2014: return (SDL12Key)0xa9;
+    case 0x2013: return (SDL12Key)0xaa;
+    case 0x2423: return (SDL12Key)0xac;
+    case 0x2026: return (SDL12Key)0xae;
+    case 0x2025: return (SDL12Key)0xaf;
+    case 0x2153: return (SDL12Key)0xb0;
+    case 0x2154: return (SDL12Key)0xb1;
+    case 0x2155: return (SDL12Key)0xb2;
+    case 0x2156: return (SDL12Key)0xb3;
+    case 0x2157: return (SDL12Key)0xb4;
+    case 0x2158: return (SDL12Key)0xb5;
+    case 0x2159: return (SDL12Key)0xb6;
+    case 0x215A: return (SDL12Key)0xb7;
+    case 0x2105: return (SDL12Key)0xb8;
+    case 0x2012: return (SDL12Key)0xbb;
+    case 0x27E8: return (SDL12Key)0xbc;
+    case 0x002E: return (SDL12Key)0xbd;
+    case 0x27E9: return (SDL12Key)0xbe;
+    case 0x215B: return (SDL12Key)0xc3;
+    case 0x215C: return (SDL12Key)0xc4;
+    case 0x215D: return (SDL12Key)0xc5;
+    case 0x215E: return (SDL12Key)0xc6;
+    case 0x2122: return (SDL12Key)0xc9;
+    case 0x2613: return (SDL12Key)0xca;
+    case 0x25C1: return (SDL12Key)0xcc;
+    case 0x25B7: return (SDL12Key)0xcd;
+    case 0x25CB: return (SDL12Key)0xce;
+    case 0x25AF: return (SDL12Key)0xcf;
+    case 0x2018: return (SDL12Key)0xd0;
+    case 0x2019: return (SDL12Key)0xd1;
+    case 0x201C: return (SDL12Key)0xd2;
+    case 0x201D: return (SDL12Key)0xd3;
+    case 0x211E: return (SDL12Key)0xd4;
+    case 0x2030: return (SDL12Key)0xd5;
+    case 0x2032: return (SDL12Key)0xd6;
+    case 0x2033: return (SDL12Key)0xd7;
+    case 0x271D: return (SDL12Key)0xd9;
+    case 0x25AC: return (SDL12Key)0xdb;
+    case 0x25C0: return (SDL12Key)0xdc;
+    case 0x25B6: return (SDL12Key)0xdd;
+    case 0x25CF: return (SDL12Key)0xde;
+    case 0x25AE: return (SDL12Key)0xdf;
+    case 0x25E6: return (SDL12Key)0xe0;
+    case 0x25AB: return (SDL12Key)0xe1;
+    case 0x25AD: return (SDL12Key)0xe2;
+    case 0x25B3: return (SDL12Key)0xe3;
+    case 0x25BD: return (SDL12Key)0xe4;
+    case 0x2606: return (SDL12Key)0xe5;
+    case 0x2022: return (SDL12Key)0xe6;
+    case 0x25AA: return (SDL12Key)0xe7;
+    case 0x25B2: return (SDL12Key)0xe8;
+    case 0x25BC: return (SDL12Key)0xe9;
+    case 0x261C: return (SDL12Key)0xea;
+    case 0x261E: return (SDL12Key)0xeb;
+    case 0x2663: return (SDL12Key)0xec;
+    case 0x2666: return (SDL12Key)0xed;
+    case 0x2665: return (SDL12Key)0xee;
+    case 0x2720: return (SDL12Key)0xf0;
+    case 0x2020: return (SDL12Key)0xf1;
+    case 0x2021: return (SDL12Key)0xf2;
+    case 0x2713: return (SDL12Key)0xf3;
+    case 0x2717: return (SDL12Key)0xf4;
+    case 0x266F: return (SDL12Key)0xf5;
+    case 0x266D: return (SDL12Key)0xf6;
+    case 0x2642: return (SDL12Key)0xf7;
+    case 0x2640: return (SDL12Key)0xf8;
+    case 0x260E: return (SDL12Key)0xf9;
+    case 0x2315: return (SDL12Key)0xfa;
+    case 0x2117: return (SDL12Key)0xfb;
+    case 0x2038: return (SDL12Key)0xfc;
+    case 0x201A: return (SDL12Key)0xfd;
+    case 0x201E: return (SDL12Key)0xfe;
+    /* Hebrew */
+    case 0x2017: return (SDL12Key)0xdf;
+    case 0x05D0: return (SDL12Key)0xe0;
+    case 0x05D1: return (SDL12Key)0xe1;
+    case 0x05D2: return (SDL12Key)0xe2;
+    case 0x05D3: return (SDL12Key)0xe3;
+    case 0x05D4: return (SDL12Key)0xe4;
+    case 0x05D5: return (SDL12Key)0xe5;
+    case 0x05D6: return (SDL12Key)0xe6;
+    case 0x05D7: return (SDL12Key)0xe7;
+    case 0x05D8: return (SDL12Key)0xe8;
+    case 0x05D9: return (SDL12Key)0xe9;
+    case 0x05DA: return (SDL12Key)0xea;
+    case 0x05DB: return (SDL12Key)0xeb;
+    case 0x05DC: return (SDL12Key)0xec;
+    case 0x05DD: return (SDL12Key)0xed;
+    case 0x05DE: return (SDL12Key)0xee;
+    case 0x05DF: return (SDL12Key)0xef;
+    case 0x05E0: return (SDL12Key)0xf0;
+    case 0x05E1: return (SDL12Key)0xf1;
+    case 0x05E2: return (SDL12Key)0xf2;
+    case 0x05E3: return (SDL12Key)0xf3;
+    case 0x05E4: return (SDL12Key)0xf4;
+    case 0x05E5: return (SDL12Key)0xf5;
+    case 0x05E6: return (SDL12Key)0xf6;
+    case 0x05E7: return (SDL12Key)0xf7;
+    case 0x05E8: return (SDL12Key)0xf8;
+    case 0x05E9: return (SDL12Key)0xf9;
+    case 0x05EA: return (SDL12Key)0xfa;
+    /* Thai */
+    case 0x0E01: return (SDL12Key)0xa1;
+    case 0x0E02: return (SDL12Key)0xa2;
+    case 0x0E03: return (SDL12Key)0xa3;
+    case 0x0E04: return (SDL12Key)0xa4;
+    case 0x0E05: return (SDL12Key)0xa5;
+    case 0x0E06: return (SDL12Key)0xa6;
+    case 0x0E07: return (SDL12Key)0xa7;
+    case 0x0E08: return (SDL12Key)0xa8;
+    case 0x0E09: return (SDL12Key)0xa9;
+    case 0x0E0A: return (SDL12Key)0xaa;
+    case 0x0E0B: return (SDL12Key)0xab;
+    case 0x0E0C: return (SDL12Key)0xac;
+    case 0x0E0D: return (SDL12Key)0xad;
+    case 0x0E0E: return (SDL12Key)0xae;
+    case 0x0E0F: return (SDL12Key)0xaf;
+    case 0x0E10: return (SDL12Key)0xb0;
+    case 0x0E11: return (SDL12Key)0xb1;
+    case 0x0E12: return (SDL12Key)0xb2;
+    case 0x0E13: return (SDL12Key)0xb3;
+    case 0x0E14: return (SDL12Key)0xb4;
+    case 0x0E15: return (SDL12Key)0xb5;
+    case 0x0E16: return (SDL12Key)0xb6;
+    case 0x0E17: return (SDL12Key)0xb7;
+    case 0x0E18: return (SDL12Key)0xb8;
+    case 0x0E19: return (SDL12Key)0xb9;
+    case 0x0E1A: return (SDL12Key)0xba;
+    case 0x0E1B: return (SDL12Key)0xbb;
+    case 0x0E1C: return (SDL12Key)0xbc;
+    case 0x0E1D: return (SDL12Key)0xbd;
+    case 0x0E1E: return (SDL12Key)0xbe;
+    case 0x0E1F: return (SDL12Key)0xbf;
+    case 0x0E20: return (SDL12Key)0xc0;
+    case 0x0E21: return (SDL12Key)0xc1;
+    case 0x0E22: return (SDL12Key)0xc2;
+    case 0x0E23: return (SDL12Key)0xc3;
+    case 0x0E24: return (SDL12Key)0xc4;
+    case 0x0E25: return (SDL12Key)0xc5;
+    case 0x0E26: return (SDL12Key)0xc6;
+    case 0x0E27: return (SDL12Key)0xc7;
+    case 0x0E28: return (SDL12Key)0xc8;
+    case 0x0E29: return (SDL12Key)0xc9;
+    case 0x0E2A: return (SDL12Key)0xca;
+    case 0x0E2B: return (SDL12Key)0xcb;
+    case 0x0E2C: return (SDL12Key)0xcc;
+    case 0x0E2D: return (SDL12Key)0xcd;
+    case 0x0E2E: return (SDL12Key)0xce;
+    case 0x0E2F: return (SDL12Key)0xcf;
+    case 0x0E30: return (SDL12Key)0xd0;
+    case 0x0E31: return (SDL12Key)0xd1;
+    case 0x0E32: return (SDL12Key)0xd2;
+    case 0x0E33: return (SDL12Key)0xd3;
+    case 0x0E34: return (SDL12Key)0xd4;
+    case 0x0E35: return (SDL12Key)0xd5;
+    case 0x0E36: return (SDL12Key)0xd6;
+    case 0x0E37: return (SDL12Key)0xd7;
+    case 0x0E38: return (SDL12Key)0xd8;
+    case 0x0E39: return (SDL12Key)0xd9;
+    case 0x0E3A: return (SDL12Key)0xda;
+    case 0x0E3F: return (SDL12Key)0xdf;
+    case 0x0E40: return (SDL12Key)0xe0;
+    case 0x0E41: return (SDL12Key)0xe1;
+    case 0x0E42: return (SDL12Key)0xe2;
+    case 0x0E43: return (SDL12Key)0xe3;
+    case 0x0E44: return (SDL12Key)0xe4;
+    case 0x0E45: return (SDL12Key)0xe5;
+    case 0x0E46: return (SDL12Key)0xe6;
+    case 0x0E47: return (SDL12Key)0xe7;
+    case 0x0E48: return (SDL12Key)0xe8;
+    case 0x0E49: return (SDL12Key)0xe9;
+    case 0x0E4A: return (SDL12Key)0xea;
+    case 0x0E4B: return (SDL12Key)0xeb;
+    case 0x0E4C: return (SDL12Key)0xec;
+    case 0x0E4D: return (SDL12Key)0xed;
+    case 0x0E50: return (SDL12Key)0xf0;
+    case 0x0E51: return (SDL12Key)0xf1;
+    case 0x0E52: return (SDL12Key)0xf2;
+    case 0x0E53: return (SDL12Key)0xf3;
+    case 0x0E54: return (SDL12Key)0xf4;
+    case 0x0E55: return (SDL12Key)0xf5;
+    case 0x0E56: return (SDL12Key)0xf6;
+    case 0x0E57: return (SDL12Key)0xf7;
+    case 0x0E58: return (SDL12Key)0xf8;
+    case 0x0E59: return (SDL12Key)0xf9;
+    /* end of SDLK_WORLD_ keys based on Latin-* or similar High-ASCII charsets
+     * and the low byte of their corresponding X11 XK_* KeySyms */
     default: break;
     }
 
     FIXME("nothing maps to SDLK12_COMPOSE, SDLK12_BREAK, or SDLK12_EURO ...?");
-    FIXME("map some of the SDLK12_WORLD keys");
     return SDLK12_UNKNOWN;
 }
 static SDL12Key