[MSCTFIME][SDK] Implement CtfImeProcessCicHotkey (#6236)

Supporting TIPs...
JIRA issue: CORE-19360
- Define ITfSysHookSink and IID_ITfThreadMgr_P
  interfaces in <cicero/cictf.h>.
- Implement CtfImeProcessCicHotkey function.
This commit is contained in:
Katayama Hirofumi MZ 2023-12-27 15:08:17 +09:00 committed by GitHub
parent cfff2dbd12
commit b9e8fb9ea4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 11 deletions

View file

@ -765,15 +765,6 @@ Inquire(
return S_OK;
}
DEFINE_GUID(IID_ITfSysHookSink, 0x495388DA, 0x21A5, 0x4852, 0x8B, 0xB1, 0xED, 0x2F, 0x29, 0xDA, 0x8D, 0x60);
struct ITfSysHookSink : IUnknown
{
STDMETHOD(OnPreFocusDIM)(HWND hwnd) = 0;
STDMETHOD(OnSysKeyboardProc)(UINT, LONG) = 0;
STDMETHOD(OnSysShellProc)(INT, UINT, LONG) = 0;
};
class TLS;
typedef INT (CALLBACK *FN_INITDOCMGR)(UINT, ITfDocumentMgr *, ITfDocumentMgr *, LPVOID);
@ -2649,14 +2640,42 @@ CtfImeSetActiveContextAlways(
return E_NOTIMPL;
}
/***********************************************************************
* CtfImeProcessCicHotkey (MSCTFIME.@)
*
* @implemented
*/
EXTERN_C HRESULT WINAPI
CtfImeProcessCicHotkey(
_In_ HIMC hIMC,
_In_ UINT vKey,
_In_ LPARAM lParam)
{
FIXME("stub:(%p, %u, %p)\n", hIMC, vKey, lParam);
return E_NOTIMPL;
TRACE("(%p, %u, %p)\n", hIMC, vKey, lParam);
TLS *pTLS = TLS::GetTLS();
if (!pTLS)
return S_OK;
HRESULT hr = S_OK;
ITfThreadMgr *pThreadMgr = NULL;
ITfThreadMgr_P *pThreadMgr_P = NULL;
if ((TF_GetThreadMgr(&pThreadMgr) == S_OK) &&
(pThreadMgr->QueryInterface(IID_ITfThreadMgr_P, (void**)&pThreadMgr_P) == S_OK) &&
CtfImmIsCiceroStartedInThread())
{
HRESULT hr2;
if (SUCCEEDED(pThreadMgr_P->CallImm32HotkeyHandler(vKey, lParam, &hr2)))
hr = hr2;
}
if (pThreadMgr)
pThreadMgr->Release();
if (pThreadMgr_P)
pThreadMgr_P->Release();
return hr;
}
/***********************************************************************

View file

@ -26,6 +26,7 @@
#include <cicero/cicbase.h>
#include <cicero/cicarray.h>
#include <cicero/cicimc.h>
#include <cicero/cictf.h>
class CicInputContext;

View file

@ -18,6 +18,7 @@ extern "C" {
#endif
BOOL WINAPI ImmDisableTextFrameService(_In_ DWORD dwThreadId);
BOOL WINAPI CtfImmIsCiceroStartedInThread(VOID);
typedef struct tagSOFTKBDDATA
{

View file

@ -0,0 +1,31 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero Text Framework
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
DEFINE_GUID(IID_ITfSysHookSink, 0x495388DA, 0x21A5, 0x4852, 0x8B, 0xB1, 0xED, 0x2F, 0x29, 0xDA, 0x8D, 0x60);
struct ITfSysHookSink : IUnknown
{
STDMETHOD(OnPreFocusDIM)(HWND hwnd) = 0;
STDMETHOD(OnSysKeyboardProc)(UINT, LONG) = 0;
STDMETHOD(OnSysShellProc)(INT, UINT, LONG) = 0;
};
DEFINE_GUID(IID_ITfThreadMgr_P, 0x7C6247A1, 0x2884, 0x4B7C, 0xAF, 0x24, 0xF1, 0x98, 0x04, 0x7A, 0xA7, 0x28);
struct ITfThreadMgr_P : ITfThreadMgr
{
STDMETHOD(GetAssociated)(HWND hwnd, ITfDocumentMgr **ppDocMgr) = 0;
STDMETHOD(SetSysHookSink)(ITfSysHookSink *pSysHookSink) = 0;
STDMETHOD(RequestPostponedLock)(ITfContext *pContext) = 0;
STDMETHOD(IsKeystrokeFeedEnabled)(int *) = 0;
STDMETHOD(CallImm32HotkeyHandler)(UINT vKey, LPARAM lParam, HRESULT* phrResult) = 0;
STDMETHOD(ActivateEx)(LPDWORD, DWORD) = 0;
};
DEFINE_GUID(IID_ITfKeystrokeMgr_P, 0x53FA1BEC, 0x5BE1, 0x458E, 0xAE, 0x70, 0xA9, 0xF1, 0xDC, 0x84, 0x3E, 0x81);