mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[IMM32] Rewrite ImmProcessKey (#3917)
- Rewrite ImmProcessKey function. - Modify win32ss/include/imetable.h. - Modify ImmProcessKey prototype. CORE-1170
This commit is contained in:
parent
c59c185d1c
commit
1d0587fc27
4 changed files with 69 additions and 36 deletions
|
@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(imm);
|
|||
|
||||
#define IMM_INIT_MAGIC 0x19650412
|
||||
#define IMM_INVALID_CANDFORM ULONG_MAX
|
||||
|
||||
#define INVALID_HOTKEY_ID 0xFFFFFFFF
|
||||
#define MAX_CANDIDATEFORM 4
|
||||
|
||||
#define LANGID_CHINESE_SIMPLIFIED MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED)
|
||||
|
@ -4870,47 +4870,80 @@ Quit:
|
|||
* ImmProcessKey(IMM32.@)
|
||||
* ( Undocumented, called from user32.dll )
|
||||
*/
|
||||
BOOL WINAPI ImmProcessKey(HWND hwnd, HKL hKL, UINT vKey, LPARAM lKeyData, DWORD unknown)
|
||||
DWORD WINAPI ImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD dwHotKeyID)
|
||||
{
|
||||
InputContextData *data;
|
||||
HIMC imc = ImmGetContext(hwnd);
|
||||
BYTE state[256];
|
||||
DWORD ret = 0;
|
||||
HIMC hIMC;
|
||||
PIMEDPI pImeDpi;
|
||||
LPINPUTCONTEXTDX pIC;
|
||||
BYTE KeyState[256];
|
||||
UINT vk;
|
||||
BOOL bUseIme = TRUE, bSkipThisKey = FALSE, bLowWordOnly = FALSE;
|
||||
|
||||
TRACE("%p %p %x %x %x\n",hwnd, hKL, vKey, (UINT)lKeyData, unknown);
|
||||
TRACE("(%p, %p, 0x%X, %p, 0x%lX)\n", hWnd, hKL, vKey, lParam, dwHotKeyID);
|
||||
|
||||
if (imc)
|
||||
data = (InputContextData *)imc;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
/* Make sure we are inputting to the correct keyboard */
|
||||
if (data->immKbd->hkl != hKL)
|
||||
hIMC = ImmGetContext(hWnd);
|
||||
pImeDpi = ImmLockImeDpi(hKL);
|
||||
if (pImeDpi)
|
||||
{
|
||||
ImmHkl *new_hkl = IMM_GetImmHkl(hKL);
|
||||
if (new_hkl)
|
||||
pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
|
||||
if (pIC)
|
||||
{
|
||||
data->immKbd->pImeSelect(imc, FALSE);
|
||||
data->immKbd->uSelected--;
|
||||
data->immKbd = new_hkl;
|
||||
data->immKbd->pImeSelect(imc, TRUE);
|
||||
data->immKbd->uSelected++;
|
||||
if (LOBYTE(vKey) == VK_PACKET &&
|
||||
!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_ACCEPT_WIDE_VKEY))
|
||||
{
|
||||
if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
|
||||
{
|
||||
bLowWordOnly = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bUseIme = FALSE;
|
||||
if (pIC->fOpen)
|
||||
bSkipThisKey = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bUseIme)
|
||||
{
|
||||
if (GetKeyboardState(KeyState))
|
||||
{
|
||||
vk = (bLowWordOnly ? LOWORD(vKey) : vKey);
|
||||
if (pImeDpi->ImeProcessKey(hIMC, vk, lParam, KeyState))
|
||||
{
|
||||
pIC->bNeedsTrans = TRUE;
|
||||
pIC->nVKey = vKey;
|
||||
ret |= IPHK_PROCESSBYIME;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bSkipThisKey)
|
||||
{
|
||||
ret |= IPHK_SKIPTHISKEY;
|
||||
}
|
||||
|
||||
ImmUnlockIMC(hIMC);
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
ImmUnlockImeDpi(pImeDpi);
|
||||
}
|
||||
|
||||
if (!data->immKbd->hIME || !data->immKbd->pImeProcessKey)
|
||||
return FALSE;
|
||||
|
||||
GetKeyboardState(state);
|
||||
if (data->immKbd->pImeProcessKey(imc, vKey, lKeyData, state))
|
||||
if (dwHotKeyID != INVALID_HOTKEY_ID)
|
||||
{
|
||||
data->lastVK = vKey;
|
||||
return TRUE;
|
||||
if (Imm32ProcessHotKey(hWnd, hIMC, hKL, dwHotKeyID))
|
||||
{
|
||||
if (vKey != VK_KANJI || dwHotKeyID != IME_JHOTKEY_CLOSE_OPEN)
|
||||
ret |= IPHK_HOTKEY;
|
||||
}
|
||||
}
|
||||
|
||||
data->lastVK = VK_PROCESSKEY;
|
||||
return FALSE;
|
||||
if (ret & IPHK_PROCESSBYIME)
|
||||
{
|
||||
FIXME("TODO: We have to do something here.\n");
|
||||
}
|
||||
|
||||
ImmReleaseContext(hWnd, hIMC);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -4959,7 +4992,7 @@ ImmGetHotKey(IN DWORD dwHotKey,
|
|||
OUT LPUINT lpuVKey,
|
||||
OUT LPHKL lphKL)
|
||||
{
|
||||
TRACE("%lx, %p, %p, %p\n", dwHotKey, lpuModifiers, lpuVKey, lphKL);
|
||||
TRACE("(0x%lX, %p, %p, %p)\n", dwHotKey, lpuModifiers, lpuVKey, lphKL);
|
||||
if (lpuModifiers && lpuVKey)
|
||||
return NtUserGetImeHotKey(dwHotKey, lpuModifiers, lpuVKey, lphKL);
|
||||
return FALSE;
|
||||
|
|
|
@ -856,7 +856,7 @@ BOOL WINAPI ImmIsUIMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM);
|
|||
|
||||
BOOL WINAPI ImmNotifyIME(_In_ HIMC, _In_ DWORD, _In_ DWORD, _In_ DWORD);
|
||||
|
||||
BOOL WINAPI ImmProcessKey(HWND, HKL, UINT, LPARAM, DWORD);
|
||||
DWORD WINAPI ImmProcessKey(HWND, HKL, UINT, LPARAM, DWORD);
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
|
|
|
@ -8,8 +8,8 @@ DEFINE_IME_ENTRY(UINT, ImeEnumRegisterWord, (LPVOID lpfnEnumProc, LPCVOID lpszRe
|
|||
DEFINE_IME_ENTRY(BOOL, ImeConfigure, (HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData), FALSE)
|
||||
DEFINE_IME_ENTRY(BOOL, ImeDestroy, (UINT uReserved), FALSE)
|
||||
DEFINE_IME_ENTRY(LRESULT, ImeEscape, (HIMC hIMC, UINT uEscape, LPVOID lpData), FALSE)
|
||||
DEFINE_IME_ENTRY(BOOL, ImeSelect, (HIMC hIMC, BOOL fSelect), FALSE)
|
||||
DEFINE_IME_ENTRY(BOOL, ImeProcessKey, (HIMC hIMC, UINT uVirKey, DWORD lParam, CONST LPBYTE lpbKeyState), FALSE)
|
||||
DEFINE_IME_ENTRY(BOOL, ImeSelect, (HIMC hIMC, BOOL fSelect), FALSE)
|
||||
DEFINE_IME_ENTRY(BOOL, ImeSetActiveContext, (HIMC hIMC, BOOL fFlag), FALSE)
|
||||
DEFINE_IME_ENTRY(UINT, ImeToAsciiEx, (UINT uVirKey, UINT uScanCode, CONST LPBYTE lpbKeyState, LPTRANSMSGLIST lpTransMsgList, UINT fuState, HIMC hIMC), FALSE)
|
||||
DEFINE_IME_ENTRY(BOOL, NotifyIME, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), FALSE)
|
||||
|
|
|
@ -1259,8 +1259,8 @@ C_ASSERT(offsetof(IMEDPI, ImeEnumRegisterWord) == 0x68);
|
|||
C_ASSERT(offsetof(IMEDPI, ImeConfigure) == 0x6c);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeDestroy) == 0x70);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeEscape) == 0x74);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeSelect) == 0x78);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeProcessKey) == 0x7c);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeProcessKey) == 0x78);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeSelect) == 0x7c);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeSetActiveContext) == 0x80);
|
||||
C_ASSERT(offsetof(IMEDPI, ImeToAsciiEx) == 0x84);
|
||||
C_ASSERT(offsetof(IMEDPI, NotifyIME) == 0x88);
|
||||
|
|
Loading…
Reference in a new issue