diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-21 14:07:20 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-21 14:07:20 +0000 |
commit | 8fae64116820207e15c5503532d6604cf6668fea (patch) | |
tree | f9c0198d2842d4dda7d83764fde240950a51210d /src | |
parent | 92ae1f2aa713c2f6ce28fda42d35e0b721e6db6e (diff) |
fix for hotkeys' швы
git-svn-id: http://svn.miranda-ng.org/main/trunk@510 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/skin/hotkey_opts.cpp | 2 | ||||
-rw-r--r-- | src/modules/skin/hotkeys.cpp | 12 | ||||
-rw-r--r-- | src/modules/skin/skin.h | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index aa1526e955..4f6ffefd45 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -267,6 +267,7 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item)
{
char buf[256];
+ mir_snprintf(buf, SIZEOF(buf), "mir_hotkey_%d_%d", g_pid, g_hkid++);
THotkeyItem *newItem = (THotkeyItem *)mir_alloc(sizeof(THotkeyItem));
newItem->pszName = NULL;
@@ -274,7 +275,6 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item) newItem->ptszSection = mir_tstrdup(item->ptszSection);
newItem->ptszDescription = mir_tstrdup(item->ptszDescription);
newItem->lParam = item->lParam;
- mir_snprintf(buf, SIZEOF(buf), "mir_hotkey_%d_%d", g_pid, hotkeys.getCount()+1);
newItem->idHotkey = GlobalAddAtomA(buf);
newItem->rootHotkey = item;
newItem->Hotkey = newItem->DefHotkey = newItem->OptHotkey = 0;
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index 7d62892e25..800947cd0a 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -40,7 +40,7 @@ static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2) }
LIST<THotkeyItem> hotkeys(10, sttCompareHotkeys);
-DWORD g_pid = 0;
+DWORD g_pid = 0, g_hkid = 1;
HWND g_hwndHotkeyHost = NULL, g_hwndHkOptions = NULL;
HANDLE hEvChanged = 0;
@@ -71,11 +71,11 @@ static void sttWordToModAndVk(WORD w, BYTE *mod, BYTE *vk) static LRESULT CALLBACK sttHotkeyHostWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_HOTKEY) {
- int i;
- for (i = 0; i < hotkeys.getCount(); i++) {
+ for (int i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
- if (item->type != HKT_GLOBAL) continue;
- if ( !item->Enabled) continue;
+ if (item->type != HKT_GLOBAL || !item->Enabled)
+ continue;
+
if (item->pszService && (wParam == item->idHotkey)) {
CallService(item->pszService, 0, item->lParam);
break;
@@ -182,7 +182,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->lParam = desc->lParam;
char buf[256];
- mir_snprintf(buf, SIZEOF(buf), "mir_hotkey_%d_%d", g_pid, hotkeys.getCount()+1);
+ mir_snprintf(buf, SIZEOF(buf), "mir_hotkey_%d_%d", g_pid, g_hkid++);
item->idHotkey = GlobalAddAtomA(buf);
if (item->type == HKT_GLOBAL) {
if (item->Enabled) {
diff --git a/src/modules/skin/skin.h b/src/modules/skin/skin.h index d66ee16515..9ce06a6cc1 100644 --- a/src/modules/skin/skin.h +++ b/src/modules/skin/skin.h @@ -62,7 +62,7 @@ struct THotkeyItem extern LIST<THotkeyItem> hotkeys;
extern HWND g_hwndHkOptions, g_hwndHotkeyHost;
-extern DWORD g_pid;
+extern DWORD g_pid, g_hkid;
extern HANDLE hEvChanged;
int HotkeyOptionsInit(WPARAM, LPARAM);
|