msctf: Implement ITfMessagePump.

This commit is contained in:
Aric Stewart 2009-05-05 10:52:00 -05:00 committed by Alexandre Julliard
parent 8ad9457fca
commit 1b92fcfa18
2 changed files with 125 additions and 0 deletions

View File

@ -60,6 +60,7 @@ typedef struct tagACLMulti {
const ITfThreadMgrVtbl *ThreadMgrVtbl;
const ITfSourceVtbl *SourceVtbl;
const ITfKeystrokeMgrVtbl *KeystrokeMgrVtbl;
const ITfMessagePumpVtbl *MessagePumpVtbl;
LONG refCount;
const ITfThreadMgrEventSinkVtbl *ThreadMgrEventSinkVtbl; /* internal */
@ -85,6 +86,11 @@ static inline ThreadMgr *impl_from_ITfKeystrokeMgrVtbl(ITfKeystrokeMgr *iface)
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,KeystrokeMgrVtbl));
}
static inline ThreadMgr *impl_from_ITfMessagePumpVtbl(ITfMessagePump *iface)
{
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,MessagePumpVtbl));
}
static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface)
{
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl));
@ -163,6 +169,10 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid,
{
*ppvOut = &This->KeystrokeMgrVtbl;
}
else if (IsEqualIID(iid, &IID_ITfMessagePump))
{
*ppvOut = &This->MessagePumpVtbl;
}
if (*ppvOut)
{
@ -575,6 +585,80 @@ static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl =
KeystrokeMgr_SimulatePreservedKey
};
/*****************************************************
* ITfMessagePump functions
*****************************************************/
static HRESULT WINAPI MessagePump_QueryInterface(ITfMessagePump *iface, REFIID iid, LPVOID *ppvOut)
{
ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface);
return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut);
}
static ULONG WINAPI MessagePump_AddRef(ITfMessagePump *iface)
{
ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface);
return ThreadMgr_AddRef((ITfThreadMgr*)This);
}
static ULONG WINAPI MessagePump_Release(ITfMessagePump *iface)
{
ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface);
return ThreadMgr_Release((ITfThreadMgr *)This);
}
static HRESULT WINAPI MessagePump_PeekMessageA(ITfMessagePump *iface,
LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax,
UINT wRemoveMsg, BOOL *pfResult)
{
if (!pfResult)
return E_INVALIDARG;
*pfResult = PeekMessageA(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
return S_OK;
}
static HRESULT WINAPI MessagePump_GetMessageA(ITfMessagePump *iface,
LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax,
BOOL *pfResult)
{
if (!pfResult)
return E_INVALIDARG;
*pfResult = GetMessageA(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax);
return S_OK;
}
static HRESULT WINAPI MessagePump_PeekMessageW(ITfMessagePump *iface,
LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax,
UINT wRemoveMsg, BOOL *pfResult)
{
if (!pfResult)
return E_INVALIDARG;
*pfResult = PeekMessageW(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
return S_OK;
}
static HRESULT WINAPI MessagePump_GetMessageW(ITfMessagePump *iface,
LPMSG pMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax,
BOOL *pfResult)
{
if (!pfResult)
return E_INVALIDARG;
*pfResult = GetMessageW(pMsg, hwnd, wMsgFilterMin, wMsgFilterMax);
return S_OK;
}
static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl =
{
MessagePump_QueryInterface,
MessagePump_AddRef,
MessagePump_Release,
MessagePump_PeekMessageA,
MessagePump_GetMessageA,
MessagePump_PeekMessageW,
MessagePump_GetMessageW
};
/*****************************************************
* ITfThreadMgrEventSink functions (internal)
*****************************************************/
@ -718,6 +802,7 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl;
This->SourceVtbl = &ThreadMgr_SourceVtbl;
This->KeystrokeMgrVtbl= &ThreadMgr_KeystrokeMgrVtbl;
This->MessagePumpVtbl= &ThreadMgr_MessagePumpVtbl;
This->ThreadMgrEventSinkVtbl = &ThreadMgr_ThreadMgrEventSinkVtbl;
This->refCount = 1;
TlsSetValue(tlsIndex,This);

View File

@ -22,6 +22,7 @@ import "comcat.idl";
import "textstor.idl";
/* import "ctfutb.idl"; */
#endif
cpp_quote("#include <winuser.h>")
cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)")
cpp_quote("#define TF_E_ALREADY_EXISTS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)")
@ -646,3 +647,42 @@ interface ITfKeyEventSink : IUnknown
[in] REFGUID rguid,
[out] BOOL *pfEaten);
};
[
object,
local,
uuid(8f1b8ad8-0b6b-4874-90c5-bd76011e8f7c),
pointer_default(unique)
]
interface ITfMessagePump : IUnknown
{
HRESULT PeekMessageA(
[out] LPMSG pMsg,
[in] HWND hwnd,
[in] UINT wMsgFilterMin,
[in] UINT wMsgFilterMax,
[in] UINT wRemoveMsg,
[out] BOOL *pfResult);
HRESULT GetMessageA(
[out] LPMSG pMsg,
[in] HWND hwnd,
[in] UINT wMsgFilterMin,
[in] UINT wMsgFilterMax,
[out] BOOL *pfResult);
HRESULT PeekMessageW(
[out] LPMSG pMsg,
[in] HWND hwnd,
[in] UINT wMsgFilterMin,
[in] UINT wMsgFilterMax,
[in] UINT wRemoveMsg,
[out] BOOL *pfResult);
HRESULT GetMessageW(
[out] LPMSG pMsg,
[in] HWND hwnd,
[in] UINT wMsgFilterMin,
[in] UINT wMsgFilterMax,
[out] BOOL *pfResult);
};