https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f972a9fbd54c662b0d3387...
commit f972a9fbd54c662b0d3387517f247684512e13c3 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Wed Jul 28 23:26:02 2021 +0900 Commit: GitHub noreply@github.com CommitDate: Wed Jul 28 23:26:02 2021 +0900
[IMM32] Rewrite ImmSetCompositionWindow (#3855)
Implementing Japanese input... CORE-11700 --- dll/win32/imm32/imm.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-)
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c index 1523c74dbbf..13c79d1a226 100644 --- a/dll/win32/imm32/imm.c +++ b/dll/win32/imm32/imm.c @@ -2997,38 +2997,28 @@ BOOL WINAPI ImmSetCompositionStringW( BOOL WINAPI ImmSetCompositionWindow( HIMC hIMC, LPCOMPOSITIONFORM lpCompForm) { - BOOL reshow = FALSE; - InputContextData *data = get_imc_data(hIMC); - - TRACE("(%p, %p)\n", hIMC, lpCompForm); - if (lpCompForm) - TRACE("\t%x, %s, %s\n", lpCompForm->dwStyle, - wine_dbgstr_point(&lpCompForm->ptCurrentPos), - wine_dbgstr_rect(&lpCompForm->rcArea)); + DWORD dwImeThreadId, dwThreadId; + LPINPUTCONTEXT pIC; + HWND hWnd;
- if (!data) - { - SetLastError(ERROR_INVALID_HANDLE); + dwImeThreadId = NtUserQueryInputContext(hIMC, 1); + dwThreadId = GetCurrentThreadId(); + if (dwImeThreadId != dwThreadId) return FALSE; - }
- if (IMM_IsCrossThreadAccess(NULL, hIMC)) + pIC = ImmLockIMC(hIMC); + if (pIC == NULL) return FALSE;
- data->IMC.cfCompForm = *lpCompForm; - - if (IsWindowVisible(data->immKbd->UIWnd)) - { - reshow = TRUE; - ShowWindow(data->immKbd->UIWnd,SW_HIDE); - } + pIC->cfCompForm = *lpCompForm; + pIC->fdwInit |= INIT_COMPFORM;
- /* FIXME: this is a partial stub */ + hWnd = pIC->hWnd;
- if (reshow) - ShowWindow(data->immKbd->UIWnd,SW_SHOWNOACTIVATE); + ImmUnlockIMC(hIMC);
- ImmInternalSendIMENotify(data, IMN_SETCOMPOSITIONWINDOW, 0); + Imm32NotifyAction(hIMC, hWnd, NI_CONTEXTUPDATED, 0, + IMC_SETCOMPOSITIONWINDOW, IMN_SETCOMPOSITIONWINDOW, 0); return TRUE; }