mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 00:54:18 +00:00
[NTUSER] Improve IntSetImeHotKey (#4789)
- Use the LOWORD value for VK_PACKET detection. - IntGetImeHotKeyByKeyAndLang accepts the neutral language identifier (that is zero). CORE-11700
This commit is contained in:
parent
122423238a
commit
39fe905efa
1 changed files with 14 additions and 10 deletions
|
@ -183,7 +183,7 @@ IntGetImeHotKeyByKeyAndLang(PIMEHOTKEY pList, UINT uModKeys, UINT uLeftRight,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LangID = IntGetImeHotKeyLangId(pNode->dwHotKeyId);
|
LangID = IntGetImeHotKeyLangId(pNode->dwHotKeyId);
|
||||||
if (LangID != TargetLangId)
|
if (LangID != TargetLangId && LangID != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uModifiers = pNode->uModifiers;
|
uModifiers = pNode->uModifiers;
|
||||||
|
@ -358,32 +358,33 @@ IntSetImeHotKey(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DW
|
||||||
switch (dwAction)
|
switch (dwAction)
|
||||||
{
|
{
|
||||||
case SETIMEHOTKEY_DELETE:
|
case SETIMEHOTKEY_DELETE:
|
||||||
pNode = IntGetImeHotKeyById(gpImeHotKeyList, dwHotKeyId);
|
pNode = IntGetImeHotKeyById(gpImeHotKeyList, dwHotKeyId); /* Find hotkey by ID */
|
||||||
if (!pNode)
|
if (!pNode)
|
||||||
{
|
{
|
||||||
ERR("dwHotKeyId: 0x%lX\n", dwHotKeyId);
|
ERR("dwHotKeyId: 0x%lX\n", dwHotKeyId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntDeleteImeHotKey(&gpImeHotKeyList, pNode);
|
IntDeleteImeHotKey(&gpImeHotKeyList, pNode); /* Delete it */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case SETIMEHOTKEY_ADD:
|
case SETIMEHOTKEY_ADD:
|
||||||
if (uVirtualKey == VK_PACKET)
|
if (LOWORD(uVirtualKey) == VK_PACKET) /* In case of VK_PACKET */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
LangId = IntGetImeHotKeyLangId(dwHotKeyId);
|
LangId = IntGetImeHotKeyLangId(dwHotKeyId);
|
||||||
if (LangId == LANGID_KOREAN)
|
if (LangId == LANGID_KOREAN)
|
||||||
return FALSE;
|
return FALSE; /* Korean can't add IME hotkeys */
|
||||||
|
|
||||||
|
/* Find hotkey by key and language */
|
||||||
pNode = IntGetImeHotKeyByKeyAndLang(gpImeHotKeyList,
|
pNode = IntGetImeHotKeyByKeyAndLang(gpImeHotKeyList,
|
||||||
(uModifiers & MOD_KEYS),
|
(uModifiers & MOD_KEYS),
|
||||||
(uModifiers & MOD_LEFT_RIGHT),
|
(uModifiers & MOD_LEFT_RIGHT),
|
||||||
uVirtualKey, LangId);
|
uVirtualKey, LangId);
|
||||||
if (!pNode)
|
if (pNode == NULL) /* If not found */
|
||||||
pNode = IntGetImeHotKeyById(gpImeHotKeyList, dwHotKeyId);
|
pNode = IntGetImeHotKeyById(gpImeHotKeyList, dwHotKeyId); /* Find by ID */
|
||||||
|
|
||||||
if (pNode)
|
if (pNode) /* Already exists */
|
||||||
{
|
{
|
||||||
pNode->uModifiers = uModifiers;
|
pNode->uModifiers = uModifiers;
|
||||||
pNode->uVirtualKey = uVirtualKey;
|
pNode->uVirtualKey = uVirtualKey;
|
||||||
|
@ -391,23 +392,26 @@ IntSetImeHotKey(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DW
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allocate new hotkey */
|
||||||
pNode = ExAllocatePoolWithTag(PagedPool, sizeof(IMEHOTKEY), USERTAG_IMEHOTKEY);
|
pNode = ExAllocatePoolWithTag(PagedPool, sizeof(IMEHOTKEY), USERTAG_IMEHOTKEY);
|
||||||
if (!pNode)
|
if (!pNode)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/* Populate */
|
||||||
pNode->pNext = NULL;
|
pNode->pNext = NULL;
|
||||||
pNode->dwHotKeyId = dwHotKeyId;
|
pNode->dwHotKeyId = dwHotKeyId;
|
||||||
pNode->uModifiers = uModifiers;
|
pNode->uModifiers = uModifiers;
|
||||||
pNode->uVirtualKey = uVirtualKey;
|
pNode->uVirtualKey = uVirtualKey;
|
||||||
pNode->hKL = hKL;
|
pNode->hKL = hKL;
|
||||||
IntAddImeHotKey(&gpImeHotKeyList, pNode);
|
IntAddImeHotKey(&gpImeHotKeyList, pNode); /* Add it */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case SETIMEHOTKEY_INITIALIZE:
|
case SETIMEHOTKEY_INITIALIZE:
|
||||||
IntFreeImeHotKeys();
|
IntFreeImeHotKeys(); /* Delete all the IME hotkeys */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
ERR("0x%lX\n", dwAction);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue