Commit 7c1c94c2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msctf: Added a helper macro for interating sink list.

parent a27da35b
...@@ -75,6 +75,12 @@ typedef struct { ...@@ -75,6 +75,12 @@ typedef struct {
} interfaces; } interfaces;
} Sink; } Sink;
#define SINK_ENTRY(cursor,type) (LIST_ENTRY(cursor,Sink,entry)->interfaces.p##type)
#define SINK_FOR_EACH(cursor,list,type,elem) \
for ((cursor) = (list)->next, elem = SINK_ENTRY(cursor,type); \
(cursor) != (list); \
(cursor) = (cursor)->next, elem = SINK_ENTRY(cursor,type))
HRESULT advise_sink(struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie) DECLSPEC_HIDDEN; HRESULT advise_sink(struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie) DECLSPEC_HIDDEN;
HRESULT unadvise_sink(DWORD cookie) DECLSPEC_HIDDEN; HRESULT unadvise_sink(DWORD cookie) DECLSPEC_HIDDEN;
void free_sinks(struct list *sink_list) DECLSPEC_HIDDEN; void free_sinks(struct list *sink_list) DECLSPEC_HIDDEN;
......
...@@ -1079,15 +1079,15 @@ static ULONG WINAPI ThreadMgrEventSink_Release(ITfThreadMgrEventSink *iface) ...@@ -1079,15 +1079,15 @@ static ULONG WINAPI ThreadMgrEventSink_Release(ITfThreadMgrEventSink *iface)
static HRESULT WINAPI ThreadMgrEventSink_OnInitDocumentMgr( static HRESULT WINAPI ThreadMgrEventSink_OnInitDocumentMgr(
ITfThreadMgrEventSink *iface,ITfDocumentMgr *pdim) ITfThreadMgrEventSink *iface,ITfDocumentMgr *pdim)
{ {
struct list *cursor;
ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface);
ITfThreadMgrEventSink *sink;
struct list *cursor;
TRACE("(%p) %p\n",This,pdim); TRACE("(%p) %p\n",This,pdim);
LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink) SINK_FOR_EACH(cursor, &This->ThreadMgrEventSink, ITfThreadMgrEventSink, sink)
{ {
Sink* sink = LIST_ENTRY(cursor,Sink,entry); ITfThreadMgrEventSink_OnInitDocumentMgr(sink, pdim);
ITfThreadMgrEventSink_OnInitDocumentMgr(sink->interfaces.pITfThreadMgrEventSink,pdim);
} }
return S_OK; return S_OK;
...@@ -1096,15 +1096,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnInitDocumentMgr( ...@@ -1096,15 +1096,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnInitDocumentMgr(
static HRESULT WINAPI ThreadMgrEventSink_OnUninitDocumentMgr( static HRESULT WINAPI ThreadMgrEventSink_OnUninitDocumentMgr(
ITfThreadMgrEventSink *iface, ITfDocumentMgr *pdim) ITfThreadMgrEventSink *iface, ITfDocumentMgr *pdim)
{ {
struct list *cursor;
ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface);
ITfThreadMgrEventSink *sink;
struct list *cursor;
TRACE("(%p) %p\n",This,pdim); TRACE("(%p) %p\n",This,pdim);
LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink) SINK_FOR_EACH(cursor, &This->ThreadMgrEventSink, ITfThreadMgrEventSink, sink)
{ {
Sink* sink = LIST_ENTRY(cursor,Sink,entry); ITfThreadMgrEventSink_OnUninitDocumentMgr(sink, pdim);
ITfThreadMgrEventSink_OnUninitDocumentMgr(sink->interfaces.pITfThreadMgrEventSink,pdim);
} }
return S_OK; return S_OK;
...@@ -1114,15 +1114,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnSetFocus( ...@@ -1114,15 +1114,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnSetFocus(
ITfThreadMgrEventSink *iface, ITfDocumentMgr *pdimFocus, ITfThreadMgrEventSink *iface, ITfDocumentMgr *pdimFocus,
ITfDocumentMgr *pdimPrevFocus) ITfDocumentMgr *pdimPrevFocus)
{ {
struct list *cursor;
ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface);
ITfThreadMgrEventSink *sink;
struct list *cursor;
TRACE("(%p) %p %p\n",This,pdimFocus, pdimPrevFocus); TRACE("(%p) %p %p\n",This,pdimFocus, pdimPrevFocus);
LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink) SINK_FOR_EACH(cursor, &This->ThreadMgrEventSink, ITfThreadMgrEventSink, sink)
{ {
Sink* sink = LIST_ENTRY(cursor,Sink,entry); ITfThreadMgrEventSink_OnSetFocus(sink, pdimFocus, pdimPrevFocus);
ITfThreadMgrEventSink_OnSetFocus(sink->interfaces.pITfThreadMgrEventSink, pdimFocus, pdimPrevFocus);
} }
return S_OK; return S_OK;
...@@ -1131,15 +1131,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnSetFocus( ...@@ -1131,15 +1131,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnSetFocus(
static HRESULT WINAPI ThreadMgrEventSink_OnPushContext( static HRESULT WINAPI ThreadMgrEventSink_OnPushContext(
ITfThreadMgrEventSink *iface, ITfContext *pic) ITfThreadMgrEventSink *iface, ITfContext *pic)
{ {
struct list *cursor;
ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface);
ITfThreadMgrEventSink *sink;
struct list *cursor;
TRACE("(%p) %p\n",This,pic); TRACE("(%p) %p\n",This,pic);
LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink) SINK_FOR_EACH(cursor, &This->ThreadMgrEventSink, ITfThreadMgrEventSink, sink)
{ {
Sink* sink = LIST_ENTRY(cursor,Sink,entry); ITfThreadMgrEventSink_OnPushContext(sink, pic);
ITfThreadMgrEventSink_OnPushContext(sink->interfaces.pITfThreadMgrEventSink,pic);
} }
return S_OK; return S_OK;
...@@ -1148,15 +1148,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnPushContext( ...@@ -1148,15 +1148,15 @@ static HRESULT WINAPI ThreadMgrEventSink_OnPushContext(
static HRESULT WINAPI ThreadMgrEventSink_OnPopContext( static HRESULT WINAPI ThreadMgrEventSink_OnPopContext(
ITfThreadMgrEventSink *iface, ITfContext *pic) ITfThreadMgrEventSink *iface, ITfContext *pic)
{ {
struct list *cursor;
ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface);
ITfThreadMgrEventSink *sink;
struct list *cursor;
TRACE("(%p) %p\n",This,pic); TRACE("(%p) %p\n",This,pic);
LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink) SINK_FOR_EACH(cursor, &This->ThreadMgrEventSink, ITfThreadMgrEventSink, sink)
{ {
Sink* sink = LIST_ENTRY(cursor,Sink,entry); ITfThreadMgrEventSink_OnPopContext(sink, pic);
ITfThreadMgrEventSink_OnPopContext(sink->interfaces.pITfThreadMgrEventSink,pic);
} }
return S_OK; return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment