diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/devdraw/x11-keysym2ucs.c | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/src/cmd/devdraw/x11-keysym2ucs.c b/src/cmd/devdraw/x11-keysym2ucs.c index f6066b1d..108f153c 100644 --- a/src/cmd/devdraw/x11-keysym2ucs.c +++ b/src/cmd/devdraw/x11-keysym2ucs.c @@ -826,49 +826,52 @@ static struct codepair { VISIBLE long _p9keysym2ucs(KeySym keysym) { - int min = 0; - int max = sizeof(keysymtab) / sizeof(struct codepair) - 1; - int mid; + int min = 0; + int max = sizeof(keysymtab) / sizeof(struct codepair) - 1; + int mid; - switch(keysym){ - case 0xfe53: /*dead tilde*/ - keysym = 0x007e; /*asciitilde*/ - break; - case 0xfe52: /*dead_circumflex*/ - keysym = 0x005e; /*asciicircum*/ - break; - case 0xfe51: /*dead_acute*/ - keysym = 0x0027; /*apostrophe*/ - break; - case 0xfe50: /*dead_grave*/ - keysym = 0x0060; /*grave*/ - break; - default: - break; - } + switch(keysym){ + case 0xfe53: /*dead tilde*/ + keysym = 0x007e; /*asciitilde*/ + break; + case 0xfe52: /*dead_circumflex*/ + keysym = 0x005e; /*asciicircum*/ + break; + case 0xfe51: /*dead_acute*/ + keysym = 0x0027; /*apostrophe*/ + break; + case 0xfe50: /*dead_grave*/ + keysym = 0x0060; /*grave*/ + break; + case 0xfe57: /*dead_diaresis*/ + keysym = 0x0022; /*quotedbl*/ + break; + default: + break; + } - /* first check for Latin-1 characters (1:1 mapping) */ - if ((keysym >= 0x0020 && keysym <= 0x007e) || - (keysym >= 0x00a0 && keysym <= 0x00ff)) - return keysym; + /* first check for Latin-1 characters (1:1 mapping) */ + if ((keysym >= 0x0020 && keysym <= 0x007e) || + (keysym >= 0x00a0 && keysym <= 0x00ff)) + return keysym; - /* also check for directly encoded 24-bit UCS characters */ - if ((keysym & 0xff000000) == 0x01000000) - return keysym & 0x00ffffff; + /* also check for directly encoded 24-bit UCS characters */ + if ((keysym & 0xff000000) == 0x01000000) + return keysym & 0x00ffffff; - /* binary search in table */ - while (max >= min) { - mid = (min + max) / 2; - if (keysymtab[mid].keysym < keysym) - min = mid + 1; - else if (keysymtab[mid].keysym > keysym) - max = mid - 1; - else { - /* found it */ - return keysymtab[mid].ucs; + /* binary search in table */ + while (max >= min) { + mid = (min + max) / 2; + if (keysymtab[mid].keysym < keysym) + min = mid + 1; + else if (keysymtab[mid].keysym > keysym) + max = mid - 1; + else { + /* found it */ + return keysymtab[mid].ucs; + } } - } - /* no matching Unicode value found */ - return -1; + /* no matching Unicode value found */ + return -1; } |