msctf: Implement ITfKeystrokeMgr::PreserveKey.
This commit is contained in:
parent
8d9434eefe
commit
45c3ff2ff8
|
@ -409,7 +409,7 @@ static void test_KeystrokeMgr(void)
|
||||||
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_PreserveKey(keymgr, 0, &CLSID_PreservedKey, &tfpk, NULL, 0);
|
hr =ITfKeystrokeMgr_PreserveKey(keymgr, 0, &CLSID_PreservedKey, &tfpk, NULL, 0);
|
||||||
todo_wine ok(hr==E_INVALIDARG,"ITfKeystrokeMgr_PreserveKey inproperly succeeded\n");
|
ok(hr==E_INVALIDARG,"ITfKeystrokeMgr_PreserveKey inproperly succeeded\n");
|
||||||
|
|
||||||
hr =ITfKeystrokeMgr_PreserveKey(keymgr, tid, &CLSID_PreservedKey, &tfpk, NULL, 0);
|
hr =ITfKeystrokeMgr_PreserveKey(keymgr, tid, &CLSID_PreservedKey, &tfpk, NULL, 0);
|
||||||
todo_wine ok(SUCCEEDED(hr),"ITfKeystrokeMgr_PreserveKey failed\n");
|
todo_wine ok(SUCCEEDED(hr),"ITfKeystrokeMgr_PreserveKey failed\n");
|
||||||
|
|
|
@ -56,6 +56,15 @@ typedef struct tagThreadMgrSink {
|
||||||
} interfaces;
|
} interfaces;
|
||||||
} ThreadMgrSink;
|
} ThreadMgrSink;
|
||||||
|
|
||||||
|
typedef struct tagPreservedKey
|
||||||
|
{
|
||||||
|
struct list entry;
|
||||||
|
GUID guid;
|
||||||
|
TF_PRESERVEDKEY prekey;
|
||||||
|
LPWSTR description;
|
||||||
|
TfClientId tid;
|
||||||
|
} PreservedKey;
|
||||||
|
|
||||||
typedef struct tagACLMulti {
|
typedef struct tagACLMulti {
|
||||||
const ITfThreadMgrVtbl *ThreadMgrVtbl;
|
const ITfThreadMgrVtbl *ThreadMgrVtbl;
|
||||||
const ITfSourceVtbl *SourceVtbl;
|
const ITfSourceVtbl *SourceVtbl;
|
||||||
|
@ -68,6 +77,8 @@ typedef struct tagACLMulti {
|
||||||
|
|
||||||
ITfDocumentMgr *focus;
|
ITfDocumentMgr *focus;
|
||||||
|
|
||||||
|
struct list CurrentPreservedKeys;
|
||||||
|
|
||||||
/* kept as separate lists to reduce unnecessary iterations */
|
/* kept as separate lists to reduce unnecessary iterations */
|
||||||
struct list ActiveLanguageProfileNotifySink;
|
struct list ActiveLanguageProfileNotifySink;
|
||||||
struct list DisplayAttributeNotifySink;
|
struct list DisplayAttributeNotifySink;
|
||||||
|
@ -155,6 +166,14 @@ static void ThreadMgr_Destructor(ThreadMgr *This)
|
||||||
free_sink(sink);
|
free_sink(sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->CurrentPreservedKeys)
|
||||||
|
{
|
||||||
|
PreservedKey* key = LIST_ENTRY(cursor,PreservedKey,entry);
|
||||||
|
list_remove(cursor);
|
||||||
|
HeapFree(GetProcessHeap(),0,key->description);
|
||||||
|
HeapFree(GetProcessHeap(),0,key);
|
||||||
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
HeapFree(GetProcessHeap(),0,This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,8 +556,42 @@ static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface,
|
||||||
const WCHAR *pchDesc, ULONG cchDesc)
|
const WCHAR *pchDesc, ULONG cchDesc)
|
||||||
{
|
{
|
||||||
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface);
|
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface);
|
||||||
FIXME("STUB:(%p)\n",This);
|
struct list *cursor;
|
||||||
return E_NOTIMPL;
|
PreservedKey *newkey;
|
||||||
|
|
||||||
|
TRACE("(%p) %x %s (%x,%x) %s\n",This,tid, debugstr_guid(rguid),(prekey)?prekey->uVKey:0,(prekey)?prekey->uModifiers:0,debugstr_wn(pchDesc,cchDesc));
|
||||||
|
|
||||||
|
if (!tid || ! rguid || !prekey || (cchDesc && !pchDesc))
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
LIST_FOR_EACH(cursor, &This->CurrentPreservedKeys)
|
||||||
|
{
|
||||||
|
PreservedKey* key = LIST_ENTRY(cursor,PreservedKey,entry);
|
||||||
|
if (IsEqualGUID(rguid,&key->guid) && prekey->uVKey == key->prekey.uVKey && prekey->uModifiers == key->prekey.uModifiers)
|
||||||
|
return TF_E_ALREADY_EXISTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
newkey = HeapAlloc(GetProcessHeap(),0,sizeof(PreservedKey));
|
||||||
|
if (!newkey)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
newkey->guid = *rguid;
|
||||||
|
newkey->prekey = *prekey;
|
||||||
|
newkey->tid = tid;
|
||||||
|
if (cchDesc)
|
||||||
|
{
|
||||||
|
newkey->description = HeapAlloc(GetProcessHeap(),0,cchDesc * sizeof(WCHAR));
|
||||||
|
if (!newkey->description)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),0,newkey);
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
memcpy(newkey->description, pchDesc, cchDesc*sizeof(WCHAR));
|
||||||
|
}
|
||||||
|
|
||||||
|
list_add_head(&This->CurrentPreservedKeys,&newkey->entry);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface,
|
static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface,
|
||||||
|
@ -866,6 +919,8 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
|
||||||
This->refCount = 1;
|
This->refCount = 1;
|
||||||
TlsSetValue(tlsIndex,This);
|
TlsSetValue(tlsIndex,This);
|
||||||
|
|
||||||
|
list_init(&This->CurrentPreservedKeys);
|
||||||
|
|
||||||
list_init(&This->ActiveLanguageProfileNotifySink);
|
list_init(&This->ActiveLanguageProfileNotifySink);
|
||||||
list_init(&This->DisplayAttributeNotifySink);
|
list_init(&This->DisplayAttributeNotifySink);
|
||||||
list_init(&This->KeyTraceEventSink);
|
list_init(&This->KeyTraceEventSink);
|
||||||
|
|
Loading…
Reference in New Issue