Rémi Bernon : user32: Add current keyboard layout to thread data.

Alexandre Julliard julliard at winehq.org
Wed May 5 16:09:01 CDT 2021


Module: wine
Branch: master
Commit: 179c57603a7fc2c65379e1a054ba006b79fda6cf
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=179c57603a7fc2c65379e1a054ba006b79fda6cf

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed May  5 11:46:48 2021 +0200

user32: Add current keyboard layout to thread data.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 */




More information about the wine-cvs mailing list