https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c06cccea22fc038d82198…
commit c06cccea22fc038d821989da27ad8c38f44bf141
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Aug 18 10:55:11 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Aug 18 10:55:11 2022 +0900
[USER32] Adjustment for IME/IMM (#4610)
- Add IS_CICERO_MODE() macro.
- Append DWORD dwLastStatus to IMEUI structure.
- Modify ImeWndProc_common, ImeWnd_OnCreate, ImeWnd_OnImeSelect, and
ImeWnd_OnImeControl functions.
CORE-11700
---
win32ss/include/ntuser.h | 2 ++
win32ss/user/user32/misc/imm.c | 44 +++++++++++++++++++++++++++++++++---------
2 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h
index 2b122059318..2a6194841e0 100644
--- a/win32ss/include/ntuser.h
+++ b/win32ss/include/ntuser.h
@@ -1201,6 +1201,7 @@ typedef enum IMEINFOEXCLASS
} IMEINFOEXCLASS;
#define IS_IME_HKL(hkl) ((((ULONG_PTR)(hkl)) & 0xF0000000) == 0xE0000000)
+#define IS_CICERO_MODE() (gpsi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)
typedef struct tagIMEUI
{
@@ -1219,6 +1220,7 @@ typedef struct tagIMEUI
UINT fCtrlShowStatus:1;
UINT fFreeActiveEvent:1;
};
+ DWORD dwLastStatus;
} IMEUI, *PIMEUI;
/* Window Extra data container. */
diff --git a/win32ss/user/user32/misc/imm.c b/win32ss/user/user32/misc/imm.c
index 017e9f2e384..0bf16913d54 100644
--- a/win32ss/user/user32/misc/imm.c
+++ b/win32ss/user/user32/misc/imm.c
@@ -340,13 +340,13 @@ Quit:
/* Initializes the default IME window. */
/* Win: ImeWndCreateHandler */
-static BOOL ImeWnd_OnCreate(PIMEUI pimeui, LPCREATESTRUCT lpCS)
+static INT ImeWnd_OnCreate(PIMEUI pimeui, LPCREATESTRUCT lpCS)
{
PWND pParentWnd, pWnd = pimeui->spwnd;
HIMC hIMC = NULL;
if (!pWnd || (pWnd->style & (WS_DISABLED | WS_POPUP)) != (WS_DISABLED |
WS_POPUP))
- return FALSE;
+ return -1;
pParentWnd = ValidateHwnd(lpCS->hwndParent);
if (pParentWnd)
@@ -365,12 +365,9 @@ static BOOL ImeWnd_OnCreate(PIMEUI pimeui, LPCREATESTRUCT lpCS)
pimeui->hwndIMC = NULL;
pimeui->hKL = GetWin32ClientInfo()->hKL;
pimeui->fCtrlShowStatus = TRUE;
+ pimeui->dwLastStatus = 0;
- IMM_FN(ImmLoadIME)(pimeui->hKL);
-
- pimeui->hwndUI = NULL;
-
- return TRUE;
+ return 0;
}
/* Destroys the IME UI window. */
@@ -399,6 +396,10 @@ static VOID ImeWnd_OnImeSelect(PIMEUI pimeui, WPARAM wParam, LPARAM
lParam)
if (wParam)
{
pimeui->hKL = hKL = (HKL)lParam;
+
+ if (!pimeui->fActivate)
+ return;
+
pimeui->hwndUI = hwndUI = User32CreateImeUIWindow(pimeui, hKL);
if (hwndUI)
User32SendImeUIMessage(pimeui, WM_IME_SELECT, wParam, lParam, TRUE);
@@ -429,6 +430,19 @@ ImeWnd_OnImeControl(PIMEUI pimeui, WPARAM wParam, LPARAM lParam, BOOL
unicode)
DWORD dwConversion, dwSentence;
POINT pt;
+ if (IS_CICERO_MODE())
+ {
+ if (wParam == IMC_OPENSTATUSWINDOW)
+ {
+ IMM_FN(CtfImmRestoreToolbarWnd)(pimeui->dwLastStatus);
+ pimeui->dwLastStatus = 0;
+ }
+ else if (wParam == IMC_CLOSESTATUSWINDOW)
+ {
+ pimeui->dwLastStatus = IMM_FN(CtfImmHideToolbarWnd)();
+ }
+ }
+
if (!hIMC)
return 0;
@@ -922,10 +936,18 @@ ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL unicod
{
PWND pWnd;
PIMEUI pimeui;
+ LRESULT ret;
pWnd = ValidateHwnd(hwnd);
if (pWnd)
{
+ if (IS_CICERO_MODE())
+ {
+ ret = IMM_FN(CtfImmDispatchDefImeMessage)(hwnd, msg, wParam, lParam);
+ if (ret)
+ return ret;
+ }
+
if (!pWnd->fnid)
{
if (msg != WM_NCCREATE)
@@ -961,7 +983,6 @@ ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL unicod
case WM_IME_CHAR:
case WM_IME_COMPOSITIONFULL:
case WM_IME_CONTROL:
- case WM_IME_NOTIFY:
case WM_IME_REQUEST:
case WM_IME_SELECT:
case WM_IME_SETCONTEXT:
@@ -970,6 +991,11 @@ ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL unicod
case WM_IME_ENDCOMPOSITION:
return 0;
+ case WM_IME_NOTIFY:
+ if (wParam < IMN_PRIVATE || IS_IME_HKL(pimeui->hKL) ||
!IS_CICERO_MODE())
+ return 0;
+ break;
+
case WM_IME_SYSTEM:
switch (wParam)
{
@@ -995,7 +1021,7 @@ ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL unicod
switch (msg)
{
case WM_CREATE:
- return (ImeWnd_OnCreate(pimeui, (LPCREATESTRUCT)lParam) ? 0 : -1);
+ return ImeWnd_OnCreate(pimeui, (LPCREATESTRUCT)lParam);
case WM_DESTROY:
User32DestroyImeUIWindow(pimeui);