Aric Stewart : msctf: Generate TfEditCookies for edit sessions.

Alexandre Julliard julliard at winehq.org
Thu May 21 09:35:51 CDT 2009


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed May 20 14:46:50 2009 -0500

msctf: Generate TfEditCookies for edit sessions.

---

 dlls/msctf/context.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
index 297f611..9733518 100644
--- a/dlls/msctf/context.c
+++ b/dlls/msctf/context.c
@@ -668,6 +668,8 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
 {
     TextStoreACPSink *This = (TextStoreACPSink *)iface;
     HRESULT hr;
+    EditCookie *cookie;
+    TfEditCookie ec;
 
     TRACE("(%p) %x\n",This, dwLockFlags);
 
@@ -677,12 +679,23 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
         return E_FAIL;
     }
 
-    /* TODO:  generate and use an edit cookie */
-    hr = ITfEditSession_DoEditSession(This->pContext->currentEditSession, 0xdeadcafe);
+    cookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie));
+    if (!cookie)
+        return E_OUTOFMEMORY;
+
+    cookie->lockType = dwLockFlags;
+    cookie->pOwningContext = This->pContext;
+    ec = generate_Cookie(COOKIE_MAGIC_EDITCOOKIE, cookie);
+
+    hr = ITfEditSession_DoEditSession(This->pContext->currentEditSession, ec);
 
     ITfEditSession_Release(This->pContext->currentEditSession);
     This->pContext->currentEditSession = NULL;
 
+    /* Edit Cookie is only valid during the edit session */
+    cookie = remove_Cookie(ec);
+    HeapFree(GetProcessHeap(),0,cookie);
+
     return hr;
 }
 




More information about the wine-cvs mailing list