From a5ce2e9f198c1da83f7eaf81d2add879bfc644cf Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 29 Nov 2001 21:30:59 +0000 Subject: [PATCH] Set up kbd_codepage at the start of the program, as well as when the input locale changes. With any luck this should sort out the Polish Unicode problems. git-svn-id: svn://svn.tartarus.org/sgt/putty@1427 cda61777-01e9-0310-a592-d414129be87e --- window.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/window.c b/window.c index 50182181..11533e29 100644 --- a/window.c +++ b/window.c @@ -73,6 +73,7 @@ static void init_palette(void); static void init_fonts(int, int); static void another_font(int); static void deinit_fonts(void); +static void set_input_locale(HKL); /* Window layout information */ static void reset_window(int); @@ -589,6 +590,11 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } /* + * Set up the initial input locale. + */ + set_input_locale(GetKeyboardLayout(0)); + + /* * Finally show the window! */ ShowWindow(hwnd, show); @@ -1367,6 +1373,16 @@ static void reset_window(int reinit) { } } +static void set_input_locale(HKL kl) +{ + char lbuf[20]; + + GetLocaleInfo(LOWORD(kl), LOCALE_IDEFAULTANSICODEPAGE, + lbuf, sizeof(lbuf)); + + kbd_codepage = atoi(lbuf); +} + static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt) { int thistime = GetMessageTime(); @@ -2287,19 +2303,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, net_pending_errors(); return 0; case WM_INPUTLANGCHANGE: - { - /* wParam == Font number */ - /* lParam == Locale */ - char lbuf[20]; - HKL NewInputLocale = (HKL) lParam; - - // lParam == GetKeyboardLayout(0); - - GetLocaleInfo(LOWORD(NewInputLocale), - LOCALE_IDEFAULTANSICODEPAGE, lbuf, sizeof(lbuf)); - - kbd_codepage = atoi(lbuf); - } + /* wParam == Font number */ + /* lParam == Locale */ + set_input_locale((HKL)lParam); break; case WM_IME_NOTIFY: if(wParam == IMN_SETOPENSTATUS) { -- 2.11.0