https://git.reactos.org/?p=reactos.git;a=commitdiff;h=87f94aa10ca4b0c47469de280419d2aa28a5c54e

commit 87f94aa10ca4b0c47469de280419d2aa28a5c54e
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Mon Oct 30 10:40:27 2023 +0900
Commit:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
CommitDate: Mon Oct 30 10:40:27 2023 +0900

    [KBSWITCH] Update layout list on WM_NOTIFYICONMSG
    
    The layout list was not updated correctly.
    CORE-10667
---
 base/applications/kbswitch/kbswitch.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/base/applications/kbswitch/kbswitch.c 
b/base/applications/kbswitch/kbswitch.c
index bc9e698774a..72b517384a7 100644
--- a/base/applications/kbswitch/kbswitch.c
+++ b/base/applications/kbswitch/kbswitch.c
@@ -145,16 +145,9 @@ static VOID UpdateLayoutList(HKL hKL OPTIONAL)
 
     if (!hKL)
     {
-        if (0 <= (g_nCurrentLayoutNum - 1) && (g_nCurrentLayoutNum - 1) < 
g_cKLs)
-        {
-            hKL = g_ahKLs[g_nCurrentLayoutNum - 1];
-        }
-        else
-        {
-            HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : 
GetForegroundWindow());
-            DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
-            hKL = GetKeyboardLayout(dwTID);
-        }
+        HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : 
GetForegroundWindow());
+        DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
+        hKL = GetKeyboardLayout(dwTID);
     }
 
     g_cKLs = GetKeyboardLayoutList(ARRAYSIZE(g_ahKLs), g_ahKLs);
@@ -737,6 +730,8 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM 
lParam)
                 case WM_RBUTTONUP:
                 case WM_LBUTTONUP:
                 {
+                    UpdateLayoutList(NULL);
+
                     GetCursorPos(&pt);
                     SetForegroundWindow(hwnd);
 

Reply via email to