@@ -61,8 +61,8 @@ BOOL SelectKeyboard(DWORD KeymanID)
6161 PKEYMAN64THREADDATA _td = ThreadGlobals ();
6262 if (!_td) return FALSE ;
6363
64- SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " ENTER SelectKeyboardCore -------------------------------------------" );
65- SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " ENTER SelectKeyboardCore : Current:(HKL=%x KeymanID=%x %s) New:(ID=%x)" , // lpActiveKeyboard=%s ActiveKeymanID: %x sk: %x KeymanID: %d",
64+ SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " ENTER SelectKeyboard -------------------------------------------" );
65+ SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " ENTER SelectKeyboard : Current:(HKL=%x KeymanID=%x %s) New:(ID=%x)" , // lpActiveKeyboard=%s ActiveKeymanID: %x sk: %x KeymanID: %d",
6666 GetKeyboardLayout (0 ),
6767 _td->ActiveKeymanID ,
6868 _td->lpActiveKeyboard == NULL ? " NULL" : _td->lpActiveKeyboard ->Name ,
@@ -86,42 +86,45 @@ BOOL SelectKeyboard(DWORD KeymanID)
8686 {
8787 if (!_td->lpKeyboards [i].lpCoreKeyboard && !LoadlpKeyboard (i))
8888 {
89- SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " SelectKeyboardCore : Unable to load" );
89+ SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " SelectKeyboard : Unable to load" );
9090 return TRUE ;
9191 }
9292
9393 _td->lpActiveKeyboard = &_td->lpKeyboards [i];
9494 _td->ActiveKeymanID = _td->lpActiveKeyboard ->KeymanID ;
9595
96- SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " SelectKeyboardCore : NewKeymanID: %x" , _td->ActiveKeymanID );
96+ SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " SelectKeyboard : NewKeymanID: %x" , _td->ActiveKeymanID );
9797
9898 if (_td->app ) _td->app ->ResetContext ();
99-
100- // TODO: #5822 tell the core with km_kbp_event so it can reset the capslock state
101-
10299 SelectApplicationIntegration (); // I4287
103100 if (_td->app && !_td->app ->IsWindowHandled (hwnd)) _td->app ->HandleWindow (hwnd);
104101 _td->state .windowunicode = !_td->app || _td->app ->IsUnicode ();
105102
106103 ActivateDLLs (_td->lpActiveKeyboard );
107104
105+ if (KM_KBP_STATUS_OK !=
106+ km_kbp_event (_td->lpActiveKeyboard ->lpCoreKeyboardState , KM_KBP_EVENT_KEYBOARD_ACTIVATED, nullptr )) {
107+ SendDebugMessageFormat (0 , sdmGlobal, 0 , " km_kbp_event Failed Result: %d " , FALSE );
108+ } else {
109+ ProcessActionsExternalEvent ();
110+ }
108111 return TRUE ;
109112 }
110113 if (IsFocusedThread ())
111114 {
112- SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " SelectKeyboardCore : Keyboard Not Found" );
115+ SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " SelectKeyboard : Keyboard Not Found" );
113116 }
114117 }
115118 }
116119
117120 __finally
118121 {
119- SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " EXIT SelectKeyboardCore : Current:(HKL=%x KeymanID=%x %s) New:(ID=%x)" , // lpActiveKeyboard=%s ActiveKeymanID: %x sk: %x KeymanID: %d",
122+ SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " EXIT SelectKeyboard : Current:(HKL=%x KeymanID=%x %s) New:(ID=%x)" , // lpActiveKeyboard=%s ActiveKeymanID: %x sk: %x KeymanID: %d",
120123 GetKeyboardLayout (0 ),
121124 _td->ActiveKeymanID ,
122125 _td->lpActiveKeyboard == NULL ? " NULL" : _td->lpActiveKeyboard ->Name ,
123126 KeymanID);
124- SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " EXIT SelectKeyboardCore -------------------------------------------" );
127+ SendDebugMessageFormat (hwnd, sdmGlobal, 0 , " EXIT SelectKeyboard -------------------------------------------" );
125128 }
126129 return TRUE ;
127130}
0 commit comments