From 48b2daa4ddeb8c3a88611bc494a0e1405fad37af Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 12 Jul 2019 09:50:00 +1000
Subject: [PATCH] msctf: Added ITfActiveLanguageProfileNotifySink support in
 ITfSource.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44502
---
 dlls/msctf/msctf_internal.h |  1 +
 dlls/msctf/threadmgr.c      | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h
index 584bb1044ed..9d60e18e6f3 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/threadmgr.c b/dlls/msctf/threadmgr.c
index 2c208fbc04f..16e261539ac 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,8 @@ 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)
         return E_INVALIDARG;
 
     return unadvise_sink(pdwCookie);
-- 
2.17.1

