wow64: Add thunks for the I/O completion syscalls.
[wine.git] / dlls / directmanipulation / directmanipulation.c
blob28fe52ac0fcc649227b4a5daea5256e9fcbdbc3b
1 /*
2 * Copyright 2019 Alistair Leslie-Hughes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 #define COBJMACROS
20 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "oleidl.h"
25 #include "rpcproxy.h"
26 #include "wine/heap.h"
27 #include "wine/debug.h"
29 #include "directmanipulation.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(manipulation);
33 struct directmanipulation
35 IDirectManipulationManager2 IDirectManipulationManager2_iface;
36 IDirectManipulationUpdateManager *updatemanager;
37 LONG ref;
40 struct directupdatemanager
42 IDirectManipulationUpdateManager IDirectManipulationUpdateManager_iface;
43 LONG ref;
46 static inline struct directmanipulation *impl_from_IDirectManipulationManager2(IDirectManipulationManager2 *iface)
48 return CONTAINING_RECORD(iface, struct directmanipulation, IDirectManipulationManager2_iface);
51 static inline struct directupdatemanager *impl_from_IDirectManipulationUpdateManager(IDirectManipulationUpdateManager *iface)
53 return CONTAINING_RECORD(iface, struct directupdatemanager, IDirectManipulationUpdateManager_iface);
56 static HRESULT WINAPI update_manager_QueryInterface(IDirectManipulationUpdateManager *iface, REFIID riid,void **ppv)
58 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
60 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
62 if (IsEqualGUID(riid, &IID_IUnknown) ||
63 IsEqualGUID(riid, &IID_IDirectManipulationUpdateManager)) {
64 IUnknown_AddRef(iface);
65 *ppv = iface;
66 return S_OK;
69 FIXME("(%p)->(%s,%p), not found\n", This, debugstr_guid(riid), ppv);
70 return E_NOINTERFACE;
73 ULONG WINAPI update_manager_AddRef(IDirectManipulationUpdateManager *iface)
75 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
76 ULONG ref = InterlockedIncrement(&This->ref);
78 TRACE("(%p) ref=%u\n", This, ref);
80 return ref;
83 ULONG WINAPI update_manager_Release(IDirectManipulationUpdateManager *iface)
85 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
86 ULONG ref = InterlockedDecrement(&This->ref);
88 TRACE("(%p) ref=%u\n", This, ref);
90 if (!ref)
92 heap_free(This);
94 return ref;
97 static HRESULT WINAPI update_manager_RegisterWaitHandleCallback(IDirectManipulationUpdateManager *iface, HANDLE handle,
98 IDirectManipulationUpdateHandler *handler, DWORD *cookie)
100 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
101 FIXME("%p, %p, %p, %p\n", This, handle, handler, cookie);
102 return E_NOTIMPL;
105 static HRESULT WINAPI update_manager_UnregisterWaitHandleCallback(IDirectManipulationUpdateManager *iface, DWORD cookie)
107 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
108 FIXME("%p, %x\n", This, cookie);
109 return E_NOTIMPL;
112 static HRESULT WINAPI update_manager_Update(IDirectManipulationUpdateManager *iface, IDirectManipulationFrameInfoProvider *provider)
114 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
115 FIXME("%p, %p\n", This, provider);
116 return E_NOTIMPL;
119 struct IDirectManipulationUpdateManagerVtbl updatemanagerVtbl =
121 update_manager_QueryInterface,
122 update_manager_AddRef,
123 update_manager_Release,
124 update_manager_RegisterWaitHandleCallback,
125 update_manager_UnregisterWaitHandleCallback,
126 update_manager_Update
129 static HRESULT create_update_manager(IDirectManipulationUpdateManager **obj)
131 struct directupdatemanager *object;
133 object = heap_alloc(sizeof(*object));
134 if(!object)
135 return E_OUTOFMEMORY;
137 object->IDirectManipulationUpdateManager_iface.lpVtbl = &updatemanagerVtbl;
138 object->ref = 1;
140 *obj = &object->IDirectManipulationUpdateManager_iface;
142 return S_OK;
145 struct primarycontext
147 IDirectManipulationPrimaryContent IDirectManipulationPrimaryContent_iface;
148 IDirectManipulationContent IDirectManipulationContent_iface;
149 LONG ref;
152 static inline struct primarycontext *impl_from_IDirectManipulationPrimaryContent(IDirectManipulationPrimaryContent *iface)
154 return CONTAINING_RECORD(iface, struct primarycontext, IDirectManipulationPrimaryContent_iface);
157 static inline struct primarycontext *impl_from_IDirectManipulationContent(IDirectManipulationContent *iface)
159 return CONTAINING_RECORD(iface, struct primarycontext, IDirectManipulationContent_iface);
162 static HRESULT WINAPI primary_QueryInterface(IDirectManipulationPrimaryContent *iface, REFIID riid, void **ppv)
164 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
165 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
167 if (IsEqualGUID(riid, &IID_IUnknown) ||
168 IsEqualGUID(riid, &IID_IDirectManipulationPrimaryContent))
170 IDirectManipulationPrimaryContent_AddRef(&This->IDirectManipulationPrimaryContent_iface);
171 *ppv = &This->IDirectManipulationPrimaryContent_iface;
172 return S_OK;
174 else if(IsEqualGUID(riid, &IID_IDirectManipulationContent))
176 IUnknown_AddRef(iface);
177 *ppv = &This->IDirectManipulationContent_iface;
178 return S_OK;
181 FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
182 return E_NOINTERFACE;
185 static ULONG WINAPI primary_AddRef(IDirectManipulationPrimaryContent *iface)
187 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
188 ULONG ref = InterlockedIncrement(&This->ref);
190 TRACE("(%p) ref=%u\n", This, ref);
192 return ref;
195 static ULONG WINAPI primary_Release(IDirectManipulationPrimaryContent *iface)
197 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
198 ULONG ref = InterlockedDecrement(&This->ref);
200 TRACE("(%p) ref=%u\n", This, ref);
202 if (!ref)
204 heap_free(This);
206 return ref;
209 static HRESULT WINAPI primary_SetSnapInterval(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
210 float interval, float offset)
212 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
213 FIXME("%p, %d, %f, %f\n", This, motion, interval, offset);
214 return E_NOTIMPL;
217 static HRESULT WINAPI primary_SetSnapPoints(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
218 const float *points, DWORD count)
220 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
221 FIXME("%p, %d, %p, %d\n", This, motion, points, count);
222 return E_NOTIMPL;
225 static HRESULT WINAPI primary_SetSnapType(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
226 DIRECTMANIPULATION_SNAPPOINT_TYPE type)
228 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
229 FIXME("%p, %d, %d\n", This, motion, type);
230 return E_NOTIMPL;
233 static HRESULT WINAPI primary_SetSnapCoordinate(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
234 DIRECTMANIPULATION_SNAPPOINT_COORDINATE coordinate, float origin)
236 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
237 FIXME("%p, %d, %d, %f\n", This, motion, coordinate, origin);
238 return E_NOTIMPL;
241 static HRESULT WINAPI primary_SetZoomBoundaries(IDirectManipulationPrimaryContent *iface, float minimum, float maximum)
243 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
244 FIXME("%p, %f, %f\n", This, minimum, maximum);
245 return E_NOTIMPL;
248 static HRESULT WINAPI primary_SetHorizontalAlignment(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_HORIZONTALALIGNMENT alignment)
250 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
251 FIXME("%p, %d\n", This, alignment);
252 return E_NOTIMPL;
255 static HRESULT WINAPI primary_SetVerticalAlignment(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_VERTICALALIGNMENT alignment)
257 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
258 FIXME("%p, %d\n", This, alignment);
259 return E_NOTIMPL;
262 static HRESULT WINAPI primary_GetInertiaEndTransform(IDirectManipulationPrimaryContent *iface, float *matrix, DWORD count)
264 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
265 FIXME("%p, %p, %d\n", This, matrix, count);
266 return E_NOTIMPL;
269 static HRESULT WINAPI primary_GetCenterPoint(IDirectManipulationPrimaryContent *iface, float *x, float *y)
271 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
272 FIXME("%p, %p, %p\n", This, x, y);
273 return E_NOTIMPL;
276 static const IDirectManipulationPrimaryContentVtbl primaryVtbl =
278 primary_QueryInterface,
279 primary_AddRef,
280 primary_Release,
281 primary_SetSnapInterval,
282 primary_SetSnapPoints,
283 primary_SetSnapType,
284 primary_SetSnapCoordinate,
285 primary_SetZoomBoundaries,
286 primary_SetHorizontalAlignment,
287 primary_SetVerticalAlignment,
288 primary_GetInertiaEndTransform,
289 primary_GetCenterPoint
293 static HRESULT WINAPI content_QueryInterface(IDirectManipulationContent *iface, REFIID riid, void **ppv)
295 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
296 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
298 return IDirectManipulationPrimaryContent_QueryInterface(&This->IDirectManipulationPrimaryContent_iface,
299 riid, ppv);
302 static ULONG WINAPI content_AddRef(IDirectManipulationContent *iface)
304 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
305 return IDirectManipulationPrimaryContent_AddRef(&This->IDirectManipulationPrimaryContent_iface);
308 static ULONG WINAPI content_Release(IDirectManipulationContent *iface)
310 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
311 return IDirectManipulationPrimaryContent_Release(&This->IDirectManipulationPrimaryContent_iface);
314 static HRESULT WINAPI content_GetContentRect(IDirectManipulationContent *iface, RECT *size)
316 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
317 FIXME("%p, %p\n", This, size);
318 return E_NOTIMPL;
321 static HRESULT WINAPI content_SetContentRect(IDirectManipulationContent *iface, const RECT *size)
323 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
324 FIXME("%p, %p\n", This, size);
325 return S_OK;
328 static HRESULT WINAPI content_GetViewport(IDirectManipulationContent *iface, REFIID riid, void **object)
330 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
331 FIXME("%p, %s, %p\n", This, debugstr_guid(riid), object);
332 return E_NOTIMPL;
335 static HRESULT WINAPI content_GetTag(IDirectManipulationContent *iface, REFIID riid, void **object, UINT32 *id)
337 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
338 FIXME("%p, %s, %p, %p\n", This, debugstr_guid(riid), object, id);
339 return E_NOTIMPL;
342 static HRESULT WINAPI content_SetTag(IDirectManipulationContent *iface, IUnknown *object, UINT32 id)
344 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
345 FIXME("%p, %p, %d\n", This, object, id);
346 return E_NOTIMPL;
349 static HRESULT WINAPI content_GetOutputTransform(IDirectManipulationContent *iface,
350 float *matrix, DWORD count)
352 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
353 FIXME("%p, %p, %d\n", This, matrix, count);
354 return E_NOTIMPL;
357 static HRESULT WINAPI content_GetContentTransform(IDirectManipulationContent *iface,
358 float *matrix, DWORD count)
360 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
361 FIXME("%p, %p, %d\n", This, matrix, count);
362 return E_NOTIMPL;
365 static HRESULT WINAPI content_SyncContentTransform(IDirectManipulationContent *iface,
366 const float *matrix, DWORD count)
368 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
369 FIXME("%p, %p, %d\n", This, matrix, count);
370 return E_NOTIMPL;
373 static const IDirectManipulationContentVtbl contentVtbl =
375 content_QueryInterface,
376 content_AddRef,
377 content_Release,
378 content_GetContentRect,
379 content_SetContentRect,
380 content_GetViewport,
381 content_GetTag,
382 content_SetTag,
383 content_GetOutputTransform,
384 content_GetContentTransform,
385 content_SyncContentTransform
388 struct directviewport
390 IDirectManipulationViewport2 IDirectManipulationViewport2_iface;
391 LONG ref;
394 static inline struct directviewport *impl_from_IDirectManipulationViewport2(IDirectManipulationViewport2 *iface)
396 return CONTAINING_RECORD(iface, struct directviewport, IDirectManipulationViewport2_iface);
399 static HRESULT WINAPI viewport_QueryInterface(IDirectManipulationViewport2 *iface, REFIID riid, void **ppv)
401 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
402 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
404 if (IsEqualGUID(riid, &IID_IUnknown) ||
405 IsEqualGUID(riid, &IID_IDirectManipulationViewport) ||
406 IsEqualGUID(riid, &IID_IDirectManipulationViewport2))
408 IDirectManipulationViewport2_AddRef(&This->IDirectManipulationViewport2_iface);
409 *ppv = &This->IDirectManipulationViewport2_iface;
410 return S_OK;
413 FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
414 return E_NOINTERFACE;
417 static ULONG WINAPI viewport_AddRef(IDirectManipulationViewport2 *iface)
419 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
420 ULONG ref = InterlockedIncrement(&This->ref);
422 TRACE("(%p) ref=%u\n", This, ref);
424 return ref;
427 static ULONG WINAPI viewport_Release(IDirectManipulationViewport2 *iface)
429 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
430 ULONG ref = InterlockedDecrement(&This->ref);
432 TRACE("(%p) ref=%u\n", This, ref);
434 if (!ref)
436 heap_free(This);
438 return ref;
441 static HRESULT WINAPI viewport_Enable(IDirectManipulationViewport2 *iface)
443 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
444 FIXME("%p\n", This);
445 return E_NOTIMPL;
448 static HRESULT WINAPI viewport_Disable(IDirectManipulationViewport2 *iface)
450 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
451 FIXME("%p\n", This);
452 return E_NOTIMPL;
455 static HRESULT WINAPI viewport_SetContact(IDirectManipulationViewport2 *iface, UINT32 id)
457 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
458 FIXME("%p, %d\n", This, id);
459 return E_NOTIMPL;
462 static HRESULT WINAPI viewport_ReleaseContact(IDirectManipulationViewport2 *iface, UINT32 id)
464 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
465 FIXME("%p, %d\n", This, id);
466 return E_NOTIMPL;
469 static HRESULT WINAPI viewport_ReleaseAllContacts(IDirectManipulationViewport2 *iface)
471 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
472 FIXME("%p\n", This);
473 return E_NOTIMPL;
476 static HRESULT WINAPI viewport_GetStatus(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_STATUS *status)
478 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
479 FIXME("%p, %p\n", This, status);
480 return E_NOTIMPL;
483 static HRESULT WINAPI viewport_GetTag(IDirectManipulationViewport2 *iface, REFIID riid, void **object, UINT32 *id)
485 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
486 FIXME("%p, %s, %p, %p\n", This, debugstr_guid(riid), object, id);
487 return E_NOTIMPL;
490 static HRESULT WINAPI viewport_SetTag(IDirectManipulationViewport2 *iface, IUnknown *object, UINT32 id)
492 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
493 FIXME("%p, %p, %u\n", This, object, id);
494 return E_NOTIMPL;
497 static HRESULT WINAPI viewport_GetViewportRect(IDirectManipulationViewport2 *iface, RECT *viewport)
499 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
500 FIXME("%p, %p\n", This, viewport);
501 return E_NOTIMPL;
504 static HRESULT WINAPI viewport_SetViewportRect(IDirectManipulationViewport2 *iface, const RECT *viewport)
506 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
507 FIXME("%p, %p\n", This, viewport);
508 return S_OK;
511 static HRESULT WINAPI viewport_ZoomToRect(IDirectManipulationViewport2 *iface, const float left,
512 const float top, const float right, const float bottom, BOOL animate)
514 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
515 FIXME("%p, %f, %f, %f, %f, %d\n", This, left, top, right, bottom, animate);
516 return E_NOTIMPL;
519 static HRESULT WINAPI viewport_SetViewportTransform(IDirectManipulationViewport2 *iface,
520 const float *matrix, DWORD count)
522 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
523 FIXME("%p, %p, %d\n", This, matrix, count);
524 return E_NOTIMPL;
527 static HRESULT WINAPI viewport_SyncDisplayTransform(IDirectManipulationViewport2 *iface,
528 const float *matrix, DWORD count)
530 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
531 FIXME("%p, %p, %d\n", This, matrix, count);
532 return E_NOTIMPL;
535 static HRESULT WINAPI viewport_GetPrimaryContent(IDirectManipulationViewport2 *iface, REFIID riid, void **object)
537 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
538 TRACE("%p, %s, %p\n", This, debugstr_guid(riid), object);
539 if(IsEqualGUID(riid, &IID_IDirectManipulationPrimaryContent))
541 struct primarycontext *primary;
542 TRACE("IDirectManipulationPrimaryContent\n");
543 primary = heap_alloc( sizeof(*primary));
544 if(!primary)
545 return E_OUTOFMEMORY;
547 primary->IDirectManipulationPrimaryContent_iface.lpVtbl = &primaryVtbl;
548 primary->IDirectManipulationContent_iface.lpVtbl = &contentVtbl;
549 primary->ref = 1;
551 *object = &primary->IDirectManipulationPrimaryContent_iface;
553 return S_OK;
555 else
556 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
557 return E_NOTIMPL;
560 static HRESULT WINAPI viewport_AddContent(IDirectManipulationViewport2 *iface, IDirectManipulationContent *content)
562 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
563 FIXME("%p, %p\n", This, content);
564 return E_NOTIMPL;
567 static HRESULT WINAPI viewport_RemoveContent(IDirectManipulationViewport2 *iface, IDirectManipulationContent *content)
569 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
570 FIXME("%p, %p\n", This, content);
571 return E_NOTIMPL;
574 static HRESULT WINAPI viewport_SetViewportOptions(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_VIEWPORT_OPTIONS options)
576 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
577 FIXME("%p, %d\n", This, options);
578 return S_OK;
581 static HRESULT WINAPI viewport_AddConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
583 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
584 FIXME("%p, %d\n", This, configuration);
585 return E_NOTIMPL;
588 static HRESULT WINAPI viewport_RemoveConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
590 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
591 FIXME("%p, %d\n", This, configuration);
592 return E_NOTIMPL;
595 static HRESULT WINAPI viewport_ActivateConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
597 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
598 FIXME("%p, %d\n", This, configuration);
599 return S_OK;
602 static HRESULT WINAPI viewport_SetManualGesture(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_GESTURE_CONFIGURATION configuration)
604 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
605 FIXME("%p, %d\n", This, configuration);
606 return E_NOTIMPL;
609 static HRESULT WINAPI viewport_SetChaining(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_MOTION_TYPES enabledTypes)
611 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
612 FIXME("%p, %d\n", This, enabledTypes);
613 return E_NOTIMPL;
616 static HRESULT WINAPI viewport_AddEventHandler(IDirectManipulationViewport2 *iface, HWND window,
617 IDirectManipulationViewportEventHandler *eventHandler, DWORD *cookie)
619 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
620 FIXME("%p, %p, %p, %p\n", This, window, eventHandler, cookie);
621 return E_NOTIMPL;
624 static HRESULT WINAPI viewport_RemoveEventHandler(IDirectManipulationViewport2 *iface, DWORD cookie)
626 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
627 FIXME("%p, %d\n", This, cookie);
628 return E_NOTIMPL;
631 static HRESULT WINAPI viewport_SetInputMode(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_INPUT_MODE mode)
633 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
634 FIXME("%p, %d\n", This, mode);
635 return E_NOTIMPL;
638 static HRESULT WINAPI viewport_SetUpdateMode(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_INPUT_MODE mode)
640 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
641 FIXME("%p, %d\n", This, mode);
642 return E_NOTIMPL;
645 static HRESULT WINAPI viewport_Stop(IDirectManipulationViewport2 *iface)
647 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
648 FIXME("%p\n", This);
649 return E_NOTIMPL;
652 static HRESULT WINAPI viewport_Abandon(IDirectManipulationViewport2 *iface)
654 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
655 FIXME("%p\n", This);
656 return E_NOTIMPL;
659 static HRESULT WINAPI viewport_AddBehavior(IDirectManipulationViewport2 *iface, IUnknown *behavior, DWORD *cookie)
661 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
662 FIXME("%p, %p, %p\n", This, behavior, cookie);
663 return E_NOTIMPL;
666 static HRESULT WINAPI viewport_RemoveBehavior(IDirectManipulationViewport2 *iface, DWORD cookie)
668 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
669 FIXME("%p, %d\n", This, cookie);
670 return E_NOTIMPL;
673 static HRESULT WINAPI viewport_RemoveAllBehaviors(IDirectManipulationViewport2 *iface)
675 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
676 FIXME("%p\n", This);
677 return E_NOTIMPL;
680 static const IDirectManipulationViewport2Vtbl viewportVtbl =
682 viewport_QueryInterface,
683 viewport_AddRef,
684 viewport_Release,
685 viewport_Enable,
686 viewport_Disable,
687 viewport_SetContact,
688 viewport_ReleaseContact,
689 viewport_ReleaseAllContacts,
690 viewport_GetStatus,
691 viewport_GetTag,
692 viewport_SetTag,
693 viewport_GetViewportRect,
694 viewport_SetViewportRect,
695 viewport_ZoomToRect,
696 viewport_SetViewportTransform,
697 viewport_SyncDisplayTransform,
698 viewport_GetPrimaryContent,
699 viewport_AddContent,
700 viewport_RemoveContent,
701 viewport_SetViewportOptions,
702 viewport_AddConfiguration,
703 viewport_RemoveConfiguration,
704 viewport_ActivateConfiguration,
705 viewport_SetManualGesture,
706 viewport_SetChaining,
707 viewport_AddEventHandler,
708 viewport_RemoveEventHandler,
709 viewport_SetInputMode,
710 viewport_SetUpdateMode,
711 viewport_Stop,
712 viewport_Abandon,
713 viewport_AddBehavior,
714 viewport_RemoveBehavior,
715 viewport_RemoveAllBehaviors
718 static HRESULT create_viewport(IDirectManipulationViewport2 **obj)
720 struct directviewport *object;
722 object = heap_alloc(sizeof(*object));
723 if(!object)
724 return E_OUTOFMEMORY;
726 object->IDirectManipulationViewport2_iface.lpVtbl = &viewportVtbl;
727 object->ref = 1;
729 *obj = &object->IDirectManipulationViewport2_iface;
731 return S_OK;
734 static HRESULT WINAPI direct_manip_QueryInterface(IDirectManipulationManager2 *iface, REFIID riid, void **ppv)
736 if (IsEqualGUID(riid, &IID_IUnknown) ||
737 IsEqualGUID(riid, &IID_IDirectManipulationManager) ||
738 IsEqualGUID(riid, &IID_IDirectManipulationManager2)) {
739 IUnknown_AddRef(iface);
740 *ppv = iface;
741 return S_OK;
744 FIXME("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
745 return E_NOINTERFACE;
748 static ULONG WINAPI direct_manip_AddRef(IDirectManipulationManager2 *iface)
750 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
751 ULONG ref = InterlockedIncrement(&This->ref);
753 TRACE("(%p) ref=%u\n", This, ref);
755 return ref;
758 static ULONG WINAPI direct_manip_Release(IDirectManipulationManager2 *iface)
760 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
761 ULONG ref = InterlockedDecrement(&This->ref);
763 TRACE("(%p) ref=%u\n", This, ref);
765 if (!ref)
767 if(This->updatemanager)
768 IDirectManipulationUpdateManager_Release(This->updatemanager);
769 heap_free(This);
771 return ref;
774 static HRESULT WINAPI direct_manip_Activate(IDirectManipulationManager2 *iface, HWND window)
776 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
777 FIXME("%p, %p\n", This, window);
778 return E_NOTIMPL;
781 static HRESULT WINAPI direct_manip_Deactivate(IDirectManipulationManager2 *iface, HWND window)
783 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
784 FIXME("%p, %p\n", This, window);
785 return E_NOTIMPL;
788 static HRESULT WINAPI direct_manip_RegisterHitTestTarget(IDirectManipulationManager2 *iface, HWND window,
789 HWND hittest, DIRECTMANIPULATION_HITTEST_TYPE type)
791 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
792 FIXME("%p, %p, %p, %d\n", This, window, hittest, type);
793 return E_NOTIMPL;
796 static HRESULT WINAPI direct_manip_ProcessInput(IDirectManipulationManager2 *iface, const MSG *msg, BOOL *handled)
798 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
799 FIXME("%p, %p, %p\n", This, msg, handled);
800 return E_NOTIMPL;
803 static HRESULT WINAPI direct_manip_GetUpdateManager(IDirectManipulationManager2 *iface, REFIID riid, void **obj)
805 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
806 HRESULT hr = E_FAIL;
808 TRACE("%p, %s, %p\n", This, debugstr_guid(riid), obj);
810 *obj = NULL;
811 if(IsEqualGUID(riid, &IID_IDirectManipulationUpdateManager))
813 if(!This->updatemanager)
815 hr = create_update_manager(&This->updatemanager);
817 else
819 hr = S_OK;
822 if(hr == S_OK)
824 IDirectManipulationUpdateManager_AddRef(This->updatemanager);
825 *obj = This->updatemanager;
828 else
829 FIXME("Interface %s currently not supported.\n", debugstr_guid(riid));
831 return hr;
834 static HRESULT WINAPI direct_manip_CreateViewport(IDirectManipulationManager2 *iface, IDirectManipulationFrameInfoProvider *frame,
835 HWND window, REFIID riid, void **obj)
837 HRESULT hr = E_NOTIMPL;
838 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
839 TRACE("%p, %p, %p, %s, %p\n", This, frame, window, debugstr_guid(riid), obj);
841 if(IsEqualGUID(riid, &IID_IDirectManipulationViewport) ||
842 IsEqualGUID(riid, &IID_IDirectManipulationViewport2) )
844 hr = create_viewport( (IDirectManipulationViewport2**)obj);
846 else
847 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
848 return hr;
851 static HRESULT WINAPI direct_manip_CreateContent(IDirectManipulationManager2 *iface, IDirectManipulationFrameInfoProvider *frame,
852 REFCLSID clsid, REFIID riid, void **obj)
854 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
855 FIXME("%p, %p, %s, %p\n", This, frame, debugstr_guid(riid), obj);
856 return E_NOTIMPL;
859 static HRESULT WINAPI direct_manip_CreateBehavior(IDirectManipulationManager2 *iface, REFCLSID clsid, REFIID riid, void **obj)
861 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
862 FIXME("%p, %s, %s, %p\n", This, debugstr_guid(clsid), debugstr_guid(riid), obj);
863 return E_NOTIMPL;
866 static const struct IDirectManipulationManager2Vtbl directmanipVtbl =
868 direct_manip_QueryInterface,
869 direct_manip_AddRef,
870 direct_manip_Release,
871 direct_manip_Activate,
872 direct_manip_Deactivate,
873 direct_manip_RegisterHitTestTarget,
874 direct_manip_ProcessInput,
875 direct_manip_GetUpdateManager,
876 direct_manip_CreateViewport,
877 direct_manip_CreateContent,
878 direct_manip_CreateBehavior
881 static HRESULT WINAPI DirectManipulation_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
883 struct directmanipulation *object;
884 HRESULT ret;
886 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
888 *ppv = NULL;
890 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
891 if (!object)
892 return E_OUTOFMEMORY;
894 object->IDirectManipulationManager2_iface.lpVtbl = &directmanipVtbl;
895 object->ref = 1;
897 ret = direct_manip_QueryInterface(&object->IDirectManipulationManager2_iface, riid, ppv);
898 direct_manip_Release(&object->IDirectManipulationManager2_iface);
900 return ret;
903 struct directcompositor
905 IDirectManipulationCompositor2 IDirectManipulationCompositor2_iface;
906 IDirectManipulationFrameInfoProvider IDirectManipulationFrameInfoProvider_iface;
907 IDirectManipulationUpdateManager *manager;
908 LONG ref;
911 static inline struct directcompositor *impl_from_IDirectManipulationCompositor2(IDirectManipulationCompositor2 *iface)
913 return CONTAINING_RECORD(iface, struct directcompositor, IDirectManipulationCompositor2_iface);
916 static inline struct directcompositor *impl_from_IDirectManipulationFrameInfoProvider(IDirectManipulationFrameInfoProvider *iface)
918 return CONTAINING_RECORD(iface, struct directcompositor, IDirectManipulationFrameInfoProvider_iface);
921 static HRESULT WINAPI compositor_QueryInterface(IDirectManipulationCompositor2 *iface, REFIID riid, void **ppv)
923 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
925 if (IsEqualGUID(riid, &IID_IUnknown) ||
926 IsEqualGUID(riid, &IID_IDirectManipulationCompositor) ||
927 IsEqualGUID(riid, &IID_IDirectManipulationCompositor2))
929 IUnknown_AddRef(iface);
930 *ppv = iface;
931 return S_OK;
933 else if(IsEqualGUID(riid, &IID_IDirectManipulationFrameInfoProvider))
935 IUnknown_AddRef(iface);
936 *ppv = &This->IDirectManipulationFrameInfoProvider_iface;
937 return S_OK;
940 FIXME("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
941 return E_NOINTERFACE;
944 static ULONG WINAPI compositor_AddRef(IDirectManipulationCompositor2 *iface)
946 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
947 ULONG ref = InterlockedIncrement(&This->ref);
949 TRACE("(%p) ref=%u\n", This, ref);
951 return ref;
954 static ULONG WINAPI compositor_Release(IDirectManipulationCompositor2 *iface)
956 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
957 ULONG ref = InterlockedDecrement(&This->ref);
959 TRACE("(%p) ref=%u\n", This, ref);
961 if (!ref)
963 if(This->manager)
964 IDirectManipulationUpdateManager_Release(This->manager);
965 heap_free(This);
967 return ref;
970 static HRESULT WINAPI compositor_AddContent(IDirectManipulationCompositor2 *iface, IDirectManipulationContent *content,
971 IUnknown *device, IUnknown *parent, IUnknown *child)
973 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
974 FIXME("%p, %p, %p, %p, %p\n", This, content, device, parent, child);
975 return E_NOTIMPL;
978 static HRESULT WINAPI compositor_RemoveContent(IDirectManipulationCompositor2 *iface, IDirectManipulationContent *content)
980 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
981 FIXME("%p, %p\n", This, content);
982 return E_NOTIMPL;
985 static HRESULT WINAPI compositor_SetUpdateManager(IDirectManipulationCompositor2 *iface, IDirectManipulationUpdateManager *manager)
987 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
988 TRACE("%p, %p\n", This, manager);
990 if(!manager)
991 return E_INVALIDARG;
993 This->manager = manager;
994 IDirectManipulationUpdateManager_AddRef(This->manager);
995 return S_OK;
998 static HRESULT WINAPI compositor_Flush(IDirectManipulationCompositor2 *iface)
1000 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1001 FIXME("%p\n", This);
1002 return E_NOTIMPL;
1005 static HRESULT WINAPI compositor_AddContentWithCrossProcessChaining(IDirectManipulationCompositor2 *iface,
1006 IDirectManipulationPrimaryContent *content, IUnknown *device, IUnknown *parentvisual, IUnknown *childvisual)
1008 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1009 FIXME("%p %p %p %p %p\n", This, content, device, parentvisual, childvisual);
1010 return E_NOTIMPL;
1013 static const struct IDirectManipulationCompositor2Vtbl compositorVtbl =
1015 compositor_QueryInterface,
1016 compositor_AddRef,
1017 compositor_Release,
1018 compositor_AddContent,
1019 compositor_RemoveContent,
1020 compositor_SetUpdateManager,
1021 compositor_Flush,
1022 compositor_AddContentWithCrossProcessChaining
1025 static HRESULT WINAPI provider_QueryInterface(IDirectManipulationFrameInfoProvider *iface, REFIID riid, void **ppv)
1027 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1028 return IDirectManipulationCompositor2_QueryInterface(&This->IDirectManipulationCompositor2_iface, riid, ppv);
1031 static ULONG WINAPI provider_AddRef(IDirectManipulationFrameInfoProvider *iface)
1033 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1034 return IDirectManipulationCompositor2_AddRef(&This->IDirectManipulationCompositor2_iface);
1037 static ULONG WINAPI provider_Release(IDirectManipulationFrameInfoProvider *iface)
1039 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1040 return IDirectManipulationCompositor2_Release(&This->IDirectManipulationCompositor2_iface);
1043 static HRESULT WINAPI provider_GetNextFrameInfo(IDirectManipulationFrameInfoProvider *iface, ULONGLONG *time,
1044 ULONGLONG *process, ULONGLONG *composition)
1046 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1047 FIXME("%p, %p, %p, %p\n", This, time, process, composition);
1048 return E_NOTIMPL;
1051 static const struct IDirectManipulationFrameInfoProviderVtbl providerVtbl =
1053 provider_QueryInterface,
1054 provider_AddRef,
1055 provider_Release,
1056 provider_GetNextFrameInfo
1059 static HRESULT WINAPI DirectCompositor_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
1061 struct directcompositor *object;
1062 HRESULT ret;
1064 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
1066 *ppv = NULL;
1068 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1069 if (!object)
1070 return E_OUTOFMEMORY;
1072 object->IDirectManipulationCompositor2_iface.lpVtbl = &compositorVtbl;
1073 object->IDirectManipulationFrameInfoProvider_iface.lpVtbl = &providerVtbl;
1074 object->ref = 1;
1076 ret = compositor_QueryInterface(&object->IDirectManipulationCompositor2_iface, riid, ppv);
1077 compositor_Release(&object->IDirectManipulationCompositor2_iface);
1079 return ret;
1082 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
1084 *ppv = NULL;
1086 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) {
1087 *ppv = iface;
1090 if(*ppv) {
1091 IUnknown_AddRef((IUnknown*)*ppv);
1092 return S_OK;
1095 WARN("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
1096 return E_NOINTERFACE;
1099 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
1101 TRACE("(%p)\n", iface);
1102 return 2;
1105 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
1107 TRACE("(%p)\n", iface);
1108 return 1;
1111 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
1113 TRACE("(%p)->(%x)\n", iface, fLock);
1114 return S_OK;
1117 static const IClassFactoryVtbl DirectFactoryVtbl = {
1118 ClassFactory_QueryInterface,
1119 ClassFactory_AddRef,
1120 ClassFactory_Release,
1121 DirectManipulation_CreateInstance,
1122 ClassFactory_LockServer
1125 static const IClassFactoryVtbl DirectCompositorVtbl = {
1126 ClassFactory_QueryInterface,
1127 ClassFactory_AddRef,
1128 ClassFactory_Release,
1129 DirectCompositor_CreateInstance,
1130 ClassFactory_LockServer
1133 static IClassFactory direct_factory = { &DirectFactoryVtbl };
1134 static IClassFactory compositor_factory = { &DirectCompositorVtbl };
1136 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
1138 if(IsEqualGUID(&CLSID_DirectManipulationManager, rclsid) ||
1139 IsEqualGUID(&CLSID_DirectManipulationSharedManager, rclsid) ) {
1140 TRACE("(CLSID_DirectManipulationManager %s %p)\n", debugstr_guid(riid), ppv);
1141 return IClassFactory_QueryInterface(&direct_factory, riid, ppv);
1143 else if(IsEqualGUID(&CLSID_DCompManipulationCompositor, rclsid)) {
1144 TRACE("(CLSID_DCompManipulationCompositor %s %p)\n", debugstr_guid(riid), ppv);
1145 return IClassFactory_QueryInterface(&compositor_factory, riid, ppv);
1148 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1149 return CLASS_E_CLASSNOTAVAILABLE;