Aric Stewart : msctf: Implement SetFocus and GetFocus.

Alexandre Julliard julliard at winehq.org
Tue Feb 3 09:13:19 CST 2009


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Feb  2 10:24:41 2009 -0600

msctf: Implement SetFocus and GetFocus.

---

 dlls/msctf/threadmgr.c |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c
index 7589052..b16f7ec 100644
--- a/dlls/msctf/threadmgr.c
+++ b/dlls/msctf/threadmgr.c
@@ -43,11 +43,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(msctf);
 typedef struct tagACLMulti {
     const ITfThreadMgrVtbl *ThreadMgrVtbl;
     LONG refCount;
+
+    ITfDocumentMgr *focus;
 } ThreadMgr;
 
 static void ThreadMgr_Destructor(ThreadMgr *This)
 {
     TRACE("destroying %p\n", This);
+    if (This->focus)
+        ITfDocumentMgr_Release(This->focus);
     HeapFree(GetProcessHeap(),0,This);
 }
 
@@ -125,15 +129,38 @@ static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr
 **ppdimFocus)
 {
     ThreadMgr *This = (ThreadMgr *)iface;
-    FIXME("STUB:(%p)\n",This);
-    return E_NOTIMPL;
+    TRACE("(%p)\n",This);
+
+    if (!ppdimFocus)
+        return E_INVALIDARG;
+
+    *ppdimFocus = This->focus;
+
+    TRACE("->%p\n",This->focus);
+
+    if (This->focus == NULL)
+        return S_FALSE;
+
+    ITfDocumentMgr_AddRef(This->focus);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus)
 {
+    ITfDocumentMgr *check;
     ThreadMgr *This = (ThreadMgr *)iface;
-    FIXME("STUB:(%p)\n",This);
-    return E_NOTIMPL;
+
+    TRACE("(%p) %p\n",This,pdimFocus);
+
+    if (!pdimFocus || FAILED(IUnknown_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check)))
+        return E_INVALIDARG;
+
+    if (This->focus)
+        ITfDocumentMgr_Release(This->focus);
+
+    This->focus = check;
+    return S_OK;
 }
 
 static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd,




More information about the wine-cvs mailing list