msctf: Implement ITfKeystrokeMgr::AdviseKeyEventSink.
This commit is contained in:
parent
601030cfa9
commit
f20c4d69c9
|
@ -55,6 +55,7 @@ typedef struct {
|
||||||
TF_LANGUAGEPROFILE LanguageProfile;
|
TF_LANGUAGEPROFILE LanguageProfile;
|
||||||
ITfTextInputProcessor *pITfTextInputProcessor;
|
ITfTextInputProcessor *pITfTextInputProcessor;
|
||||||
ITfThreadMgr *pITfThreadMgr;
|
ITfThreadMgr *pITfThreadMgr;
|
||||||
|
ITfKeyEventSink *pITfKeyEventSink;
|
||||||
TfClientId tid;
|
TfClientId tid;
|
||||||
} ActivatedTextService;
|
} ActivatedTextService;
|
||||||
|
|
||||||
|
@ -378,6 +379,7 @@ HRESULT add_active_textservice(TF_LANGUAGEPROFILE *lp)
|
||||||
actsvr->pITfTextInputProcessor = NULL;
|
actsvr->pITfTextInputProcessor = NULL;
|
||||||
actsvr->LanguageProfile = *lp;
|
actsvr->LanguageProfile = *lp;
|
||||||
actsvr->LanguageProfile.fActive = TRUE;
|
actsvr->LanguageProfile.fActive = TRUE;
|
||||||
|
actsvr->pITfKeyEventSink = NULL;
|
||||||
|
|
||||||
/* get TIP category */
|
/* get TIP category */
|
||||||
if (SUCCEEDED(CategoryMgr_Constructor(NULL,(IUnknown**)&catmgr)))
|
if (SUCCEEDED(CategoryMgr_Constructor(NULL,(IUnknown**)&catmgr)))
|
||||||
|
@ -456,6 +458,50 @@ HRESULT deactivate_textservices(void)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLSID get_textservice_clsid(TfClientId tid)
|
||||||
|
{
|
||||||
|
AtsEntry *ats;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry)
|
||||||
|
if (ats->ats->tid == tid)
|
||||||
|
return ats->ats->LanguageProfile.clsid;
|
||||||
|
return GUID_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT get_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown **sink)
|
||||||
|
{
|
||||||
|
AtsEntry *ats;
|
||||||
|
|
||||||
|
if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink))
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry)
|
||||||
|
if (ats->ats->tid == tid)
|
||||||
|
{
|
||||||
|
*sink = (IUnknown*)ats->ats->pITfKeyEventSink;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT set_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown* sink)
|
||||||
|
{
|
||||||
|
AtsEntry *ats;
|
||||||
|
|
||||||
|
if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink))
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry)
|
||||||
|
if (ats->ats->tid == tid)
|
||||||
|
{
|
||||||
|
ats->ats->pITfKeyEventSink = (ITfKeyEventSink*)sink;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* MSCTF DllMain
|
* MSCTF DllMain
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,5 +47,9 @@ extern BOOL get_active_textservice(REFCLSID rclsid, TF_LANGUAGEPROFILE *lp);
|
||||||
extern HRESULT activate_textservices(ITfThreadMgr *tm);
|
extern HRESULT activate_textservices(ITfThreadMgr *tm);
|
||||||
extern HRESULT deactivate_textservices(void);
|
extern HRESULT deactivate_textservices(void);
|
||||||
|
|
||||||
|
extern CLSID get_textservice_clsid(TfClientId tid);
|
||||||
|
extern HRESULT get_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown** sink);
|
||||||
|
extern HRESULT set_textservice_sink(TfClientId tid, REFCLSID iid, IUnknown* sink);
|
||||||
|
|
||||||
extern const WCHAR szwSystemTIPKey[];
|
extern const WCHAR szwSystemTIPKey[];
|
||||||
#endif /* __WINE_MSCTF_I_H */
|
#endif /* __WINE_MSCTF_I_H */
|
||||||
|
|
|
@ -405,8 +405,12 @@ 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);
|
||||||
todo_wine 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");
|
todo_wine 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);
|
||||||
|
ok(hr == E_INVALIDARG,"Wrong return, expected E_INVALIDARG\n");
|
||||||
|
|
||||||
hr =ITfKeystrokeMgr_PreserveKey(keymgr, 0, &CLSID_PreservedKey, &tfpk, NULL, 0);
|
hr =ITfKeystrokeMgr_PreserveKey(keymgr, 0, &CLSID_PreservedKey, &tfpk, NULL, 0);
|
||||||
ok(hr==E_INVALIDARG,"ITfKeystrokeMgr_PreserveKey inproperly succeeded\n");
|
ok(hr==E_INVALIDARG,"ITfKeystrokeMgr_PreserveKey inproperly succeeded\n");
|
||||||
|
|
|
@ -78,6 +78,8 @@ typedef struct tagACLMulti {
|
||||||
ITfDocumentMgr *focus;
|
ITfDocumentMgr *focus;
|
||||||
LONG activationCount;
|
LONG activationCount;
|
||||||
|
|
||||||
|
ITfKeyEventSink *forgroundKeyEventSink;
|
||||||
|
|
||||||
struct list CurrentPreservedKeys;
|
struct list CurrentPreservedKeys;
|
||||||
|
|
||||||
/* kept as separate lists to reduce unnecessary iterations */
|
/* kept as separate lists to reduce unnecessary iterations */
|
||||||
|
@ -509,8 +511,35 @@ static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface,
|
||||||
TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground)
|
TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground)
|
||||||
{
|
{
|
||||||
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface);
|
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface);
|
||||||
FIXME("STUB:(%p)\n",This);
|
CLSID textservice;
|
||||||
return E_NOTIMPL;
|
ITfKeyEventSink *check = NULL;
|
||||||
|
|
||||||
|
TRACE("(%p) %x %p %i\n",This,tid,pSink,fForeground);
|
||||||
|
|
||||||
|
if (!tid || !pSink)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
textservice = get_textservice_clsid(tid);
|
||||||
|
if (IsEqualCLSID(&GUID_NULL,&textservice))
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
get_textservice_sink(tid, &IID_ITfKeyEventSink, (IUnknown**)&check);
|
||||||
|
if (check != NULL)
|
||||||
|
return CONNECT_E_ADVISELIMIT;
|
||||||
|
|
||||||
|
if (FAILED(IUnknown_QueryInterface(pSink,&IID_ITfKeyEventSink,(LPVOID*) &check)))
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
set_textservice_sink(tid, &IID_ITfKeyEventSink, (IUnknown*)check);
|
||||||
|
|
||||||
|
if (fForeground)
|
||||||
|
{
|
||||||
|
if (This->forgroundKeyEventSink)
|
||||||
|
ITfKeyEventSink_Release(This->forgroundKeyEventSink);
|
||||||
|
ITfKeyEventSink_AddRef(check);
|
||||||
|
This->forgroundKeyEventSink = check;
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface,
|
static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface,
|
||||||
|
|
Loading…
Reference in New Issue