Module: wine Branch: master Commit: efbd3b4f560c4ff7740a8cefac78b63db2334639 URL: http://source.winehq.org/git/wine.git/?a=commit;h=efbd3b4f560c4ff7740a8cefac...
Author: Aric Stewart aric@codeweavers.com Date: Mon Feb 2 10:25:42 2009 -0600
msctf: Add ITfSource interface to Context.
---
dlls/msctf/context.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c index 696db65..aa8647c 100644 --- a/dlls/msctf/context.c +++ b/dlls/msctf/context.c @@ -42,12 +42,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(msctf);
typedef struct tagContext { const ITfContextVtbl *ContextVtbl; + const ITfSourceVtbl *SourceVtbl; LONG refCount;
TfClientId tidOwner; IUnknown *punk; /* possible ITextStoreACP or ITfContextOwnerCompositionSink */ } Context;
+static inline Context *impl_from_ITfSourceVtbl(ITfSource *iface) +{ + return (Context *)((char *)iface - FIELD_OFFSET(Context,SourceVtbl)); +} + static void Context_Destructor(Context *This) { TRACE("destroying %p\n", This); @@ -63,6 +69,10 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO { *ppvOut = This; } + else if (IsEqualIID(iid, &IID_ITfSource)) + { + *ppvOut = &This->SourceVtbl; + }
if (*ppvOut) { @@ -241,6 +251,52 @@ static const ITfContextVtbl Context_ContextVtbl = Context_CreateRangeBackup };
+static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) +{ + Context *This = impl_from_ITfSourceVtbl(iface); + return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); +} + +static ULONG WINAPI Source_AddRef(ITfSource *iface) +{ + Context *This = impl_from_ITfSourceVtbl(iface); + return Context_AddRef((ITfContext *)This); +} + +static ULONG WINAPI Source_Release(ITfSource *iface) +{ + Context *This = impl_from_ITfSourceVtbl(iface); + return Context_Release((ITfContext *)This); +} + +/***************************************************** + * ITfSource functions + *****************************************************/ +static WINAPI HRESULT ContextSource_AdviseSink(ITfSource *iface, + REFIID riid, IUnknown *punk, DWORD *pdwCookie) +{ + Context *This = impl_from_ITfSourceVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static WINAPI HRESULT ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) +{ + Context *This = impl_from_ITfSourceVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static const ITfSourceVtbl Context_SourceVtbl = +{ + Source_QueryInterface, + Source_AddRef, + Source_Release, + + ContextSource_AdviseSink, + ContextSource_UnadviseSink, +}; + HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore) { Context *This; @@ -250,6 +306,7 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **pp return E_OUTOFMEMORY;
This->ContextVtbl= &Context_ContextVtbl; + This->SourceVtbl = &Context_SourceVtbl; This->refCount = 1; This->tidOwner = tidOwner; This->punk = punk;