msctf: Use generic sinks in InputProcessorProfiles object.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c80a96504e
commit
361f0690f6
|
@ -51,15 +51,6 @@ static const WCHAR szwDefault[] = {'D','e','f','a','u','l','t',0};
|
||||||
static const WCHAR szwProfile[] = {'P','r','o','f','i','l','e',0};
|
static const WCHAR szwProfile[] = {'P','r','o','f','i','l','e',0};
|
||||||
static const WCHAR szwDefaultFmt[] = {'%','s','\\','%','s','\\','0','x','%','0','8','x','\\','%','s',0};
|
static const WCHAR szwDefaultFmt[] = {'%','s','\\','%','s','\\','0','x','%','0','8','x','\\','%','s',0};
|
||||||
|
|
||||||
typedef struct tagInputProcessorProfilesSink {
|
|
||||||
struct list entry;
|
|
||||||
union {
|
|
||||||
/* InputProcessorProfile Sinks */
|
|
||||||
IUnknown *pIUnknown;
|
|
||||||
ITfLanguageProfileNotifySink *pITfLanguageProfileNotifySink;
|
|
||||||
} interfaces;
|
|
||||||
} InputProcessorProfilesSink;
|
|
||||||
|
|
||||||
typedef struct tagInputProcessorProfiles {
|
typedef struct tagInputProcessorProfiles {
|
||||||
ITfInputProcessorProfiles ITfInputProcessorProfiles_iface;
|
ITfInputProcessorProfiles ITfInputProcessorProfiles_iface;
|
||||||
ITfSource ITfSource_iface;
|
ITfSource ITfSource_iface;
|
||||||
|
@ -217,25 +208,11 @@ static inline EnumTfLanguageProfiles *impl_from_IEnumTfLanguageProfiles(IEnumTfL
|
||||||
return CONTAINING_RECORD(iface, EnumTfLanguageProfiles, IEnumTfLanguageProfiles_iface);
|
return CONTAINING_RECORD(iface, EnumTfLanguageProfiles, IEnumTfLanguageProfiles_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_sink(InputProcessorProfilesSink *sink)
|
|
||||||
{
|
|
||||||
IUnknown_Release(sink->interfaces.pIUnknown);
|
|
||||||
HeapFree(GetProcessHeap(),0,sink);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This)
|
static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This)
|
||||||
{
|
{
|
||||||
struct list *cursor, *cursor2;
|
|
||||||
TRACE("destroying %p\n", This);
|
TRACE("destroying %p\n", This);
|
||||||
|
|
||||||
/* free sinks */
|
free_sinks(&This->LanguageProfileNotifySink);
|
||||||
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->LanguageProfileNotifySink)
|
|
||||||
{
|
|
||||||
InputProcessorProfilesSink* sink = LIST_ENTRY(cursor,InputProcessorProfilesSink,entry);
|
|
||||||
list_remove(cursor);
|
|
||||||
free_sink(sink);
|
|
||||||
}
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
HeapFree(GetProcessHeap(),0,This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,18 +582,18 @@ static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage(
|
||||||
ITfInputProcessorProfiles *iface, LANGID langid)
|
ITfInputProcessorProfiles *iface, LANGID langid)
|
||||||
{
|
{
|
||||||
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
||||||
|
ITfLanguageProfileNotifySink *sink;
|
||||||
struct list *cursor;
|
struct list *cursor;
|
||||||
BOOL accept;
|
BOOL accept;
|
||||||
|
|
||||||
FIXME("STUB:(%p)\n",This);
|
FIXME("STUB:(%p)\n",This);
|
||||||
|
|
||||||
LIST_FOR_EACH(cursor, &This->LanguageProfileNotifySink)
|
SINK_FOR_EACH(cursor, &This->LanguageProfileNotifySink, ITfLanguageProfileNotifySink, sink)
|
||||||
{
|
{
|
||||||
InputProcessorProfilesSink* sink = LIST_ENTRY(cursor,InputProcessorProfilesSink,entry);
|
|
||||||
accept = TRUE;
|
accept = TRUE;
|
||||||
ITfLanguageProfileNotifySink_OnLanguageChange(sink->interfaces.pITfLanguageProfileNotifySink, langid, &accept);
|
ITfLanguageProfileNotifySink_OnLanguageChange(sink, langid, &accept);
|
||||||
if (!accept)
|
if (!accept)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: On successful language change call OnLanguageChanged sink */
|
/* TODO: On successful language change call OnLanguageChanged sink */
|
||||||
|
@ -928,7 +905,6 @@ static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface,
|
||||||
REFIID riid, IUnknown *punk, DWORD *pdwCookie)
|
REFIID riid, IUnknown *punk, DWORD *pdwCookie)
|
||||||
{
|
{
|
||||||
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
||||||
InputProcessorProfilesSink *ipps;
|
|
||||||
|
|
||||||
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
|
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
|
||||||
|
|
||||||
|
@ -936,47 +912,23 @@ static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface,
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if (IsEqualIID(riid, &IID_ITfLanguageProfileNotifySink))
|
if (IsEqualIID(riid, &IID_ITfLanguageProfileNotifySink))
|
||||||
{
|
return advise_sink(&This->LanguageProfileNotifySink, &IID_ITfLanguageProfileNotifySink,
|
||||||
ipps = HeapAlloc(GetProcessHeap(),0,sizeof(InputProcessorProfilesSink));
|
COOKIE_MAGIC_IPPSINK, punk, pdwCookie);
|
||||||
if (!ipps)
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
if (FAILED(IUnknown_QueryInterface(punk, riid, (LPVOID *)&ipps->interfaces.pITfLanguageProfileNotifySink)))
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(),0,ipps);
|
|
||||||
return CONNECT_E_CANNOTCONNECT;
|
|
||||||
}
|
|
||||||
list_add_head(&This->LanguageProfileNotifySink,&ipps->entry);
|
|
||||||
*pdwCookie = generate_Cookie(COOKIE_MAGIC_IPPSINK, ipps);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("cookie %x\n",*pdwCookie);
|
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
|
||||||
|
return E_NOTIMPL;
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
|
static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
|
||||||
{
|
{
|
||||||
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
||||||
InputProcessorProfilesSink *sink;
|
|
||||||
|
|
||||||
TRACE("(%p) %x\n",This,pdwCookie);
|
TRACE("(%p) %x\n",This,pdwCookie);
|
||||||
|
|
||||||
if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_IPPSINK)
|
if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_IPPSINK)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
sink = remove_Cookie(pdwCookie);
|
return unadvise_sink(pdwCookie);
|
||||||
if (!sink)
|
|
||||||
return CONNECT_E_NOCONNECTION;
|
|
||||||
|
|
||||||
list_remove(&sink->entry);
|
|
||||||
free_sink(sink);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const ITfSourceVtbl InputProcessorProfilesSourceVtbl =
|
static const ITfSourceVtbl InputProcessorProfilesSourceVtbl =
|
||||||
|
|
|
@ -74,6 +74,7 @@ typedef struct {
|
||||||
ITfThreadMgrEventSink *pITfThreadMgrEventSink;
|
ITfThreadMgrEventSink *pITfThreadMgrEventSink;
|
||||||
ITfCompartmentEventSink *pITfCompartmentEventSink;
|
ITfCompartmentEventSink *pITfCompartmentEventSink;
|
||||||
ITfTextEditSink *pITfTextEditSink;
|
ITfTextEditSink *pITfTextEditSink;
|
||||||
|
ITfLanguageProfileNotifySink *pITfLanguageProfileNotifySink;
|
||||||
} interfaces;
|
} interfaces;
|
||||||
} Sink;
|
} Sink;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue