https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fb2aef9e4ecb4f3ab2033…
commit fb2aef9e4ecb4f3ab2033aef85ded75c7ee239ca
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jul 28 23:24:09 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jul 28 23:24:09 2021 +0900
[IMM32] Rewrite ImmNotifyIME (#3853)
Implementing Japanese input... CORE-11700
---
dll/win32/imm32/imm.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index e47224e0a6a..df4db4cfca1 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -2609,23 +2609,29 @@ BOOL WINAPI ImmIsUIMessageW(
BOOL WINAPI ImmNotifyIME(
HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
{
- InputContextData *data = get_imc_data(hIMC);
+ DWORD dwImeThreadId, dwThreadId;
+ HKL hKL;
+ PIMEDPI pImeDpi;
+ BOOL ret;
- TRACE("(%p, %d, %d, %d)\n",
- hIMC, dwAction, dwIndex, dwValue);
+ TRACE("ImmNotifyIME(%p, %lu, %lu, %lu)\n", hIMC, dwAction, dwIndex,
dwValue);
- if (hIMC == NULL)
+ if (hIMC)
{
- SetLastError(ERROR_SUCCESS);
- return FALSE;
+ dwImeThreadId = Imm32QueryWindow(hIMC, QUERY_WINDOW_UNIQUE_THREAD_ID);
+ dwThreadId = GetCurrentThreadId();
+ if (dwImeThreadId != dwThreadId)
+ return FALSE;
}
- if (!data || ! data->immKbd->pNotifyIME)
- {
+ hKL = GetKeyboardLayout(0);
+ pImeDpi = ImmLockImeDpi(hKL);
+ if (pImeDpi == NULL)
return FALSE;
- }
- return data->immKbd->pNotifyIME(hIMC,dwAction,dwIndex,dwValue);
+ ret = pImeDpi->NotifyIME(hIMC, dwAction, dwIndex, dwValue);
+ ImmUnlockImeDpi(pImeDpi);
+ return ret;
}
/***********************************************************************