From 7a24f3c0a1f7ce93b165686a5c7586dce7c47e39 Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 5 Apr 2006 19:48:23 +0000 Subject: * win/tkWinX.c (TkWinXInit): init default keyboard charset correctly. [Bug 1374119] (pajas) --- win/tkWinX.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/win/tkWinX.c b/win/tkWinX.c index 4b28faa..39339c9 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinX.c,v 1.25.2.6 2005/02/28 22:10:26 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.25.2.7 2006/04/05 19:48:23 hobbs Exp $ */ #include "tkWinInt.h" @@ -226,6 +226,9 @@ void TkWinXInit(hInstance) HINSTANCE hInstance; { + CHARSETINFO lpCs; + DWORD lpCP; + if (childClassInitialized != 0) { return; } @@ -281,6 +284,17 @@ TkWinXInit(hInstance) } /* + * Initialize input language info + */ + + if (GetLocaleInfo(LANGIDFROMLCID(GetKeyboardLayout(0)), + LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, + (LPTSTR) &lpCP, sizeof(lpCP)/sizeof(TCHAR)) + && TranslateCharsetInfo((DWORD *)lpCP, &lpCs, TCI_SRCCODEPAGE)) { + UpdateInputLanguage(lpCs.ciCharset); + } + + /* * Make sure we cleanup on finalize. */ TkCreateExitHandler(TkWinXCleanup, (ClientData) hInstance); @@ -1355,13 +1369,12 @@ GetTranslatedKey(xkey) * * UpdateInputLanguage -- * - * Gets called when a WM_INPUTLANGCHANGE message is received - * by the TK child window procedure. This message is sent - * by the Input Method Editor system when the user chooses - * a different input method. All subsequent WM_CHAR - * messages will contain characters in the new encoding. We record - * the new encoding so that TkpGetString() knows how to - * correctly translate the WM_CHAR into unicode. + * Gets called when a WM_INPUTLANGCHANGE message is received by the Tk + * child window procedure. This message is sent by the Input Method + * Editor system when the user chooses a different input method. All + * subsequent WM_CHAR messages will contain characters in the new + * encoding. We record the new encoding so that TkpGetString() knows how + * to correctly translate the WM_CHAR into unicode. * * Results: * Records the new encoding in keyInputEncoding. -- cgit v0.12