Recovering Traditional Chinese IM
This commit is contained in:
parent
9adbd1e261
commit
ee3529b7bf
1 changed files with 83 additions and 72 deletions
19
src/im.c
19
src/im.c
|
|
@ -744,7 +744,7 @@ static void im_event(IM_DATA* im)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
// event.key.keysym = 0;
|
event.key.keysym.sym = 0;
|
||||||
event.text.text[0] = '\0';
|
event.text.text[0] = '\0';
|
||||||
|
|
||||||
im_read(im, event);
|
im_read(im, event);
|
||||||
|
|
@ -905,6 +905,12 @@ static int im_event_zh_tw(IM_DATA* im, SDL_Event event)
|
||||||
case SDLK_MODE: case SDLK_APPLICATION:
|
case SDLK_MODE: case SDLK_APPLICATION:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* This wasn't needed in SDL1.2 */
|
||||||
|
case SDLK_BACKSPACE:
|
||||||
|
im_fullreset(im);
|
||||||
|
im->s[0] = L'\b';
|
||||||
|
break;
|
||||||
|
|
||||||
/* Left-Alt & Right-Alt mapped to mode-switch */
|
/* Left-Alt & Right-Alt mapped to mode-switch */
|
||||||
case SDLK_RALT: case SDLK_LALT:
|
case SDLK_RALT: case SDLK_LALT:
|
||||||
cm.section = (++cm.section % SEC_TOTAL); /* Change section */
|
cm.section = (++cm.section % SEC_TOTAL); /* Change section */
|
||||||
|
|
@ -929,6 +935,8 @@ static int im_event_zh_tw(IM_DATA* im, SDL_Event event)
|
||||||
|
|
||||||
/* Actual character processing */
|
/* Actual character processing */
|
||||||
default:
|
default:
|
||||||
|
if (event.type == SDL_TEXTINPUT)
|
||||||
|
{
|
||||||
/* English mode */
|
/* English mode */
|
||||||
if(cm.section == SEC_ENGLISH) {
|
if(cm.section == SEC_ENGLISH) {
|
||||||
mbstowcs(im->s , event.text.text, 16);
|
mbstowcs(im->s , event.text.text, 16);
|
||||||
|
|
@ -936,9 +944,11 @@ static int im_event_zh_tw(IM_DATA* im, SDL_Event event)
|
||||||
// im->s[1] = L'\0';
|
// im->s[1] = L'\0';
|
||||||
im->buf[0] = L'\0';
|
im->buf[0] = L'\0';
|
||||||
}
|
}
|
||||||
/* Thai mode */
|
/* ZH_TW mode */
|
||||||
else {
|
else
|
||||||
wchar_t u = event.text.text[0];
|
{
|
||||||
|
wchar_t u;
|
||||||
|
mbtowc(&u, event.text.text, 255);
|
||||||
|
|
||||||
im->s[0] = L'\0'; /* Zero-out output string */
|
im->s[0] = L'\0'; /* Zero-out output string */
|
||||||
wcsncat(im->buf, &u, 1); /* Copy new character */
|
wcsncat(im->buf, &u, 1); /* Copy new character */
|
||||||
|
|
@ -1015,6 +1025,7 @@ static int im_event_zh_tw(IM_DATA* im, SDL_Event event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return im->redraw;
|
return im->redraw;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue