push 378fe7a60681a28e8b22f62dcfe122d585b92570
[wine/hacks.git] / dlls / msctf / threadmgr.c
blob18675708cb8e7b7b6826c98c7a87b7e312a511f9
1 /*
2 * ITfThreadMgr implementation
4 * Copyright 2008 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <stdarg.h>
25 #define COBJMACROS
27 #include "wine/debug.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "winuser.h"
32 #include "shlwapi.h"
33 #include "winerror.h"
34 #include "objbase.h"
36 #include "wine/unicode.h"
38 #include "msctf.h"
39 #include "msctf_internal.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
43 typedef struct tagACLMulti {
44 const ITfThreadMgrVtbl *ThreadMgrVtbl;
45 LONG refCount;
46 } ThreadMgr;
48 static void ThreadMgr_Destructor(ThreadMgr *This)
50 TRACE("destroying %p\n", This);
51 HeapFree(GetProcessHeap(),0,This);
54 static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut)
56 ThreadMgr *This = (ThreadMgr *)iface;
57 *ppvOut = NULL;
59 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr))
61 *ppvOut = This;
64 if (*ppvOut)
66 IUnknown_AddRef(iface);
67 return S_OK;
70 WARN("unsupported interface: %s\n", debugstr_guid(iid));
71 return E_NOINTERFACE;
74 static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface)
76 ThreadMgr *This = (ThreadMgr *)iface;
77 return InterlockedIncrement(&This->refCount);
80 static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface)
82 ThreadMgr *This = (ThreadMgr *)iface;
83 ULONG ret;
85 ret = InterlockedDecrement(&This->refCount);
86 if (ret == 0)
87 ThreadMgr_Destructor(This);
88 return ret;
91 /*****************************************************
92 * ITfThreadMgr functions
93 *****************************************************/
95 static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid)
97 ThreadMgr *This = (ThreadMgr *)iface;
98 FIXME("STUB:(%p)\n",This);
99 return E_NOTIMPL;
102 static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface)
104 ThreadMgr *This = (ThreadMgr *)iface;
105 FIXME("STUB:(%p)\n",This);
106 return E_NOTIMPL;
109 static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr
110 **ppdim)
112 ThreadMgr *This = (ThreadMgr *)iface;
113 FIXME("STUB:(%p)\n",This);
114 return E_NOTIMPL;
117 static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs
118 **ppEnum)
120 ThreadMgr *This = (ThreadMgr *)iface;
121 FIXME("STUB:(%p)\n",This);
122 return E_NOTIMPL;
125 static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr
126 **ppdimFocus)
128 ThreadMgr *This = (ThreadMgr *)iface;
129 FIXME("STUB:(%p)\n",This);
130 return E_NOTIMPL;
133 static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus)
135 ThreadMgr *This = (ThreadMgr *)iface;
136 FIXME("STUB:(%p)\n",This);
137 return E_NOTIMPL;
140 static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd,
141 ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev)
143 ThreadMgr *This = (ThreadMgr *)iface;
144 FIXME("STUB:(%p)\n",This);
145 return E_NOTIMPL;
148 static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus)
150 ThreadMgr *This = (ThreadMgr *)iface;
151 FIXME("STUB:(%p)\n",This);
152 return E_NOTIMPL;
155 static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid,
156 ITfFunctionProvider **ppFuncProv)
158 ThreadMgr *This = (ThreadMgr *)iface;
159 FIXME("STUB:(%p)\n",This);
160 return E_NOTIMPL;
163 static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface,
164 IEnumTfFunctionProviders **ppEnum)
166 ThreadMgr *This = (ThreadMgr *)iface;
167 FIXME("STUB:(%p)\n",This);
168 return E_NOTIMPL;
171 static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface,
172 ITfCompartmentMgr **ppCompMgr)
174 ThreadMgr *This = (ThreadMgr *)iface;
175 FIXME("STUB:(%p)\n",This);
176 return E_NOTIMPL;
179 static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl =
181 ThreadMgr_QueryInterface,
182 ThreadMgr_AddRef,
183 ThreadMgr_Release,
185 ThreadMgr_fnActivate,
186 ThreadMgr_fnDeactivate,
187 ThreadMgr_CreateDocumentMgr,
188 ThreadMgr_EnumDocumentMgrs,
189 ThreadMgr_GetFocus,
190 ThreadMgr_SetFocus,
191 ThreadMgr_AssociateFocus,
192 ThreadMgr_IsThreadFocus,
193 ThreadMgr_GetFunctionProvider,
194 ThreadMgr_EnumFunctionProviders,
195 ThreadMgr_GetGlobalCompartment
198 HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
200 ThreadMgr *This;
201 if (pUnkOuter)
202 return CLASS_E_NOAGGREGATION;
204 This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ThreadMgr));
205 if (This == NULL)
206 return E_OUTOFMEMORY;
208 This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl;
209 This->refCount = 1;
211 TRACE("returning %p\n", This);
212 *ppOut = (IUnknown *)This;
213 return S_OK;