https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0af58654a37f2bd9123cc…
commit 0af58654a37f2bd9123cca6f9ee4845e2aae7a1d
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Aug 8 08:34:47 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Aug 8 08:34:47 2021 +0900
[IMM32] Rewrite ImmSetCandidateWindow (#3884)
Implementing Japanese input... CORE-11700
---
dll/win32/imm32/imm.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index c1f5db8b1c1..f33211203e4 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -3452,29 +3452,34 @@ LRESULT WINAPI ImmRequestMessageW(HIMC hIMC, WPARAM wParam, LPARAM
lParam)
BOOL WINAPI ImmSetCandidateWindow(
HIMC hIMC, LPCANDIDATEFORM lpCandidate)
{
- InputContextData *data = get_imc_data(hIMC);
+#define MAX_CANDIDATEFORM 4
+ DWORD dwImeThreadId, dwThreadId;
+ HWND hWnd;
+ LPINPUTCONTEXT pIC;
TRACE("(%p, %p)\n", hIMC, lpCandidate);
- if (!data || !lpCandidate)
+ if (lpCandidate->dwIndex >= MAX_CANDIDATEFORM)
return FALSE;
- if (IMM_IsCrossThreadAccess(NULL, hIMC))
+ dwImeThreadId = Imm32QueryInputContext(hIMC, 1);
+ dwThreadId = GetCurrentThreadId();
+ if (dwImeThreadId != dwThreadId)
return FALSE;
- TRACE("\t%x, %x, %s, %s\n",
- lpCandidate->dwIndex, lpCandidate->dwStyle,
- wine_dbgstr_point(&lpCandidate->ptCurrentPos),
- wine_dbgstr_rect(&lpCandidate->rcArea));
-
- if (lpCandidate->dwIndex >= ARRAY_SIZE(data->IMC.cfCandForm))
+ pIC = ImmLockIMC(hIMC);
+ if (pIC == NULL)
return FALSE;
- data->IMC.cfCandForm[lpCandidate->dwIndex] = *lpCandidate;
- ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, 0, IMC_SETCANDIDATEPOS);
- ImmInternalSendIMENotify(data, IMN_SETCANDIDATEPOS, 1 <<
lpCandidate->dwIndex);
+ hWnd = pIC->hWnd;
+ pIC->cfCandForm[lpCandidate->dwIndex] = *lpCandidate;
+
+ ImmUnlockIMC(hIMC);
+ Imm32NotifyAction(hIMC, hWnd, NI_CONTEXTUPDATED, 0, IMC_SETCANDIDATEPOS,
+ IMN_SETCANDIDATEPOS, (1 << lpCandidate->dwIndex));
return TRUE;
+#undef MAX_CANDIDATEFORM
}
/***********************************************************************