https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3714ee269b099f9078bea…
commit 3714ee269b099f9078bead13aeb2f655787b82c3
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Jul 15 21:59:53 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Jul 15 21:59:53 2021 +0900
[IMM32] Rewrite ImmGetDefaultIMEWnd (#3821)
- Rewrite ImmGetDefaultIMEWnd function.
- Add g_dwImm32Flags global variable.
- Add Imm32QueryWindow helper function.
- Implement CtfImmIsCiceroEnabled function.
- Modify imm32.spec.
CORE-11700
---
dll/win32/imm32/imm.c | 31 ++++++++++++++++++++++++-------
dll/win32/imm32/imm32.spec | 1 +
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index e68f59c35a1..4bcc133ae66 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -1005,6 +1005,11 @@ LRESULT WINAPI ImmEscapeW(
#define ROUNDUP4(n) (((n) + 3) & ~3) /* DWORD alignment */
HANDLE g_hImm32Heap = NULL;
+DWORD g_dwImm32Flags = 0;
+
+/* flags for g_dwImm32Flags */
+#define IMM32_FLAG_UNKNOWN 0x4
+#define IMM32_FLAG_CICERO_ENABLED 0x20
LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes)
{
@@ -1023,6 +1028,11 @@ Imm32GetThreadState(DWORD Routine)
return NtUserGetThreadState(Routine);
}
+static DWORD_PTR APIENTRY Imm32QueryWindow(HWND hWnd, DWORD Index)
+{
+ return NtUserQueryWindow(hWnd, Index);
+}
+
static DWORD APIENTRY
Imm32UpdateInputContext(HIMC hIMC, DWORD Unknown1, PCLIENTIMC pClientImc)
{
@@ -2096,14 +2106,21 @@ void WINAPI __wine_unregister_window(HWND hwnd)
*/
HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
{
- HWND ret;
- IMMThreadData* thread_data = IMM_GetThreadData(hWnd, 0);
- if (!thread_data)
+ if (!(g_dwImm32Flags & IMM32_FLAG_UNKNOWN))
return NULL;
- ret = thread_data->hwndDefault;
- LeaveCriticalSection(&threaddata_cs);
- TRACE("Default is %p\n",ret);
- return ret;
+
+ if (hWnd == NULL)
+ return (HWND)Imm32GetThreadState(THREADSTATE_ACTIVEWINDOW);
+
+ return (HWND)Imm32QueryWindow(hWnd, QUERY_WINDOW_DEFAULT_IME);
+}
+
+/***********************************************************************
+ * CtfImmIsCiceroEnabled (IMM32.@)
+ */
+BOOL WINAPI CtfImmIsCiceroEnabled(VOID)
+{
+ return !!(g_dwImm32Flags & IMM32_FLAG_CICERO_ENABLED);
}
/***********************************************************************
diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec
index b41e2ee2049..43107d4797a 100644
--- a/dll/win32/imm32/imm32.spec
+++ b/dll/win32/imm32/imm32.spec
@@ -1,3 +1,4 @@
+@ stdcall CtfImmIsCiceroEnabled()
@ stdcall -stub ImmActivateLayout(long)
@ stdcall ImmAssociateContext(ptr ptr)
@ stdcall ImmAssociateContextEx(ptr ptr long)