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;
|
||||
|
||||
// event.key.keysym = 0;
|
||||
event.key.keysym.sym = 0;
|
||||
event.text.text[0] = '\0';
|
||||
|
||||
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:
|
||||
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 */
|
||||
case SDLK_RALT: case SDLK_LALT:
|
||||
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 */
|
||||
default:
|
||||
if (event.type == SDL_TEXTINPUT)
|
||||
{
|
||||
/* English mode */
|
||||
if(cm.section == SEC_ENGLISH) {
|
||||
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->buf[0] = L'\0';
|
||||
}
|
||||
/* Thai mode */
|
||||
else {
|
||||
wchar_t u = event.text.text[0];
|
||||
/* ZH_TW mode */
|
||||
else
|
||||
{
|
||||
wchar_t u;
|
||||
mbtowc(&u, event.text.text, 255);
|
||||
|
||||
im->s[0] = L'\0'; /* Zero-out output string */
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue