From f3e2027b43fd5c28534036d11b9f7b2dc746a2b6 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Mon, 2 Feb 2009 10:25:16 -0600 Subject: [PATCH] msctf: Implement ITfDocumentMgr::Pop. --- dlls/msctf/documentmgr.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c index eb6e4d2e82e..040db7bae0d 100644 --- a/dlls/msctf/documentmgr.c +++ b/dlls/msctf/documentmgr.c @@ -129,8 +129,29 @@ static HRESULT WINAPI DocumentMgr_Push(ITfDocumentMgr *iface, ITfContext *pic) static HRESULT WINAPI DocumentMgr_Pop(ITfDocumentMgr *iface, DWORD dwFlags) { DocumentMgr *This = (DocumentMgr *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + TRACE("(%p) 0x%x\n",This,dwFlags); + + if (dwFlags == TF_POPF_ALL) + { + if (This->contextStack[0]) + ITfContext_Release(This->contextStack[0]); + if (This->contextStack[1]) + ITfContext_Release(This->contextStack[1]); + This->contextStack[0] = This->contextStack[1] = NULL; + return S_OK; + } + + if (dwFlags) + return E_INVALIDARG; + + if (This->contextStack[0] == NULL) /* Cannot pop last context */ + return E_FAIL; + + ITfContext_Release(This->contextStack[0]); + This->contextStack[0] = This->contextStack[1]; + This->contextStack[1] = NULL; + + return S_OK; } static HRESULT WINAPI DocumentMgr_GetTop(ITfDocumentMgr *iface, ITfContext **ppic)