Jacek Caban : msctf: Use generic sink type for thread manager sinks.

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 5 10:29:33 CDT 2016


Module: wine
Branch: master
Commit: 0b912fecf6e9b6fcf022d0533952ce42d9841add
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0b912fecf6e9b6fcf022d0533952ce42d9841add

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed May  4 19:40:29 2016 +0200

msctf: Use generic sink type for thread manager sinks.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msctf/compartmentmgr.c |  1 -
 dlls/msctf/context.c        |  1 -
 dlls/msctf/inputprocessor.c |  1 -
 dlls/msctf/msctf.c          |  1 -
 dlls/msctf/msctf_internal.h | 10 ++++++++++
 dlls/msctf/threadmgr.c      | 45 +++++++++++++++------------------------------
 6 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/dlls/msctf/compartmentmgr.c b/dlls/msctf/compartmentmgr.c
index 8182679..c39f194 100644
--- a/dlls/msctf/compartmentmgr.c
+++ b/dlls/msctf/compartmentmgr.c
@@ -36,7 +36,6 @@
 #include "olectl.h"
 
 #include "wine/unicode.h"
-#include "wine/list.h"
 
 #include "msctf.h"
 #include "msctf_internal.h"
diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
index 5a45466..fd23c2a 100644
--- a/dlls/msctf/context.c
+++ b/dlls/msctf/context.c
@@ -35,7 +35,6 @@
 #include "olectl.h"
 
 #include "wine/unicode.h"
-#include "wine/list.h"
 
 #include "msctf.h"
 #include "msctf_internal.h"
diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c
index 01af325..08e51fd 100644
--- a/dlls/msctf/inputprocessor.c
+++ b/dlls/msctf/inputprocessor.c
@@ -35,7 +35,6 @@
 #include "olectl.h"
 
 #include "wine/unicode.h"
-#include "wine/list.h"
 
 #include "msctf.h"
 #include "msctf_internal.h"
diff --git a/dlls/msctf/msctf.c b/dlls/msctf/msctf.c
index a5cfc35..83eaab9 100644
--- a/dlls/msctf/msctf.c
+++ b/dlls/msctf/msctf.c
@@ -26,7 +26,6 @@
 #define COBJMACROS
 
 #include "wine/debug.h"
-#include "wine/list.h"
 #include "windef.h"
 #include "winbase.h"
 #include "winreg.h"
diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h
index 06244ea..8923c60 100644
--- a/dlls/msctf/msctf_internal.h
+++ b/dlls/msctf/msctf_internal.h
@@ -21,6 +21,8 @@
 #ifndef __WINE_MSCTF_I_H
 #define __WINE_MSCTF_I_H
 
+#include "wine/list.h"
+
 #define COOKIE_MAGIC_TMSINK  0x0010
 #define COOKIE_MAGIC_CONTEXTSINK 0x0020
 #define COOKIE_MAGIC_GUIDATOM 0x0030
@@ -65,6 +67,14 @@ extern CLSID get_textservice_clsid(TfClientId tid) DECLSPEC_HIDDEN;
 extern HRESULT get_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown** sink) DECLSPEC_HIDDEN;
 extern HRESULT set_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown* sink) DECLSPEC_HIDDEN;
 
+typedef struct {
+    struct list entry;
+    union {
+        IUnknown *pIUnknown;
+        ITfThreadMgrEventSink *pITfThreadMgrEventSink;
+    } interfaces;
+} Sink;
+
 extern const WCHAR szwSystemTIPKey[] DECLSPEC_HIDDEN;
 extern const WCHAR szwSystemCTFKey[] DECLSPEC_HIDDEN;
 
diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c
index ac47545..44e8c87 100644
--- a/dlls/msctf/threadmgr.c
+++ b/dlls/msctf/threadmgr.c
@@ -35,27 +35,12 @@
 #include "olectl.h"
 
 #include "wine/unicode.h"
-#include "wine/list.h"
 
 #include "msctf.h"
 #include "msctf_internal.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
 
