Author: cwittich Date: Sun Mar 7 10:48:42 2010 New Revision: 45982
URL: http://svn.reactos.org/svn/reactos?rev=45982&view=rev Log: [MSCTF] sync msctf to wine 1.1.40
Added: trunk/reactos/dll/win32/msctf/langbarmgr.c (with props) trunk/reactos/include/psdk/ctfutb.idl (with props) Removed: trunk/reactos/dll/win32/msctf/msctf_local.idl trunk/reactos/dll/win32/msctf/textstor_local.idl Modified: trunk/reactos/dll/win32/msctf/msctf.c trunk/reactos/dll/win32/msctf/msctf.rbuild trunk/reactos/dll/win32/msctf/msctf.spec trunk/reactos/dll/win32/msctf/msctf_internal.h trunk/reactos/dll/win32/msctf/regsvr.c trunk/reactos/dll/win32/msctf/threadmgr.c trunk/reactos/include/psdk/msctf.idl trunk/reactos/include/psdk/psdk.rbuild trunk/reactos/lib/sdk/uuid/uuid.c
Added: trunk/reactos/dll/win32/msctf/langbarmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/langbarmgr.... ============================================================================== --- trunk/reactos/dll/win32/msctf/langbarmgr.c (added) +++ trunk/reactos/dll/win32/msctf/langbarmgr.c [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -1,0 +1,193 @@ +/* + * ITfLangBarMgr implementation + * + * Copyright 2010 Justin Chevrier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "wine/debug.h" +#include "winbase.h" +#include "winreg.h" +#include "shlwapi.h" + +#include "msctf.h" +#include "msctf_internal.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msctf); + +typedef struct tagLangBarMgr { + const ITfLangBarMgrVtbl *LangBarMgrVtbl; + + LONG refCount; + +} LangBarMgr; + +static void LangBarMgr_Destructor(LangBarMgr *This) +{ + TRACE("destroying %p\n", This); + + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI LangBarMgr_QueryInterface(ITfLangBarMgr *iface, REFIID iid, LPVOID *ppvOut) +{ + LangBarMgr *This = (LangBarMgr *)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfLangBarMgr)) + { + *ppvOut = This; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI LangBarMgr_AddRef(ITfLangBarMgr *iface) +{ + LangBarMgr *This = (LangBarMgr *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI LangBarMgr_Release(ITfLangBarMgr *iface) +{ + LangBarMgr *This = (LangBarMgr *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + LangBarMgr_Destructor(This); + return ret; +} + +/***************************************************** + * ITfLangBarMgr functions + *****************************************************/ + +static HRESULT WINAPI LangBarMgr_AdviseEventSink( ITfLangBarMgr* iface, ITfLangBarEventSink *pSink, HWND hwnd, DWORD dwflags, DWORD *pdwCookie) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_UnAdviseEventSink( ITfLangBarMgr* iface, DWORD dwCookie) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_GetThreadMarshalInterface( ITfLangBarMgr* iface, DWORD dwThreadId, DWORD dwType, REFIID riid, IUnknown **ppunk) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_GetThreadLangBarItemMgr( ITfLangBarMgr* iface, DWORD dwThreadId, ITfLangBarItemMgr **pplbi, DWORD *pdwThreadid) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_GetInputProcessorProfiles( ITfLangBarMgr* iface, DWORD dwThreadId, ITfInputProcessorProfiles **ppaip, DWORD *pdwThreadid) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_RestoreLastFocus( ITfLangBarMgr* iface, DWORD *dwThreadId, BOOL fPrev) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_SetModalInput( ITfLangBarMgr* iface, ITfLangBarEventSink *pSink, DWORD dwThreadId, DWORD dwFlags) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_ShowFloating( ITfLangBarMgr* iface, DWORD dwFlags) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI LangBarMgr_GetShowFloatingStatus( ITfLangBarMgr* iface, DWORD *pdwFlags) +{ + LangBarMgr *This = (LangBarMgr *)iface; + + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static const ITfLangBarMgrVtbl LangBarMgr_LangBarMgrVtbl = +{ + LangBarMgr_QueryInterface, + LangBarMgr_AddRef, + LangBarMgr_Release, + + LangBarMgr_AdviseEventSink, + LangBarMgr_UnAdviseEventSink, + LangBarMgr_GetThreadMarshalInterface, + LangBarMgr_GetThreadLangBarItemMgr, + LangBarMgr_GetInputProcessorProfiles, + LangBarMgr_RestoreLastFocus, + LangBarMgr_SetModalInput, + LangBarMgr_ShowFloating, + LangBarMgr_GetShowFloatingStatus +}; + +HRESULT LangBarMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) +{ + LangBarMgr *This; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + This = HeapAlloc(GetProcessHeap(),0,sizeof(LangBarMgr)); + if (This == NULL) + return E_OUTOFMEMORY; + + This->LangBarMgrVtbl= &LangBarMgr_LangBarMgrVtbl; + This->refCount = 1; + + TRACE("returning %p\n", This); + *ppOut = (IUnknown *)This; + return S_OK; +}
Propchange: trunk/reactos/dll/win32/msctf/langbarmgr.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/dll/win32/msctf/msctf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf.c?rev... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf.c [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -87,6 +87,7 @@ {&CLSID_TF_ThreadMgr, ThreadMgr_Constructor}, {&CLSID_TF_InputProcessorProfiles, InputProcessorProfiles_Constructor}, {&CLSID_TF_CategoryMgr, CategoryMgr_Constructor}, + {&CLSID_TF_LangBarMgr, LangBarMgr_Constructor}, {NULL, NULL} };
@@ -351,7 +352,7 @@ ActivatedTextService *actsvr; ITfCategoryMgr *catmgr; AtsEntry *entry; - ITfThreadMgr *tm = (ITfThreadMgr*)TlsGetValue(tlsIndex); + ITfThreadMgr *tm = TlsGetValue(tlsIndex); ITfClientId *clientid;
if (!tm) return E_UNEXPECTED; @@ -608,3 +609,21 @@ { return InputProcessorProfiles_Constructor(NULL,(IUnknown**)ppipr); } + +/*********************************************************************** + * TF_InvalidAssemblyListCacheIfExist(MSCTF.@) + */ +HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(void) +{ + FIXME("Stub\n"); + return S_OK; +} + +/*********************************************************************** + * TF_CreateLangBarMgr (MSCTF.@) + */ +HRESULT WINAPI TF_CreateLangBarMgr(ITfLangBarMgr **pppbm) +{ + TRACE("\n"); + return LangBarMgr_Constructor(NULL,(IUnknown**)pppbm); +}
Modified: trunk/reactos/dll/win32/msctf/msctf.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf.rbuil... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf.rbuild [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -13,6 +13,7 @@ <file>context.c</file> <file>documentmgr.c</file> <file>inputprocessor.c</file> + <file>langbarmgr.c</file> <file>msctf.c</file> <file>range.c</file> <file>regsvr.c</file> @@ -24,14 +25,6 @@ <library>oleaut32</library> <library>user32</library> <library>advapi32</library> - <library>msctf_local_interface</library> - <library>textstor_local_interface</library> <library>ntdll</library> </module> -<module name="msctf_local_interface" type="idlinterface"> - <file>msctf_local.idl</file> -</module> -<module name="textstor_local_interface" type="idlinterface"> - <file>textstor_local.idl</file> -</module> </group>
Modified: trunk/reactos/dll/win32/msctf/msctf.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf.spec?... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf.spec [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -13,7 +13,7 @@ @ stub TF_CreateDisplayAttributeMgr @ stdcall TF_CreateInputProcessorProfiles(ptr) @ stub TF_CreateLangBarItemMgr -@ stub TF_CreateLangBarMgr +@ stdcall TF_CreateLangBarMgr(ptr) @ stdcall TF_CreateThreadMgr(ptr) @ stub TF_DllDetachInOther @ stub TF_GetGlobalCompartment @@ -27,7 +27,7 @@ @ stub TF_InitMlngInfo @ stub TF_InitSystem @ stub TF_InvalidAssemblyListCache -@ stub TF_InvalidAssemblyListCacheIfExist +@ stdcall TF_InvalidAssemblyListCacheIfExist() @ stub TF_IsCtfmonRunning @ stub TF_IsInMarshaling @ stub TF_MlngInfoCount
Modified: trunk/reactos/dll/win32/msctf/msctf_internal.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf_inter... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf_internal.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf_internal.h [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -40,6 +40,7 @@ extern HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut); extern HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown **ppOut); extern HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *This); +extern HRESULT LangBarMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
extern HRESULT Context_Initialize(ITfContext *cxt, ITfDocumentMgr *manager); extern HRESULT Context_Uninitialize(ITfContext *cxt);
Removed: trunk/reactos/dll/win32/msctf/msctf_local.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf_local... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf_local.idl [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf_local.idl (removed) @@ -1,2 +1,0 @@ - -#include "msctf.idl"
Modified: trunk/reactos/dll/win32/msctf/regsvr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/regsvr.c?re... ============================================================================== --- trunk/reactos/dll/win32/msctf/regsvr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/regsvr.c [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -462,6 +462,13 @@ "msctf.dll", "Apartment" }, + { + &CLSID_TF_LangBarMgr, + "TF_LangBarMgr", + NULL, + "msctf.dll", + "Apartment" + }, { NULL } /* list terminator */ };
@@ -474,7 +481,7 @@ };
/*********************************************************************** - * DllRegisterServer (HHCTRL.@) + * DllRegisterServer (MSCTF.@) */ HRESULT WINAPI DllRegisterServer(void) { @@ -489,7 +496,7 @@ }
/*********************************************************************** - * DllUnregisterServer (HHCTRL.@) + * DllUnregisterServer (MSCTF.@) */ HRESULT WINAPI DllUnregisterServer(void) {
Removed: trunk/reactos/dll/win32/msctf/textstor_local.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/textstor_lo... ============================================================================== --- trunk/reactos/dll/win32/msctf/textstor_local.idl [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/textstor_local.idl (removed) @@ -1,2 +1,0 @@ - -#include "textstor.idl"
Modified: trunk/reactos/dll/win32/msctf/threadmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/threadmgr.c... ============================================================================== --- trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -88,7 +88,7 @@ /* const ITfConfigureSystemKeystrokeFeedVtbl *ConfigureSystemKeystrokeFeedVtbl; */ /* const ITfLangBarItemMgrVtbl *LangBarItemMgrVtbl; */ /* const ITfUIElementMgrVtbl *UIElementMgrVtbl; */ - /* const ITfSourceSingleVtbl *SourceSingleVtbl; */ + const ITfSourceSingleVtbl *SourceSingleVtbl; LONG refCount;
/* Aggregation */ @@ -126,7 +126,6 @@ } EnumTfDocumentMgr;
static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentMgrs **ppOut); -LRESULT CALLBACK ThreadFocusHookProc(int nCode, WPARAM wParam, LPARAM lParam);
static inline ThreadMgr *impl_from_ITfSourceVtbl(ITfSource *iface) { @@ -151,6 +150,324 @@ static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface) { return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl)); +} + +static inline ThreadMgr *impl_from_ITfSourceSingleVtbl(ITfSourceSingle* iface) + +{ + return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceSingleVtbl)); +} + +static void free_sink(ThreadMgrSink *sink) +{ + IUnknown_Release(sink->interfaces.pIUnknown); + HeapFree(GetProcessHeap(),0,sink); +} + +static void ThreadMgr_Destructor(ThreadMgr *This) +{ + struct list *cursor, *cursor2; + + /* unhook right away */ + if (This->focusHook) + UnhookWindowsHookEx(This->focusHook); + + TlsSetValue(tlsIndex,NULL); + TRACE("destroying %p\n", This); + if (This->focus) + ITfDocumentMgr_Release(This->focus); + + /* free sinks */ + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ActiveLanguageProfileNotifySink) + { + ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); + list_remove(cursor); + free_sink(sink); + } + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->DisplayAttributeNotifySink) + { + ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); + list_remove(cursor); + free_sink(sink); + } + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->KeyTraceEventSink) + { + ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); + list_remove(cursor); + free_sink(sink); + } + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->PreservedKeyNotifySink) + { + ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); + list_remove(cursor); + free_sink(sink); + } + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadFocusSink) + { + ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); + list_remove(cursor); + free_sink(sink); + } + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadMgrEventSink) + { + ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); + list_remove(cursor); + 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); + } + + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->CreatedDocumentMgrs) + { + DocumentMgrEntry *mgr = LIST_ENTRY(cursor,DocumentMgrEntry,entry); + list_remove(cursor); + FIXME("Left Over ITfDocumentMgr. Should we do something with it?\n"); + HeapFree(GetProcessHeap(),0,mgr); + } + + LIST_FOR_EACH_SAFE(cursor, cursor2, &This->AssociatedFocusWindows) + { + AssociatedWindow *wnd = LIST_ENTRY(cursor,AssociatedWindow,entry); + list_remove(cursor); + HeapFree(GetProcessHeap(),0,wnd); + } + + CompartmentMgr_Destructor(This->CompartmentMgr); + + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut) +{ + ThreadMgr *This = (ThreadMgr *)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr)) + { + *ppvOut = This; + } + else if (IsEqualIID(iid, &IID_ITfSource)) + { + *ppvOut = &This->SourceVtbl; + } + else if (IsEqualIID(iid, &IID_ITfKeystrokeMgr)) + { + *ppvOut = &This->KeystrokeMgrVtbl; + } + else if (IsEqualIID(iid, &IID_ITfMessagePump)) + { + *ppvOut = &This->MessagePumpVtbl; + } + else if (IsEqualIID(iid, &IID_ITfClientId)) + { + *ppvOut = &This->ClientIdVtbl; + } + else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) + { + *ppvOut = This->CompartmentMgr; + } + else if (IsEqualIID(iid, &IID_ITfSourceSingle)) + { + *ppvOut = &This->SourceSingleVtbl; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface) +{ + ThreadMgr *This = (ThreadMgr *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) +{ + ThreadMgr *This = (ThreadMgr *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + ThreadMgr_Destructor(This); + return ret; +} + +/***************************************************** + * ITfThreadMgr functions + *****************************************************/ + +static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid) +{ + ThreadMgr *This = (ThreadMgr *)iface; + + TRACE("(%p) %p\n",This, ptid); + + if (!ptid) + return E_INVALIDARG; + + if (!processId) + { + GUID guid; + CoCreateGuid(&guid); + ITfClientId_GetClientId((ITfClientId*)&This->ClientIdVtbl,&guid,&processId); + } + + activate_textservices(iface); + This->activationCount++; + *ptid = processId; + return S_OK; +} + +static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) +{ + ThreadMgr *This = (ThreadMgr *)iface; + TRACE("(%p)\n",This); + + if (This->activationCount == 0) + return E_UNEXPECTED; + + This->activationCount --; + + if (This->activationCount == 0) + { + if (This->focus) + { + ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, 0, This->focus); + ITfDocumentMgr_Release(This->focus); + This->focus = 0; + } + } + + deactivate_textservices(); + + return S_OK; +} + +static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr +**ppdim) +{ + ThreadMgr *This = (ThreadMgr *)iface; + DocumentMgrEntry *mgrentry; + HRESULT hr; + + TRACE("(%p)\n",iface); + mgrentry = HeapAlloc(GetProcessHeap(),0,sizeof(DocumentMgrEntry)); + if (mgrentry == NULL) + return E_OUTOFMEMORY; + + hr = DocumentMgr_Constructor((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, ppdim); + + if (SUCCEEDED(hr)) + { + mgrentry->docmgr = *ppdim; + list_add_head(&This->CreatedDocumentMgrs,&mgrentry->entry); + } + else + HeapFree(GetProcessHeap(),0,mgrentry); + + return hr; +} + +static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs +**ppEnum) +{ + ThreadMgr *This = (ThreadMgr *)iface; + TRACE("(%p) %p\n",This,ppEnum); + + if (!ppEnum) + return E_INVALIDARG; + + return EnumTfDocumentMgr_Constructor(&This->CreatedDocumentMgrs, ppEnum); +} + +static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr +**ppdimFocus) +{ + ThreadMgr *This = (ThreadMgr *)iface; + TRACE("(%p)\n",This); + + if (!ppdimFocus) + return E_INVALIDARG; + + *ppdimFocus = This->focus; + + TRACE("->%p\n",This->focus); + + if (This->focus == NULL) + return S_FALSE; + + ITfDocumentMgr_AddRef(This->focus); + + return S_OK; +} + +static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus) +{ + ITfDocumentMgr *check; + ThreadMgr *This = (ThreadMgr *)iface; + + TRACE("(%p) %p\n",This,pdimFocus); + + if (!pdimFocus) + check = NULL; + else if (FAILED(IUnknown_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check))) + return E_INVALIDARG; + + ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, check, This->focus); + + if (This->focus) + ITfDocumentMgr_Release(This->focus); + + This->focus = check; + return S_OK; +} + +static LRESULT CALLBACK ThreadFocusHookProc(int nCode, WPARAM wParam, LPARAM lParam) +{ + ThreadMgr *This; + + This = TlsGetValue(tlsIndex); + if (!This) + { + ERR("Hook proc but no ThreadMgr for this thread. Serious Error\n"); + return 0; + } + if (!This->focusHook) + { + ERR("Hook proc but no ThreadMgr focus Hook. Serious Error\n"); + return 0; + } + + if (nCode == HCBT_SETFOCUS) /* focus change within our thread */ + { + struct list *cursor; + + LIST_FOR_EACH(cursor, &This->AssociatedFocusWindows) + { + AssociatedWindow *wnd = LIST_ENTRY(cursor,AssociatedWindow,entry); + if (wnd->hwnd == (HWND)wParam) + { + TRACE("Triggering Associated window focus\n"); + if (This->focus != wnd->docmgr) + ThreadMgr_SetFocus((ITfThreadMgr*)This, wnd->docmgr); + break; + } + } + } + + return CallNextHookEx(This->focusHook, nCode, wParam, lParam); }
static HRESULT SetupWindowsHook(ThreadMgr *This) @@ -167,278 +484,6 @@ return S_OK; } return S_FALSE; -} - -static void free_sink(ThreadMgrSink *sink) -{ - IUnknown_Release(sink->interfaces.pIUnknown); - HeapFree(GetProcessHeap(),0,sink); -} - -static void ThreadMgr_Destructor(ThreadMgr *This) -{ - struct list *cursor, *cursor2; - - /* unhook right away */ - if (This->focusHook) - UnhookWindowsHookEx(This->focusHook); - - TlsSetValue(tlsIndex,NULL); - TRACE("destroying %p\n", This); - if (This->focus) - ITfDocumentMgr_Release(This->focus); - - /* free sinks */ - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ActiveLanguageProfileNotifySink) - { - ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); - list_remove(cursor); - free_sink(sink); - } - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->DisplayAttributeNotifySink) - { - ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); - list_remove(cursor); - free_sink(sink); - } - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->KeyTraceEventSink) - { - ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); - list_remove(cursor); - free_sink(sink); - } - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->PreservedKeyNotifySink) - { - ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); - list_remove(cursor); - free_sink(sink); - } - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadFocusSink) - { - ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); - list_remove(cursor); - free_sink(sink); - } - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadMgrEventSink) - { - ThreadMgrSink* sink = LIST_ENTRY(cursor,ThreadMgrSink,entry); - list_remove(cursor); - 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); - } - - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->CreatedDocumentMgrs) - { - DocumentMgrEntry *mgr = LIST_ENTRY(cursor,DocumentMgrEntry,entry); - list_remove(cursor); - FIXME("Left Over ITfDocumentMgr. Should we do something with it?\n"); - HeapFree(GetProcessHeap(),0,mgr); - } - - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->AssociatedFocusWindows) - { - AssociatedWindow *wnd = LIST_ENTRY(cursor,AssociatedWindow,entry); - list_remove(cursor); - HeapFree(GetProcessHeap(),0,wnd); - } - - CompartmentMgr_Destructor(This->CompartmentMgr); - - HeapFree(GetProcessHeap(),0,This); -} - -static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut) -{ - ThreadMgr *This = (ThreadMgr *)iface; - *ppvOut = NULL; - - if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr)) - { - *ppvOut = This; - } - else if (IsEqualIID(iid, &IID_ITfSource)) - { - *ppvOut = &This->SourceVtbl; - } - else if (IsEqualIID(iid, &IID_ITfKeystrokeMgr)) - { - *ppvOut = &This->KeystrokeMgrVtbl; - } - else if (IsEqualIID(iid, &IID_ITfMessagePump)) - { - *ppvOut = &This->MessagePumpVtbl; - } - else if (IsEqualIID(iid, &IID_ITfClientId)) - { - *ppvOut = &This->ClientIdVtbl; - } - else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) - { - *ppvOut = This->CompartmentMgr; - } - - if (*ppvOut) - { - IUnknown_AddRef(iface); - return S_OK; - } - - WARN("unsupported interface: %s\n", debugstr_guid(iid)); - return E_NOINTERFACE; -} - -static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface) -{ - ThreadMgr *This = (ThreadMgr *)iface; - return InterlockedIncrement(&This->refCount); -} - -static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) -{ - ThreadMgr *This = (ThreadMgr *)iface; - ULONG ret; - - ret = InterlockedDecrement(&This->refCount); - if (ret == 0) - ThreadMgr_Destructor(This); - return ret; -} - -/***************************************************** - * ITfThreadMgr functions - *****************************************************/ - -static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid) -{ - ThreadMgr *This = (ThreadMgr *)iface; - - TRACE("(%p) %p\n",This, ptid); - - if (!ptid) - return E_INVALIDARG; - - if (!processId) - { - GUID guid; - CoCreateGuid(&guid); - ITfClientId_GetClientId((ITfClientId*)&This->ClientIdVtbl,&guid,&processId); - } - - activate_textservices(iface); - This->activationCount++; - *ptid = processId; - return S_OK; -} - -static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) -{ - ThreadMgr *This = (ThreadMgr *)iface; - TRACE("(%p)\n",This); - - if (This->activationCount == 0) - return E_UNEXPECTED; - - This->activationCount --; - - if (This->activationCount == 0) - { - if (This->focus) - { - ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, 0, This->focus); - ITfDocumentMgr_Release(This->focus); - This->focus = 0; - } - } - - deactivate_textservices(); - - return S_OK; -} - -static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr -**ppdim) -{ - ThreadMgr *This = (ThreadMgr *)iface; - DocumentMgrEntry *mgrentry; - HRESULT hr; - - TRACE("(%p)\n",iface); - mgrentry = HeapAlloc(GetProcessHeap(),0,sizeof(DocumentMgrEntry)); - if (mgrentry == NULL) - return E_OUTOFMEMORY; - - hr = DocumentMgr_Constructor((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, ppdim); - - if (SUCCEEDED(hr)) - { - mgrentry->docmgr = *ppdim; - list_add_head(&This->CreatedDocumentMgrs,&mgrentry->entry); - } - else - HeapFree(GetProcessHeap(),0,mgrentry); - - return hr; -} - -static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs -**ppEnum) -{ - ThreadMgr *This = (ThreadMgr *)iface; - TRACE("(%p) %p\n",This,ppEnum); - - if (!ppEnum) - return E_INVALIDARG; - - return EnumTfDocumentMgr_Constructor(&This->CreatedDocumentMgrs, ppEnum); -} - -static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr -**ppdimFocus) -{ - ThreadMgr *This = (ThreadMgr *)iface; - TRACE("(%p)\n",This); - - if (!ppdimFocus) - return E_INVALIDARG; - - *ppdimFocus = This->focus; - - TRACE("->%p\n",This->focus); - - if (This->focus == NULL) - return S_FALSE; - - ITfDocumentMgr_AddRef(This->focus); - - return S_OK; -} - -static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus) -{ - ITfDocumentMgr *check; - ThreadMgr *This = (ThreadMgr *)iface; - - TRACE("(%p) %p\n",This,pdimFocus); - - if (!pdimFocus) - check = NULL; - else if (FAILED(IUnknown_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check))) - return E_INVALIDARG; - - ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, check, This->focus); - - if (This->focus) - ITfDocumentMgr_Release(This->focus); - - This->focus = check; - return S_OK; }
static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd, @@ -838,6 +883,7 @@ newkey->guid = *rguid; newkey->prekey = *prekey; newkey->tid = tid; + newkey->description = NULL; if (cchDesc) { newkey->description = HeapAlloc(GetProcessHeap(),0,cchDesc * sizeof(WCHAR)); @@ -1172,6 +1218,53 @@ ThreadMgrEventSink_OnPopContext };
+/***************************************************** + * ITfSourceSingle functions + *****************************************************/ +static HRESULT WINAPI ThreadMgrSourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) +{ + ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); +} + +static ULONG WINAPI ThreadMgrSourceSingle_AddRef(ITfSourceSingle *iface) +{ + ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + return ThreadMgr_AddRef((ITfThreadMgr *)This); +} + +static ULONG WINAPI ThreadMgrSourceSingle_Release(ITfSourceSingle *iface) +{ + ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + return ThreadMgr_Release((ITfThreadMgr *)This); +} + +static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *iface, + TfClientId tid, REFIID riid, IUnknown *punk) +{ + ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + FIXME("STUB:(%p) %i %s %p\n",This, tid, debugstr_guid(riid),punk); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgrSourceSingle_UnadviseSingleSink( ITfSourceSingle *iface, + TfClientId tid, REFIID riid) +{ + ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + FIXME("STUB:(%p) %i %s\n",This, tid, debugstr_guid(riid)); + return E_NOTIMPL; +} + +static const ITfSourceSingleVtbl ThreadMgr_SourceSingleVtbl = +{ + ThreadMgrSourceSingle_QueryInterface, + ThreadMgrSourceSingle_AddRef, + ThreadMgrSourceSingle_Release, + + ThreadMgrSourceSingle_AdviseSingleSink, + ThreadMgrSourceSingle_UnadviseSingleSink, +}; + HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) { ThreadMgr *This; @@ -1197,6 +1290,7 @@ This->MessagePumpVtbl= &ThreadMgr_MessagePumpVtbl; This->ClientIdVtbl = &ThreadMgr_ClientIdVtbl; This->ThreadMgrEventSinkVtbl = &ThreadMgr_ThreadMgrEventSinkVtbl; + This->SourceSingleVtbl = &ThreadMgr_SourceSingleVtbl; This->refCount = 1; TlsSetValue(tlsIndex,This);
@@ -1378,39 +1472,3 @@ } FIXME("ITfDocumenMgr %p not found in this thread\n",mgr); } - -LRESULT CALLBACK ThreadFocusHookProc(int nCode, WPARAM wParam, LPARAM lParam) -{ - ThreadMgr *This; - - This = TlsGetValue(tlsIndex); - if (!This) - { - ERR("Hook proc but no ThreadMgr for this thread. Serious Error\n"); - return 0; - } - if (!This->focusHook) - { - ERR("Hook proc but no ThreadMgr focus Hook. Serious Error\n"); - return 0; - } - - if (nCode == HCBT_SETFOCUS) /* focus change within our thread */ - { - struct list *cursor; - - LIST_FOR_EACH(cursor, &This->AssociatedFocusWindows) - { - AssociatedWindow *wnd = LIST_ENTRY(cursor,AssociatedWindow,entry); - if (wnd->hwnd == (HWND)wParam) - { - TRACE("Triggering Associated window focus\n"); - if (This->focus != wnd->docmgr) - ThreadMgr_SetFocus((ITfThreadMgr*)This, wnd->docmgr); - break; - } - } - } - - return CallNextHookEx(This->focusHook, nCode, wParam, lParam); -}
Added: trunk/reactos/include/psdk/ctfutb.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ctfutb.idl?rev... ============================================================================== --- trunk/reactos/include/psdk/ctfutb.idl (added) +++ trunk/reactos/include/psdk/ctfutb.idl [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -1,0 +1,73 @@ +/* + * Copyright 2010 Justin Chevrier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef DO_NO_IMPORTS +import "oaidl.idl"; +#endif + +interface ITfLangBarEventSink; +interface ITfLangBarItemMgr; +interface ITfInputProcessorProfiles; + +[ + object, + uuid(87955690-e627-11d2-8ddb-00105a2799b5), + pointer_default(unique) +] +interface ITfLangBarMgr: IUnknown +{ + HRESULT AdviseEventSink( + [in] ITfLangBarEventSink *pSink, + [in] HWND hwnd, + [in] DWORD dwflags, + [in] DWORD *pdwCookie); + + HRESULT UnAdviseEventSink( + [in] DWORD dwCookie); + + HRESULT GetThreadMarshalInterface( + [in] DWORD dwThreadId, + [in] DWORD dwType, + [in] REFIID riid, + [out] IUnknown **ppunk); + + HRESULT GetThreadLangBarItemMgr( + [in] DWORD dwThreadId, + [out] ITfLangBarItemMgr **pplbie, + [out] DWORD *pdwThreadid); + + HRESULT GetInputProcessorProfiles( + [in] DWORD dwThreadId, + [out] ITfInputProcessorProfiles **ppaip, + [out] DWORD *pdwThreadid); + + HRESULT RestoreLastFocus( + [out] DWORD *dwThreadId, + [in] BOOL fPrev); + + HRESULT SetModalInput( + [in] ITfLangBarEventSink *pSink, + [in] DWORD dwThreadId, + [in] DWORD dwFlags); + + HRESULT ShowFloating( + [in] DWORD dwFlags); + + HRESULT GetShowFloatingStatus( + [out] DWORD *pdwFlags); +};
Propchange: trunk/reactos/include/psdk/ctfutb.idl ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/include/psdk/msctf.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/msctf.idl?rev=... ============================================================================== --- trunk/reactos/include/psdk/msctf.idl [iso-8859-1] (original) +++ trunk/reactos/include/psdk/msctf.idl [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -20,7 +20,7 @@ import "oaidl.idl"; import "comcat.idl"; import "textstor.idl"; -/* import "ctfutb.idl"; */ +import "ctfutb.idl"; #endif cpp_quote("#include <winuser.h>")
@@ -37,6 +37,7 @@ cpp_quote("HRESULT WINAPI TF_CreateThreadMgr(ITfThreadMgr **pptim);") cpp_quote("HRESULT WINAPI TF_GetThreadMgr(ITfThreadMgr **pptim);") cpp_quote("HRESULT WINAPI TF_CreateInputProcessorProfiles(ITfInputProcessorProfiles **ppipr);") +cpp_quote("HRESULT WINAPI TF_CreateLangBarMgr(ITfLangBarMgr **pppbm);")
cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;") cpp_quote("DEFINE_GUID(GUID_PROP_ATTRIBUTE,0x34b45670,0x7526,0x11d2,0xa1,0x47,0x00,0x10,0x5a,0x27,0x99,0xb5);") @@ -46,6 +47,7 @@
cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;") cpp_quote("EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles;") +cpp_quote("EXTERN_C const CLSID CLSID_TF_LangBarMgr;") cpp_quote("EXTERN_C const CLSID CLSID_TF_CategoryMgr;") cpp_quote("DEFINE_GUID(CLSID_TF_DisplayAttributeMgr,0x3ce74de4,0x53d3,0x4d74,0x8b,0x83,0x43,0x1b,0x38,0x28,0xba,0x53);")
@@ -1349,3 +1351,16 @@ [in] TfClientId tid, [in] REFIID riid); }; + +[ + object, + local, + uuid(c0f1db0c-3a20-405c-a303-96b6010a885f), + pointer_default(unique) +] +interface ITfThreadFocusSink : IUnknown +{ + HRESULT OnSetThreadFocus(); + + HRESULT OnKillThreadFocus(); +};
Modified: trunk/reactos/include/psdk/psdk.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/psdk.rbuild?re... ============================================================================== --- trunk/reactos/include/psdk/psdk.rbuild [iso-8859-1] (original) +++ trunk/reactos/include/psdk/psdk.rbuild [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -10,6 +10,7 @@ <file>bits.idl</file> <file>commoncontrols.idl</file> <file>control.idl</file> + <file>ctfutb.idl</file> <file>ctxtcall.idl</file> <file>dimm.idl</file> <file>dispex.idl</file>
Modified: trunk/reactos/lib/sdk/uuid/uuid.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/uuid/uuid.c?rev=459... ============================================================================== --- trunk/reactos/lib/sdk/uuid/uuid.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/uuid/uuid.c [iso-8859-1] Sun Mar 7 10:48:42 2010 @@ -155,6 +155,7 @@ DEFINE_GUID(CLSID_TF_ThreadMgr, 0x529a9e6b,0x6587,0x4f23,0xab,0x9e,0x9c,0x7d,0x68,0x3e,0x3c,0x50); DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed); DEFINE_GUID(CLSID_TF_CategoryMgr, 0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7); +DEFINE_GUID(CLSID_TF_LangBarMgr, 0xebb08c45,0x6c4a,0x4fdc,0xae,0x53,0x4e,0xb8,0xc4,0xc7,0xdb,0x8e); DEFINE_GUID(CLSID_TaskbarList, 0x56fdf344,0xfd6d,0x11d0,0x95,0x8a,0x00,0x60,0x97,0xc9,0xa0,0x90); DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745c63,0xb2f0,0x4784,0x8b,0x67,0x5e,0x12,0xc8,0x70,0x1a,0x31); DEFINE_GUID(GUID_TFCAT_TIP_SPEECH, 0xB5A73CD1,0x8355,0x426B,0xA1,0x61,0x25,0x98,0x08,0xF2,0x6B,0x14);