1 /* 2 * PROJECT: ReactOS msctfime.ime 3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) 4 * PURPOSE: Bridge 5 * COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 6 */ 7 8 #pragma once 9 10 #include "sinks.h" 11 #include "tls.h" 12 13 class CicBridge : public ITfSysHookSink 14 { 15 protected: 16 LONG m_cRefs; 17 BOOL m_bImmxInited; 18 BOOL m_bUnknown1; 19 BOOL m_bDeactivating; 20 DWORD m_cActivateLocks; 21 ITfKeystrokeMgr *m_pKeystrokeMgr; 22 ITfDocumentMgr *m_pDocMgr; 23 CThreadMgrEventSink *m_pThreadMgrEventSink; 24 TfClientId m_cliendId; 25 CIC_LIBTHREAD m_LibThread; 26 BOOL m_bUnknown2; 27 28 static BOOL CALLBACK EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam); 29 static BOOL CALLBACK EnumDestroyInputContextCallback(HIMC hIMC, LPARAM lParam); 30 31 public: 32 CicBridge(); 33 virtual ~CicBridge(); 34 35 // IUnknown interface 36 STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override; 37 STDMETHODIMP_(ULONG) AddRef() override; 38 STDMETHODIMP_(ULONG) Release() override; 39 40 // ITfSysHookSink interface 41 STDMETHODIMP OnPreFocusDIM(HWND hwnd) override; 42 STDMETHODIMP OnSysKeyboardProc(UINT, LONG) override; 43 STDMETHODIMP OnSysShellProc(INT, UINT, LONG) override; 44 45 HRESULT InitIMMX(_Inout_ TLS *pTLS); 46 BOOL UnInitIMMX(_Inout_ TLS *pTLS); 47 HRESULT ActivateIMMX(_Inout_ TLS *pTLS, _Inout_ ITfThreadMgr_P *pThreadMgr); 48 HRESULT DeactivateIMMX(_Inout_ TLS *pTLS, _Inout_ ITfThreadMgr_P *pThreadMgr); 49 50 HRESULT CreateInputContext(TLS *pTLS, HIMC hIMC); 51 HRESULT DestroyInputContext(TLS *pTLS, HIMC hIMC); 52 ITfContext *GetInputContext(CicIMCCLock<CTFIMECONTEXT>& imeContext); 53 54 HRESULT SelectEx( 55 _Inout_ TLS *pTLS, 56 _Inout_ ITfThreadMgr_P *pThreadMgr, 57 _In_ HIMC hIMC, 58 _In_ BOOL fSelect, 59 _In_ HKL hKL); 60 HRESULT OnSetOpenStatus( 61 TLS *pTLS, 62 ITfThreadMgr_P *pThreadMgr, 63 CicIMCLock& imcLock, 64 CicInputContext *pCicIC); 65 66 void PostTransMsg(_In_ HWND hWnd, _In_ INT cTransMsgs, _In_ const TRANSMSG *pTransMsgs); 67 void GetDocumentManager(_Inout_ CicIMCCLock<CTFIMECONTEXT>& imeContext); 68 69 HRESULT 70 ConfigureGeneral(_Inout_ TLS* pTLS, 71 _In_ ITfThreadMgr *pThreadMgr, 72 _In_ HKL hKL, 73 _In_ HWND hWnd); 74 HRESULT ConfigureRegisterWord( 75 _Inout_ TLS* pTLS, 76 _In_ ITfThreadMgr *pThreadMgr, 77 _In_ HKL hKL, 78 _In_ HWND hWnd, 79 _Inout_opt_ LPVOID lpData); 80 }; 81