Aric Stewart : msctf: Support advising ITfLanguageProfileNotifySink in ITfInputProcessorProfiles .

Alexandre Julliard julliard at winehq.org
Wed May 13 10:19:45 CDT 2009


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue May 12 12:50:08 2009 -0500

msctf: Support advising ITfLanguageProfileNotifySink in ITfInputProcessorProfiles.

---

 dlls/msctf/inputprocessor.c |   27 ++++++++++++++++++++++++---
 include/msctf.idl           |   14 ++++++++++++++
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c
index f5e5989..8d36cd5 100644
--- a/dlls/msctf/inputprocessor.c
+++ b/dlls/msctf/inputprocessor.c
@@ -52,7 +52,7 @@ typedef struct tagInputProcessorProfilesSink {
     union {
         /* InputProcessorProfile Sinks */
         IUnknown            *pIUnknown;
-        /* ITfLanguageProfileNotifySink *pITfLanguageProfileNotifySink; */
+        ITfLanguageProfileNotifySink *pITfLanguageProfileNotifySink;
     } interfaces;
 } InputProcessorProfilesSink;
 
@@ -599,6 +599,7 @@ static ULONG WINAPI IPPSource_Release(ITfSource *iface)
 static WINAPI HRESULT IPPSource_AdviseSink(ITfSource *iface,
         REFIID riid, IUnknown *punk, DWORD *pdwCookie)
 {
+    InputProcessorProfilesSink *ipps;
     InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
 
     TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
@@ -606,8 +607,28 @@ static WINAPI HRESULT IPPSource_AdviseSink(ITfSource *iface,
     if (!riid || !punk || !pdwCookie)
         return E_INVALIDARG;
 
-    FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
-    return E_NOTIMPL;
+    if (IsEqualIID(riid, &IID_ITfLanguageProfileNotifySink))
+    {
+        ipps = HeapAlloc(GetProcessHeap(),0,sizeof(InputProcessorProfilesSink));
+        if (!ipps)
+            return E_OUTOFMEMORY;
+        if (!SUCCEEDED(IUnknown_QueryInterface(punk, riid, (LPVOID*)&ipps->interfaces.pITfLanguageProfileNotifySink)))
+        {
+            HeapFree(GetProcessHeap(),0,ipps);
+            return CONNECT_E_CANNOTCONNECT;
+        }
+        list_add_head(&This->LanguageProfileNotifySink,&ipps->entry);
+        *pdwCookie = generate_Cookie(COOKIE_MAGIC_IPPSINK, ipps);
+    }
+    else
+    {
+        FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
+        return E_NOTIMPL;
+    }
+
+    TRACE("cookie %x\n",*pdwCookie);
+
+    return S_OK;
 }
 
 static WINAPI HRESULT IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
diff --git a/include/msctf.idl b/include/msctf.idl
index 7e643f4..40853ee 100644
--- a/include/msctf.idl
+++ b/include/msctf.idl
@@ -699,3 +699,17 @@ interface ITfClientId : IUnknown
         [in] REFCLSID rclsid,
         [out] TfClientId *ptid);
 };
+
+[
+  object,
+  uuid(43c9fe15-f494-4c17-9de2-b8a4ac350aa8),
+  pointer_default(unique)
+]
+interface ITfLanguageProfileNotifySink : IUnknown
+{
+    HRESULT OnLanguageChange(
+        [in] LANGID langid,
+        [out] BOOL *pfAccept);
+
+    HRESULT OnLanguageChanged();
+}




More information about the wine-cvs mailing list