include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / dlls / directmanipulation / directmanipulation.c
blobe72ffec3ddb965051083724a9ee434f8aedd3570
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/debug.h"
28 #include "directmanipulation.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(manipulation);
32 struct directmanipulation
34 IDirectManipulationManager2 IDirectManipulationManager2_iface;
35 IDirectManipulationUpdateManager *updatemanager;
36 LONG ref;
39 struct directupdatemanager
41 IDirectManipulationUpdateManager IDirectManipulationUpdateManager_iface;
42 LONG ref;
45 static inline struct directmanipulation *impl_from_IDirectManipulationManager2(IDirectManipulationManager2 *iface)
47 return CONTAINING_RECORD(iface, struct directmanipulation, IDirectManipulationManager2_iface);
50 static inline struct directupdatemanager *impl_from_IDirectManipulationUpdateManager(IDirectManipulationUpdateManager *iface)
52 return CONTAINING_RECORD(iface, struct directupdatemanager, IDirectManipulationUpdateManager_iface);
55 static HRESULT WINAPI update_manager_QueryInterface(IDirectManipulationUpdateManager *iface, REFIID riid,void **ppv)
57 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
59 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
61 if (IsEqualGUID(riid, &IID_IUnknown) ||
62 IsEqualGUID(riid, &IID_IDirectManipulationUpdateManager)) {
63 IUnknown_AddRef(iface);
64 *ppv = iface;
65 return S_OK;
68 FIXME("(%p)->(%s,%p), not found\n", This, debugstr_guid(riid), ppv);
69 return E_NOINTERFACE;
72 ULONG WINAPI update_manager_AddRef(IDirectManipulationUpdateManager *iface)
74 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
75 ULONG ref = InterlockedIncrement(&This->ref);
77 TRACE("(%p) ref=%lu\n", This, ref);
79 return ref;
82 ULONG WINAPI update_manager_Release(IDirectManipulationUpdateManager *iface)
84 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
85 ULONG ref = InterlockedDecrement(&This->ref);
87 TRACE("(%p) ref=%lu\n", This, ref);
89 if (!ref)
91 free(This);
93 return ref;
96 static HRESULT WINAPI update_manager_RegisterWaitHandleCallback(IDirectManipulationUpdateManager *iface, HANDLE handle,
97 IDirectManipulationUpdateHandler *handler, DWORD *cookie)
99 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
100 FIXME("%p, %p, %p, %p\n", This, handle, handler, cookie);
101 return E_NOTIMPL;
104 static HRESULT WINAPI update_manager_UnregisterWaitHandleCallback(IDirectManipulationUpdateManager *iface, DWORD cookie)
106 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
107 FIXME("%p, %lx\n", This, cookie);
108 return E_NOTIMPL;
111 static HRESULT WINAPI update_manager_Update(IDirectManipulationUpdateManager *iface, IDirectManipulationFrameInfoProvider *provider)
113 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
114 FIXME("%p, %p\n", This, provider);
115 return E_NOTIMPL;
118 struct IDirectManipulationUpdateManagerVtbl updatemanagerVtbl =
120 update_manager_QueryInterface,
121 update_manager_AddRef,
122 update_manager_Release,
123 update_manager_RegisterWaitHandleCallback,
124 update_manager_UnregisterWaitHandleCallback,
125 update_manager_Update
128 static HRESULT create_update_manager(IDirectManipulationUpdateManager **obj)
130 struct directupdatemanager *object;
132 object = malloc(sizeof(*object));
133 if(!object)
134 return E_OUTOFMEMORY;
136 object->IDirectManipulationUpdateManager_iface.lpVtbl = &updatemanagerVtbl;
137 object->ref = 1;
139 *obj = &object->IDirectManipulationUpdateManager_iface;
141 return S_OK;
144 struct primarycontext
146 IDirectManipulationPrimaryContent IDirectManipulationPrimaryContent_iface;
147 IDirectManipulationContent IDirectManipulationContent_iface;
148 LONG ref;
151 static inline struct primarycontext *impl_from_IDirectManipulationPrimaryContent(IDirectManipulationPrimaryContent *iface)
153 return CONTAINING_RECORD(iface, struct primarycontext, IDirectManipulationPrimaryContent_iface);
156 static inline struct primarycontext *impl_from_IDirectManipulationContent(IDirectManipulationContent *iface)
158 return CONTAINING_RECORD(iface, struct primarycontext, IDirectManipulationContent_iface);
161 static HRESULT WINAPI primary_QueryInterface(IDirectManipulationPrimaryContent *iface, REFIID riid, void **ppv)
163 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
164 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
166 if (IsEqualGUID(riid, &IID_IUnknown) ||
167 IsEqualGUID(riid, &IID_IDirectManipulationPrimaryContent))
169 IDirectManipulationPrimaryContent_AddRef(&This->IDirectManipulationPrimaryContent_iface);
170 *ppv = &This->IDirectManipulationPrimaryContent_iface;
171 return S_OK;
173 else if(IsEqualGUID(riid, &IID_IDirectManipulationContent))
175 IUnknown_AddRef(iface);
176 *ppv = &This->IDirectManipulationContent_iface;
177 return S_OK;
180 FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
181 return E_NOINTERFACE;
184 static ULONG WINAPI primary_AddRef(IDirectManipulationPrimaryContent *iface)
186 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
187 ULONG ref = InterlockedIncrement(&This->ref);
189 TRACE("(%p) ref=%lu\n", This, ref);
191 return ref;
194 static ULONG WINAPI primary_Release(IDirectManipulationPrimaryContent *iface)
196 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
197 ULONG ref = InterlockedDecrement(&This->ref);
199 TRACE("(%p) ref=%lu\n", This, ref);
201 if (!ref)
203 free(This);
205 return ref;
208 static HRESULT WINAPI primary_SetSnapInterval(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
209 float interval, float offset)
211 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
212 FIXME("%p, %d, %f, %f\n", This, motion, interval, offset);
213 return E_NOTIMPL;
216 static HRESULT WINAPI primary_SetSnapPoints(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
217 const float *points, DWORD count)
219 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
220 FIXME("%p, %d, %p, %ld\n", This, motion, points, count);
221 return E_NOTIMPL;
224 static HRESULT WINAPI primary_SetSnapType(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
225 DIRECTMANIPULATION_SNAPPOINT_TYPE type)
227 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
228 FIXME("%p, %d, %d\n", This, motion, type);
229 return E_NOTIMPL;
232 static HRESULT WINAPI primary_SetSnapCoordinate(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
233 DIRECTMANIPULATION_SNAPPOINT_COORDINATE coordinate, float origin)
235 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
236 FIXME("%p, %d, %d, %f\n", This, motion, coordinate, origin);
237 return E_NOTIMPL;
240 static HRESULT WINAPI primary_SetZoomBoundaries(IDirectManipulationPrimaryContent *iface, float minimum, float maximum)
242 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
243 FIXME("%p, %f, %f\n", This, minimum, maximum);
244 return E_NOTIMPL;
247 static HRESULT WINAPI primary_SetHorizontalAlignment(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_HORIZONTALALIGNMENT alignment)
249 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
250 FIXME("%p, %d\n", This, alignment);
251 return E_NOTIMPL;
254 static HRESULT WINAPI primary_SetVerticalAlignment(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_VERTICALALIGNMENT alignment)
256 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
257 FIXME("%p, %d\n", This, alignment);
258 return E_NOTIMPL;
261 static HRESULT WINAPI primary_GetInertiaEndTransform(IDirectManipulationPrimaryContent *iface, float *matrix, DWORD count)
263 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
264 FIXME("%p, %p, %ld\n", This, matrix, count);
265 return E_NOTIMPL;
268 static HRESULT WINAPI primary_GetCenterPoint(IDirectManipulationPrimaryContent *iface, float *x, float *y)
270 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
271 FIXME("%p, %p, %p\n", This, x, y);
272 return E_NOTIMPL;
275 static const IDirectManipulationPrimaryContentVtbl primaryVtbl =
277 primary_QueryInterface,
278 primary_AddRef,
279 primary_Release,
280 primary_SetSnapInterval,
281 primary_SetSnapPoints,
282 primary_SetSnapType,
283 primary_SetSnapCoordinate,
284 primary_SetZoomBoundaries,
285 primary_SetHorizontalAlignment,
286 primary_SetVerticalAlignment,
287 primary_GetInertiaEndTransform,
288 primary_GetCenterPoint
292 static HRESULT WINAPI content_QueryInterface(IDirectManipulationContent *iface, REFIID riid, void **ppv)
294 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
295 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
297 return IDirectManipulationPrimaryContent_QueryInterface(&This->IDirectManipulationPrimaryContent_iface,
298 riid, ppv);
301 static ULONG WINAPI content_AddRef(IDirectManipulationContent *iface)
303 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
304 return IDirectManipulationPrimaryContent_AddRef(&This->IDirectManipulationPrimaryContent_iface);
307 static ULONG WINAPI content_Release(IDirectManipulationContent *iface)
309 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
310 return IDirectManipulationPrimaryContent_Release(&This->IDirectManipulationPrimaryContent_iface);
313 static HRESULT WINAPI content_GetContentRect(IDirectManipulationContent *iface, RECT *size)
315 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
316 FIXME("%p, %p\n", This, size);
317 return E_NOTIMPL;
320 static HRESULT WINAPI content_SetContentRect(IDirectManipulationContent *iface, const RECT *size)
322 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
323 FIXME("%p, %p\n", This, size);
324 return S_OK;
327 static HRESULT WINAPI content_GetViewport(IDirectManipulationContent *iface, REFIID riid, void **object)
329 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
330 FIXME("%p, %s, %p\n", This, debugstr_guid(riid), object);
331 return E_NOTIMPL;
334 static HRESULT WINAPI content_GetTag(IDirectManipulationContent *iface, REFIID riid, void **object, UINT32 *id)
336 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
337 FIXME("%p, %s, %p, %p\n", This, debugstr_guid(riid), object, id);
338 return E_NOTIMPL;
341 static HRESULT WINAPI content_SetTag(IDirectManipulationContent *iface, IUnknown *object, UINT32 id)
343 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
344 FIXME("%p, %p, %d\n", This, object, id);
345 return E_NOTIMPL;
348 static HRESULT WINAPI content_GetOutputTransform(IDirectManipulationContent *iface,
349 float *matrix, DWORD count)
351 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
352 FIXME("%p, %p, %ld\n", This, matrix, count);
353 return E_NOTIMPL;
356 static HRESULT WINAPI content_GetContentTransform(IDirectManipulationContent *iface,
357 float *matrix, DWORD count)
359 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
360 FIXME("%p, %p, %ld\n", This, matrix, count);
361 return E_NOTIMPL;
364 static HRESULT WINAPI content_SyncContentTransform(IDirectManipulationContent *iface,
365 const float *matrix, DWORD count)
367 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
368 FIXME("%p, %p, %ld\n", This, matrix, count);
369 return E_NOTIMPL;
372 static const IDirectManipulationContentVtbl contentVtbl =
374 content_QueryInterface,
375 content_AddRef,
376 content_Release,
377 content_GetContentRect,
378 content_SetContentRect,
379 content_GetViewport,
380 content_GetTag,
381 content_SetTag,
382 content_GetOutputTransform,
383 content_GetContentTransform,
384 content_SyncContentTransform
387 struct directviewport
389 IDirectManipulationViewport2 IDirectManipulationViewport2_iface;
390 LONG ref;
393 static inline struct directviewport *impl_from_IDirectManipulationViewport2(IDirectManipulationViewport2 *iface)
395 return CONTAINING_RECORD(iface, struct directviewport, IDirectManipulationViewport2_iface);
398 static HRESULT WINAPI viewport_QueryInterface(IDirectManipulationViewport2 *iface, REFIID riid, void **ppv)
400 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
401 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
403 if (IsEqualGUID(riid, &IID_IUnknown) ||
404 IsEqualGUID(riid, &IID_IDirectManipulationViewport) ||
405 IsEqualGUID(riid, &IID_IDirectManipulationViewport2))
407 IDirectManipulationViewport2_AddRef(&This->IDirectManipulationViewport2_iface);
408 *ppv = &This->IDirectManipulationViewport2_iface;
409 return S_OK;
412 FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
413 return E_NOINTERFACE;
416 static ULONG WINAPI viewport_AddRef(IDirectManipulationViewport2 *iface)
418 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
419 ULONG ref = InterlockedIncrement(&This->ref);
421 TRACE("(%p) ref=%lu\n", This, ref);
423 return ref;
426 static ULONG WINAPI viewport_Release(IDirectManipulationViewport2 *iface)
428 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
429 ULONG ref = InterlockedDecrement(&This->ref);
431 TRACE("(%p) ref=%lu\n", This, ref);
433 if (!ref)
435 free(This);
437 return ref;
440 static HRESULT WINAPI viewport_Enable(IDirectManipulationViewport2 *iface)
442 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
443 FIXME("%p\n", This);
444 return E_NOTIMPL;
447 static HRESULT WINAPI viewport_Disable(IDirectManipulationViewport2 *iface)
449 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
450 FIXME("%p\n", This);
451 return E_NOTIMPL;
454 static HRESULT WINAPI viewport_SetContact(IDirectManipulationViewport2 *iface, UINT32 id)
456 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
457 FIXME("%p, %d\n", This, id);
458 return E_NOTIMPL;
461 static HRESULT WINAPI viewport_ReleaseContact(IDirectManipulationViewport2 *iface, UINT32 id)
463 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
464 FIXME("%p, %d\n", This, id);
465 return E_NOTIMPL;
468 static HRESULT WINAPI viewport_ReleaseAllContacts(IDirectManipulationViewport2 *iface)
470 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
471 FIXME("%p\n", This);
472 return E_NOTIMPL;
475 static HRESULT WINAPI viewport_GetStatus(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_STATUS *status)
477 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
478 FIXME("%p, %p\n", This, status);
479 return E_NOTIMPL;
482 static HRESULT WINAPI viewport_GetTag(IDirectManipulationViewport2 *iface, REFIID riid, void **object, UINT32 *id)
484 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
485 FIXME("%p, %s, %p, %p\n", This, debugstr_guid(riid), object, id);
486 return E_NOTIMPL;
489 static HRESULT WINAPI viewport_SetTag(IDirectManipulationViewport2 *iface, IUnknown *object, UINT32 id)
491 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
492 FIXME("%p, %p, %u\n", This, object, id);
493 return E_NOTIMPL;
496 static HRESULT WINAPI viewport_GetViewportRect(IDirectManipulationViewport2 *iface, RECT *viewport)
498 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
499 FIXME("%p, %p\n", This, viewport);
500 return E_NOTIMPL;
503 static HRESULT WINAPI viewport_SetViewportRect(IDirectManipulationViewport2 *iface, const RECT *viewport)
505 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
506 FIXME("%p, %p\n", This, viewport);
507 return S_OK;
510 static HRESULT WINAPI viewport_ZoomToRect(IDirectManipulationViewport2 *iface, const float left,
511 const float top, const float right, const float bottom, BOOL animate)
513 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
514 FIXME("%p, %f, %f, %f, %f, %d\n", This, left, top, right, bottom, animate);
515 return E_NOTIMPL;
518 static HRESULT WINAPI viewport_SetViewportTransform(IDirectManipulationViewport2 *iface,
519 const float *matrix, DWORD count)
521 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
522 FIXME("%p, %p, %ld\n", This, matrix, count);
523 return E_NOTIMPL;
526 static HRESULT WINAPI viewport_SyncDisplayTransform(IDirectManipulationViewport2 *iface,
527 const float *matrix, DWORD count)
529 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
530 FIXME("%p, %p, %ld\n", This, matrix, count);
531 return E_NOTIMPL;
534 static HRESULT WINAPI viewport_GetPrimaryContent(IDirectManipulationViewport2 *iface, REFIID riid, void **object)
536 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
537 TRACE("%p, %s, %p\n", This, debugstr_guid(riid), object);
538 if(IsEqualGUID(riid, &IID_IDirectManipulationPrimaryContent))
540 struct primarycontext *primary;
541 TRACE("IDirectManipulationPrimaryContent\n");
542 primary = malloc( sizeof(*primary));
543 if(!primary)
544 return E_OUTOFMEMORY;
546 primary->IDirectManipulationPrimaryContent_iface.lpVtbl = &primaryVtbl;
547 primary->IDirectManipulationContent_iface.lpVtbl = &contentVtbl;
548 primary->ref = 1;
550 *object = &primary->IDirectManipulationPrimaryContent_iface;
552 return S_OK;
554 else
555 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
556 return E_NOTIMPL;
559 static HRESULT WINAPI viewport_AddContent(IDirectManipulationViewport2 *iface, IDirectManipulationContent *content)
561 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
562 FIXME("%p, %p\n", This, content);
563 return E_NOTIMPL;
566 static HRESULT WINAPI viewport_RemoveContent(IDirectManipulationViewport2 *iface, IDirectManipulationContent *content)
568 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
569 FIXME("%p, %p\n", This, content);
570 return E_NOTIMPL;
573 static HRESULT WINAPI viewport_SetViewportOptions(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_VIEWPORT_OPTIONS options)
575 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
576 FIXME("%p, %d\n", This, options);
577 return S_OK;
580 static HRESULT WINAPI viewport_AddConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
582 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
583 FIXME("%p, %d\n", This, configuration);
584 return E_NOTIMPL;
587 static HRESULT WINAPI viewport_RemoveConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
589 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
590 FIXME("%p, %d\n", This, configuration);
591 return E_NOTIMPL;
594 static HRESULT WINAPI viewport_ActivateConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
596 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
597 FIXME("%p, %d\n", This, configuration);
598 return S_OK;
601 static HRESULT WINAPI viewport_SetManualGesture(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_GESTURE_CONFIGURATION configuration)
603 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
604 FIXME("%p, %d\n", This, configuration);
605 return E_NOTIMPL;
608 static HRESULT WINAPI viewport_SetChaining(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_MOTION_TYPES enabledTypes)
610 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
611 FIXME("%p, %d\n", This, enabledTypes);
612 return E_NOTIMPL;
615 static HRESULT WINAPI viewport_AddEventHandler(IDirectManipulationViewport2 *iface, HWND window,
616 IDirectManipulationViewportEventHandler *eventHandler, DWORD *cookie)
618 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
619 FIXME("%p, %p, %p, %p\n", This, window, eventHandler, cookie);
620 return E_NOTIMPL;
623 static HRESULT WINAPI viewport_RemoveEventHandler(IDirectManipulationViewport2 *iface, DWORD cookie)
625 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
626 FIXME("%p, %ld\n", This, cookie);
627 return E_NOTIMPL;
630 static HRESULT WINAPI viewport_SetInputMode(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_INPUT_MODE mode)
632 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
633 FIXME("%p, %d\n", This, mode);
634 return E_NOTIMPL;
637 static HRESULT WINAPI viewport_SetUpdateMode(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_INPUT_MODE mode)
639 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
640 FIXME("%p, %d\n", This, mode);
641 return E_NOTIMPL;
644 static HRESULT WINAPI viewport_Stop(IDirectManipulationViewport2 *iface)
646 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
647 FIXME("%p\n", This);
648 return E_NOTIMPL;
651 static HRESULT WINAPI viewport_Abandon(IDirectManipulationViewport2 *iface)
653 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
654 FIXME("%p\n", This);
655 return E_NOTIMPL;
658 static HRESULT WINAPI viewport_AddBehavior(IDirectManipulationViewport2 *iface, IUnknown *behavior, DWORD *cookie)
660 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
661 FIXME("%p, %p, %p\n", This, behavior, cookie);
662 return E_NOTIMPL;
665 static HRESULT WINAPI viewport_RemoveBehavior(IDirectManipulationViewport2 *iface, DWORD cookie)
667 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
668 FIXME("%p, %ld\n", This, cookie);
669 return E_NOTIMPL;
672 static HRESULT WINAPI viewport_RemoveAllBehaviors(IDirectManipulationViewport2 *iface)
674 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
675 FIXME("%p\n", This);
676 return E_NOTIMPL;
679 static const IDirectManipulationViewport2Vtbl viewportVtbl =
681 viewport_QueryInterface,
682 viewport_AddRef,
683 viewport_Release,
684 viewport_Enable,
685 viewport_Disable,
686 viewport_SetContact,
687 viewport_ReleaseContact,
688 viewport_ReleaseAllContacts,
689 viewport_GetStatus,
690 viewport_GetTag,
691 viewport_SetTag,
692 viewport_GetViewportRect,
693 viewport_SetViewportRect,
694 viewport_ZoomToRect,
695 viewport_SetViewportTransform,
696 viewport_SyncDisplayTransform,
697 viewport_GetPrimaryContent,
698 viewport_AddContent,
699 viewport_RemoveContent,
700 viewport_SetViewportOptions,
701 viewport_AddConfiguration,
702 viewport_RemoveConfiguration,
703 viewport_ActivateConfiguration,
704 viewport_SetManualGesture,
705 viewport_SetChaining,
706 viewport_AddEventHandler,
707 viewport_RemoveEventHandler,
708 viewport_SetInputMode,
709 viewport_SetUpdateMode,
710 viewport_Stop,
711 viewport_Abandon,
712 viewport_AddBehavior,
713 viewport_RemoveBehavior,
714 viewport_RemoveAllBehaviors
717 static HRESULT create_viewport(IDirectManipulationViewport2 **obj)
719 struct directviewport *object;
721 object = malloc(sizeof(*object));
722 if(!object)
723 return E_OUTOFMEMORY;
725 object->IDirectManipulationViewport2_iface.lpVtbl = &viewportVtbl;
726 object->ref = 1;
728 *obj = &object->IDirectManipulationViewport2_iface;
730 return S_OK;
733 static HRESULT WINAPI direct_manip_QueryInterface(IDirectManipulationManager2 *iface, REFIID riid, void **ppv)
735 if (IsEqualGUID(riid, &IID_IUnknown) ||
736 IsEqualGUID(riid, &IID_IDirectManipulationManager) ||
737 IsEqualGUID(riid, &IID_IDirectManipulationManager2)) {
738 IUnknown_AddRef(iface);
739 *ppv = iface;
740 return S_OK;
743 FIXME("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
744 return E_NOINTERFACE;
747 static ULONG WINAPI direct_manip_AddRef(IDirectManipulationManager2 *iface)
749 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
750 ULONG ref = InterlockedIncrement(&This->ref);
752 TRACE("(%p) ref=%lu\n", This, ref);
754 return ref;
757 static ULONG WINAPI direct_manip_Release(IDirectManipulationManager2 *iface)
759 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
760 ULONG ref = InterlockedDecrement(&This->ref);
762 TRACE("(%p) ref=%lu\n", This, ref);
764 if (!ref)
766 if(This->updatemanager)
767 IDirectManipulationUpdateManager_Release(This->updatemanager);
768 free(This);
770 return ref;
773 static HRESULT WINAPI direct_manip_Activate(IDirectManipulationManager2 *iface, HWND window)
775 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
776 FIXME("%p, %p\n", This, window);
777 return E_NOTIMPL;
780 static HRESULT WINAPI direct_manip_Deactivate(IDirectManipulationManager2 *iface, HWND window)
782 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
783 FIXME("%p, %p\n", This, window);
784 return E_NOTIMPL;
787 static HRESULT WINAPI direct_manip_RegisterHitTestTarget(IDirectManipulationManager2 *iface, HWND window,
788 HWND hittest, DIRECTMANIPULATION_HITTEST_TYPE type)
790 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
791 FIXME("%p, %p, %p, %d\n", This, window, hittest, type);
792 return E_NOTIMPL;
795 static HRESULT WINAPI direct_manip_ProcessInput(IDirectManipulationManager2 *iface, const MSG *msg, BOOL *handled)
797 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
798 FIXME("%p, %p, %p\n", This, msg, handled);
799 return E_NOTIMPL;
802 static HRESULT WINAPI direct_manip_GetUpdateManager(IDirectManipulationManager2 *iface, REFIID riid, void **obj)
804 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
805 HRESULT hr = E_FAIL;
807 TRACE("%p, %s, %p\n", This, debugstr_guid(riid), obj);
809 *obj = NULL;
810 if(IsEqualGUID(riid, &IID_IDirectManipulationUpdateManager))
812 if(!This->updatemanager)
814 hr = create_update_manager(&This->updatemanager);
816 else
818 hr = S_OK;
821 if(hr == S_OK)
823 IDirectManipulationUpdateManager_AddRef(This->updatemanager);
824 *obj = This->updatemanager;
827 else
828 FIXME("Interface %s currently not supported.\n", debugstr_guid(riid));
830 return hr;
833 static HRESULT WINAPI direct_manip_CreateViewport(IDirectManipulationManager2 *iface, IDirectManipulationFrameInfoProvider *frame,
834 HWND window, REFIID riid, void **obj)
836 HRESULT hr = E_NOTIMPL;
837 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
838 TRACE("%p, %p, %p, %s, %p\n", This, frame, window, debugstr_guid(riid), obj);
840 if(IsEqualGUID(riid, &IID_IDirectManipulationViewport) ||
841 IsEqualGUID(riid, &IID_IDirectManipulationViewport2) )
843 hr = create_viewport( (IDirectManipulationViewport2**)obj);
845 else
846 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
847 return hr;
850 static HRESULT WINAPI direct_manip_CreateContent(IDirectManipulationManager2 *iface, IDirectManipulationFrameInfoProvider *frame,
851 REFCLSID clsid, REFIID riid, void **obj)
853 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
854 FIXME("%p, %p, %s, %p\n", This, frame, debugstr_guid(riid), obj);
855 return E_NOTIMPL;
858 static HRESULT WINAPI direct_manip_CreateBehavior(IDirectManipulationManager2 *iface, REFCLSID clsid, REFIID riid, void **obj)
860 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
861 FIXME("%p, %s, %s, %p\n", This, debugstr_guid(clsid), debugstr_guid(riid), obj);
862 return E_NOTIMPL;
865 static const struct IDirectManipulationManager2Vtbl directmanipVtbl =
867 direct_manip_QueryInterface,
868 direct_manip_AddRef,
869 direct_manip_Release,
870 direct_manip_Activate,
871 direct_manip_Deactivate,
872 direct_manip_RegisterHitTestTarget,
873 direct_manip_ProcessInput,
874 direct_manip_GetUpdateManager,
875 direct_manip_CreateViewport,
876 direct_manip_CreateContent,
877 direct_manip_CreateBehavior
880 static HRESULT WINAPI DirectManipulation_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
882 struct directmanipulation *object;
883 HRESULT ret;
885 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
887 *ppv = NULL;
889 object = calloc(1, sizeof(*object));
890 if (!object)
891 return E_OUTOFMEMORY;
893 object->IDirectManipulationManager2_iface.lpVtbl = &directmanipVtbl;
894 object->ref = 1;
896 ret = direct_manip_QueryInterface(&object->IDirectManipulationManager2_iface, riid, ppv);
897 direct_manip_Release(&object->IDirectManipulationManager2_iface);
899 return ret;
902 struct directcompositor
904 IDirectManipulationCompositor2 IDirectManipulationCompositor2_iface;
905 IDirectManipulationFrameInfoProvider IDirectManipulationFrameInfoProvider_iface;
906 IDirectManipulationUpdateManager *manager;
907 LONG ref;
910 static inline struct directcompositor *impl_from_IDirectManipulationCompositor2(IDirectManipulationCompositor2 *iface)
912 return CONTAINING_RECORD(iface, struct directcompositor, IDirectManipulationCompositor2_iface);
915 static inline struct directcompositor *impl_from_IDirectManipulationFrameInfoProvider(IDirectManipulationFrameInfoProvider *iface)
917 return CONTAINING_RECORD(iface, struct directcompositor, IDirectManipulationFrameInfoProvider_iface);
920 static HRESULT WINAPI compositor_QueryInterface(IDirectManipulationCompositor2 *iface, REFIID riid, void **ppv)
922 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
924 if (IsEqualGUID(riid, &IID_IUnknown) ||
925 IsEqualGUID(riid, &IID_IDirectManipulationCompositor) ||
926 IsEqualGUID(riid, &IID_IDirectManipulationCompositor2))
928 IUnknown_AddRef(iface);
929 *ppv = iface;
930 return S_OK;
932 else if(IsEqualGUID(riid, &IID_IDirectManipulationFrameInfoProvider))
934 IUnknown_AddRef(iface);
935 *ppv = &This->IDirectManipulationFrameInfoProvider_iface;
936 return S_OK;
939 FIXME("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
940 return E_NOINTERFACE;
943 static ULONG WINAPI compositor_AddRef(IDirectManipulationCompositor2 *iface)
945 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
946 ULONG ref = InterlockedIncrement(&This->ref);
948 TRACE("(%p) ref=%lu\n", This, ref);
950 return ref;
953 static ULONG WINAPI compositor_Release(IDirectManipulationCompositor2 *iface)
955 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
956 ULONG ref = InterlockedDecrement(&This->ref);
958 TRACE("(%p) ref=%lu\n", This, ref);
960 if (!ref)
962 if(This->manager)
963 IDirectManipulationUpdateManager_Release(This->manager);
964 free(This);
966 return ref;
969 static HRESULT WINAPI compositor_AddContent(IDirectManipulationCompositor2 *iface, IDirectManipulationContent *content,
970 IUnknown *device, IUnknown *parent, IUnknown *child)
972 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
973 FIXME("%p, %p, %p, %p, %p\n", This, content, device, parent, child);
974 return E_NOTIMPL;
977 static HRESULT WINAPI compositor_RemoveContent(IDirectManipulationCompositor2 *iface, IDirectManipulationContent *content)
979 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
980 FIXME("%p, %p\n", This, content);
981 return E_NOTIMPL;
984 static HRESULT WINAPI compositor_SetUpdateManager(IDirectManipulationCompositor2 *iface, IDirectManipulationUpdateManager *manager)
986 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
987 TRACE("%p, %p\n", This, manager);
989 if(!manager)
990 return E_INVALIDARG;
992 This->manager = manager;
993 IDirectManipulationUpdateManager_AddRef(This->manager);
994 return S_OK;
997 static HRESULT WINAPI compositor_Flush(IDirectManipulationCompositor2 *iface)
999 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1000 FIXME("%p\n", This);
1001 return E_NOTIMPL;
1004 static HRESULT WINAPI compositor_AddContentWithCrossProcessChaining(IDirectManipulationCompositor2 *iface,
1005 IDirectManipulationPrimaryContent *content, IUnknown *device, IUnknown *parentvisual, IUnknown *childvisual)
1007 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1008 FIXME("%p %p %p %p %p\n", This, content, device, parentvisual, childvisual);
1009 return E_NOTIMPL;
1012 static const struct IDirectManipulationCompositor2Vtbl compositorVtbl =
1014 compositor_QueryInterface,
1015 compositor_AddRef,
1016 compositor_Release,
1017 compositor_AddContent,
1018 compositor_RemoveContent,
1019 compositor_SetUpdateManager,
1020 compositor_Flush,
1021 compositor_AddContentWithCrossProcessChaining
1024 static HRESULT WINAPI provider_QueryInterface(IDirectManipulationFrameInfoProvider *iface, REFIID riid, void **ppv)
1026 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1027 return IDirectManipulationCompositor2_QueryInterface(&This->IDirectManipulationCompositor2_iface, riid, ppv);
1030 static ULONG WINAPI provider_AddRef(IDirectManipulationFrameInfoProvider *iface)
1032 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1033 return IDirectManipulationCompositor2_AddRef(&This->IDirectManipulationCompositor2_iface);
1036 static ULONG WINAPI provider_Release(IDirectManipulationFrameInfoProvider *iface)
1038 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1039 return IDirectManipulationCompositor2_Release(&This->IDirectManipulationCompositor2_iface);
1042 static HRESULT WINAPI provider_GetNextFrameInfo(IDirectManipulationFrameInfoProvider *iface, ULONGLONG *time,
1043 ULONGLONG *process, ULONGLONG *composition)
1045 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1046 FIXME("%p, %p, %p, %p\n", This, time, process, composition);
1047 return E_NOTIMPL;
1050 static const struct IDirectManipulationFrameInfoProviderVtbl providerVtbl =
1052 provider_QueryInterface,
1053 provider_AddRef,
1054 provider_Release,
1055 provider_GetNextFrameInfo
1058 static HRESULT WINAPI DirectCompositor_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
1060 struct directcompositor *object;
1061 HRESULT ret;
1063 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
1065 *ppv = NULL;
1067 object = calloc(1, sizeof(*object));
1068 if (!object)
1069 return E_OUTOFMEMORY;
1071 object->IDirectManipulationCompositor2_iface.lpVtbl = &compositorVtbl;
1072 object->IDirectManipulationFrameInfoProvider_iface.lpVtbl = &providerVtbl;
1073 object->ref = 1;
1075 ret = compositor_QueryInterface(&object->IDirectManipulationCompositor2_iface, riid, ppv);
1076 compositor_Release(&object->IDirectManipulationCompositor2_iface);
1078 return ret;
1081 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
1083 *ppv = NULL;
1085 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) {
1086 *ppv = iface;
1089 if(*ppv) {
1090 IUnknown_AddRef((IUnknown*)*ppv);
1091 return S_OK;
1094 WARN("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
1095 return E_NOINTERFACE;
1098 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
1100 TRACE("(%p)\n", iface);
1101 return 2;
1104 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
1106 TRACE("(%p)\n", iface);
1107 return 1;
1110 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
1112 TRACE("(%p)->(%x)\n", iface, fLock);
1113 return S_OK;
1116 static const IClassFactoryVtbl DirectFactoryVtbl = {
1117 ClassFactory_QueryInterface,
1118 ClassFactory_AddRef,
1119 ClassFactory_Release,
1120 DirectManipulation_CreateInstance,
1121 ClassFactory_LockServer
1124 static const IClassFactoryVtbl DirectCompositorVtbl = {
1125 ClassFactory_QueryInterface,
1126 ClassFactory_AddRef,
1127 ClassFactory_Release,
1128 DirectCompositor_CreateInstance,
1129 ClassFactory_LockServer
1132 static IClassFactory direct_factory = { &DirectFactoryVtbl };
1133 static IClassFactory compositor_factory = { &DirectCompositorVtbl };
1135 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
1137 if(IsEqualGUID(&CLSID_DirectManipulationManager, rclsid) ||
1138 IsEqualGUID(&CLSID_DirectManipulationSharedManager, rclsid) ) {
1139 TRACE("(CLSID_DirectManipulationManager %s %p)\n", debugstr_guid(riid), ppv);
1140 return IClassFactory_QueryInterface(&direct_factory, riid, ppv);
1142 else if(IsEqualGUID(&CLSID_DCompManipulationCompositor, rclsid)) {
1143 TRACE("(CLSID_DCompManipulationCompositor %s %p)\n", debugstr_guid(riid), ppv);
1144 return IClassFactory_QueryInterface(&compositor_factory, riid, ppv);
1147 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1148 return CLASS_E_CLASSNOTAVAILABLE;