mfplat: Read queue subscriber within the critical section.
[wine/zf.git] / dlls / directmanipulation / directmanipulation.c
blob5db998ee9c8074447c2cc07c92d976765d5eb14b
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 static HINSTANCE dm_instance;
35 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
37 TRACE("(%p, %u, %p)\n", instance, reason, reserved);
39 switch (reason)
41 case DLL_PROCESS_ATTACH:
42 dm_instance = instance;
43 DisableThreadLibraryCalls(instance);
44 break;
47 return TRUE;
50 HRESULT WINAPI DllRegisterServer(void)
52 return __wine_register_resources( dm_instance );
55 HRESULT WINAPI DllUnregisterServer(void)
57 return __wine_unregister_resources( dm_instance );
60 HRESULT WINAPI DllCanUnloadNow(void)
62 return S_FALSE;
66 struct directmanipulation
68 IDirectManipulationManager2 IDirectManipulationManager2_iface;
69 IDirectManipulationUpdateManager *updatemanager;
70 LONG ref;
73 struct directupdatemanager
75 IDirectManipulationUpdateManager IDirectManipulationUpdateManager_iface;
76 LONG ref;
79 static inline struct directmanipulation *impl_from_IDirectManipulationManager2(IDirectManipulationManager2 *iface)
81 return CONTAINING_RECORD(iface, struct directmanipulation, IDirectManipulationManager2_iface);
84 static inline struct directupdatemanager *impl_from_IDirectManipulationUpdateManager(IDirectManipulationUpdateManager *iface)
86 return CONTAINING_RECORD(iface, struct directupdatemanager, IDirectManipulationUpdateManager_iface);
89 static HRESULT WINAPI update_manager_QueryInterface(IDirectManipulationUpdateManager *iface, REFIID riid,void **ppv)
91 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
93 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
95 if (IsEqualGUID(riid, &IID_IUnknown) ||
96 IsEqualGUID(riid, &IID_IDirectManipulationUpdateManager)) {
97 IUnknown_AddRef(iface);
98 *ppv = iface;
99 return S_OK;
102 FIXME("(%p)->(%s,%p), not found\n", This, debugstr_guid(riid), ppv);
103 return E_NOINTERFACE;
106 ULONG WINAPI update_manager_AddRef(IDirectManipulationUpdateManager *iface)
108 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
109 ULONG ref = InterlockedIncrement(&This->ref);
111 TRACE("(%p) ref=%u\n", This, ref);
113 return ref;
116 ULONG WINAPI update_manager_Release(IDirectManipulationUpdateManager *iface)
118 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
119 ULONG ref = InterlockedDecrement(&This->ref);
121 TRACE("(%p) ref=%u\n", This, ref);
123 if (!ref)
125 heap_free(This);
127 return ref;
130 static HRESULT WINAPI update_manager_RegisterWaitHandleCallback(IDirectManipulationUpdateManager *iface, HANDLE handle,
131 IDirectManipulationUpdateHandler *handler, DWORD *cookie)
133 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
134 FIXME("%p, %p, %p, %p\n", This, handle, handler, cookie);
135 return E_NOTIMPL;
138 static HRESULT WINAPI update_manager_UnregisterWaitHandleCallback(IDirectManipulationUpdateManager *iface, DWORD cookie)
140 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
141 FIXME("%p, %x\n", This, cookie);
142 return E_NOTIMPL;
145 static HRESULT WINAPI update_manager_Update(IDirectManipulationUpdateManager *iface, IDirectManipulationFrameInfoProvider *provider)
147 struct directupdatemanager *This = impl_from_IDirectManipulationUpdateManager(iface);
148 FIXME("%p, %p\n", This, provider);
149 return E_NOTIMPL;
152 struct IDirectManipulationUpdateManagerVtbl updatemanagerVtbl =
154 update_manager_QueryInterface,
155 update_manager_AddRef,
156 update_manager_Release,
157 update_manager_RegisterWaitHandleCallback,
158 update_manager_UnregisterWaitHandleCallback,
159 update_manager_Update
162 static HRESULT create_update_manager(IDirectManipulationUpdateManager **obj)
164 struct directupdatemanager *object;
166 object = heap_alloc(sizeof(*object));
167 if(!object)
168 return E_OUTOFMEMORY;
170 object->IDirectManipulationUpdateManager_iface.lpVtbl = &updatemanagerVtbl;
171 object->ref = 1;
173 *obj = &object->IDirectManipulationUpdateManager_iface;
175 return S_OK;
178 struct primarycontext
180 IDirectManipulationPrimaryContent IDirectManipulationPrimaryContent_iface;
181 IDirectManipulationContent IDirectManipulationContent_iface;
182 LONG ref;
185 static inline struct primarycontext *impl_from_IDirectManipulationPrimaryContent(IDirectManipulationPrimaryContent *iface)
187 return CONTAINING_RECORD(iface, struct primarycontext, IDirectManipulationPrimaryContent_iface);
190 static inline struct primarycontext *impl_from_IDirectManipulationContent(IDirectManipulationContent *iface)
192 return CONTAINING_RECORD(iface, struct primarycontext, IDirectManipulationContent_iface);
195 static HRESULT WINAPI primary_QueryInterface(IDirectManipulationPrimaryContent *iface, REFIID riid, void **ppv)
197 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
198 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
200 if (IsEqualGUID(riid, &IID_IUnknown) ||
201 IsEqualGUID(riid, &IID_IDirectManipulationPrimaryContent))
203 IDirectManipulationPrimaryContent_AddRef(&This->IDirectManipulationPrimaryContent_iface);
204 *ppv = &This->IDirectManipulationPrimaryContent_iface;
205 return S_OK;
207 else if(IsEqualGUID(riid, &IID_IDirectManipulationContent))
209 IUnknown_AddRef(iface);
210 *ppv = &This->IDirectManipulationContent_iface;
211 return S_OK;
214 FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
215 return E_NOINTERFACE;
218 static ULONG WINAPI primary_AddRef(IDirectManipulationPrimaryContent *iface)
220 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
221 ULONG ref = InterlockedIncrement(&This->ref);
223 TRACE("(%p) ref=%u\n", This, ref);
225 return ref;
228 static ULONG WINAPI primary_Release(IDirectManipulationPrimaryContent *iface)
230 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
231 ULONG ref = InterlockedDecrement(&This->ref);
233 TRACE("(%p) ref=%u\n", This, ref);
235 if (!ref)
237 heap_free(This);
239 return ref;
242 static HRESULT WINAPI primary_SetSnapInterval(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
243 float interval, float offset)
245 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
246 FIXME("%p, %d, %f, %f\n", This, motion, interval, offset);
247 return E_NOTIMPL;
250 static HRESULT WINAPI primary_SetSnapPoints(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
251 const float *points, DWORD count)
253 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
254 FIXME("%p, %d, %p, %d\n", This, motion, points, count);
255 return E_NOTIMPL;
258 static HRESULT WINAPI primary_SetSnapType(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
259 DIRECTMANIPULATION_SNAPPOINT_TYPE type)
261 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
262 FIXME("%p, %d, %d\n", This, motion, type);
263 return E_NOTIMPL;
266 static HRESULT WINAPI primary_SetSnapCoordinate(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_MOTION_TYPES motion,
267 DIRECTMANIPULATION_SNAPPOINT_COORDINATE coordinate, float origin)
269 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
270 FIXME("%p, %d, %d, %f\n", This, motion, coordinate, origin);
271 return E_NOTIMPL;
274 static HRESULT WINAPI primary_SetZoomBoundaries(IDirectManipulationPrimaryContent *iface, float minimum, float maximum)
276 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
277 FIXME("%p, %f, %f\n", This, minimum, maximum);
278 return E_NOTIMPL;
281 static HRESULT WINAPI primary_SetHorizontalAlignment(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_HORIZONTALALIGNMENT alignment)
283 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
284 FIXME("%p, %d\n", This, alignment);
285 return E_NOTIMPL;
288 static HRESULT WINAPI primary_SetVerticalAlignment(IDirectManipulationPrimaryContent *iface, DIRECTMANIPULATION_VERTICALALIGNMENT alignment)
290 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
291 FIXME("%p, %d\n", This, alignment);
292 return E_NOTIMPL;
295 static HRESULT WINAPI primary_GetInertiaEndTransform(IDirectManipulationPrimaryContent *iface, float *matrix, DWORD count)
297 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
298 FIXME("%p, %p, %d\n", This, matrix, count);
299 return E_NOTIMPL;
302 static HRESULT WINAPI primary_GetCenterPoint(IDirectManipulationPrimaryContent *iface, float *x, float *y)
304 struct primarycontext *This = impl_from_IDirectManipulationPrimaryContent(iface);
305 FIXME("%p, %p, %p\n", This, x, y);
306 return E_NOTIMPL;
309 static const IDirectManipulationPrimaryContentVtbl primaryVtbl =
311 primary_QueryInterface,
312 primary_AddRef,
313 primary_Release,
314 primary_SetSnapInterval,
315 primary_SetSnapPoints,
316 primary_SetSnapType,
317 primary_SetSnapCoordinate,
318 primary_SetZoomBoundaries,
319 primary_SetHorizontalAlignment,
320 primary_SetVerticalAlignment,
321 primary_GetInertiaEndTransform,
322 primary_GetCenterPoint
326 static HRESULT WINAPI content_QueryInterface(IDirectManipulationContent *iface, REFIID riid, void **ppv)
328 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
329 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
331 return IDirectManipulationPrimaryContent_QueryInterface(&This->IDirectManipulationPrimaryContent_iface,
332 riid, ppv);
335 static ULONG WINAPI content_AddRef(IDirectManipulationContent *iface)
337 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
338 return IDirectManipulationPrimaryContent_AddRef(&This->IDirectManipulationPrimaryContent_iface);
341 static ULONG WINAPI content_Release(IDirectManipulationContent *iface)
343 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
344 return IDirectManipulationPrimaryContent_Release(&This->IDirectManipulationPrimaryContent_iface);
347 static HRESULT WINAPI content_GetContentRect(IDirectManipulationContent *iface, RECT *size)
349 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
350 FIXME("%p, %p\n", This, size);
351 return E_NOTIMPL;
354 static HRESULT WINAPI content_SetContentRect(IDirectManipulationContent *iface, const RECT *size)
356 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
357 FIXME("%p, %p\n", This, size);
358 return S_OK;
361 static HRESULT WINAPI content_GetViewport(IDirectManipulationContent *iface, REFIID riid, void **object)
363 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
364 FIXME("%p, %s, %p\n", This, debugstr_guid(riid), object);
365 return E_NOTIMPL;
368 static HRESULT WINAPI content_GetTag(IDirectManipulationContent *iface, REFIID riid, void **object, UINT32 *id)
370 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
371 FIXME("%p, %s, %p, %p\n", This, debugstr_guid(riid), object, id);
372 return E_NOTIMPL;
375 static HRESULT WINAPI content_SetTag(IDirectManipulationContent *iface, IUnknown *object, UINT32 id)
377 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
378 FIXME("%p, %p, %d\n", This, object, id);
379 return E_NOTIMPL;
382 static HRESULT WINAPI content_GetOutputTransform(IDirectManipulationContent *iface,
383 float *matrix, DWORD count)
385 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
386 FIXME("%p, %p, %d\n", This, matrix, count);
387 return E_NOTIMPL;
390 static HRESULT WINAPI content_GetContentTransform(IDirectManipulationContent *iface,
391 float *matrix, DWORD count)
393 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
394 FIXME("%p, %p, %d\n", This, matrix, count);
395 return E_NOTIMPL;
398 static HRESULT WINAPI content_SyncContentTransform(IDirectManipulationContent *iface,
399 const float *matrix, DWORD count)
401 struct primarycontext *This = impl_from_IDirectManipulationContent(iface);
402 FIXME("%p, %p, %d\n", This, matrix, count);
403 return E_NOTIMPL;
406 static const IDirectManipulationContentVtbl contentVtbl =
408 content_QueryInterface,
409 content_AddRef,
410 content_Release,
411 content_GetContentRect,
412 content_SetContentRect,
413 content_GetViewport,
414 content_GetTag,
415 content_SetTag,
416 content_GetOutputTransform,
417 content_GetContentTransform,
418 content_SyncContentTransform
421 struct directviewport
423 IDirectManipulationViewport2 IDirectManipulationViewport2_iface;
424 LONG ref;
427 static inline struct directviewport *impl_from_IDirectManipulationViewport2(IDirectManipulationViewport2 *iface)
429 return CONTAINING_RECORD(iface, struct directviewport, IDirectManipulationViewport2_iface);
432 static HRESULT WINAPI viewport_QueryInterface(IDirectManipulationViewport2 *iface, REFIID riid, void **ppv)
434 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
435 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
437 if (IsEqualGUID(riid, &IID_IUnknown) ||
438 IsEqualGUID(riid, &IID_IDirectManipulationViewport) ||
439 IsEqualGUID(riid, &IID_IDirectManipulationViewport2))
441 IDirectManipulationViewport2_AddRef(&This->IDirectManipulationViewport2_iface);
442 *ppv = &This->IDirectManipulationViewport2_iface;
443 return S_OK;
446 FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
447 return E_NOINTERFACE;
450 static ULONG WINAPI viewport_AddRef(IDirectManipulationViewport2 *iface)
452 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
453 ULONG ref = InterlockedIncrement(&This->ref);
455 TRACE("(%p) ref=%u\n", This, ref);
457 return ref;
460 static ULONG WINAPI viewport_Release(IDirectManipulationViewport2 *iface)
462 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
463 ULONG ref = InterlockedDecrement(&This->ref);
465 TRACE("(%p) ref=%u\n", This, ref);
467 if (!ref)
469 heap_free(This);
471 return ref;
474 static HRESULT WINAPI viewport_Enable(IDirectManipulationViewport2 *iface)
476 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
477 FIXME("%p\n", This);
478 return E_NOTIMPL;
481 static HRESULT WINAPI viewport_Disable(IDirectManipulationViewport2 *iface)
483 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
484 FIXME("%p\n", This);
485 return E_NOTIMPL;
488 static HRESULT WINAPI viewport_SetContact(IDirectManipulationViewport2 *iface, UINT32 id)
490 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
491 FIXME("%p, %d\n", This, id);
492 return E_NOTIMPL;
495 static HRESULT WINAPI viewport_ReleaseContact(IDirectManipulationViewport2 *iface, UINT32 id)
497 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
498 FIXME("%p, %d\n", This, id);
499 return E_NOTIMPL;
502 static HRESULT WINAPI viewport_ReleaseAllContacts(IDirectManipulationViewport2 *iface)
504 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
505 FIXME("%p\n", This);
506 return E_NOTIMPL;
509 static HRESULT WINAPI viewport_GetStatus(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_STATUS *status)
511 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
512 FIXME("%p, %p\n", This, status);
513 return E_NOTIMPL;
516 static HRESULT WINAPI viewport_GetTag(IDirectManipulationViewport2 *iface, REFIID riid, void **object, UINT32 *id)
518 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
519 FIXME("%p, %s, %p, %p\n", This, debugstr_guid(riid), object, id);
520 return E_NOTIMPL;
523 static HRESULT WINAPI viewport_SetTag(IDirectManipulationViewport2 *iface, IUnknown *object, UINT32 id)
525 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
526 FIXME("%p, %p, %u\n", This, object, id);
527 return E_NOTIMPL;
530 static HRESULT WINAPI viewport_GetViewportRect(IDirectManipulationViewport2 *iface, RECT *viewport)
532 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
533 FIXME("%p, %p\n", This, viewport);
534 return E_NOTIMPL;
537 static HRESULT WINAPI viewport_SetViewportRect(IDirectManipulationViewport2 *iface, const RECT *viewport)
539 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
540 FIXME("%p, %p\n", This, viewport);
541 return S_OK;
544 static HRESULT WINAPI viewport_ZoomToRect(IDirectManipulationViewport2 *iface, const float left,
545 const float top, const float right, const float bottom, BOOL animate)
547 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
548 FIXME("%p, %f, %f, %f, %f, %d\n", This, left, top, right, bottom, animate);
549 return E_NOTIMPL;
552 static HRESULT WINAPI viewport_SetViewportTransform(IDirectManipulationViewport2 *iface,
553 const float *matrix, DWORD count)
555 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
556 FIXME("%p, %p, %d\n", This, matrix, count);
557 return E_NOTIMPL;
560 static HRESULT WINAPI viewport_SyncDisplayTransform(IDirectManipulationViewport2 *iface,
561 const float *matrix, DWORD count)
563 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
564 FIXME("%p, %p, %d\n", This, matrix, count);
565 return E_NOTIMPL;
568 static HRESULT WINAPI viewport_GetPrimaryContent(IDirectManipulationViewport2 *iface, REFIID riid, void **object)
570 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
571 TRACE("%p, %s, %p\n", This, debugstr_guid(riid), object);
572 if(IsEqualGUID(riid, &IID_IDirectManipulationPrimaryContent))
574 struct primarycontext *primary;
575 TRACE("IDirectManipulationPrimaryContent\n");
576 primary = heap_alloc( sizeof(*primary));
577 if(!primary)
578 return E_OUTOFMEMORY;
580 primary->IDirectManipulationPrimaryContent_iface.lpVtbl = &primaryVtbl;
581 primary->IDirectManipulationContent_iface.lpVtbl = &contentVtbl;
582 primary->ref = 1;
584 *object = &primary->IDirectManipulationPrimaryContent_iface;
586 return S_OK;
588 else
589 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
590 return E_NOTIMPL;
593 static HRESULT WINAPI viewport_AddContent(IDirectManipulationViewport2 *iface, IDirectManipulationContent *content)
595 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
596 FIXME("%p, %p\n", This, content);
597 return E_NOTIMPL;
600 static HRESULT WINAPI viewport_RemoveContent(IDirectManipulationViewport2 *iface, IDirectManipulationContent *content)
602 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
603 FIXME("%p, %p\n", This, content);
604 return E_NOTIMPL;
607 static HRESULT WINAPI viewport_SetViewportOptions(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_VIEWPORT_OPTIONS options)
609 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
610 FIXME("%p, %d\n", This, options);
611 return S_OK;
614 static HRESULT WINAPI viewport_AddConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
616 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
617 FIXME("%p, %d\n", This, configuration);
618 return E_NOTIMPL;
621 static HRESULT WINAPI viewport_RemoveConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
623 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
624 FIXME("%p, %d\n", This, configuration);
625 return E_NOTIMPL;
628 static HRESULT WINAPI viewport_ActivateConfiguration(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_CONFIGURATION configuration)
630 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
631 FIXME("%p, %d\n", This, configuration);
632 return S_OK;
635 static HRESULT WINAPI viewport_SetManualGesture(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_GESTURE_CONFIGURATION configuration)
637 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
638 FIXME("%p, %d\n", This, configuration);
639 return E_NOTIMPL;
642 static HRESULT WINAPI viewport_SetChaining(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_MOTION_TYPES enabledTypes)
644 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
645 FIXME("%p, %d\n", This, enabledTypes);
646 return E_NOTIMPL;
649 static HRESULT WINAPI viewport_AddEventHandler(IDirectManipulationViewport2 *iface, HWND window,
650 IDirectManipulationViewportEventHandler *eventHandler, DWORD *cookie)
652 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
653 FIXME("%p, %p, %p, %p\n", This, window, eventHandler, cookie);
654 return E_NOTIMPL;
657 static HRESULT WINAPI viewport_RemoveEventHandler(IDirectManipulationViewport2 *iface, DWORD cookie)
659 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
660 FIXME("%p, %d\n", This, cookie);
661 return E_NOTIMPL;
664 static HRESULT WINAPI viewport_SetInputMode(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_INPUT_MODE mode)
666 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
667 FIXME("%p, %d\n", This, mode);
668 return E_NOTIMPL;
671 static HRESULT WINAPI viewport_SetUpdateMode(IDirectManipulationViewport2 *iface, DIRECTMANIPULATION_INPUT_MODE mode)
673 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
674 FIXME("%p, %d\n", This, mode);
675 return E_NOTIMPL;
678 static HRESULT WINAPI viewport_Stop(IDirectManipulationViewport2 *iface)
680 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
681 FIXME("%p\n", This);
682 return E_NOTIMPL;
685 static HRESULT WINAPI viewport_Abandon(IDirectManipulationViewport2 *iface)
687 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
688 FIXME("%p\n", This);
689 return E_NOTIMPL;
692 static HRESULT WINAPI viewport_AddBehavior(IDirectManipulationViewport2 *iface, IUnknown *behavior, DWORD *cookie)
694 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
695 FIXME("%p, %p, %p\n", This, behavior, cookie);
696 return E_NOTIMPL;
699 static HRESULT WINAPI viewport_RemoveBehavior(IDirectManipulationViewport2 *iface, DWORD cookie)
701 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
702 FIXME("%p, %d\n", This, cookie);
703 return E_NOTIMPL;
706 static HRESULT WINAPI viewport_RemoveAllBehaviors(IDirectManipulationViewport2 *iface)
708 struct directviewport *This = impl_from_IDirectManipulationViewport2(iface);
709 FIXME("%p\n", This);
710 return E_NOTIMPL;
713 static const IDirectManipulationViewport2Vtbl viewportVtbl =
715 viewport_QueryInterface,
716 viewport_AddRef,
717 viewport_Release,
718 viewport_Enable,
719 viewport_Disable,
720 viewport_SetContact,
721 viewport_ReleaseContact,
722 viewport_ReleaseAllContacts,
723 viewport_GetStatus,
724 viewport_GetTag,
725 viewport_SetTag,
726 viewport_GetViewportRect,
727 viewport_SetViewportRect,
728 viewport_ZoomToRect,
729 viewport_SetViewportTransform,
730 viewport_SyncDisplayTransform,
731 viewport_GetPrimaryContent,
732 viewport_AddContent,
733 viewport_RemoveContent,
734 viewport_SetViewportOptions,
735 viewport_AddConfiguration,
736 viewport_RemoveConfiguration,
737 viewport_ActivateConfiguration,
738 viewport_SetManualGesture,
739 viewport_SetChaining,
740 viewport_AddEventHandler,
741 viewport_RemoveEventHandler,
742 viewport_SetInputMode,
743 viewport_SetUpdateMode,
744 viewport_Stop,
745 viewport_Abandon,
746 viewport_AddBehavior,
747 viewport_RemoveBehavior,
748 viewport_RemoveAllBehaviors
751 static HRESULT create_viewport(IDirectManipulationViewport2 **obj)
753 struct directviewport *object;
755 object = heap_alloc(sizeof(*object));
756 if(!object)
757 return E_OUTOFMEMORY;
759 object->IDirectManipulationViewport2_iface.lpVtbl = &viewportVtbl;
760 object->ref = 1;
762 *obj = &object->IDirectManipulationViewport2_iface;
764 return S_OK;
767 static HRESULT WINAPI direct_manip_QueryInterface(IDirectManipulationManager2 *iface, REFIID riid, void **ppv)
769 if (IsEqualGUID(riid, &IID_IUnknown) ||
770 IsEqualGUID(riid, &IID_IDirectManipulationManager) ||
771 IsEqualGUID(riid, &IID_IDirectManipulationManager2)) {
772 IUnknown_AddRef(iface);
773 *ppv = iface;
774 return S_OK;
777 FIXME("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
778 return E_NOINTERFACE;
781 static ULONG WINAPI direct_manip_AddRef(IDirectManipulationManager2 *iface)
783 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
784 ULONG ref = InterlockedIncrement(&This->ref);
786 TRACE("(%p) ref=%u\n", This, ref);
788 return ref;
791 static ULONG WINAPI direct_manip_Release(IDirectManipulationManager2 *iface)
793 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
794 ULONG ref = InterlockedDecrement(&This->ref);
796 TRACE("(%p) ref=%u\n", This, ref);
798 if (!ref)
800 if(This->updatemanager)
801 IDirectManipulationUpdateManager_Release(This->updatemanager);
802 heap_free(This);
804 return ref;
807 static HRESULT WINAPI direct_manip_Activate(IDirectManipulationManager2 *iface, HWND window)
809 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
810 FIXME("%p, %p\n", This, window);
811 return E_NOTIMPL;
814 static HRESULT WINAPI direct_manip_Deactivate(IDirectManipulationManager2 *iface, HWND window)
816 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
817 FIXME("%p, %p\n", This, window);
818 return E_NOTIMPL;
821 static HRESULT WINAPI direct_manip_RegisterHitTestTarget(IDirectManipulationManager2 *iface, HWND window,
822 HWND hittest, DIRECTMANIPULATION_HITTEST_TYPE type)
824 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
825 FIXME("%p, %p, %p, %d\n", This, window, hittest, type);
826 return E_NOTIMPL;
829 static HRESULT WINAPI direct_manip_ProcessInput(IDirectManipulationManager2 *iface, const MSG *msg, BOOL *handled)
831 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
832 FIXME("%p, %p, %p\n", This, msg, handled);
833 return E_NOTIMPL;
836 static HRESULT WINAPI direct_manip_GetUpdateManager(IDirectManipulationManager2 *iface, REFIID riid, void **obj)
838 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
839 HRESULT hr = E_FAIL;
841 TRACE("%p, %s, %p\n", This, debugstr_guid(riid), obj);
843 *obj = NULL;
844 if(IsEqualGUID(riid, &IID_IDirectManipulationUpdateManager))
846 if(!This->updatemanager)
848 hr = create_update_manager(&This->updatemanager);
850 else
852 hr = S_OK;
855 if(hr == S_OK)
857 IDirectManipulationUpdateManager_AddRef(This->updatemanager);
858 *obj = This->updatemanager;
861 else
862 FIXME("Interface %s currently not supported.\n", debugstr_guid(riid));
864 return hr;
867 static HRESULT WINAPI direct_manip_CreateViewport(IDirectManipulationManager2 *iface, IDirectManipulationFrameInfoProvider *frame,
868 HWND window, REFIID riid, void **obj)
870 HRESULT hr = E_NOTIMPL;
871 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
872 TRACE("%p, %p, %p, %s, %p\n", This, frame, window, debugstr_guid(riid), obj);
874 if(IsEqualGUID(riid, &IID_IDirectManipulationViewport) ||
875 IsEqualGUID(riid, &IID_IDirectManipulationViewport2) )
877 hr = create_viewport( (IDirectManipulationViewport2**)obj);
879 else
880 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
881 return hr;
884 static HRESULT WINAPI direct_manip_CreateContent(IDirectManipulationManager2 *iface, IDirectManipulationFrameInfoProvider *frame,
885 REFCLSID clsid, REFIID riid, void **obj)
887 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
888 FIXME("%p, %p, %s, %p\n", This, frame, debugstr_guid(riid), obj);
889 return E_NOTIMPL;
892 static HRESULT WINAPI direct_manip_CreateBehavior(IDirectManipulationManager2 *iface, REFCLSID clsid, REFIID riid, void **obj)
894 struct directmanipulation *This = impl_from_IDirectManipulationManager2(iface);
895 FIXME("%p, %s, %s, %p\n", This, debugstr_guid(clsid), debugstr_guid(riid), obj);
896 return E_NOTIMPL;
899 static const struct IDirectManipulationManager2Vtbl directmanipVtbl =
901 direct_manip_QueryInterface,
902 direct_manip_AddRef,
903 direct_manip_Release,
904 direct_manip_Activate,
905 direct_manip_Deactivate,
906 direct_manip_RegisterHitTestTarget,
907 direct_manip_ProcessInput,
908 direct_manip_GetUpdateManager,
909 direct_manip_CreateViewport,
910 direct_manip_CreateContent,
911 direct_manip_CreateBehavior
914 static HRESULT WINAPI DirectManipulation_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
916 struct directmanipulation *object;
917 HRESULT ret;
919 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
921 *ppv = NULL;
923 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
924 if (!object)
925 return E_OUTOFMEMORY;
927 object->IDirectManipulationManager2_iface.lpVtbl = &directmanipVtbl;
928 object->ref = 1;
930 ret = direct_manip_QueryInterface(&object->IDirectManipulationManager2_iface, riid, ppv);
931 direct_manip_Release(&object->IDirectManipulationManager2_iface);
933 return ret;
936 struct directcompositor
938 IDirectManipulationCompositor2 IDirectManipulationCompositor2_iface;
939 IDirectManipulationFrameInfoProvider IDirectManipulationFrameInfoProvider_iface;
940 IDirectManipulationUpdateManager *manager;
941 LONG ref;
944 static inline struct directcompositor *impl_from_IDirectManipulationCompositor2(IDirectManipulationCompositor2 *iface)
946 return CONTAINING_RECORD(iface, struct directcompositor, IDirectManipulationCompositor2_iface);
949 static inline struct directcompositor *impl_from_IDirectManipulationFrameInfoProvider(IDirectManipulationFrameInfoProvider *iface)
951 return CONTAINING_RECORD(iface, struct directcompositor, IDirectManipulationFrameInfoProvider_iface);
954 static HRESULT WINAPI compositor_QueryInterface(IDirectManipulationCompositor2 *iface, REFIID riid, void **ppv)
956 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
958 if (IsEqualGUID(riid, &IID_IUnknown) ||
959 IsEqualGUID(riid, &IID_IDirectManipulationCompositor) ||
960 IsEqualGUID(riid, &IID_IDirectManipulationCompositor2))
962 IUnknown_AddRef(iface);
963 *ppv = iface;
964 return S_OK;
966 else if(IsEqualGUID(riid, &IID_IDirectManipulationFrameInfoProvider))
968 IUnknown_AddRef(iface);
969 *ppv = &This->IDirectManipulationFrameInfoProvider_iface;
970 return S_OK;
973 FIXME("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
974 return E_NOINTERFACE;
977 static ULONG WINAPI compositor_AddRef(IDirectManipulationCompositor2 *iface)
979 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
980 ULONG ref = InterlockedIncrement(&This->ref);
982 TRACE("(%p) ref=%u\n", This, ref);
984 return ref;
987 static ULONG WINAPI compositor_Release(IDirectManipulationCompositor2 *iface)
989 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
990 ULONG ref = InterlockedDecrement(&This->ref);
992 TRACE("(%p) ref=%u\n", This, ref);
994 if (!ref)
996 if(This->manager)
997 IDirectManipulationUpdateManager_Release(This->manager);
998 heap_free(This);
1000 return ref;
1003 static HRESULT WINAPI compositor_AddContent(IDirectManipulationCompositor2 *iface, IDirectManipulationContent *content,
1004 IUnknown *device, IUnknown *parent, IUnknown *child)
1006 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1007 FIXME("%p, %p, %p, %p, %p\n", This, content, device, parent, child);
1008 return E_NOTIMPL;
1011 static HRESULT WINAPI compositor_RemoveContent(IDirectManipulationCompositor2 *iface, IDirectManipulationContent *content)
1013 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1014 FIXME("%p, %p\n", This, content);
1015 return E_NOTIMPL;
1018 static HRESULT WINAPI compositor_SetUpdateManager(IDirectManipulationCompositor2 *iface, IDirectManipulationUpdateManager *manager)
1020 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1021 TRACE("%p, %p\n", This, manager);
1023 if(!manager)
1024 return E_INVALIDARG;
1026 This->manager = manager;
1027 IDirectManipulationUpdateManager_AddRef(This->manager);
1028 return S_OK;
1031 static HRESULT WINAPI compositor_Flush(IDirectManipulationCompositor2 *iface)
1033 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1034 FIXME("%p\n", This);
1035 return E_NOTIMPL;
1038 static HRESULT WINAPI compositor_AddContentWithCrossProcessChaining(IDirectManipulationCompositor2 *iface,
1039 IDirectManipulationPrimaryContent *content, IUnknown *device, IUnknown *parentvisual, IUnknown *childvisual)
1041 struct directcompositor *This = impl_from_IDirectManipulationCompositor2(iface);
1042 FIXME("%p %p %p %p %p\n", This, content, device, parentvisual, childvisual);
1043 return E_NOTIMPL;
1046 static const struct IDirectManipulationCompositor2Vtbl compositorVtbl =
1048 compositor_QueryInterface,
1049 compositor_AddRef,
1050 compositor_Release,
1051 compositor_AddContent,
1052 compositor_RemoveContent,
1053 compositor_SetUpdateManager,
1054 compositor_Flush,
1055 compositor_AddContentWithCrossProcessChaining
1058 static HRESULT WINAPI provider_QueryInterface(IDirectManipulationFrameInfoProvider *iface, REFIID riid, void **ppv)
1060 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1061 return IDirectManipulationCompositor2_QueryInterface(&This->IDirectManipulationCompositor2_iface, riid, ppv);
1064 static ULONG WINAPI provider_AddRef(IDirectManipulationFrameInfoProvider *iface)
1066 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1067 return IDirectManipulationCompositor2_AddRef(&This->IDirectManipulationCompositor2_iface);
1070 static ULONG WINAPI provider_Release(IDirectManipulationFrameInfoProvider *iface)
1072 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1073 return IDirectManipulationCompositor2_Release(&This->IDirectManipulationCompositor2_iface);
1076 static HRESULT WINAPI provider_GetNextFrameInfo(IDirectManipulationFrameInfoProvider *iface, ULONGLONG *time,
1077 ULONGLONG *process, ULONGLONG *composition)
1079 struct directcompositor *This = impl_from_IDirectManipulationFrameInfoProvider(iface);
1080 FIXME("%p, %p, %p, %p\n", This, time, process, composition);
1081 return E_NOTIMPL;
1084 static const struct IDirectManipulationFrameInfoProviderVtbl providerVtbl =
1086 provider_QueryInterface,
1087 provider_AddRef,
1088 provider_Release,
1089 provider_GetNextFrameInfo
1092 static HRESULT WINAPI DirectCompositor_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
1094 struct directcompositor *object;
1095 HRESULT ret;
1097 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
1099 *ppv = NULL;
1101 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1102 if (!object)
1103 return E_OUTOFMEMORY;
1105 object->IDirectManipulationCompositor2_iface.lpVtbl = &compositorVtbl;
1106 object->IDirectManipulationFrameInfoProvider_iface.lpVtbl = &providerVtbl;
1107 object->ref = 1;
1109 ret = compositor_QueryInterface(&object->IDirectManipulationCompositor2_iface, riid, ppv);
1110 compositor_Release(&object->IDirectManipulationCompositor2_iface);
1112 return ret;
1115 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
1117 *ppv = NULL;
1119 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) {
1120 *ppv = iface;
1123 if(*ppv) {
1124 IUnknown_AddRef((IUnknown*)*ppv);
1125 return S_OK;
1128 WARN("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
1129 return E_NOINTERFACE;
1132 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
1134 TRACE("(%p)\n", iface);
1135 return 2;
1138 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
1140 TRACE("(%p)\n", iface);
1141 return 1;
1144 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
1146 TRACE("(%p)->(%x)\n", iface, fLock);
1147 return S_OK;
1150 static const IClassFactoryVtbl DirectFactoryVtbl = {
1151 ClassFactory_QueryInterface,
1152 ClassFactory_AddRef,
1153 ClassFactory_Release,
1154 DirectManipulation_CreateInstance,
1155 ClassFactory_LockServer
1158 static const IClassFactoryVtbl DirectCompositorVtbl = {
1159 ClassFactory_QueryInterface,
1160 ClassFactory_AddRef,
1161 ClassFactory_Release,
1162 DirectCompositor_CreateInstance,
1163 ClassFactory_LockServer
1166 static IClassFactory direct_factory = { &DirectFactoryVtbl };
1167 static IClassFactory compositor_factory = { &DirectCompositorVtbl };
1169 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
1171 if(IsEqualGUID(&CLSID_DirectManipulationManager, rclsid) ||
1172 IsEqualGUID(&CLSID_DirectManipulationSharedManager, rclsid) ) {
1173 TRACE("(CLSID_DirectManipulationManager %s %p)\n", debugstr_guid(riid), ppv);
1174 return IClassFactory_QueryInterface(&direct_factory, riid, ppv);
1176 else if(IsEqualGUID(&CLSID_DCompManipulationCompositor, rclsid)) {
1177 TRACE("(CLSID_DCompManipulationCompositor %s %p)\n", debugstr_guid(riid), ppv);
1178 return IClassFactory_QueryInterface(&compositor_factory, riid, ppv);
1181 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1182 return CLASS_E_CLASSNOTAVAILABLE;