From cbf4671d4825b2ae3d4c4853b8d0aa0afc651820 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Fri, 8 May 2009 08:51:18 -0500 Subject: [PATCH] msctf: Implement ITfKeystrokeMgr::GetForeground. --- dlls/msctf/tests/inputprocessor.c | 2 +- dlls/msctf/threadmgr.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index 5ab645d8fe4..ac993cc4cdc 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -406,7 +406,7 @@ static void test_KeystrokeMgr(void) test_KEV_OnSetFocus = SINK_EXPECTED; hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,tid,sink,TRUE); ok(SUCCEEDED(hr),"ITfKeystrokeMgr_AdviseKeyEventSink failed\n"); - todo_wine ok(test_KEV_OnSetFocus == SINK_FIRED, "KeyEventSink_OnSetFocus not fired as expected\n"); + ok(test_KEV_OnSetFocus == SINK_FIRED, "KeyEventSink_OnSetFocus not fired as expected\n"); hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,tid,sink,TRUE); ok(hr == CONNECT_E_ADVISELIMIT,"Wrong return, expected CONNECT_E_ADVISELIMIT\n"); hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,cid,sink,TRUE); diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c index 5ee08dd2eb4..277923e96e5 100644 --- a/dlls/msctf/threadmgr.c +++ b/dlls/msctf/threadmgr.c @@ -79,6 +79,7 @@ typedef struct tagACLMulti { LONG activationCount; ITfKeyEventSink *forgroundKeyEventSink; + CLSID forgroundTextService; struct list CurrentPreservedKeys; @@ -535,9 +536,14 @@ static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, if (fForeground) { if (This->forgroundKeyEventSink) + { + ITfKeyEventSink_OnSetFocus(This->forgroundKeyEventSink, FALSE); ITfKeyEventSink_Release(This->forgroundKeyEventSink); + } ITfKeyEventSink_AddRef(check); + ITfKeyEventSink_OnSetFocus(check, TRUE); This->forgroundKeyEventSink = check; + This->forgroundTextService = textservice; } return S_OK; } @@ -569,6 +575,7 @@ static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, { ITfKeyEventSink_Release(This->forgroundKeyEventSink); This->forgroundKeyEventSink = NULL; + This->forgroundTextService = GUID_NULL; } return S_OK; } @@ -577,8 +584,15 @@ static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, CLSID *pclsid) { ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + TRACE("(%p) %p\n",This,pclsid); + if (!pclsid) + return E_INVALIDARG; + + if (IsEqualCLSID(&This->forgroundTextService,&GUID_NULL)) + return S_FALSE; + + *pclsid = This->forgroundTextService; + return S_OK; } static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface,