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_PROCESS_ATTACH
:
42 dm_instance
= instance
;
43 DisableThreadLibraryCalls(instance
);
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)
66 struct directmanipulation
68 IDirectManipulationManager2 IDirectManipulationManager2_iface
;
69 IDirectManipulationUpdateManager
*updatemanager
;
73 struct directupdatemanager
75 IDirectManipulationUpdateManager IDirectManipulationUpdateManager_iface
;
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
);
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
);
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
);
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
);
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
);
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
);
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
));
168 return E_OUTOFMEMORY
;
170 object
->IDirectManipulationUpdateManager_iface
.lpVtbl
= &updatemanagerVtbl
;
173 *obj
= &object
->IDirectManipulationUpdateManager_iface
;
178 struct primarycontext
180 IDirectManipulationPrimaryContent IDirectManipulationPrimaryContent_iface
;
181 IDirectManipulationContent IDirectManipulationContent_iface
;
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
;
207 else if(IsEqualGUID(riid
, &IID_IDirectManipulationContent
))
209 IUnknown_AddRef(iface
);
210 *ppv
= &This
->IDirectManipulationContent_iface
;
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
309 static const IDirectManipulationPrimaryContentVtbl primaryVtbl
=
311 primary_QueryInterface
,
314 primary_SetSnapInterval
,
315 primary_SetSnapPoints
,
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
,
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
406 static const IDirectManipulationContentVtbl contentVtbl
=
408 content_QueryInterface
,
411 content_GetContentRect
,
412 content_SetContentRect
,
416 content_GetOutputTransform
,
417 content_GetContentTransform
,
418 content_SyncContentTransform
421 struct directviewport
423 IDirectManipulationViewport2 IDirectManipulationViewport2_iface
;
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
;
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
);
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
);
474 static HRESULT WINAPI
viewport_Enable(IDirectManipulationViewport2
*iface
)
476 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
481 static HRESULT WINAPI
viewport_Disable(IDirectManipulationViewport2
*iface
)
483 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
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
);
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
);
502 static HRESULT WINAPI
viewport_ReleaseAllContacts(IDirectManipulationViewport2
*iface
)
504 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
));
578 return E_OUTOFMEMORY
;
580 primary
->IDirectManipulationPrimaryContent_iface
.lpVtbl
= &primaryVtbl
;
581 primary
->IDirectManipulationContent_iface
.lpVtbl
= &contentVtbl
;
584 *object
= &primary
->IDirectManipulationPrimaryContent_iface
;
589 FIXME("Unsupported interface %s\n", debugstr_guid(riid
));
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
678 static HRESULT WINAPI
viewport_Stop(IDirectManipulationViewport2
*iface
)
680 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
685 static HRESULT WINAPI
viewport_Abandon(IDirectManipulationViewport2
*iface
)
687 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
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
);
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
);
706 static HRESULT WINAPI
viewport_RemoveAllBehaviors(IDirectManipulationViewport2
*iface
)
708 struct directviewport
*This
= impl_from_IDirectManipulationViewport2(iface
);
713 static const IDirectManipulationViewport2Vtbl viewportVtbl
=
715 viewport_QueryInterface
,
721 viewport_ReleaseContact
,
722 viewport_ReleaseAllContacts
,
726 viewport_GetViewportRect
,
727 viewport_SetViewportRect
,
729 viewport_SetViewportTransform
,
730 viewport_SyncDisplayTransform
,
731 viewport_GetPrimaryContent
,
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
,
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
));
757 return E_OUTOFMEMORY
;
759 object
->IDirectManipulationViewport2_iface
.lpVtbl
= &viewportVtbl
;
762 *obj
= &object
->IDirectManipulationViewport2_iface
;
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
);
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
);
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
);
800 if(This
->updatemanager
)
801 IDirectManipulationUpdateManager_Release(This
->updatemanager
);
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
);
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
);
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
);
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
);
836 static HRESULT WINAPI
direct_manip_GetUpdateManager(IDirectManipulationManager2
*iface
, REFIID riid
, void **obj
)
838 struct directmanipulation
*This
= impl_from_IDirectManipulationManager2(iface
);
841 TRACE("%p, %s, %p\n", This
, debugstr_guid(riid
), obj
);
844 if(IsEqualGUID(riid
, &IID_IDirectManipulationUpdateManager
))
846 if(!This
->updatemanager
)
848 hr
= create_update_manager(&This
->updatemanager
);
857 IDirectManipulationUpdateManager_AddRef(This
->updatemanager
);
858 *obj
= This
->updatemanager
;
862 FIXME("Interface %s currently not supported.\n", debugstr_guid(riid
));
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
);
880 FIXME("Unsupported interface %s\n", debugstr_guid(riid
));
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
);
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
);
899 static const struct IDirectManipulationManager2Vtbl directmanipVtbl
=
901 direct_manip_QueryInterface
,
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
;
919 TRACE("(%p, %s, %p)\n", outer
, debugstr_guid(riid
), ppv
);
923 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
925 return E_OUTOFMEMORY
;
927 object
->IDirectManipulationManager2_iface
.lpVtbl
= &directmanipVtbl
;
930 ret
= direct_manip_QueryInterface(&object
->IDirectManipulationManager2_iface
, riid
, ppv
);
931 direct_manip_Release(&object
->IDirectManipulationManager2_iface
);
936 struct directcompositor
938 IDirectManipulationCompositor2 IDirectManipulationCompositor2_iface
;
939 IDirectManipulationFrameInfoProvider IDirectManipulationFrameInfoProvider_iface
;
940 IDirectManipulationUpdateManager
*manager
;
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
);
966 else if(IsEqualGUID(riid
, &IID_IDirectManipulationFrameInfoProvider
))
968 IUnknown_AddRef(iface
);
969 *ppv
= &This
->IDirectManipulationFrameInfoProvider_iface
;
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
);
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
);
997 IDirectManipulationUpdateManager_Release(This
->manager
);
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
);
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
);
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
);
1024 return E_INVALIDARG
;
1026 This
->manager
= manager
;
1027 IDirectManipulationUpdateManager_AddRef(This
->manager
);
1031 static HRESULT WINAPI
compositor_Flush(IDirectManipulationCompositor2
*iface
)
1033 struct directcompositor
*This
= impl_from_IDirectManipulationCompositor2(iface
);
1034 FIXME("%p\n", This
);
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
);
1046 static const struct IDirectManipulationCompositor2Vtbl compositorVtbl
=
1048 compositor_QueryInterface
,
1051 compositor_AddContent
,
1052 compositor_RemoveContent
,
1053 compositor_SetUpdateManager
,
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
);
1084 static const struct IDirectManipulationFrameInfoProviderVtbl providerVtbl
=
1086 provider_QueryInterface
,
1089 provider_GetNextFrameInfo
1092 static HRESULT WINAPI
DirectCompositor_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **ppv
)
1094 struct directcompositor
*object
;
1097 TRACE("(%p, %s, %p)\n", outer
, debugstr_guid(riid
), ppv
);
1101 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
1103 return E_OUTOFMEMORY
;
1105 object
->IDirectManipulationCompositor2_iface
.lpVtbl
= &compositorVtbl
;
1106 object
->IDirectManipulationFrameInfoProvider_iface
.lpVtbl
= &providerVtbl
;
1109 ret
= compositor_QueryInterface(&object
->IDirectManipulationCompositor2_iface
, riid
, ppv
);
1110 compositor_Release(&object
->IDirectManipulationCompositor2_iface
);
1115 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
1119 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IClassFactory
, riid
)) {
1124 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
1138 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
1140 TRACE("(%p)\n", iface
);
1144 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
1146 TRACE("(%p)->(%x)\n", iface
, fLock
);
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
;