https://git.reactos.org/?p=reactos.git;a=commitdiff;h=934e5212e4cf36fa1467a…
commit 934e5212e4cf36fa1467a30fab3e82ce46208ad9
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Aug 9 20:09:23 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Aug 9 20:09:23 2022 +0900
[IMM32] Implement ImmWINNLSEnableIME (#4599)
- Implement imm32!ImmWINNLSEnableIME function.
- Rename CLIENTIMC_UNKNOWN3 flag as CLIENTIMC_DISABLEIME.
- Modify imm32.spec.
CORE-11700
---
dll/win32/imm32/ime.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
dll/win32/imm32/imm.c | 2 +-
dll/win32/imm32/imm32.spec | 2 +-
win32ss/include/ntuser.h | 2 +-
4 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/dll/win32/imm32/ime.c b/dll/win32/imm32/ime.c
index 30fc0af9203..79c40435188 100644
--- a/dll/win32/imm32/ime.c
+++ b/dll/win32/imm32/ime.c
@@ -1993,3 +1993,57 @@ ImmGetImeMenuItemsW(HIMC hIMC, DWORD dwFlags, DWORD dwType,
hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize);
return ImmGetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu,
dwSize, FALSE);
}
+
+/***********************************************************************
+ * ImmWINNLSEnableIME (IMM32.@)
+ */
+BOOL WINAPI ImmWINNLSEnableIME(HWND hWnd, BOOL enable)
+{
+ HIMC hIMC;
+ PCLIENTIMC pClientImc;
+ HWND hImeWnd;
+ BOOL bImeWnd, ret;
+
+ TRACE("(%p, %d)\n", hWnd, enable);
+
+ if (!Imm32IsSystemJapaneseOrKorean())
+ {
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FALSE;
+ }
+
+ hIMC = (HIMC)NtUserGetThreadState(THREADSTATE_DEFAULTINPUTCONTEXT);
+ if (!hIMC)
+ return FALSE;
+
+ pClientImc = ImmLockClientImc(hIMC);
+ if (!pClientImc)
+ return FALSE;
+
+ ret = !(pClientImc->dwFlags & CLIENTIMC_DISABLEIME);
+ if (!!enable == ret)
+ {
+ ImmUnlockClientImc(pClientImc);
+ return ret;
+ }
+
+ if (!IsWindow(hWnd))
+ hWnd = GetFocus();
+
+ hImeWnd = ImmGetDefaultIMEWnd(hWnd);
+ bImeWnd = IsWindow(hImeWnd);
+ if (bImeWnd)
+ ImmSetActiveContext(hWnd, (enable ? NULL : hIMC), FALSE);
+
+ if (enable)
+ pClientImc->dwFlags &= ~CLIENTIMC_DISABLEIME;
+ else
+ pClientImc->dwFlags |= CLIENTIMC_DISABLEIME;
+
+ ImmUnlockClientImc(pClientImc);
+
+ if (bImeWnd)
+ ImmSetActiveContext(hWnd, (enable ? hIMC : NULL), TRUE);
+
+ return ret;
+}
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index c4cb95a1da1..94a1afcd488 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -998,7 +998,7 @@ Quit:
pClientImc = ImmLockClientImc(hIMC);
if (pClientImc == NULL)
return NULL;
- if ((dwContextFlags & 2) && (pClientImc->dwFlags &
CLIENTIMC_UNKNOWN3))
+ if ((dwContextFlags & 2) && (pClientImc->dwFlags &
CLIENTIMC_DISABLEIME))
hIMC = NULL;
ImmUnlockClientImc(pClientImc);
return hIMC;
diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec
index 0764e8dd0e5..78316f2a447 100644
--- a/dll/win32/imm32/imm32.spec
+++ b/dll/win32/imm32/imm32.spec
@@ -114,6 +114,6 @@
@ stdcall ImmUnlockImeDpi(ptr)
@ stdcall ImmUnregisterWordA(long str long str)
@ stdcall ImmUnregisterWordW(long wstr long wstr)
-@ stdcall -stub ImmWINNLSEnableIME(ptr long)
+@ stdcall ImmWINNLSEnableIME(ptr long)
@ stdcall ImmWINNLSGetEnableStatus(ptr)
@ stdcall ImmWINNLSGetIMEHotkey(ptr)
diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h
index 531d83392ef..924a0bef195 100644
--- a/win32ss/include/ntuser.h
+++ b/win32ss/include/ntuser.h
@@ -1326,7 +1326,7 @@ C_ASSERT(sizeof(CLIENTIMC) == 0x34);
#define CLIENTIMC_UNKNOWN5 0x2
#define CLIENTIMC_UNKNOWN4 0x20
#define CLIENTIMC_DESTROY 0x40
-#define CLIENTIMC_UNKNOWN3 0x80
+#define CLIENTIMC_DISABLEIME 0x80
#define CLIENTIMC_UNKNOWN2 0x100
DWORD