msctf: Moved thread manager's AdviseSink implementation into a more generic helper.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0b912fecf6
commit
c0efd074b2
|
@ -32,6 +32,7 @@
|
|||
#include "shlwapi.h"
|
||||
#include "shlguid.h"
|
||||
#include "comcat.h"
|
||||
#include "olectl.h"
|
||||
#include "rpcproxy.h"
|
||||
#include "msctf.h"
|
||||
#include "inputscope.h"
|
||||
|
@ -283,6 +284,26 @@ DWORD enumerate_Cookie(DWORD magic, DWORD *index)
|
|||
return 0x0;
|
||||
}
|
||||
|
||||
HRESULT advise_sink(struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie)
|
||||
{
|
||||
Sink *sink;
|
||||
|
||||
sink = HeapAlloc(GetProcessHeap(), 0, sizeof(*sink));
|
||||
if (!sink)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(IUnknown_QueryInterface(unk, riid, (void**)&sink->interfaces.pIUnknown)))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, sink);
|
||||
return CONNECT_E_CANNOTCONNECT;
|
||||
}
|
||||
|
||||
list_add_head(sink_list, &sink->entry);
|
||||
*cookie = generate_Cookie(cookie_magic, sink);
|
||||
TRACE("cookie %x\n", *cookie);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Active Text Service Management
|
||||
*****************************************************************************/
|
||||
|
|
|
@ -75,6 +75,8 @@ typedef struct {
|
|||
} interfaces;
|
||||
} Sink;
|
||||
|
||||
HRESULT advise_sink(struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie) DECLSPEC_HIDDEN;
|
||||
|
||||
extern const WCHAR szwSystemTIPKey[] DECLSPEC_HIDDEN;
|
||||
extern const WCHAR szwSystemCTFKey[] DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -643,7 +643,6 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
|
|||
REFIID riid, IUnknown *punk, DWORD *pdwCookie)
|
||||
{
|
||||
ThreadMgr *This = impl_from_ITfSource(iface);
|
||||
Sink *tms;
|
||||
|
||||
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
|
||||
|
||||
|
@ -651,27 +650,10 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
|
|||
return E_INVALIDARG;
|
||||
|
||||
if (IsEqualIID(riid, &IID_ITfThreadMgrEventSink))
|
||||
{
|
||||
tms = HeapAlloc(GetProcessHeap(),0,sizeof(*tms));
|
||||
if (!tms)
|
||||
return E_OUTOFMEMORY;
|
||||
if (FAILED(IUnknown_QueryInterface(punk, riid, (LPVOID *)&tms->interfaces.pITfThreadMgrEventSink)))
|
||||
{
|
||||
HeapFree(GetProcessHeap(),0,tms);
|
||||
return CONNECT_E_CANNOTCONNECT;
|
||||
}
|
||||
list_add_head(&This->ThreadMgrEventSink,&tms->entry);
|
||||
*pdwCookie = generate_Cookie(COOKIE_MAGIC_TMSINK, tms);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
return advise_sink(&This->ThreadMgrEventSink, &IID_ITfThreadMgrEventSink, COOKIE_MAGIC_TMSINK, punk, pdwCookie);
|
||||
|
||||
TRACE("cookie %x\n",*pdwCookie);
|
||||
|
||||
return S_OK;
|
||||
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
|
||||
|
|
Loading…
Reference in New Issue