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
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
);
41 case DLL_WINE_PREATTACH
:
42 return FALSE
; /* prefer native version */
43 case DLL_PROCESS_ATTACH
:
44 dm_instance
= instance
;
45 DisableThreadLibraryCalls(instance
);
52 HRESULT WINAPI
DllRegisterServer(void)
54 return __wine_register_resources( dm_instance
);
57 HRESULT WINAPI
DllUnregisterServer(void)
59 return __wine_unregister_resources( dm_instance
);
62 HRESULT WINAPI
DllCanUnloadNow(void)
68 struct directmanipulation
70 IDirectManipulationManager2 IDirectManipulationManager2_iface
;
71 IDirectManipulationUpdateManager
*updatemanager
;
75 struct directupdatemanager
77 IDirectManipulationUpdateManager IDirectManipulationUpdateManager_iface
;
81 static inline struct directmanipulation
*impl_from_IDirectManipulationManager2(IDirectManipulationManager2
*iface
)
83 return CONTAINING_RECORD(iface
, struct directmanipulation
, IDirectManipulationManager2_iface
);
86 static inline struct directupdatemanager
*impl_from_IDirectManipulationUpdateManager(IDirectManipulationUpdateManager
*iface
)
88 return CONTAINING_RECORD(iface
, struct directupdatemanager
, IDirectManipulationUpdateManager_iface
);
91 static HRESULT WINAPI
update_manager_QueryInterface(IDirectManipulationUpdateManager
*iface
, REFIID riid
,void **ppv
)
93 struct directupdatemanager
*This
= impl_from_IDirectManipulationUpdateManager(iface
);
95 TRACE("(%p)->(%s,%p)\n", This
, debugstr_guid(riid
), ppv
);
97 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
98 IsEqualGUID(riid
, &IID_IDirectManipulationUpdateManager
)) {
99 IUnknown_AddRef(iface
);
104 FIXME("(%p)->(%s,%p), not found\n", This
, debugstr_guid(riid
), ppv
);
105 return E_NOINTERFACE
;
108 ULONG WINAPI
update_manager_AddRef(IDirectManipulationUpdateManager
*iface
)
110 struct directupdatemanager
*This
= impl_from_IDirectManipulationUpdateManager(iface
);
111 ULONG ref
= InterlockedIncrement(&This
->ref
);
113 TRACE("(%p) ref=%u\n", This
, ref
);
118 ULONG WINAPI
update_manager_Release(IDirectManipulationUpdateManager
*iface
)
120 struct directupdatemanager
*This
= impl_from_IDirectManipulationUpdateManager(iface
);
121 ULONG ref
= InterlockedDecrement(&This
->ref
);
123 TRACE("(%p) ref=%u\n", This
, ref
);
132 static HRESULT WINAPI
update_manager_RegisterWaitHandleCallback(IDirectManipulationUpdateManager
*iface
, HANDLE handle
,
133 IDirectManipulationUpdateHandler
*handler
, DWORD
*cookie
)
135 struct directupdatemanager
*This
= impl_from_IDirectManipulationUpdateManager(iface
);
136 FIXME("%p, %p, %p, %p\n", This
, handle
, handler
, cookie
);
140 static HRESULT WINAPI
update_manager_UnregisterWaitHandleCallback(IDirectManipulationUpdateManager
*iface
, DWORD cookie
)
142 struct directupdatemanager
*This
= impl_from_IDirectManipulationUpdateManager(iface
);
143 FIXME("%p, %x\n", This
, cookie
);
147 static HRESULT WINAPI
update_manager_Update(IDirectManipulationUpdateManager
*iface
, IDirectManipulationFrameInfoProvider
*provider
)
149 struct directupdatemanager
*This
= impl_from_IDirectManipulationUpdateManager(iface
);
150 FIXME("%p, %p\n", This
, provider
);
154 struct IDirectManipulationUpdateManagerVtbl updatemanagerVtbl
=
156 update_manager_QueryInterface
,
157 update_manager_AddRef
,
158 update_manager_Release
,
159 update_manager_RegisterWaitHandleCallback
,
160 update_manager_UnregisterWaitHandleCallback
,
161 update_manager_Update
164 static HRESULT
create_update_manager(IDirectManipulationUpdateManager
**obj
)
166 struct directupdatemanager
*object
;
168 object
= heap_alloc(sizeof(*object
));
170 return E_OUTOFMEMORY
;
172 object
->IDirectManipulationUpdateManager_iface
.lpVtbl
= &updatemanagerVtbl
;
175 *obj
= &object
->IDirectManipulationUpdateManager_iface
;
180 struct primarycontext
182 IDirectManipulationPrimaryContent IDirectManipulationPrimaryContent_iface
;
183 IDirectManipulationContent IDirectManipulationContent_iface
;
187 static inline struct primarycontext
*impl_from_IDirectManipulationPrimaryContent(IDirectManipulationPrimaryContent
*iface
)
189 return CONTAINING_RECORD(iface
, struct primarycontext
, IDirectManipulationPrimaryContent_iface
);
192 static inline struct primarycontext
*impl_from_IDirectManipulationContent(IDirectManipulationContent
*iface
)
194 return CONTAINING_RECORD(iface
, struct primarycontext
, IDirectManipulationContent_iface
);
197 static HRESULT WINAPI
primary_QueryInterface(IDirectManipulationPrimaryContent
*iface
, REFIID riid
, void **ppv
)
199 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
200 TRACE("(%p)->(%s,%p)\n", This
, debugstr_guid(riid
), ppv
);
202 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
203 IsEqualGUID(riid
, &IID_IDirectManipulationPrimaryContent
))
205 IDirectManipulationPrimaryContent_AddRef(&This
->IDirectManipulationPrimaryContent_iface
);
206 *ppv
= &This
->IDirectManipulationPrimaryContent_iface
;
209 else if(IsEqualGUID(riid
, &IID_IDirectManipulationContent
))
211 IUnknown_AddRef(iface
);
212 *ppv
= &This
->IDirectManipulationContent_iface
;
216 FIXME("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppv
);
217 return E_NOINTERFACE
;
220 static ULONG WINAPI
primary_AddRef(IDirectManipulationPrimaryContent
*iface
)
222 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
223 ULONG ref
= InterlockedIncrement(&This
->ref
);
225 TRACE("(%p) ref=%u\n", This
, ref
);
230 static ULONG WINAPI
primary_Release(IDirectManipulationPrimaryContent
*iface
)
232 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
233 ULONG ref
= InterlockedDecrement(&This
->ref
);
235 TRACE("(%p) ref=%u\n", This
, ref
);
244 static HRESULT WINAPI
primary_SetSnapInterval(IDirectManipulationPrimaryContent
*iface
, DIRECTMANIPULATION_MOTION_TYPES motion
,
245 float interval
, float offset
)
247 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
248 FIXME("%p, %d, %f, %f\n", This
, motion
, interval
, offset
);
252 static HRESULT WINAPI
primary_SetSnapPoints(IDirectManipulationPrimaryContent
*iface
, DIRECTMANIPULATION_MOTION_TYPES motion
,
253 const float *points
, DWORD count
)
255 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
256 FIXME("%p, %d, %p, %d\n", This
, motion
, points
, count
);
260 static HRESULT WINAPI
primary_SetSnapType(IDirectManipulationPrimaryContent
*iface
, DIRECTMANIPULATION_MOTION_TYPES motion
,
261 DIRECTMANIPULATION_SNAPPOINT_TYPE type
)
263 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
264 FIXME("%p, %d, %d\n", This
, motion
, type
);
268 static HRESULT WINAPI
primary_SetSnapCoordinate(IDirectManipulationPrimaryContent
*iface
, DIRECTMANIPULATION_MOTION_TYPES motion
,
269 DIRECTMANIPULATION_SNAPPOINT_COORDINATE coordinate
, float origin
)
271 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
272 FIXME("%p, %d, %d, %f\n", This
, motion
, coordinate
, origin
);
276 static HRESULT WINAPI
primary_SetZoomBoundaries(IDirectManipulationPrimaryContent
*iface
, float minimum
, float maximum
)
278 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
279 FIXME("%p, %f, %f\n", This
, minimum
, maximum
);
283 static HRESULT WINAPI
primary_SetHorizontalAlignment(IDirectManipulationPrimaryContent
*iface
, DIRECTMANIPULATION_HORIZONTALALIGNMENT alignment
)
285 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
286 FIXME("%p, %d\n", This
, alignment
);
290 static HRESULT WINAPI
primary_SetVerticalAlignment(IDirectManipulationPrimaryContent
*iface
, DIRECTMANIPULATION_VERTICALALIGNMENT alignment
)
292 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
293 FIXME("%p, %d\n", This
, alignment
);
297 static HRESULT WINAPI
primary_GetInertiaEndTransform(IDirectManipulationPrimaryContent
*iface
, float *matrix
, DWORD count
)
299 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
300 FIXME("%p, %p, %d\n", This
, matrix
, count
);
304 static HRESULT WINAPI
primary_GetCenterPoint(IDirectManipulationPrimaryContent
*iface
, float *x
, float *y
)
306 struct primarycontext
*This
= impl_from_IDirectManipulationPrimaryContent(iface
);
307 FIXME("%p, %p, %p\n", This
, x
, y
);
311 static const IDirectManipulationPrimaryContentVtbl primaryVtbl
=
313 primary_QueryInterface
,
316 primary_SetSnapInterval
,
317 primary_SetSnapPoints
,
319 primary_SetSnapCoordinate
,
320 primary_SetZoomBoundaries
,
321 primary_SetHorizontalAlignment
,
322 primary_SetVerticalAlignment
,
323 primary_GetInertiaEndTransform
,
324 primary_GetCenterPoint
328 static HRESULT WINAPI
content_QueryInterface(IDirectManipulationContent
*iface
, REFIID riid
, void **ppv
)
330 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
331 TRACE("(%p)->(%s,%p)\n", This
, debugstr_guid(riid
), ppv
);
333 return IDirectManipulationPrimaryContent_QueryInterface(&This
->IDirectManipulationPrimaryContent_iface
,
337 static ULONG WINAPI
content_AddRef(IDirectManipulationContent
*iface
)
339 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
340 return IDirectManipulationPrimaryContent_AddRef(&This
->IDirectManipulationPrimaryContent_iface
);
343 static ULONG WINAPI
content_Release(IDirectManipulationContent
*iface
)
345 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
346 return IDirectManipulationPrimaryContent_Release(&This
->IDirectManipulationPrimaryContent_iface
);
349 static HRESULT WINAPI
content_GetContentRect(IDirectManipulationContent
*iface
, RECT
*size
)
351 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
352 FIXME("%p, %p\n", This
, size
);
356 static HRESULT WINAPI
content_SetContentRect(IDirectManipulationContent
*iface
, const RECT
*size
)
358 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
359 FIXME("%p, %p\n", This
, size
);
363 static HRESULT WINAPI
content_GetViewport(IDirectManipulationContent
*iface
, REFIID riid
, void **object
)
365 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
366 FIXME("%p, %s, %p\n", This
, debugstr_guid(riid
), object
);
370 static HRESULT WINAPI
content_GetTag(IDirectManipulationContent
*iface
, REFIID riid
, void **object
, UINT32
*id
)
372 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
373 FIXME("%p, %s, %p, %p\n", This
, debugstr_guid(riid
), object
, id
);
377 static HRESULT WINAPI
content_SetTag(IDirectManipulationContent
*iface
, IUnknown
*object
, UINT32 id
)
379 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
380 FIXME("%p, %p, %d\n", This
, object
, id
);
384 static HRESULT WINAPI
content_GetOutputTransform(IDirectManipulationContent
*iface
,
385 float *matrix
, DWORD count
)
387 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
388 FIXME("%p, %p, %d\n", This
, matrix
, count
);
392 static HRESULT WINAPI
content_GetContentTransform(IDirectManipulationContent
*iface
,
393 float *matrix
, DWORD count
)
395 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
396 FIXME("%p, %p, %d\n", This
, matrix
, count
);
400 static HRESULT WINAPI
content_SyncContentTransform(IDirectManipulationContent
*iface
,
401 const float *matrix
, DWORD count
)
403 struct primarycontext
*This
= impl_from_IDirectManipulationContent(iface
);
404 FIXME("%p, %p, %d\n", This
, matrix
, count
);
408 static const IDirectManipulationContentVtbl contentVtbl
=
410 content_QueryInterface
,
413 content_GetContentRect
,
414 content_SetContentRect
,
418 content_GetOutputTransform
,
419 content_GetContentTransform
,
420 content_SyncContentTransform
423 struct directviewport
425 IDirectManipulationViewport2 IDirectManipulationViewport2_iface
;
429 static inline struct directviewport
*impl_from_IDirectManipulationViewport2(IDirectManipulationViewport2
*iface
)
431 return CONTAINING_RECORD(iface
, struct directviewport
, IDirectManipulationViewport2_iface
);
434 static HRESULT WINAPI
viewport_QueryInterface(IDirectManipulationViewport2
*iface
, REFIID riid
, void **ppv
)
436 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
437 TRACE("(%p)->(%s,%p)\n", This
, debugstr_guid(riid
), ppv
);
439 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
440 IsEqualGUID(riid
, &IID_IDirectManipulationViewport
) ||
441 IsEqualGUID(riid
, &IID_IDirectManipulationViewport2
))
443 IDirectManipulationViewport2_AddRef(&This
->IDirectManipulationViewport2_iface
);
444 *ppv
= &This
->IDirectManipulationViewport2_iface
;
448 FIXME("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppv
);
449 return E_NOINTERFACE
;
452 static ULONG WINAPI
viewport_AddRef(IDirectManipulationViewport2
*iface
)
454 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
455 ULONG ref
= InterlockedIncrement(&This
->ref
);
457 TRACE("(%p) ref=%u\n", This
, ref
);
462 static ULONG WINAPI
viewport_Release(IDirectManipulationViewport2
*iface
)
464 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
465 ULONG ref
= InterlockedDecrement(&This
->ref
);
467 TRACE("(%p) ref=%u\n", This
, ref
);
476 static HRESULT WINAPI
viewport_Enable(IDirectManipulationViewport2
*iface
)
478 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
483 static HRESULT WINAPI
viewport_Disable(IDirectManipulationViewport2
*iface
)
485 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
490 static HRESULT WINAPI
viewport_SetContact(IDirectManipulationViewport2
*iface
, UINT32 id
)
492 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
493 FIXME("%p, %d\n", This
, id
);
497 static HRESULT WINAPI
viewport_ReleaseContact(IDirectManipulationViewport2
*iface
, UINT32 id
)
499 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
500 FIXME("%p, %d\n", This
, id
);
504 static HRESULT WINAPI
viewport_ReleaseAllContacts(IDirectManipulationViewport2
*iface
)
506 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
511 static HRESULT WINAPI
viewport_GetStatus(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_STATUS
*status
)
513 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
514 FIXME("%p, %p\n", This
, status
);
518 static HRESULT WINAPI
viewport_GetTag(IDirectManipulationViewport2
*iface
, REFIID riid
, void **object
, UINT32
*id
)
520 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
521 FIXME("%p, %s, %p, %p\n", This
, debugstr_guid(riid
), object
, id
);
525 static HRESULT WINAPI
viewport_SetTag(IDirectManipulationViewport2
*iface
, IUnknown
*object
, UINT32 id
)
527 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
528 FIXME("%p, %p, %u\n", This
, object
, id
);
532 static HRESULT WINAPI
viewport_GetViewportRect(IDirectManipulationViewport2
*iface
, RECT
*viewport
)
534 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
535 FIXME("%p, %p\n", This
, viewport
);
539 static HRESULT WINAPI
viewport_SetViewportRect(IDirectManipulationViewport2
*iface
, const RECT
*viewport
)
541 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
542 FIXME("%p, %p\n", This
, viewport
);
546 static HRESULT WINAPI
viewport_ZoomToRect(IDirectManipulationViewport2
*iface
, const float left
,
547 const float top
, const float right
, const float bottom
, BOOL animate
)
549 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
550 FIXME("%p, %f, %f, %f, %f, %d\n", This
, left
, top
, right
, bottom
, animate
);
554 static HRESULT WINAPI
viewport_SetViewportTransform(IDirectManipulationViewport2
*iface
,
555 const float *matrix
, DWORD count
)
557 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
558 FIXME("%p, %p, %d\n", This
, matrix
, count
);
562 static HRESULT WINAPI
viewport_SyncDisplayTransform(IDirectManipulationViewport2
*iface
,
563 const float *matrix
, DWORD count
)
565 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
566 FIXME("%p, %p, %d\n", This
, matrix
, count
);
570 static HRESULT WINAPI
viewport_GetPrimaryContent(IDirectManipulationViewport2
*iface
, REFIID riid
, void **object
)
572 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
573 TRACE("%p, %s, %p\n", This
, debugstr_guid(riid
), object
);
574 if(IsEqualGUID(riid
, &IID_IDirectManipulationPrimaryContent
))
576 struct primarycontext
*primary
;
577 TRACE("IDirectManipulationPrimaryContent\n");
578 primary
= heap_alloc( sizeof(*primary
));
580 return E_OUTOFMEMORY
;
582 primary
->IDirectManipulationPrimaryContent_iface
.lpVtbl
= &primaryVtbl
;
583 primary
->IDirectManipulationContent_iface
.lpVtbl
= &contentVtbl
;
586 *object
= &primary
->IDirectManipulationPrimaryContent_iface
;
591 FIXME("Unsupported interface %s\n", debugstr_guid(riid
));
595 static HRESULT WINAPI
viewport_AddContent(IDirectManipulationViewport2
*iface
, IDirectManipulationContent
*content
)
597 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
598 FIXME("%p, %p\n", This
, content
);
602 static HRESULT WINAPI
viewport_RemoveContent(IDirectManipulationViewport2
*iface
, IDirectManipulationContent
*content
)
604 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
605 FIXME("%p, %p\n", This
, content
);
609 static HRESULT WINAPI
viewport_SetViewportOptions(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_VIEWPORT_OPTIONS options
)
611 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
612 FIXME("%p, %d\n", This
, options
);
616 static HRESULT WINAPI
viewport_AddConfiguration(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_CONFIGURATION configuration
)
618 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
619 FIXME("%p, %d\n", This
, configuration
);
623 static HRESULT WINAPI
viewport_RemoveConfiguration(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_CONFIGURATION configuration
)
625 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
626 FIXME("%p, %d\n", This
, configuration
);
630 static HRESULT WINAPI
viewport_ActivateConfiguration(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_CONFIGURATION configuration
)
632 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
633 FIXME("%p, %d\n", This
, configuration
);
637 static HRESULT WINAPI
viewport_SetManualGesture(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_GESTURE_CONFIGURATION configuration
)
639 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
640 FIXME("%p, %d\n", This
, configuration
);
644 static HRESULT WINAPI
viewport_SetChaining(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_MOTION_TYPES enabledTypes
)
646 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
647 FIXME("%p, %d\n", This
, enabledTypes
);
651 static HRESULT WINAPI
viewport_AddEventHandler(IDirectManipulationViewport2
*iface
, HWND window
,
652 IDirectManipulationViewportEventHandler
*eventHandler
, DWORD
*cookie
)
654 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
655 FIXME("%p, %p, %p, %p\n", This
, window
, eventHandler
, cookie
);
659 static HRESULT WINAPI
viewport_RemoveEventHandler(IDirectManipulationViewport2
*iface
, DWORD cookie
)
661 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
662 FIXME("%p, %d\n", This
, cookie
);
666 static HRESULT WINAPI
viewport_SetInputMode(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_INPUT_MODE mode
)
668 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
669 FIXME("%p, %d\n", This
, mode
);
673 static HRESULT WINAPI
viewport_SetUpdateMode(IDirectManipulationViewport2
*iface
, DIRECTMANIPULATION_INPUT_MODE mode
)
675 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
676 FIXME("%p, %d\n", This
, mode
);
680 static HRESULT WINAPI
viewport_Stop(IDirectManipulationViewport2
*iface
)
682 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
687 static HRESULT WINAPI
viewport_Abandon(IDirectManipulationViewport2
*iface
)
689 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
694 static HRESULT WINAPI
viewport_AddBehavior(IDirectManipulationViewport2
*iface
, IUnknown
*behavior
, DWORD
*cookie
)
696 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
697 FIXME("%p, %p, %p\n", This
, behavior
, cookie
);
701 static HRESULT WINAPI
viewport_RemoveBehavior(IDirectManipulationViewport2
*iface
, DWORD cookie
)
703 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
704 FIXME("%p, %d\n", This
, cookie
);
708 static HRESULT WINAPI
viewport_RemoveAllBehaviors(IDirectManipulationViewport2
*iface
)
710 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
715 static const IDirectManipulationViewport2Vtbl viewportVtbl
=
717 viewport_QueryInterface
,
723 viewport_ReleaseContact
,
724 viewport_ReleaseAllContacts
,
728 viewport_GetViewportRect
,
729 viewport_SetViewportRect
,
731 viewport_SetViewportTransform
,
732 viewport_SyncDisplayTransform
,
733 viewport_GetPrimaryContent
,
735 viewport_RemoveContent
,
736 viewport_SetViewportOptions
,
737 viewport_AddConfiguration
,
738 viewport_RemoveConfiguration
,
739 viewport_ActivateConfiguration
,
740 viewport_SetManualGesture
,
741 viewport_SetChaining
,
742 viewport_AddEventHandler
,
743 viewport_RemoveEventHandler
,
744 viewport_SetInputMode
,
745 viewport_SetUpdateMode
,
748 viewport_AddBehavior
,
749 viewport_RemoveBehavior
,
750 viewport_RemoveAllBehaviors
753 static HRESULT
create_viewport(IDirectManipulationViewport2
**obj
)
755 struct directviewport
*object
;
757 object
= heap_alloc(sizeof(*object
));
759 return E_OUTOFMEMORY
;
761 object
->IDirectManipulationViewport2_iface
.lpVtbl
= &viewportVtbl
;
764 *obj
= &object
->IDirectManipulationViewport2_iface
;
769 static HRESULT WINAPI
direct_manip_QueryInterface(IDirectManipulationManager2
*iface
, REFIID riid
, void **ppv
)
771 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
772 IsEqualGUID(riid
, &IID_IDirectManipulationManager
) ||
773 IsEqualGUID(riid
, &IID_IDirectManipulationManager2
)) {
774 IUnknown_AddRef(iface
);
779 FIXME("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
780 return E_NOINTERFACE
;
783 static ULONG WINAPI
direct_manip_AddRef(IDirectManipulationManager2
*iface
)
785 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
786 ULONG ref
= InterlockedIncrement(&This
->ref
);
788 TRACE("(%p) ref=%u\n", This
, ref
);
793 static ULONG WINAPI
direct_manip_Release(IDirectManipulationManager2
*iface
)
795 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
796 ULONG ref
= InterlockedDecrement(&This
->ref
);
798 TRACE("(%p) ref=%u\n", This
, ref
);
802 if(This
->updatemanager
)
803 IDirectManipulationUpdateManager_Release(This
->updatemanager
);
809 static HRESULT WINAPI
direct_manip_Activate(IDirectManipulationManager2
*iface
, HWND window
)
811 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
812 FIXME("%p, %p\n", This
, window
);
816 static HRESULT WINAPI
direct_manip_Deactivate(IDirectManipulationManager2
*iface
, HWND window
)
818 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
819 FIXME("%p, %p\n", This
, window
);
823 static HRESULT WINAPI
direct_manip_RegisterHitTestTarget(IDirectManipulationManager2
*iface
, HWND window
,
824 HWND hittest
, DIRECTMANIPULATION_HITTEST_TYPE type
)
826 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
827 FIXME("%p, %p, %p, %d\n", This
, window
, hittest
, type
);
831 static HRESULT WINAPI
direct_manip_ProcessInput(IDirectManipulationManager2
*iface
, const MSG
*msg
, BOOL
*handled
)
833 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
834 FIXME("%p, %p, %p\n", This
, msg
, handled
);
838 static HRESULT WINAPI
direct_manip_GetUpdateManager(IDirectManipulationManager2
*iface
, REFIID riid
, void **obj
)
840 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
843 TRACE("%p, %s, %p\n", This
, debugstr_guid(riid
), obj
);
846 if(IsEqualGUID(riid
, &IID_IDirectManipulationUpdateManager
))
848 if(!This
->updatemanager
)
850 hr
= create_update_manager(&This
->updatemanager
);
859 IDirectManipulationUpdateManager_AddRef(This
->updatemanager
);
860 *obj
= This
->updatemanager
;
864 FIXME("Interface %s currently not supported.\n", debugstr_guid(riid
));
869 static HRESULT WINAPI
direct_manip_CreateViewport(IDirectManipulationManager2
*iface
, IDirectManipulationFrameInfoProvider
*frame
,
870 HWND window
, REFIID riid
, void **obj
)
872 HRESULT hr
= E_NOTIMPL
;
873 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
874 TRACE("%p, %p, %p, %s, %p\n", This
, frame
, window
, debugstr_guid(riid
), obj
);
876 if(IsEqualGUID(riid
, &IID_IDirectManipulationViewport
) ||
877 IsEqualGUID(riid
, &IID_IDirectManipulationViewport2
) )
879 hr
= create_viewport( (IDirectManipulationViewport2
**)obj
);
882 FIXME("Unsupported interface %s\n", debugstr_guid(riid
));
886 static HRESULT WINAPI
direct_manip_CreateContent(IDirectManipulationManager2
*iface
, IDirectManipulationFrameInfoProvider
*frame
,
887 REFCLSID clsid
, REFIID riid
, void **obj
)
889 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
890 FIXME("%p, %p, %s, %p\n", This
, frame
, debugstr_guid(riid
), obj
);
894 static HRESULT WINAPI
direct_manip_CreateBehavior(IDirectManipulationManager2
*iface
, REFCLSID clsid
, REFIID riid
, void **obj
)
896 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
897 FIXME("%p, %s, %s, %p\n", This
, debugstr_guid(clsid
), debugstr_guid(riid
), obj
);
901 static const struct IDirectManipulationManager2Vtbl directmanipVtbl
=
903 direct_manip_QueryInterface
,
905 direct_manip_Release
,
906 direct_manip_Activate
,
907 direct_manip_Deactivate
,
908 direct_manip_RegisterHitTestTarget
,
909 direct_manip_ProcessInput
,
910 direct_manip_GetUpdateManager
,
911 direct_manip_CreateViewport
,
912 direct_manip_CreateContent
,
913 direct_manip_CreateBehavior
916 static HRESULT WINAPI
DirectManipulation_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **ppv
)
918 struct directmanipulation
*object
;
921 TRACE("(%p, %s, %p)\n", outer
, debugstr_guid(riid
), ppv
);
925 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
927 return E_OUTOFMEMORY
;
929 object
->IDirectManipulationManager2_iface
.lpVtbl
= &directmanipVtbl
;
932 ret
= direct_manip_QueryInterface(&object
->IDirectManipulationManager2_iface
, riid
, ppv
);
933 direct_manip_Release(&object
->IDirectManipulationManager2_iface
);
938 struct directcompositor
940 IDirectManipulationCompositor2 IDirectManipulationCompositor2_iface
;
941 IDirectManipulationFrameInfoProvider IDirectManipulationFrameInfoProvider_iface
;
942 IDirectManipulationUpdateManager
*manager
;
946 static inline struct directcompositor
*impl_from_IDirectManipulationCompositor2(IDirectManipulationCompositor2
*iface
)
948 return CONTAINING_RECORD(iface
, struct directcompositor
, IDirectManipulationCompositor2_iface
);
951 static inline struct directcompositor
*impl_from_IDirectManipulationFrameInfoProvider(IDirectManipulationFrameInfoProvider
*iface
)
953 return CONTAINING_RECORD(iface
, struct directcompositor
, IDirectManipulationFrameInfoProvider_iface
);
956 static HRESULT WINAPI
compositor_QueryInterface(IDirectManipulationCompositor2
*iface
, REFIID riid
, void **ppv
)
958 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
960 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
961 IsEqualGUID(riid
, &IID_IDirectManipulationCompositor
) ||
962 IsEqualGUID(riid
, &IID_IDirectManipulationCompositor2
))
964 IUnknown_AddRef(iface
);
968 else if(IsEqualGUID(riid
, &IID_IDirectManipulationFrameInfoProvider
))
970 IUnknown_AddRef(iface
);
971 *ppv
= &This
->IDirectManipulationFrameInfoProvider_iface
;
975 FIXME("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
976 return E_NOINTERFACE
;
979 static ULONG WINAPI
compositor_AddRef(IDirectManipulationCompositor2
*iface
)
981 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
982 ULONG ref
= InterlockedIncrement(&This
->ref
);
984 TRACE("(%p) ref=%u\n", This
, ref
);
989 static ULONG WINAPI
compositor_Release(IDirectManipulationCompositor2
*iface
)
991 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
992 ULONG ref
= InterlockedDecrement(&This
->ref
);
994 TRACE("(%p) ref=%u\n", This
, ref
);
999 IDirectManipulationUpdateManager_Release(This
->manager
);
1005 static HRESULT WINAPI
compositor_AddContent(IDirectManipulationCompositor2
*iface
, IDirectManipulationContent
*content
,
1006 IUnknown
*device
, IUnknown
*parent
, IUnknown
*child
)
1008 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
1009 FIXME("%p, %p, %p, %p, %p\n", This
, content
, device
, parent
, child
);
1013 static HRESULT WINAPI
compositor_RemoveContent(IDirectManipulationCompositor2
*iface
, IDirectManipulationContent
*content
)
1015 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
1016 FIXME("%p, %p\n", This
, content
);
1020 static HRESULT WINAPI
compositor_SetUpdateManager(IDirectManipulationCompositor2
*iface
, IDirectManipulationUpdateManager
*manager
)
1022 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
1023 TRACE("%p, %p\n", This
, manager
);
1026 return E_INVALIDARG
;
1028 This
->manager
= manager
;
1029 IDirectManipulationUpdateManager_AddRef(This
->manager
);
1033 static HRESULT WINAPI
compositor_Flush(IDirectManipulationCompositor2
*iface
)
1035 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
1036 FIXME("%p\n", This
);
1040 static HRESULT WINAPI
compositor_AddContentWithCrossProcessChaining(IDirectManipulationCompositor2
*iface
,
1041 IDirectManipulationPrimaryContent
*content
, IUnknown
*device
, IUnknown
*parentvisual
, IUnknown
*childvisual
)
1043 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
1044 FIXME("%p %p %p %p %p\n", This
, content
, device
, parentvisual
, childvisual
);
1048 static const struct IDirectManipulationCompositor2Vtbl compositorVtbl
=
1050 compositor_QueryInterface
,
1053 compositor_AddContent
,
1054 compositor_RemoveContent
,
1055 compositor_SetUpdateManager
,
1057 compositor_AddContentWithCrossProcessChaining
1060 static HRESULT WINAPI
provider_QueryInterface(IDirectManipulationFrameInfoProvider
*iface
, REFIID riid
, void **ppv
)
1062 struct directcompositor
*This
= impl_from_IDirectManipulationFrameInfoProvider(iface
);
1063 return IDirectManipulationCompositor2_QueryInterface(&This
->IDirectManipulationCompositor2_iface
, riid
, ppv
);
1066 static ULONG WINAPI
provider_AddRef(IDirectManipulationFrameInfoProvider
*iface
)
1068 struct directcompositor
*This
= impl_from_IDirectManipulationFrameInfoProvider(iface
);
1069 return IDirectManipulationCompositor2_AddRef(&This
->IDirectManipulationCompositor2_iface
);
1072 static ULONG WINAPI
provider_Release(IDirectManipulationFrameInfoProvider
*iface
)
1074 struct directcompositor
*This
= impl_from_IDirectManipulationFrameInfoProvider(iface
);
1075 return IDirectManipulationCompositor2_Release(&This
->IDirectManipulationCompositor2_iface
);
1078 static HRESULT WINAPI
provider_GetNextFrameInfo(IDirectManipulationFrameInfoProvider
*iface
, ULONGLONG
*time
,
1079 ULONGLONG
*process
, ULONGLONG
*composition
)
1081 struct directcompositor
*This
= impl_from_IDirectManipulationFrameInfoProvider(iface
);
1082 FIXME("%p, %p, %p, %p\n", This
, time
, process
, composition
);
1086 static const struct IDirectManipulationFrameInfoProviderVtbl providerVtbl
=
1088 provider_QueryInterface
,
1091 provider_GetNextFrameInfo
1094 static HRESULT WINAPI
DirectCompositor_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **ppv
)
1096 struct directcompositor
*object
;
1099 TRACE("(%p, %s, %p)\n", outer
, debugstr_guid(riid
), ppv
);
1103 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1105 return E_OUTOFMEMORY
;
1107 object
->IDirectManipulationCompositor2_iface
.lpVtbl
= &compositorVtbl
;
1108 object
->IDirectManipulationFrameInfoProvider_iface
.lpVtbl
= &providerVtbl
;
1111 ret
= compositor_QueryInterface(&object
->IDirectManipulationCompositor2_iface
, riid
, ppv
);
1112 compositor_Release(&object
->IDirectManipulationCompositor2_iface
);
1117 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
1121 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IClassFactory
, riid
)) {
1126 IUnknown_AddRef((IUnknown
*)*ppv
);
1130 WARN("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
1131 return E_NOINTERFACE
;
1134 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
1136 TRACE("(%p)\n", iface
);
1140 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
1142 TRACE("(%p)\n", iface
);
1146 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
1148 TRACE("(%p)->(%x)\n", iface
, fLock
);
1152 static const IClassFactoryVtbl DirectFactoryVtbl
= {
1153 ClassFactory_QueryInterface
,
1154 ClassFactory_AddRef
,
1155 ClassFactory_Release
,
1156 DirectManipulation_CreateInstance
,
1157 ClassFactory_LockServer
1160 static const IClassFactoryVtbl DirectCompositorVtbl
= {
1161 ClassFactory_QueryInterface
,
1162 ClassFactory_AddRef
,
1163 ClassFactory_Release
,
1164 DirectCompositor_CreateInstance
,
1165 ClassFactory_LockServer
1168 static IClassFactory direct_factory
= { &DirectFactoryVtbl
};
1169 static IClassFactory compositor_factory
= { &DirectCompositorVtbl
};
1171 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
1173 if(IsEqualGUID(&CLSID_DirectManipulationManager
, rclsid
) ||
1174 IsEqualGUID(&CLSID_DirectManipulationSharedManager
, rclsid
) ) {
1175 TRACE("(CLSID_DirectManipulationManager %s %p)\n", debugstr_guid(riid
), ppv
);
1176 return IClassFactory_QueryInterface(&direct_factory
, riid
, ppv
);
1178 else if(IsEqualGUID(&CLSID_DCompManipulationCompositor
, rclsid
)) {
1179 TRACE("(CLSID_DCompManipulationCompositor %s %p)\n", debugstr_guid(riid
), ppv
);
1180 return IClassFactory_QueryInterface(&compositor_factory
, riid
, ppv
);
1183 FIXME("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
1184 return CLASS_E_CLASSNOTAVAILABLE
;