Index: windows/window.c =================================================================== --- windows/window.c (revision 5856) +++ windows/window.c (working copy) @@ -1773,6 +1773,18 @@ lbuf, sizeof(lbuf)); kbd_codepage = atoi(lbuf); + +#ifdef ONTHESPOT + /* Korean IME doesn't need to show the external IME composing + * window and it can make users less intuitive to see what they + * are typing. */ + if (kbd_codepage == 949 /* Korean */) { + term->onthespot = 1; + term->onthespot_buf[0] = 0; + } + else + term->onthespot = 0; +#endif } static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt) @@ -2821,10 +2833,31 @@ case WM_IME_STARTCOMPOSITION: { HIMC hImc = ImmGetContext(hwnd); +#ifdef ONTHESPOT + if (term->onthespot) { + COMPOSITIONFORM cf; + RECT rectWorkArea; + + SystemParametersInfo(SPI_GETWORKAREA, 0, + (void*)&rectWorkArea, 0); + cf.dwStyle = CFS_POINT; + cf.ptCurrentPos.x = 0; // drive out of screen + cf.ptCurrentPos.y = rectWorkArea.bottom+50; + ImmSetCompositionWindow(hImc, &cf); + ImmReleaseContext(hwnd, hImc); + term->onthespot_buf[0] = 0; + return 0; + } +#endif ImmSetCompositionFont(hImc, &lfont); ImmReleaseContext(hwnd, hImc); } break; +#ifdef ONTHESPOT + case WM_IME_ENDCOMPOSITION: + term->onthespot_buf[0] = 0; + break; +#endif case WM_IME_COMPOSITION: { HIMC hIMC; @@ -2834,8 +2867,27 @@ if(osVersion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || osVersion.dwPlatformId == VER_PLATFORM_WIN32s) break; /* no Unicode */ - if ((lParam & GCS_RESULTSTR) == 0) /* Composition unfinished. */ + if ((lParam & GCS_RESULTSTR) == 0) { /* Composition unfinished. */ +#ifdef ONTHESPOT + if (term->onthespot) { + RECT invrect; + + /* IME_COMPOSITION carries "DBCS" character */ + term->onthespot_buf[0] = wParam >> 8; + term->onthespot_buf[1] = wParam & 0xff; + invrect.left = caret_x; + invrect.top = caret_y; + invrect.right = caret_x + font_width * 2; + invrect.bottom = caret_y + font_height; + InvalidateRect(hwnd, &invrect, TRUE); + } +#endif break; /* fall back to DefWindowProc */ + } +#ifdef ONTHESPOT + else + term->onthespot_buf[0] = 0; +#endif hIMC = ImmGetContext(hwnd); n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0); Index: terminal.c =================================================================== --- terminal.c (revision 5856) +++ terminal.c (working copy) @@ -1221,6 +1221,10 @@ } term_schedule_tblink(term); term_schedule_cblink(term); +#ifdef ONTHESPOT + term->onthespot = 0; + term->onthespot_buf[0] = 0; +#endif } /* @@ -4766,7 +4770,22 @@ term->curstype = cursor; term->dispcursx = j; term->dispcursy = i; +#ifdef ONTHESPOT + if (term->onthespot && term->onthespot_buf[0]) { + tchar = tchar & 0xffffff00 | + (unsigned char)term->onthespot_buf[0]; + tattr |= ATTR_INVALID; + } } + /* Onthespot IMEs always process DBCS characters and cursors + * are always wide while composing */ + else if (i == our_curs_y && j == our_curs_x + 1 && + term->onthespot && term->onthespot_buf[0]) { + tattr |= cursor | ATTR_INVALID; + term->curstype = cursor; + tchar = tchar & 0xffffff00 | (unsigned char)term->onthespot_buf[1]; +#endif + } /* FULL-TERMCHAR */ newline[j].attr = tattr; Index: terminal.h =================================================================== --- terminal.h (revision 5856) +++ terminal.h (working copy) @@ -265,6 +265,14 @@ int wcFromTo_size; struct bidi_cache_entry *pre_bidi_cache, *post_bidi_cache; int bidi_cache_size; + +#ifdef ONTHESPOT + /* + * These are stuff used by the on-the-spot IME support code. + */ + int onthespot; + char onthespot_buf[2]; +#endif }; #define in_utf(term) ((term)->utf || (term)->ucsdata->line_codepage==CP_UTF8) Index: putty.h =================================================================== --- putty.h (revision 5856) +++ putty.h (working copy) @@ -609,6 +609,13 @@ struct RSAKey; /* be a little careful of scope */ +#if defined(WIN32) || defined(WIN64) +/* Korean IME doesn't need to show the external IME composing + * window and it can make users less intuitive to see what they + * are typing. */ +#define ONTHESPOT 1 +#endif + /* * Exports from the front end. */