msctf: Add a partial implementation of ITfThreadMgrEx_ActivateEx().
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bd4cb88e6b
commit
a977484765
|
@ -53,7 +53,7 @@ typedef struct
|
|||
typedef struct {
|
||||
TF_LANGUAGEPROFILE LanguageProfile;
|
||||
ITfTextInputProcessor *pITfTextInputProcessor;
|
||||
ITfThreadMgr *pITfThreadMgr;
|
||||
ITfThreadMgrEx *pITfThreadMgrEx;
|
||||
ITfKeyEventSink *pITfKeyEventSink;
|
||||
TfClientId tid;
|
||||
} ActivatedTextService;
|
||||
|
@ -287,7 +287,7 @@ DWORD enumerate_Cookie(DWORD magic, DWORD *index)
|
|||
/*****************************************************************************
|
||||
* Active Text Service Management
|
||||
*****************************************************************************/
|
||||
static HRESULT activate_given_ts(ActivatedTextService *actsvr, ITfThreadMgr* tm)
|
||||
static HRESULT activate_given_ts(ActivatedTextService *actsvr, ITfThreadMgrEx *tm)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -299,7 +299,7 @@ static HRESULT activate_given_ts(ActivatedTextService *actsvr, ITfThreadMgr* tm)
|
|||
&IID_ITfTextInputProcessor, (void**)&actsvr->pITfTextInputProcessor);
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
hr = ITfTextInputProcessor_Activate(actsvr->pITfTextInputProcessor, tm, actsvr->tid);
|
||||
hr = ITfTextInputProcessor_Activate(actsvr->pITfTextInputProcessor, (ITfThreadMgr *)tm, actsvr->tid);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ITfTextInputProcessor_Release(actsvr->pITfTextInputProcessor);
|
||||
|
@ -307,8 +307,8 @@ static HRESULT activate_given_ts(ActivatedTextService *actsvr, ITfThreadMgr* tm)
|
|||
return hr;
|
||||
}
|
||||
|
||||
actsvr->pITfThreadMgr = tm;
|
||||
ITfThreadMgr_AddRef(tm);
|
||||
actsvr->pITfThreadMgrEx = tm;
|
||||
ITfThreadMgrEx_AddRef(tm);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -320,9 +320,9 @@ static HRESULT deactivate_given_ts(ActivatedTextService *actsvr)
|
|||
{
|
||||
hr = ITfTextInputProcessor_Deactivate(actsvr->pITfTextInputProcessor);
|
||||
ITfTextInputProcessor_Release(actsvr->pITfTextInputProcessor);
|
||||
ITfThreadMgr_Release(actsvr->pITfThreadMgr);
|
||||
ITfThreadMgrEx_Release(actsvr->pITfThreadMgrEx);
|
||||
actsvr->pITfTextInputProcessor = NULL;
|
||||
actsvr->pITfThreadMgr = NULL;
|
||||
actsvr->pITfThreadMgrEx = NULL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
@ -351,7 +351,7 @@ HRESULT add_active_textservice(TF_LANGUAGEPROFILE *lp)
|
|||
ActivatedTextService *actsvr;
|
||||
ITfCategoryMgr *catmgr;
|
||||
AtsEntry *entry;
|
||||
ITfThreadMgr *tm = TlsGetValue(tlsIndex);
|
||||
ITfThreadMgrEx *tm = TlsGetValue(tlsIndex);
|
||||
ITfClientId *clientid;
|
||||
|
||||
if (!tm) return E_UNEXPECTED;
|
||||
|
@ -359,7 +359,7 @@ HRESULT add_active_textservice(TF_LANGUAGEPROFILE *lp)
|
|||
actsvr = HeapAlloc(GetProcessHeap(),0,sizeof(ActivatedTextService));
|
||||
if (!actsvr) return E_OUTOFMEMORY;
|
||||
|
||||
ITfThreadMgr_QueryInterface(tm,&IID_ITfClientId,(LPVOID)&clientid);
|
||||
ITfThreadMgrEx_QueryInterface(tm, &IID_ITfClientId, (void **)&clientid);
|
||||
ITfClientId_GetClientId(clientid, &lp->clsid, &actsvr->tid);
|
||||
ITfClientId_Release(clientid);
|
||||
|
||||
|
@ -426,7 +426,7 @@ BOOL get_active_textservice(REFCLSID rclsid, TF_LANGUAGEPROFILE *profile)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
HRESULT activate_textservices(ITfThreadMgr *tm)
|
||||
HRESULT activate_textservices(ITfThreadMgrEx *tm)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
AtsEntry *ats;
|
||||
|
|
|
@ -58,7 +58,7 @@ extern DWORD enumerate_Cookie(DWORD magic, DWORD *index) DECLSPEC_HIDDEN;
|
|||
/* activated text services functions */
|
||||
extern HRESULT add_active_textservice(TF_LANGUAGEPROFILE *lp) DECLSPEC_HIDDEN;
|
||||
extern BOOL get_active_textservice(REFCLSID rclsid, TF_LANGUAGEPROFILE *lp) DECLSPEC_HIDDEN;
|
||||
extern HRESULT activate_textservices(ITfThreadMgr *tm) DECLSPEC_HIDDEN;
|
||||
extern HRESULT activate_textservices(ITfThreadMgrEx *tm) DECLSPEC_HIDDEN;
|
||||
extern HRESULT deactivate_textservices(void) DECLSPEC_HIDDEN;
|
||||
|
||||
extern CLSID get_textservice_clsid(TfClientId tid) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1409,6 +1409,7 @@ static void test_startSession(void)
|
|||
ITfContext *cxt,*cxt2,*cxt3,*cxtTest;
|
||||
ITextStoreACP *ts;
|
||||
TfClientId cid2 = 0;
|
||||
ITfThreadMgrEx *tmex;
|
||||
|
||||
hr = ITfThreadMgr_Deactivate(g_tm);
|
||||
ok(hr == E_UNEXPECTED,"Deactivate should have failed with E_UNEXPECTED\n");
|
||||
|
@ -1421,10 +1422,21 @@ static void test_startSession(void)
|
|||
test_ShouldActivate = FALSE;
|
||||
hr = ITfThreadMgr_Activate(g_tm,&cid2);
|
||||
ok(SUCCEEDED(hr),"Failed to Activate\n");
|
||||
ok (cid == cid2, "Second activate client ID does not match\n");
|
||||
ok(cid == cid2, "Second activate client ID does not match\n");
|
||||
|
||||
hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfThreadMgrEx, (void **)&tmex);
|
||||
ok(SUCCEEDED(hr), "Unable to acquire ITfThreadMgrEx interface\n");
|
||||
|
||||
hr = ITfThreadMgrEx_ActivateEx(tmex, &cid2, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to Activate\n");
|
||||
ok(cid == cid2, "ActivateEx client ID does not match\n");
|
||||
|
||||
ITfThreadMgrEx_Release(tmex);
|
||||
|
||||
hr = ITfThreadMgr_Deactivate(g_tm);
|
||||
ok(SUCCEEDED(hr),"Failed to Deactivate\n");
|
||||
ok(SUCCEEDED(hr), "Failed to Deactivate\n");
|
||||
hr = ITfThreadMgr_Deactivate(g_tm);
|
||||
ok(SUCCEEDED(hr), "Failed to Deactivate\n");
|
||||
|
||||
test_EnumDocumentMgr(g_tm,NULL,NULL);
|
||||
|
||||
|
|
|
@ -327,29 +327,15 @@ static ULONG WINAPI ThreadMgr_Release(ITfThreadMgrEx *iface)
|
|||
* ITfThreadMgr functions
|
||||
*****************************************************/
|
||||
|
||||
static HRESULT WINAPI ThreadMgr_fnActivate(ITfThreadMgrEx *iface, TfClientId *ptid)
|
||||
static HRESULT WINAPI ThreadMgr_Activate(ITfThreadMgrEx *iface, TfClientId *id)
|
||||
{
|
||||
ThreadMgr *This = impl_from_ITfThreadMgrEx(iface);
|
||||
|
||||
TRACE("(%p) %p\n",This, ptid);
|
||||
|
||||
if (!ptid)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!processId)
|
||||
{
|
||||
GUID guid;
|
||||
CoCreateGuid(&guid);
|
||||
ITfClientId_GetClientId(&This->ITfClientId_iface, &guid, &processId);
|
||||
}
|
||||
|
||||
activate_textservices((ITfThreadMgr *)iface);
|
||||
This->activationCount++;
|
||||
*ptid = processId;
|
||||
return S_OK;
|
||||
TRACE("(%p) %p\n", This, id);
|
||||
return ITfThreadMgrEx_ActivateEx(iface, id, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ThreadMgr_fnDeactivate(ITfThreadMgrEx *iface)
|
||||
static HRESULT WINAPI ThreadMgr_Deactivate(ITfThreadMgrEx *iface)
|
||||
{
|
||||
ThreadMgr *This = impl_from_ITfThreadMgrEx(iface);
|
||||
TRACE("(%p)\n",This);
|
||||
|
@ -597,8 +583,25 @@ static HRESULT WINAPI ThreadMgr_ActivateEx(ITfThreadMgrEx *iface, TfClientId *id
|
|||
{
|
||||
ThreadMgr *This = impl_from_ITfThreadMgrEx(iface);
|
||||
|
||||
FIXME("STUB:(%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p) %p, %#x\n", This, id, flags);
|
||||
|
||||
if (!id)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (flags)
|
||||
FIXME("Unimplemented flags %#x\n", flags);
|
||||
|
||||
if (!processId)
|
||||
{
|
||||
GUID guid;
|
||||
CoCreateGuid(&guid);
|
||||
ITfClientId_GetClientId(&This->ITfClientId_iface, &guid, &processId);
|
||||
}
|
||||
|
||||
activate_textservices(iface);
|
||||
This->activationCount++;
|
||||
*id = processId;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ThreadMgr_GetActiveFlags(ITfThreadMgrEx *iface, DWORD *flags)
|
||||
|
@ -614,8 +617,8 @@ static const ITfThreadMgrExVtbl ThreadMgrExVtbl =
|
|||
ThreadMgr_QueryInterface,
|
||||
ThreadMgr_AddRef,
|
||||
ThreadMgr_Release,
|
||||
ThreadMgr_fnActivate,
|
||||
ThreadMgr_fnDeactivate,
|
||||
ThreadMgr_Activate,
|
||||
ThreadMgr_Deactivate,
|
||||
ThreadMgr_CreateDocumentMgr,
|
||||
ThreadMgr_EnumDocumentMgrs,
|
||||
ThreadMgr_GetFocus,
|
||||
|
|
Loading…
Reference in New Issue