Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44502 Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msctf/msctf_internal.h | 1 + dlls/msctf/tests/inputprocessor.c | 46 +++++++++++++++++++++++++++++++ dlls/msctf/threadmgr.c | 11 +++++++- 3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h index 584bb1044e..9d60e18e6f 100644 --- a/dlls/msctf/msctf_internal.h +++ b/dlls/msctf/msctf_internal.h @@ -34,6 +34,7 @@ #define COOKIE_MAGIC_KEYTRACESINK 0x0090 #define COOKIE_MAGIC_UIELEMENTSINK 0x00a0 #define COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK 0x00b0 +#define COOKIE_MAGIC_ACTIVELANGSINK 0x00c0
extern DWORD tlsIndex DECLSPEC_HIDDEN; extern TfClientId processId DECLSPEC_HIDDEN; diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index d73a3f9451..a90e0db879 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -63,6 +63,7 @@ static BOOL test_ShouldDeactivate = FALSE; static DWORD tmSinkCookie; static DWORD tmSinkRefCount; static DWORD dmSinkCookie; +static DWORD dmLangCookie; static DWORD documentStatus; static DWORD key_trace_sink_cookie, ui_element_sink_cookie, profile_activation_sink_cookie; static DWORD fake_service_onactivated_flags = 0; @@ -819,6 +820,45 @@ static const ITfTransitoryExtensionSinkVtbl TfTransitoryExtensionSinkVtbl = {
static ITfTransitoryExtensionSink TfTransitoryExtensionSink = { &TfTransitoryExtensionSinkVtbl };
+static HRESULT WINAPI active_lang_sink_QueryInterface(ITfActiveLanguageProfileNotifySink *iface, REFIID iid, LPVOID *ppvOut) +{ + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfActiveLanguageProfileNotifySink)) + { + *ppvOut = iface; + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI active_lang_sink_AddRef(ITfActiveLanguageProfileNotifySink *iface) +{ + return 2; +} + +static ULONG WINAPI active_lang_sink_Release(ITfActiveLanguageProfileNotifySink *iface) +{ + return 1; +} + +HRESULT active_lang_sink_OnActivated(ITfActiveLanguageProfileNotifySink *iface, REFCLSID clsid, REFGUID profile, BOOL activated) +{ + trace("%p, %s, %s, %d\n", iface, wine_dbgstr_guid(clsid), wine_dbgstr_guid(profile), activated); + return S_OK; +} + +static const ITfActiveLanguageProfileNotifySinkVtbl TfActiveLanguageProfileNotifySinkVtbl = +{ + active_lang_sink_QueryInterface, + active_lang_sink_AddRef, + active_lang_sink_Release, + active_lang_sink_OnActivated, +}; + +static ITfActiveLanguageProfileNotifySink TfActiveLanguageProfileNotifySink = { &TfActiveLanguageProfileNotifySinkVtbl }; + /******************************************************************************************** * Stub text service for testing ********************************************************************************************/ @@ -1258,6 +1298,9 @@ static void test_ThreadMgrAdviseSinks(void) &profile_activation_sink_cookie); ok(hr == S_OK, "Failed to Advise ITfInputProcessorProfileActivationSink\n");
+ hr = ITfSource_AdviseSink(source, &IID_ITfActiveLanguageProfileNotifySink, (IUnknown*)&TfActiveLanguageProfileNotifySink, &dmLangCookie); + ok(hr == S_OK,"Failed to Advise Sink\n"); + ITfSource_Release(source); }
@@ -1284,6 +1327,9 @@ static void test_ThreadMgrUnadviseSinks(void) hr = ITfSource_UnadviseSink(source, profile_activation_sink_cookie); ok(hr == S_OK, "Failed to unadvise ITfInputProcessorProfileActivationSink\n");
+ hr = ITfSource_UnadviseSink(source, dmLangCookie); + ok(hr == S_OK, "Failed to unadvise ITfActiveLanguageProfileNotifySink\n"); + ITfSource_Release(source); }
diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c index 2c208fbc04..b57c2784a1 100644 --- a/dlls/msctf/threadmgr.c +++ b/dlls/msctf/threadmgr.c @@ -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_ITfActiveLanguageProfileNotifySink)) + { + WARN("semi-stub for ITfActiveLanguageProfileNotifySink: sink won't be used.\n"); + return advise_sink(&This->ActiveLanguageProfileNotifySink, &IID_ITfActiveLanguageProfileNotifySink, + COOKIE_MAGIC_ACTIVELANGSINK, punk, pdwCookie); + } + if (IsEqualIID(riid, &IID_ITfKeyTraceEventSink)) { WARN("semi-stub for ITfKeyTraceEventSink: sink won't be used.\n"); @@ -656,7 +663,9 @@ static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCo magic = get_Cookie_magic(pdwCookie); if (magic != COOKIE_MAGIC_TMSINK && magic != COOKIE_MAGIC_THREADFOCUSSINK && magic != COOKIE_MAGIC_KEYTRACESINK && magic != COOKIE_MAGIC_UIELEMENTSINK - && magic != COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK) + && magic != COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK + && magic != COOKIE_MAGIC_KEYTRACESINK + && magic != COOKIE_MAGIC_ACTIVELANGSINK) return E_INVALIDARG;
return unadvise_sink(pdwCookie);