devdraw: map X11 dead_diaresis to double quote
R=rsc CC=plan9port.codebot http://codereview.appspot.com/6690049
This commit is contained in:
parent
33cdf63251
commit
e4122a42b9
2 changed files with 46 additions and 42 deletions
|
|
@ -11,6 +11,7 @@ Anthony Martin <ality@pbrane.org>
|
|||
Anthony Sorace <a@9srv.net>
|
||||
Arvindh Rajesh Tamilmani <art@a-30.net>
|
||||
Benjamin Huntsman <BHuntsman@mail2.cu-portland.edu>
|
||||
Caio Oliveira <cmarcelo@gmail.com>
|
||||
Christopher Brannon <chris@the-brannons.com>
|
||||
David du Colombier <0intro@gmail.com>
|
||||
David Jeannot <djeannot24@gmail.com>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/* no matching Unicode value found */
|
||||
return -1;
|
||||
/* 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;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue