msctf: Added semi-stub support for ITfKeyTraceEventSink event sink.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Aric Stewart <aric@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2bb69639e6
commit
c082108e24
|
@ -31,6 +31,7 @@
|
|||
#define COOKIE_MAGIC_COMPARTMENTSINK 0x0060
|
||||
#define COOKIE_MAGIC_DMSINK 0x0070
|
||||
#define COOKIE_MAGIC_THREADFOCUSSINK 0x0080
|
||||
#define COOKIE_MAGIC_KEYTRACESINK 0x0090
|
||||
|
||||
extern DWORD tlsIndex DECLSPEC_HIDDEN;
|
||||
extern TfClientId processId DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -64,6 +64,7 @@ static DWORD tmSinkCookie;
|
|||
static DWORD tmSinkRefCount;
|
||||
static DWORD dmSinkCookie;
|
||||
static DWORD documentStatus;
|
||||
static DWORD key_trace_sink_cookie;
|
||||
static ITfDocumentMgr *test_CurrentFocus = NULL;
|
||||
static ITfDocumentMgr *test_PrevFocus = NULL;
|
||||
static ITfDocumentMgr *test_LastCurrentFocus = FOCUS_SAVE;
|
||||
|
@ -625,6 +626,51 @@ static HRESULT ThreadMgrEventSink_Constructor(IUnknown **ppOut)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TfKeyTraceEventSink_QueryInterface(ITfKeyTraceEventSink *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITfKeyTraceEventSink, riid)) {
|
||||
*ppv = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI TfKeyTraceEventSink_AddRef(ITfKeyTraceEventSink *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI TfKeyTraceEventSink_Release(ITfKeyTraceEventSink *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TfKeyTraceEventSink_OnKeyTraceDown(ITfKeyTraceEventSink *iface,
|
||||
WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TfKeyTraceEventSink_OnKeyTraceUp(ITfKeyTraceEventSink *iface,
|
||||
WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const ITfKeyTraceEventSinkVtbl TfKeyTraceEventSinkVtbl = {
|
||||
TfKeyTraceEventSink_QueryInterface,
|
||||
TfKeyTraceEventSink_AddRef,
|
||||
TfKeyTraceEventSink_Release,
|
||||
TfKeyTraceEventSink_OnKeyTraceDown,
|
||||
TfKeyTraceEventSink_OnKeyTraceUp
|
||||
};
|
||||
|
||||
static ITfKeyTraceEventSink TfKeyTraceEventSink = { &TfKeyTraceEventSinkVtbl };
|
||||
|
||||
static HRESULT WINAPI TfTransitoryExtensionSink_QueryInterface(ITfTransitoryExtensionSink *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITfTransitoryExtensionSink, riid)) {
|
||||
|
@ -1070,13 +1116,18 @@ static void test_ThreadMgrAdviseSinks(void)
|
|||
tmSinkRefCount = 1;
|
||||
tmSinkCookie = 0;
|
||||
hr = ITfSource_AdviseSink(source,&IID_ITfThreadMgrEventSink, sink, &tmSinkCookie);
|
||||
ok(SUCCEEDED(hr),"Failed to Advise Sink\n");
|
||||
ok(hr == S_OK, "Failed to Advise Sink\n");
|
||||
ok(tmSinkCookie!=0,"Failed to get sink cookie\n");
|
||||
|
||||
/* Advising the sink adds a ref, Releasing here lets the object be deleted
|
||||
when unadvised */
|
||||
tmSinkRefCount = 2;
|
||||
IUnknown_Release(sink);
|
||||
|
||||
hr = ITfSource_AdviseSink(source, &IID_ITfKeyTraceEventSink, (IUnknown*)&TfKeyTraceEventSink,
|
||||
&key_trace_sink_cookie);
|
||||
ok(hr == S_OK, "Failed to Advise Sink\n");
|
||||
|
||||
ITfSource_Release(source);
|
||||
}
|
||||
|
||||
|
@ -1092,7 +1143,11 @@ static void test_ThreadMgrUnadviseSinks(void)
|
|||
|
||||
tmSinkRefCount = 1;
|
||||
hr = ITfSource_UnadviseSink(source, tmSinkCookie);
|
||||
ok(SUCCEEDED(hr),"Failed to unadvise Sink\n");
|
||||
ok(hr == S_OK, "Failed to unadvise Sink\n");
|
||||
|
||||
hr = ITfSource_UnadviseSink(source, key_trace_sink_cookie);
|
||||
ok(hr == S_OK, "Failed to unadvise Sink\n");
|
||||
|
||||
ITfSource_Release(source);
|
||||
}
|
||||
|
||||
|
|
|
@ -621,6 +621,13 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
|
|||
return advise_sink(&This->ThreadFocusSink, &IID_ITfThreadFocusSink, COOKIE_MAGIC_THREADFOCUSSINK, punk, pdwCookie);
|
||||
}
|
||||
|
||||
if (IsEqualIID(riid, &IID_ITfKeyTraceEventSink))
|
||||
{
|
||||
WARN("semi-stub for ITfKeyTraceEventSink: sink won't be used.\n");
|
||||
return advise_sink(&This->KeyTraceEventSink, &IID_ITfKeyTraceEventSink,
|
||||
COOKIE_MAGIC_KEYTRACESINK, punk, pdwCookie);
|
||||
}
|
||||
|
||||
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
@ -628,10 +635,13 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
|
|||
static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
|
||||
{
|
||||
ThreadMgr *This = impl_from_ITfSource(iface);
|
||||
DWORD magic;
|
||||
|
||||
TRACE("(%p) %x\n",This,pdwCookie);
|
||||
|
||||
if (get_Cookie_magic(pdwCookie) != COOKIE_MAGIC_TMSINK && get_Cookie_magic(pdwCookie) != COOKIE_MAGIC_THREADFOCUSSINK)
|
||||
magic = get_Cookie_magic(pdwCookie);
|
||||
if (magic != COOKIE_MAGIC_TMSINK && magic != COOKIE_MAGIC_THREADFOCUSSINK
|
||||
&& magic != COOKIE_MAGIC_KEYTRACESINK)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return unadvise_sink(pdwCookie);
|
||||
|
|
|
@ -1119,6 +1119,23 @@ interface ITfKeyEventSink : IUnknown
|
|||
[out] BOOL *pfEaten);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(1cd4c13b-1c36-4191-a70a-7f3e611f367d),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface ITfKeyTraceEventSink : IUnknown
|
||||
{
|
||||
HRESULT OnKeyTraceDown(
|
||||
[in] WPARAM wParam,
|
||||
[in] LPARAM lParam);
|
||||
|
||||
HRESULT OnKeyTraceUp(
|
||||
[in] WPARAM wParam,
|
||||
[in] LPARAM lParam);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
|
|
Loading…
Reference in New Issue