https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b9e8fb9ea4fd919449635…
commit b9e8fb9ea4fd919449635b5f2f68652f3cced8b8
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Dec 27 15:08:17 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Dec 27 15:08:17 2023 +0900
[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.
---
dll/ime/msctfime/msctfime.cpp | 41 ++++++++++++++++++++++++++++----------
dll/ime/msctfime/msctfime.h | 1 +
sdk/include/ddk/immdev.h | 1 +
sdk/include/reactos/cicero/cictf.h | 31 ++++++++++++++++++++++++++++
4 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp
index 376416110a5..246f924ecbe 100644
--- a/dll/ime/msctfime/msctfime.cpp
+++ b/dll/ime/msctfime/msctfime.cpp
@@ -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;
}
/***********************************************************************
diff --git a/dll/ime/msctfime/msctfime.h b/dll/ime/msctfime/msctfime.h
index a5273e11d2d..8ab6bf3f5ad 100644
--- a/dll/ime/msctfime/msctfime.h
+++ b/dll/ime/msctfime/msctfime.h
@@ -26,6 +26,7 @@
#include <cicero/cicbase.h>
#include <cicero/cicarray.h>
#include <cicero/cicimc.h>
+#include <cicero/cictf.h>
class CicInputContext;
diff --git a/sdk/include/ddk/immdev.h b/sdk/include/ddk/immdev.h
index 2d955dd81c6..3d3b4b5686a 100644
--- a/sdk/include/ddk/immdev.h
+++ b/sdk/include/ddk/immdev.h
@@ -18,6 +18,7 @@ extern "C" {
#endif
BOOL WINAPI ImmDisableTextFrameService(_In_ DWORD dwThreadId);
+BOOL WINAPI CtfImmIsCiceroStartedInThread(VOID);
typedef struct tagSOFTKBDDATA
{
diff --git a/sdk/include/reactos/cicero/cictf.h b/sdk/include/reactos/cicero/cictf.h
new file mode 100644
index 00000000000..33598b1c5b1
--- /dev/null
+++ b/sdk/include/reactos/cicero/cictf.h
@@ -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(a)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);