[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
This commit is contained in:
Katayama Hirofumi MZ 2022-01-29 10:35:48 +09:00 committed by GitHub
parent 82136b3ee4
commit 3fc83b4361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 130 additions and 3 deletions

View File

@ -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;

View File

@ -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);