1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-21 04:55:02 -05:00

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.

[originally from svn r1427]
This commit is contained in:
Simon Tatham 2001-11-29 21:30:59 +00:00
parent 82e7fd0f23
commit 43a4339ac5

View File

@ -73,6 +73,7 @@ static void init_palette(void);
static void init_fonts(int, int); static void init_fonts(int, int);
static void another_font(int); static void another_font(int);
static void deinit_fonts(void); static void deinit_fonts(void);
static void set_input_locale(HKL);
/* Window layout information */ /* Window layout information */
static void reset_window(int); static void reset_window(int);
@ -588,6 +589,11 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
AppendMenu(m, MF_ENABLED, IDM_ABOUT, "&About PuTTY"); AppendMenu(m, MF_ENABLED, IDM_ABOUT, "&About PuTTY");
} }
/*
* Set up the initial input locale.
*/
set_input_locale(GetKeyboardLayout(0));
/* /*
* Finally show the window! * Finally show the window!
*/ */
@ -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) static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt)
{ {
int thistime = GetMessageTime(); int thistime = GetMessageTime();
@ -2287,19 +2303,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
net_pending_errors(); net_pending_errors();
return 0; return 0;
case WM_INPUTLANGCHANGE: case WM_INPUTLANGCHANGE:
{ /* wParam == Font number */
/* wParam == Font number */ /* lParam == Locale */
/* lParam == Locale */ set_input_locale((HKL)lParam);
char lbuf[20];
HKL NewInputLocale = (HKL) lParam;
// lParam == GetKeyboardLayout(0);
GetLocaleInfo(LOWORD(NewInputLocale),
LOCALE_IDEFAULTANSICODEPAGE, lbuf, sizeof(lbuf));
kbd_codepage = atoi(lbuf);
}
break; break;
case WM_IME_NOTIFY: case WM_IME_NOTIFY:
if(wParam == IMN_SETOPENSTATUS) { if(wParam == IMN_SETOPENSTATUS) {