https://git.reactos.org/?p=reactos.git;a=commitdiff;h=99614febadf56ad08f5cb…
commit 99614febadf56ad08f5cb0f90267aa13d24cee99
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Jan 31 21:20:08 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Jan 31 21:20:08 2022 +0900
[USER32] Add ImeWnd_OnImeSystem (#4327)
- Add WM_IME_SYSTEM message handling of the IME window.
- Modify immtable.h.
CORE-11700
---
win32ss/user/ntuser/simplecall.c | 5 +
win32ss/user/user32/include/immtable.h | 1 +
win32ss/user/user32/misc/imm.c | 179 ++++++++++++++++++++++++++++++++-
3 files changed, 181 insertions(+), 4 deletions(-)
diff --git a/win32ss/user/ntuser/simplecall.c b/win32ss/user/ntuser/simplecall.c
index 76ea0340c7b..42feafd0f44 100644
--- a/win32ss/user/ntuser/simplecall.c
+++ b/win32ss/user/ntuser/simplecall.c
@@ -891,6 +891,11 @@ NtUserCallHwndParamLock(
switch (Routine)
{
+ case X_ROUTINE_IMESHOWSTATUSCHANGE:
+ {
+ // TODO:
+ break;
+ }
case TWOPARAM_ROUTINE_VALIDATERGN:
{
PREGION Rgn = REGION_LockRgn((HRGN)Param);
diff --git a/win32ss/user/user32/include/immtable.h
b/win32ss/user/user32/include/immtable.h
index 4e194a02811..5672285ec4b 100644
--- a/win32ss/user/user32/include/immtable.h
+++ b/win32ss/user/user32/include/immtable.h
@@ -32,6 +32,7 @@ DEFINE_IMM_ENTRY(BOOL, ImmLoadIME, (HKL hKL), 0, NONVOID)
DEFINE_IMM_ENTRY(BOOL, ImmSetOpenStatus, (HIMC hIMC, BOOL bOpen), 0, NONVOID)
DEFINE_IMM_ENTRY(BOOL, ImmFreeLayout, (DWORD dwFlags), 0, NONVOID)
DEFINE_IMM_ENTRY(BOOL, ImmActivateLayout, (HKL hKL), 0, NONVOID)
+DEFINE_IMM_ENTRY(BOOL, ImmGetCandidateWindow, (HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM
lpCandForm), 0, NONVOID)
DEFINE_IMM_ENTRY(BOOL, ImmSetCandidateWindow, (HIMC hIMC, LPCANDIDATEFORM lpCandForm), 0,
NONVOID)
DEFINE_IMM_ENTRY(BOOL, ImmConfigureIMEW, (HKL hKL, HWND hWnd, DWORD dwMode, LPVOID
lpData), 0, NONVOID)
DEFINE_IMM_ENTRY(BOOL, ImmGetConversionStatus, (HIMC hIMC, LPDWORD lpdwConversion,
LPDWORD lpdwSentence), 0, NONVOID)
diff --git a/win32ss/user/user32/misc/imm.c b/win32ss/user/user32/misc/imm.c
index 2a9f6d523f0..7d84a2bb0f4 100644
--- a/win32ss/user/user32/misc/imm.c
+++ b/win32ss/user/user32/misc/imm.c
@@ -16,6 +16,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(user32);
#define IMM_INIT_MAGIC 0x19650412
+#define MAX_CANDIDATEFORM 4
/* Is != NULL when we have loaded the IMM ourselves */
HINSTANCE ghImm32 = NULL;
@@ -491,6 +492,168 @@ ImeWnd_OnImeControl(PIMEUI pimeui, WPARAM wParam, LPARAM lParam,
BOOL unicode)
return 0;
}
+static VOID FASTCALL User32SetImeActivenessOfWindow(HWND hWnd, BOOL bActive)
+{
+ HIMC hIMC;
+
+ if (!hWnd || !IsWindow(hWnd))
+ {
+ IMM_FN(ImmSetActiveContext)(NULL, NULL, bActive);
+ return;
+ }
+
+ hIMC = IMM_FN(ImmGetContext)(hWnd);
+ IMM_FN(ImmSetActiveContext)(hWnd, hIMC, bActive);
+ IMM_FN(ImmReleaseContext)(hWnd, hIMC);
+}
+
+static LRESULT ImeWnd_OnImeSystem(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT ret = 0;
+ LPINPUTCONTEXTDX pIC;
+ HIMC hIMC = pimeui->hIMC;
+ LPCANDIDATEFORM pCandForm;
+ LPCOMPOSITIONFORM pCompForm;
+ DWORD dwConversion, dwSentence;
+ HWND hImeWnd;
+ BOOL bCompForm;
+ CANDIDATEFORM CandForm;
+ COMPOSITIONFORM CompForm;
+ UINT iCandForm;
+
+ switch (wParam)
+ {
+ case 0x05:
+ if (User32GetImeShowStatus() == !lParam)
+ {
+ hImeWnd = UserHMGetHandle(pimeui->spwnd);
+ NtUserCallHwndParamLock(hImeWnd, lParam, X_ROUTINE_IMESHOWSTATUSCHANGE);
+ }
+ break;
+
+ case 0x06:
+ if (!hIMC)
+ break;
+
+ bCompForm = TRUE;
+ pIC = IMM_FN(ImmLockIMC)(hIMC);
+ if (pIC)
+ {
+ bCompForm = !(pIC->dwUIFlags & 0x2);
+ IMM_FN(ImmUnlockIMC)(hIMC);
+ }
+
+ if (!IsWindow(pimeui->hwndIMC))
+ break;
+
+ if (bCompForm && IMM_FN(ImmGetCompositionWindow)(hIMC,
&CompForm))
+ {
+ if (CompForm.dwStyle)
+ IMM_FN(ImmSetCompositionWindow)(hIMC, &CompForm);
+ }
+
+ for (iCandForm = 0; iCandForm < MAX_CANDIDATEFORM; ++iCandForm)
+ {
+ if (IMM_FN(ImmGetCandidateWindow)(hIMC, iCandForm, &CandForm))
+ {
+ if (CandForm.dwStyle)
+ IMM_FN(ImmSetCandidateWindow)(hIMC, &CandForm);
+ }
+ }
+ break;
+
+ case 0x09:
+ pIC = IMM_FN(ImmLockIMC)(hIMC);
+ if (!pIC)
+ break;
+
+ pCandForm = &pIC->cfCandForm[lParam];
+ IMM_FN(ImmSetCandidateWindow)(hIMC, pCandForm);
+ IMM_FN(ImmUnlockIMC)(hIMC);
+ break;
+
+ case 0x0A:
+ pIC = IMM_FN(ImmLockIMC)(hIMC);
+ if (!pIC)
+ break;
+
+ IMM_FN(ImmSetCompositionFontW)(hIMC, &pIC->lfFont.W);
+ IMM_FN(ImmUnlockIMC)(hIMC);
+ break;
+
+ case 0x0B:
+ pIC = IMM_FN(ImmLockIMC)(hIMC);
+ if (!pIC)
+ break;
+
+ pCompForm = &pIC->cfCompForm;
+ pIC->dwUIFlags |= 0x8;
+ IMM_FN(ImmSetCompositionWindow)(hIMC, pCompForm);
+ IMM_FN(ImmUnlockIMC)(hIMC);
+ break;
+
+ case 0x0D:
+ IMM_FN(ImmConfigureIMEW)((HKL)lParam, pimeui->hwndIMC, IME_CONFIG_GENERAL,
NULL);
+ break;
+
+ case 0x0F:
+ if (hIMC)
+ IMM_FN(ImmSetOpenStatus)(hIMC, (BOOL)lParam);
+ break;
+
+ case 0x11:
+ ret = IMM_FN(ImmFreeLayout)((DWORD)lParam);
+ break;
+
+ case 0x13:
+ // TODO:
+ break;
+
+ case 0x14:
+ IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence);
+ ret = dwConversion;
+ break;
+
+ case 0x15:
+ // TODO:
+ break;
+
+ case 0x17:
+ User32SetImeActivenessOfWindow((HWND)lParam, TRUE);
+ break;
+
+ case 0x18:
+ User32SetImeActivenessOfWindow((HWND)lParam, FALSE);
+ break;
+
+ case 0x19:
+ ret = IMM_FN(ImmActivateLayout)((HKL)lParam);
+ break;
+
+ case 0x1C:
+ ret = IMM_FN(ImmPutImeMenuItemsIntoMappedFile)((HIMC)lParam);
+ break;
+
+ case 0x1D:
+ // TODO:
+ break;
+
+ case 0x1E:
+ ret = (ULONG_PTR)IMM_FN(ImmGetContext)((HWND)lParam);
+ break;
+
+ case 0x1F:
+ case 0x20:
+ ret = IMM_FN(ImmSystemHandler)(hIMC, wParam, lParam);
+ break;
+
+ default:
+ break;
+ }
+
+ return ret;
+}
+
LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL
unicode ) // ReactOS
{
PWND pWnd;
@@ -545,8 +708,17 @@ LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lPa
return 0;
case WM_IME_SYSTEM:
- // TODO:
- return 0;
+ switch (wParam)
+ {
+ case 0x03:
+ case 0x10:
+ case 0x13:
+ break;
+
+ default:
+ return 0;
+ }
+ break;
default:
{
@@ -605,8 +777,7 @@ LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lPa
break;
case WM_IME_SYSTEM:
- // TODO:
- break;
+ return ImeWnd_OnImeSystem(pimeui, wParam, lParam);
default:
{