https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3fc83b4361a5ae6bf0ce8…
commit 3fc83b4361a5ae6bf0ce88d82248296bf2276ebc
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Jan 29 10:35:48 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Jan 29 10:35:48 2022 +0900
[USER32] Implement ImeWnd_OnImeControl (#4320)
- Add IMC_GETCONVERSIONMODE, IMC_GETSENTENCEMODE, IMC_GETOPENSTATUS,
IMC_GETSOFTKBDPOS, and IMC_SETSOFTKBDPOS macros into <ddk/imm.h>.
- Implement WM_IME_CONTROL message handling of the IME window.
CORE-11700
---
sdk/include/reactos/wine/ddk/imm.h | 7 +++
win32ss/user/user32/misc/imm.c | 126 ++++++++++++++++++++++++++++++++++++-
2 files changed, 130 insertions(+), 3 deletions(-)
diff --git a/sdk/include/reactos/wine/ddk/imm.h b/sdk/include/reactos/wine/ddk/imm.h
index 33ed8e49a82..4f5e16a3568 100644
--- a/sdk/include/reactos/wine/ddk/imm.h
+++ b/sdk/include/reactos/wine/ddk/imm.h
@@ -24,6 +24,13 @@
#include <psdk/imm.h>
+/* wParam for WM_IME_CONTROL */
+#define IMC_GETCONVERSIONMODE 0x0001
+#define IMC_GETSENTENCEMODE 0x0003
+#define IMC_GETOPENSTATUS 0x0005
+#define IMC_GETSOFTKBDPOS 0x0013
+#define IMC_SETSOFTKBDPOS 0x0014
+
typedef struct _tagINPUTCONTEXT {
HWND hWnd;
BOOL fOpen;
diff --git a/win32ss/user/user32/misc/imm.c b/win32ss/user/user32/misc/imm.c
index 8a7a5eb7c14..13f749926b4 100644
--- a/win32ss/user/user32/misc/imm.c
+++ b/win32ss/user/user32/misc/imm.c
@@ -341,7 +341,7 @@ static VOID User32DestroyImeUIWindow(PIMEUI pimeui)
pimeui->hwndUI = NULL;
}
-VOID ImeWnd_OnImeSelect(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
+static VOID ImeWnd_OnImeSelect(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
{
HKL hKL;
HWND hwndUI, hwndIMC = pimeui->hwndIMC;
@@ -370,6 +370,127 @@ VOID ImeWnd_OnImeSelect(PIMEUI pimeui, WPARAM wParam, LPARAM
lParam)
}
}
+static LRESULT
+ImeWnd_OnImeControl(PIMEUI pimeui, WPARAM wParam, LPARAM lParam, BOOL unicode)
+{
+ HIMC hIMC = pimeui->hIMC;
+ DWORD dwConversion, dwSentence;
+ POINT pt;
+
+ if (!hIMC)
+ return 0;
+
+ switch (wParam)
+ {
+ case IMC_GETCONVERSIONMODE:
+ if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion,
&dwSentence))
+ return 1;
+ return dwConversion;
+
+ case IMC_GETSENTENCEMODE:
+ if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion,
&dwSentence))
+ return 1;
+ return dwSentence;
+
+ case IMC_GETOPENSTATUS:
+ return IMM_FN(ImmGetOpenStatus)(hIMC);
+
+ case IMC_SETCONVERSIONMODE:
+ if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence)
||
+ !IMM_FN(ImmSetConversionStatus)(hIMC, (DWORD)lParam, dwSentence))
+ {
+ return 1;
+ }
+ break;
+
+ case IMC_SETSENTENCEMODE:
+ if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence)
||
+ !IMM_FN(ImmSetConversionStatus)(hIMC, dwConversion, (DWORD)lParam))
+ {
+ return 1;
+ }
+ break;
+
+ case IMC_SETOPENSTATUS:
+ if (!IMM_FN(ImmSetOpenStatus)(hIMC, (BOOL)lParam))
+ return 1;
+ break;
+
+ case IMC_GETCANDIDATEPOS:
+ case IMC_GETCOMPOSITIONWINDOW:
+ case IMC_GETSOFTKBDPOS:
+ case IMC_SETSOFTKBDPOS:
+ case IMC_GETSTATUSWINDOWPOS:
+ return User32SendImeUIMessage(pimeui, WM_IME_CONTROL, wParam, lParam,
unicode);
+
+ case IMC_SETCANDIDATEPOS:
+ if (!IMM_FN(ImmSetCandidateWindow)(hIMC, (LPCANDIDATEFORM)lParam))
+ return 1;
+ break;
+
+ case IMC_GETCOMPOSITIONFONT:
+ if (unicode)
+ {
+ if (!IMM_FN(ImmGetCompositionFontW)(hIMC, (LPLOGFONTW)lParam))
+ return 1;
+ }
+ else
+ {
+ if (!IMM_FN(ImmGetCompositionFontA)(hIMC, (LPLOGFONTA)lParam))
+ return 1;
+ }
+ break;
+
+ case IMC_SETCOMPOSITIONFONT:
+ if (unicode)
+ {
+ if (!IMM_FN(ImmSetCompositionFontW)(hIMC, (LPLOGFONTW)lParam))
+ return 1;
+ }
+ else
+ {
+ if (!IMM_FN(ImmSetCompositionFontA)(hIMC, (LPLOGFONTA)lParam))
+ return 1;
+ }
+ break;
+
+ case IMC_SETCOMPOSITIONWINDOW:
+ if (!IMM_FN(ImmSetCompositionWindow)(hIMC, (LPCOMPOSITIONFORM)lParam))
+ return 1;
+ break;
+
+ case IMC_SETSTATUSWINDOWPOS:
+ pt.x = GET_X_LPARAM(lParam);
+ pt.y = GET_Y_LPARAM(lParam);
+ if (!IMM_FN(ImmSetStatusWindowPos)(hIMC, &pt))
+ return 1;
+ break;
+
+ case IMC_CLOSESTATUSWINDOW:
+ if (pimeui->fShowStatus && User32GetImeShowStatus())
+ {
+ pimeui->fShowStatus = FALSE;
+ User32SendImeUIMessage(pimeui, WM_IME_NOTIFY, IMN_CLOSESTATUSWINDOW, 0,
TRUE);
+ }
+ pimeui->fCtrlShowStatus = FALSE;
+ break;
+
+ case IMC_OPENSTATUSWINDOW:
+ if (!pimeui->fShowStatus && User32GetImeShowStatus())
+ {
+ pimeui->fShowStatus = TRUE;
+ User32SendImeUIMessage(pimeui, WM_IME_NOTIFY, IMN_OPENSTATUSWINDOW, 0,
TRUE);
+ }
+ pimeui->fCtrlShowStatus = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL
unicode ) // ReactOS
{
PWND pWnd;
@@ -467,8 +588,7 @@ LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lPa
return User32SendImeUIMessage(pimeui, msg, wParam, lParam, unicode);
case WM_IME_CONTROL:
- // TODO:
- break;
+ return ImeWnd_OnImeControl(pimeui, wParam, lParam, unicode);
case WM_IME_NOTIFY:
return ImeWnd_OnImeNotify(pimeui, wParam, lParam);