msctf: Implement ITfKeystrokeMgr::GetForeground.

This commit is contained in:
Aric Stewart 2009-05-08 08:51:18 -05:00 committed by Alexandre Julliard
parent 161fa4bc30
commit cbf4671d48
2 changed files with 17 additions and 3 deletions

View File

@ -406,7 +406,7 @@ static void test_KeystrokeMgr(void)
test_KEV_OnSetFocus = SINK_EXPECTED; test_KEV_OnSetFocus = SINK_EXPECTED;
hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,tid,sink,TRUE); hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,tid,sink,TRUE);
ok(SUCCEEDED(hr),"ITfKeystrokeMgr_AdviseKeyEventSink failed\n"); 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); hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,tid,sink,TRUE);
ok(hr == CONNECT_E_ADVISELIMIT,"Wrong return, expected CONNECT_E_ADVISELIMIT\n"); ok(hr == CONNECT_E_ADVISELIMIT,"Wrong return, expected CONNECT_E_ADVISELIMIT\n");
hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,cid,sink,TRUE); hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,cid,sink,TRUE);

View File

@ -79,6 +79,7 @@ typedef struct tagACLMulti {
LONG activationCount; LONG activationCount;
ITfKeyEventSink *forgroundKeyEventSink; ITfKeyEventSink *forgroundKeyEventSink;
CLSID forgroundTextService;
struct list CurrentPreservedKeys; struct list CurrentPreservedKeys;
@ -535,9 +536,14 @@ static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface,
if (fForeground) if (fForeground)
{ {
if (This->forgroundKeyEventSink) if (This->forgroundKeyEventSink)
{
ITfKeyEventSink_OnSetFocus(This->forgroundKeyEventSink, FALSE);
ITfKeyEventSink_Release(This->forgroundKeyEventSink); ITfKeyEventSink_Release(This->forgroundKeyEventSink);
}
ITfKeyEventSink_AddRef(check); ITfKeyEventSink_AddRef(check);
ITfKeyEventSink_OnSetFocus(check, TRUE);
This->forgroundKeyEventSink = check; This->forgroundKeyEventSink = check;
This->forgroundTextService = textservice;
} }
return S_OK; return S_OK;
} }
@ -569,6 +575,7 @@ static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface,
{ {
ITfKeyEventSink_Release(This->forgroundKeyEventSink); ITfKeyEventSink_Release(This->forgroundKeyEventSink);
This->forgroundKeyEventSink = NULL; This->forgroundKeyEventSink = NULL;
This->forgroundTextService = GUID_NULL;
} }
return S_OK; return S_OK;
} }
@ -577,8 +584,15 @@ static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface,
CLSID *pclsid) CLSID *pclsid)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface);
FIXME("STUB:(%p)\n",This); TRACE("(%p) %p\n",This,pclsid);
return E_NOTIMPL; 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, static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface,