Aric Stewart : msctf: When a Context is created connect to the ITextStoreACP if provided and create and advise our ITextStoreACPSink .

Alexandre Julliard julliard at winehq.org
Fri Feb 6 09:55:56 CST 2009


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Feb  5 14:17:41 2009 -0600

msctf: When a Context is created connect to the ITextStoreACP if provided and create and advise our ITextStoreACPSink.

---

 dlls/msctf/context.c |   28 ++++++++++++++++++++++++++--
 include/textstor.idl |    9 +++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
index 17396ef..37c651c 100644
--- a/dlls/msctf/context.c
+++ b/dlls/msctf/context.c
@@ -61,7 +61,11 @@ typedef struct tagContext {
     LONG refCount;
 
     TfClientId tidOwner;
-    IUnknown *punk;  /* possible ITextStoreACP or ITfContextOwnerCompositionSink */
+
+    ITextStoreACP   *pITextStoreACP;
+    /* ITfContextOwnerCompositionSink */
+
+    ITextStoreACPSink *pITextStoreACPSink;
 
     /* kept as seperate lists to reduce unnesseccary iterations */
     struct list     pContextKeyEventSink;
@@ -99,6 +103,15 @@ static void Context_Destructor(Context *This)
     struct list *cursor, *cursor2;
     TRACE("destroying %p\n", This);
 
+    if (This->pITextStoreACPSink)
+    {
+        ITextStoreACP_UnadviseSink(This->pITextStoreACP, (IUnknown*)This->pITextStoreACPSink);
+        ITextStoreACPSink_Release(This->pITextStoreACPSink);
+    }
+
+    if (This->pITextStoreACP)
+        ITextStoreACPSink_Release(This->pITextStoreACP);
+
     LIST_FOR_EACH_SAFE(cursor, cursor2, &This->pContextKeyEventSink)
     {
         ContextSink* sink = LIST_ENTRY(cursor,ContextSink,entry);
@@ -408,11 +421,22 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **pp
     if (This == NULL)
         return E_OUTOFMEMORY;
 
+    TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore);
+
     This->ContextVtbl= &Context_ContextVtbl;
     This->SourceVtbl = &Context_SourceVtbl;
     This->refCount = 1;
     This->tidOwner = tidOwner;
-    This->punk = punk;
+
+    if (punk && SUCCEEDED(IUnknown_QueryInterface(punk, &IID_ITextStoreACP,
+                          (LPVOID*)&This->pITextStoreACP)))
+    {
+        if (SUCCEEDED(TextStoreACPSink_Constructor(&This->pITextStoreACPSink, This)))
+            ITextStoreACP_AdviseSink(This->pITextStoreACP, &IID_ITextStoreACPSink,
+                                    (IUnknown*)This->pITextStoreACPSink, TS_AS_ALL_SINKS);
+    }
+    else if (punk)
+        FIXME("Unhandled pUnk\n");
 
     TRACE("returning %p\n", This);
     *ppOut = (ITfContext*)This;
diff --git a/include/textstor.idl b/include/textstor.idl
index 0d75d17..08ee21d 100644
--- a/include/textstor.idl
+++ b/include/textstor.idl
@@ -30,6 +30,15 @@ const DWORD TS_SS_REGIONS      = 0x002;
 const DWORD TS_SS_TRANSITORY   = 0x004;
 const DWORD TS_SS_NOHIDDENTEXT = 0x008;
 
+const DWORD TS_AS_TEXT_CHANGE      = 0x01;
+const DWORD TS_AS_SEL_CHANGE       = 0x02;
+const DWORD TS_AS_LAYOUT_CHANGE    = 0x04;
+const DWORD TS_AS_ATTR_CHANGE      = 0x08;
+const DWORD TS_AS_STATUS_CHANGE    = 0x10;
+
+const DWORD TS_AS_ALL_SINKS = (TS_AS_TEXT_CHANGE | TS_AS_SEL_CHANGE | TS_AS_LAYOUT_CHANGE | TS_AS_ATTR_CHANGE | TS_AS_STATUS_CHANGE);
+
+
 typedef [uuid(05fcf85b-5e9c-4c3e-ab71-29471d4f38e7)]  enum { TS_AE_NONE, TS_AE_START, TS_AE_END } TsActiveSelEnd;
 typedef [uuid(033b0df0-f193-4170-b47b-141afc247878)]  enum { TS_RT_PLAIN, TS_RT_HIDDEN, TS_RT_OPAQUE } TsRunType;
 typedef [uuid(ef3457d9-8446-49a7-a9e6-b50d9d5f3fd9)]  GUID TS_ATTRID;




More information about the wine-cvs mailing list