https://git.reactos.org/?p=reactos.git;a=commitdiff;h=20a782b7b191ed57a4877…
commit 20a782b7b191ed57a4877107faeba29bdd0ef6fa
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Mon Jan 22 17:49:33 2018 +0300
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Mon Jan 22 18:56:41 2018 +0200
[KBSWITCH] Update tray icon on color scheme change
CORE-14240 #resolve
---
base/applications/kbswitch/kbswitch.c | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/base/applications/kbswitch/kbswitch.c
b/base/applications/kbswitch/kbswitch.c
index d06cd5f9a2..61fa5cc4cb 100644
--- a/base/applications/kbswitch/kbswitch.c
+++ b/base/applications/kbswitch/kbswitch.c
@@ -396,11 +396,28 @@ GetNextLayout(VOID)
return -1;
}
+LRESULT
+UpdateLanguageDisplay(HWND hwnd, HKL hKl)
+{
+ static TCHAR szLCID[MAX_PATH], szLangName[MAX_PATH];
+
+ GetLayoutIDByHkl(hKl, szLCID, ARRAYSIZE(szLCID));
+ GetLocaleInfo((LANGID)_tcstoul(szLCID, NULL, 16), LOCALE_SLANGUAGE,
(LPTSTR)szLangName, ARRAYSIZE(szLangName));
+ UpdateTrayIcon(hwnd, szLCID, szLangName);
+
+ return 0;
+}
+
+LRESULT
+UpdateLanguageDisplayCurrent(HWND hwnd, WPARAM wParam)
+{
+ return UpdateLanguageDisplay(hwnd,
GetKeyboardLayout(GetWindowThreadProcessId((HWND)wParam, 0)));
+}
+
LRESULT CALLBACK
WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
static HMENU hRightPopupMenu;
- static TCHAR szLCID[MAX_PATH], szLangName[MAX_PATH];
static UINT s_uTaskbarRestart;
switch (Message)
@@ -419,11 +436,7 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_LANG_CHANGED:
{
- GetLayoutIDByHkl((HKL)lParam, szLCID, ARRAYSIZE(szLCID));
- GetLocaleInfo((LANGID)_tcstoul(szLCID, NULL, 16), LOCALE_SLANGUAGE,
(LPTSTR)szLangName, ARRAYSIZE(szLangName));
- UpdateTrayIcon(hwnd, szLCID, szLangName);
-
- return 0;
+ return UpdateLanguageDisplay(hwnd, (HKL)lParam);
}
case WM_LOAD_LAYOUT:
@@ -435,11 +448,7 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_WINDOW_ACTIVATE:
{
- GetLayoutIDByHkl(GetKeyboardLayout(GetWindowThreadProcessId((HWND)wParam,
0)), szLCID, ARRAYSIZE(szLCID));
- GetLocaleInfo((LANGID)_tcstoul(szLCID, NULL, 16), LOCALE_SLANGUAGE,
(LPTSTR)szLangName, ARRAYSIZE(szLangName));
- UpdateTrayIcon(hwnd, szLCID, szLangName);
-
- return 0;
+ return UpdateLanguageDisplayCurrent(hwnd, wParam);
}
case WM_NOTIFYICONMSG:
@@ -508,6 +517,10 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
//FIXME: Should detect default language changes by CPL applet or by other
tools and update UI
}
+ if (wParam == SPI_SETNONCLIENTMETRICS)
+ {
+ return UpdateLanguageDisplayCurrent(hwnd, wParam);
+ }
}
break;