Aric Stewart : msctf: Implement ITfKeystrokeMgr::UnadviseKeyEventSink.

Alexandre Julliard julliard at winehq.org
Mon May 11 09:10:48 CDT 2009


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri May  8 08:51:07 2009 -0500

msctf: Implement ITfKeystrokeMgr::UnadviseKeyEventSink.

---

 dlls/msctf/tests/inputprocessor.c |    2 +-
 dlls/msctf/threadmgr.c            |   27 +++++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c
index 4ea2ec9..5ab645d 100644
--- a/dlls/msctf/tests/inputprocessor.c
+++ b/dlls/msctf/tests/inputprocessor.c
@@ -437,7 +437,7 @@ static void test_KeystrokeMgr(void)
     ok(hr==CONNECT_E_NOCONNECTION,"ITfKeystrokeMgr_UnpreserveKey inproperly succeeded\n");
 
     hr = ITfKeystrokeMgr_UnadviseKeyEventSink(keymgr,tid);
-    todo_wine ok(SUCCEEDED(hr),"ITfKeystrokeMgr_UnadviseKeyEventSink failed\n");
+    ok(SUCCEEDED(hr),"ITfKeystrokeMgr_UnadviseKeyEventSink failed\n");
 
     ITfKeystrokeMgr_Release(keymgr);
     ITfKeyEventSink_Release(sink);
diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c
index e8743ec..5ee08dd 100644
--- a/dlls/msctf/threadmgr.c
+++ b/dlls/msctf/threadmgr.c
@@ -546,8 +546,31 @@ static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface,
         TfClientId tid)
 {
     ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface);
-    FIXME("STUB:(%p)\n",This);
-    return E_NOTIMPL;
+    CLSID textservice;
+    ITfKeyEventSink *check = NULL;
+    TRACE("(%p) %x\n",This,tid);
+
+    if (!tid)
+        return E_INVALIDARG;
+
+    textservice = get_textservice_clsid(tid);
+    if (IsEqualCLSID(&GUID_NULL,&textservice))
+        return E_INVALIDARG;
+
+    get_textservice_sink(tid, &IID_ITfKeyEventSink, (IUnknown**)&check);
+
+    if (!check)
+        return CONNECT_E_NOCONNECTION;
+
+    set_textservice_sink(tid, &IID_ITfKeyEventSink, NULL);
+    ITfKeyEventSink_Release(check);
+
+    if (This->forgroundKeyEventSink == check)
+    {
+        ITfKeyEventSink_Release(This->forgroundKeyEventSink);
+        This->forgroundKeyEventSink = NULL;
+    }
+    return S_OK;
 }
 
 static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface,




More information about the wine-cvs mailing list