Author: mpiulachs
Date: Sun May 4 15:58:15 2008
New Revision: 33281
URL:
http://svn.reactos.org/svn/reactos?rev=33281&view=rev
Log:
- Add language name tooltip to kbswitch systray icon
Modified:
trunk/reactos/base/applications/kbswitch/kbswitch.c
trunk/reactos/base/applications/kbswitch/kbswitch.h
Modified: trunk/reactos/base/applications/kbswitch/kbswitch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] Sun May 4 15:58:15
2008
@@ -15,6 +15,9 @@
static BOOL
GetLayoutID(LPTSTR szLayoutNum, LPTSTR szLCID);
+
+static BOOL
+GetLayoutName(LPTSTR szLayoutNum, LPTSTR szName);
HINSTANCE hInst;
HANDLE hProcessHeap;
@@ -95,15 +98,19 @@
{
NOTIFYICONDATA tnid;
TCHAR szLCID[CCH_LAYOUT_ID + 1];
+ TCHAR szName[MAX_PATH];
GetLayoutID(_T("1"), szLCID);
+ GetLayoutName(_T("1"), szName);
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = hwnd;
tnid.uID = 1;
- tnid.uFlags = NIF_ICON | NIF_MESSAGE;
+ tnid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
tnid.uCallbackMessage = WM_NOTIFYICONMSG;
tnid.hIcon = CreateTrayIcon(szLCID);
+
+ lstrcpyn(tnid.szTip, szName, sizeof(tnid.szTip));
Shell_NotifyIcon(NIM_ADD, &tnid);
}
@@ -121,16 +128,18 @@
}
static VOID
-UpdateTrayIcon(HWND hwnd, LPTSTR szLCID)
+UpdateTrayIcon(HWND hwnd, LPTSTR szLCID, LPTSTR szName)
{
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = hwnd;
tnid.uID = 1;
- tnid.uFlags = NIF_ICON | NIF_MESSAGE;
+ tnid.uFlags = NIF_ICON | NIF_MESSAGE |NIF_TIP;
tnid.uCallbackMessage = WM_NOTIFYICONMSG;
tnid.hIcon = CreateTrayIcon(szLCID);
+
+ lstrcpyn(tnid.szTip, szName, sizeof(tnid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &tnid);
}
@@ -259,13 +268,15 @@
HKL hKl;
TCHAR szLayoutNum[CCH_ULONG_DEC + 1];
TCHAR szLCID[CCH_LAYOUT_ID + 1];
+ TCHAR szName[MAX_PATH];
_ultot(uLayoutNum, szLayoutNum, 10);
GetLayoutID(szLayoutNum, szLCID);
+ GetLayoutName(szLayoutNum, szName);
CreateTrayIcon(szLCID);
// Switch to the new keyboard layout
- UpdateTrayIcon(hwnd, szLCID);
+ UpdateTrayIcon(hwnd, szLCID, szName);
hKl = LoadKeyboardLayout(szLCID, KLF_ACTIVATE);
SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, &hKl, SPIF_SENDWININICHANGE);
EnumWindows(EnumWindowsProc, (LPARAM) hKl);
@@ -411,6 +422,15 @@
}
break;
+ case WM_SETTINGCHANGE:
+ {
+ if (wParam == SPI_SETDEFAULTINPUTLANG)
+ {
+ //FIXME: Should detect default language changes by CPL applet or by
other tools and update UI
+ }
+ }
+ break;
+
case WM_DESTROY:
DestroyMenu(hLeftPopupMenu);
DestroyMenu(hRightPopupMenu);
Modified: trunk/reactos/base/applications/kbswitch/kbswitch.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] Sun May 4 15:58:15
2008
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
+#include <winuser.h>
#include <tchar.h>
#include "resource.h"