mirror of
https://github.com/reactos/reactos.git
synced 2024-12-03 00:13:32 +08:00
[IMM32] Add ctf.c for Cicero (#4430)
Preparing of Cicero (modern input method) support. - Add ctf.c and add some CTF functions. - Modify the IMM table. - Modify imm32.spec. - Rename: s/Imm32FreeImeStates/Imm32DestroyImeModeSaver/. - Improve Imm32DestroyInputContext. CORE-11700
This commit is contained in:
parent
7a83e0a145
commit
4342b84c9a
@ -10,6 +10,7 @@ spec2def(imm32.dll imm32.spec ADD_IMPORTLIB)
|
||||
list(APPEND SOURCE
|
||||
candidate.c
|
||||
compstr.c
|
||||
ctf.c
|
||||
guideline.c
|
||||
ime.c
|
||||
imm.c
|
||||
|
90
dll/win32/imm32/ctf.c
Normal file
90
dll/win32/imm32/ctf.c
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* PROJECT: ReactOS IMM32
|
||||
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
||||
* PURPOSE: Implementing IMM32 Cicero (modern input method)
|
||||
* COPYRIGHT: Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(imm);
|
||||
|
||||
// Win: LoadCtfIme
|
||||
HMODULE APIENTRY Imm32LoadCtfIme(VOID)
|
||||
{
|
||||
FIXME("()\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Win: Internal_CtfImeDestroyInputContext
|
||||
HRESULT APIENTRY Imm32CtfImeDestroyInputContext(HIMC hIMC)
|
||||
{
|
||||
if (!Imm32LoadCtfIme())
|
||||
return E_FAIL;
|
||||
#if 1
|
||||
FIXME("(%p)\n", hIMC);
|
||||
return E_NOTIMPL;
|
||||
#else
|
||||
return g_pfnCtfImeDestroyInputContext(hIMC);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Win: CtfImmTIMDestroyInputContext
|
||||
HRESULT APIENTRY CtfImmTIMDestroyInputContext(HIMC hIMC)
|
||||
{
|
||||
if (!Imm32IsCiceroMode() || (GetWin32ClientInfo()->dwCompatFlags2 & 2))
|
||||
return E_NOINTERFACE;
|
||||
|
||||
return Imm32CtfImeDestroyInputContext(hIMC);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmIsCiceroEnabled (IMM32.@)
|
||||
*/
|
||||
BOOL WINAPI CtfImmIsCiceroEnabled(VOID)
|
||||
{
|
||||
return Imm32IsCiceroMode();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmIsTextFrameServiceDisabled(IMM32.@)
|
||||
*/
|
||||
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
|
||||
{
|
||||
return !!(GetWin32ClientInfo()->CI_flags & CI_TFSDISABLED);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmTIMActivate(IMM32.@)
|
||||
*/
|
||||
HRESULT WINAPI CtfImmTIMActivate(HKL hKL)
|
||||
{
|
||||
FIXME("(%p)\n", hKL);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmRestoreToolbarWnd(IMM32.@)
|
||||
*/
|
||||
VOID WINAPI CtfImmRestoreToolbarWnd(DWORD dwStatus)
|
||||
{
|
||||
FIXME("(0x%lx)\n", dwStatus);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmHideToolbarWnd(IMM32.@)
|
||||
*/
|
||||
DWORD WINAPI CtfImmHideToolbarWnd(VOID)
|
||||
{
|
||||
FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmDispatchDefImeMessage(IMM32.@)
|
||||
*/
|
||||
LRESULT WINAPI CtfImmDispatchDefImeMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
FIXME("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam);
|
||||
return 0;
|
||||
}
|
@ -611,23 +611,26 @@ HIMC WINAPI ImmCreateContext(void)
|
||||
return hIMC;
|
||||
}
|
||||
|
||||
static VOID APIENTRY Imm32FreeImeStates(LPINPUTCONTEXTDX pIC)
|
||||
// Win: DestroyImeModeSaver
|
||||
static VOID APIENTRY Imm32DestroyImeModeSaver(LPINPUTCONTEXTDX pIC)
|
||||
{
|
||||
PIME_STATE pState, pStateNext;
|
||||
PIME_SUBSTATE pSubState, pSubStateNext;
|
||||
PIME_STATE pState, pNext;
|
||||
PIME_SUBSTATE pSubState, pSubNext;
|
||||
|
||||
pState = pIC->pState;
|
||||
pIC->pState = NULL;
|
||||
for (; pState; pState = pStateNext)
|
||||
for (pState = pIC->pState; pState; pState = pNext)
|
||||
{
|
||||
pStateNext = pState->pNext;
|
||||
for (pSubState = pState->pSubState; pSubState; pSubState = pSubStateNext)
|
||||
pNext = pState->pNext;
|
||||
|
||||
for (pSubState = pState->pSubState; pSubState; pSubState = pSubNext)
|
||||
{
|
||||
pSubStateNext = pSubState->pNext;
|
||||
pSubNext = pSubState->pNext;
|
||||
ImmLocalFree(pSubState);
|
||||
}
|
||||
|
||||
ImmLocalFree(pState);
|
||||
}
|
||||
|
||||
pIC->pState = NULL;
|
||||
}
|
||||
|
||||
// Win: DestroyInputContext
|
||||
@ -638,7 +641,7 @@ BOOL APIENTRY Imm32DestroyInputContext(HIMC hIMC, HKL hKL, BOOL bKeep)
|
||||
PCLIENTIMC pClientImc;
|
||||
PIMC pIMC;
|
||||
|
||||
if (!IS_IMM_MODE() || hIMC == NULL)
|
||||
if (!hIMC || !IS_IMM_MODE())
|
||||
return FALSE;
|
||||
|
||||
pIMC = ValidateHandleNoErr(hIMC, TYPE_INPUTCONTEXT);
|
||||
@ -674,19 +677,30 @@ BOOL APIENTRY Imm32DestroyInputContext(HIMC hIMC, HKL hKL, BOOL bKeep)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pImeDpi = ImmLockImeDpi(hKL);
|
||||
if (pImeDpi)
|
||||
CtfImmTIMDestroyInputContext(hIMC);
|
||||
|
||||
if (pClientImc->hKL == hKL)
|
||||
{
|
||||
pImeDpi->ImeSelect(hIMC, FALSE);
|
||||
ImmUnlockImeDpi(pImeDpi);
|
||||
pImeDpi = ImmLockImeDpi(hKL);
|
||||
if (pImeDpi)
|
||||
{
|
||||
if (IS_IME_HKL(hKL))
|
||||
pImeDpi->ImeSelect(hIMC, FALSE);
|
||||
else if (Imm32IsCiceroMode() && !Imm32Is16BitMode())
|
||||
pImeDpi->CtfImeSelectEx(hIMC, FALSE, hKL);
|
||||
|
||||
ImmUnlockImeDpi(pImeDpi);
|
||||
}
|
||||
|
||||
pClientImc->hKL = NULL;
|
||||
}
|
||||
|
||||
pIC->hPrivate = ImmDestroyIMCC(pIC->hPrivate);
|
||||
pIC->hMsgBuf = ImmDestroyIMCC(pIC->hMsgBuf);
|
||||
pIC->hGuideLine = ImmDestroyIMCC(pIC->hGuideLine);
|
||||
pIC->hCandInfo = ImmDestroyIMCC(pIC->hCandInfo);
|
||||
pIC->hCompStr = ImmDestroyIMCC(pIC->hCompStr);
|
||||
Imm32FreeImeStates(pIC);
|
||||
ImmDestroyIMCC(pIC->hPrivate);
|
||||
ImmDestroyIMCC(pIC->hMsgBuf);
|
||||
ImmDestroyIMCC(pIC->hGuideLine);
|
||||
ImmDestroyIMCC(pIC->hCandInfo);
|
||||
ImmDestroyIMCC(pIC->hCompStr);
|
||||
Imm32DestroyImeModeSaver(pIC);
|
||||
ImmUnlockIMC(hIMC);
|
||||
|
||||
Quit:
|
||||
@ -1008,14 +1022,6 @@ HIMC WINAPI ImmGetContext(HWND hWnd)
|
||||
return ImmGetSaveContext(hWnd, 2);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmIsCiceroEnabled (IMM32.@)
|
||||
*/
|
||||
BOOL WINAPI CtfImmIsCiceroEnabled(VOID)
|
||||
{
|
||||
return Imm32IsCiceroMode();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ImmLockIMC(IMM32.@)
|
||||
*
|
||||
|
@ -1,9 +1,9 @@
|
||||
@ stdcall CtfImmIsCiceroEnabled()
|
||||
@ stdcall CtfImmIsTextFrameServiceDisabled()
|
||||
@ stdcall -stub CtfImmTIMActivate(ptr)
|
||||
@ stdcall -stub CtfImmRestoreToolbarWnd(long)
|
||||
@ stdcall -stub CtfImmHideToolbarWnd()
|
||||
@ stdcall -stub CtfImmDispatchDefImeMessage(ptr long ptr ptr)
|
||||
@ stdcall CtfImmTIMActivate(ptr)
|
||||
@ stdcall CtfImmRestoreToolbarWnd(long)
|
||||
@ stdcall CtfImmHideToolbarWnd()
|
||||
@ stdcall CtfImmDispatchDefImeMessage(ptr long ptr ptr)
|
||||
@ stdcall ImmActivateLayout(ptr)
|
||||
@ stdcall ImmAssociateContext(ptr ptr)
|
||||
@ stdcall ImmAssociateContextEx(ptr ptr long)
|
||||
|
@ -941,14 +941,6 @@ Quit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CtfImmIsTextFrameServiceDisabled(IMM32.@)
|
||||
*/
|
||||
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
|
||||
{
|
||||
return !!(GetWin32ClientInfo()->CI_flags & CI_TFSDISABLED);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ImmCreateIMCC(IMM32.@)
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@ PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc);
|
||||
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc);
|
||||
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL);
|
||||
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi);
|
||||
HRESULT APIENTRY CtfImmTIMDestroyInputContext(HIMC hIMC);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
@ -52,7 +52,7 @@ DEFINE_IMM_ENTRY(BOOL, ImmSetCompositionStringA, (HIMC hIMC, DWORD dwIndex, LPCV
|
||||
DEFINE_IMM_ENTRY(BOOL, ImmSetCompositionStringW, (HIMC hIMC, DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen), 0, NONVOID)
|
||||
DEFINE_IMM_ENTRY(BOOL, ImmEnumInputContext, (DWORD dwThreadID, IMCENUMPROC lpfn, LPARAM lParam), 0, NONVOID)
|
||||
DEFINE_IMM_ENTRY(LRESULT, ImmSystemHandler, (HIMC hIMC, WPARAM wParam, LPARAM lParam), 0, NONVOID)
|
||||
DEFINE_IMM_ENTRY(LRESULT, CtfImmTIMActivate, (HKL hKL), 0, NONVOID)
|
||||
DEFINE_IMM_ENTRY(HRESULT, CtfImmTIMActivate, (HKL hKL), 0, NONVOID)
|
||||
DEFINE_IMM_ENTRY(VOID, CtfImmRestoreToolbarWnd, (DWORD dwStatus), 0, VOID)
|
||||
DEFINE_IMM_ENTRY(DWORD, CtfImmHideToolbarWnd, (VOID), 0, NONVOID)
|
||||
DEFINE_IMM_ENTRY(LRESULT, CtfImmDispatchDefImeMessage, (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam), 0, NONVOID)
|
||||
|
Loading…
Reference in New Issue
Block a user