[PATCH 1/4] user32: Add current keyboard layout to thread data.
Rémi Bernon
rbernon at codeweavers.com
Wed May 5 04:46:48 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/defwnd.c | 2 ++
dlls/user32/input.c | 4 ++++
dlls/user32/user_private.h | 1 +
3 files changed, 7 insertions(+)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index d00fc8584c6..a3d92e84aef 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -728,8 +728,10 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
case WM_INPUTLANGCHANGE:
{
+ struct user_thread_info *info = get_user_thread_info();
int count = 0;
HWND *win_array = WIN_ListChildren( hwnd );
+ info->kbd_layout = (HKL)lParam;
if (!win_array)
break;
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 1f795e43545..8e5ab91baf3 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -1316,6 +1316,7 @@ INT WINAPI ToAsciiEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
*/
HKL WINAPI ActivateKeyboardLayout( HKL layout, UINT flags )
{
+ struct user_thread_info *info = get_user_thread_info();
HKL old_layout;
TRACE_(keyboard)( "layout %p, flags %x\n", layout, flags );
@@ -1330,7 +1331,10 @@ HKL WINAPI ActivateKeyboardLayout( HKL layout, UINT flags )
}
if ((old_layout = USER_Driver->pActivateKeyboardLayout( layout, flags )) != (HKL)~0)
+ {
+ if (old_layout) info->kbd_layout = layout;
return old_layout;
+ }
return get_locale_kbd_layout();
}
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 5f8059a12a0..7ac65a34db3 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -199,6 +199,7 @@ struct user_thread_info
DWORD GetMessagePosVal; /* Value for GetMessagePos */
ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
struct user_key_state_info *key_state; /* Cache of global key state */
+ HKL kbd_layout; /* Current keyboard layout */
HWND top_window; /* Desktop window */
HWND msg_window; /* HWND_MESSAGE parent window */
struct rawinput_thread_data *rawinput; /* RawInput thread local data / buffer */
--
2.31.0
More information about the wine-devel
mailing list