-typedef struct tagThreadMgrSink {
-    struct list         entry;
-    union {
-        /* ThreadMgr Sinks */
-        IUnknown            *pIUnknown;
-        /* ITfActiveLanguageProfileNotifySink *pITfActiveLanguageProfileNotifySink; */
-        /* ITfDisplayAttributeNotifySink *pITfDisplayAttributeNotifySink; */
-        /* ITfKeyTraceEventSink *pITfKeyTraceEventSink; */
-        /* ITfPreservedKeyNotifySink *pITfPreservedKeyNotifySink; */
-        /* ITfThreadFocusSink *pITfThreadFocusSink; */
-        ITfThreadMgrEventSink *pITfThreadMgrEventSink;
-    } interfaces;
-} ThreadMgrSink;
-
 typedef struct tagPreservedKey
 {
     struct list     entry;
@@ -172,7 +157,7 @@ static inline EnumTfDocumentMgr *impl_from_IEnumTfDocumentMgrs(IEnumTfDocumentMg
     return CONTAINING_RECORD(iface, EnumTfDocumentMgr, IEnumTfDocumentMgrs_iface);
 }
 
-static void free_sink(ThreadMgrSink *sink)
+static void free_sink(Sink *sink)
 {
         IUnknown_Release(sink->interfaces.pIUnknown);
         HeapFree(GetProcessHeap(),0,sink);
@@ -194,37 +179,37 @@ static void ThreadMgr_Destructor(ThreadMgr *This)
     /* free sinks */
     LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ActiveLanguageProfileNotifySink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         list_remove(cursor);
         free_sink(sink);
     }
     LIST_FOR_EACH_SAFE(cursor, cursor2, &This->DisplayAttributeNotifySink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         list_remove(cursor);
         free_sink(sink);
     }
     LIST_FOR_EACH_SAFE(cursor, cursor2, &This->KeyTraceEventSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         list_remove(cursor);
         free_sink(sink);
     }
     LIST_FOR_EACH_SAFE(cursor, cursor2, &This->PreservedKeyNotifySink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         list_remove(cursor);
         free_sink(sink);
     }
     LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadFocusSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         list_remove(cursor);
         free_sink(sink);
     }
     LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadMgrEventSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         list_remove(cursor);
         free_sink(sink);
     }
@@ -658,7 +643,7 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
         REFIID riid, IUnknown *punk, DWORD *pdwCookie)
 {
     ThreadMgr *This = impl_from_ITfSource(iface);
-    ThreadMgrSink *tms;
+    Sink *tms;
 
     TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
 
@@ -667,7 +652,7 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
 
     if (IsEqualIID(riid, &IID_ITfThreadMgrEventSink))
     {
-        tms = HeapAlloc(GetProcessHeap(),0,sizeof(ThreadMgrSink));
+        tms = HeapAlloc(GetProcessHeap(),0,sizeof(*tms));
         if (!tms)
             return E_OUTOFMEMORY;
         if (FAILED(IUnknown_QueryInterface(punk, riid, (LPVOID *)&tms->interfaces.pITfThreadMgrEventSink)))
@@ -692,7 +677,7 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
 static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
 {
     ThreadMgr *This = impl_from_ITfSource(iface);
-    ThreadMgrSink *sink;
+    Sink *sink;
 
     TRACE("(%p) %x\n",This,pdwCookie);
 
@@ -1164,7 +1149,7 @@ static HRESULT WINAPI ThreadMgrEventSink_OnInitDocumentMgr(
 
     LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         ITfThreadMgrEventSink_OnInitDocumentMgr(sink->interfaces.pITfThreadMgrEventSink,pdim);
     }
 
@@ -1181,7 +1166,7 @@ static HRESULT WINAPI ThreadMgrEventSink_OnUninitDocumentMgr(
 
     LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         ITfThreadMgrEventSink_OnUninitDocumentMgr(sink->interfaces.pITfThreadMgrEventSink,pdim);
     }
 
@@ -1199,7 +1184,7 @@ static HRESULT WINAPI ThreadMgrEventSink_OnSetFocus(
 
     LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         ITfThreadMgrEventSink_OnSetFocus(sink->interfaces.pITfThreadMgrEventSink, pdimFocus, pdimPrevFocus);
     }
 
@@ -1216,7 +1201,7 @@ static HRESULT WINAPI ThreadMgrEventSink_OnPushContext(
 
     LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         ITfThreadMgrEventSink_OnPushContext(sink->interfaces.pITfThreadMgrEventSink,pic);
     }
 
@@ -1233,7 +1218,7 @@ static HRESULT WINAPI ThreadMgrEventSink_OnPopContext(
 
     LIST_FOR_EACH(cursor, &This->ThreadMgrEventSink)
     {
-        ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry);
+        Sink* sink = LIST_ENTRY(cursor,Sink,entry);
         ITfThreadMgrEventSink_OnPopContext(sink->interfaces.pITfThreadMgrEventSink,pic);
     }
 




More information about the wine-cvs mailing list