maintainers: Update the Direct3D section.
[wine.git] / dlls / ninput / main.c
blob56d82b08ac54fdc0ad893369ebaf30693c49bb08
1 /*
2 * Copyright 2018 Andrey Gusev
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
19 #include <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
23 #include "wine/debug.h"
24 #include "wine/heap.h"
26 #include "interactioncontext.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(ninput);
30 struct interaction_context
32 BOOL filter_pointers;
35 static struct interaction_context *context_from_handle(HINTERACTIONCONTEXT handle)
37 return (struct interaction_context *)handle;
40 HRESULT WINAPI CreateInteractionContext(HINTERACTIONCONTEXT *handle)
42 struct interaction_context *context;
44 TRACE("handle %p.\n", handle);
46 if (!handle)
47 return E_POINTER;
49 if (!(context = heap_alloc(sizeof(*context))))
50 return E_OUTOFMEMORY;
52 context->filter_pointers = TRUE;
54 TRACE("Created context %p.\n", context);
56 *handle = (HINTERACTIONCONTEXT)context;
58 return S_OK;
61 HRESULT WINAPI DestroyInteractionContext(HINTERACTIONCONTEXT handle)
63 struct interaction_context *context = context_from_handle(handle);
65 TRACE("context %p.\n", context);
67 if (!context)
68 return E_HANDLE;
70 heap_free(context);
71 return S_OK;
74 HRESULT WINAPI GetPropertyInteractionContext(HINTERACTIONCONTEXT handle,
75 INTERACTION_CONTEXT_PROPERTY property, UINT32 *value)
77 struct interaction_context *context = context_from_handle(handle);
79 TRACE("context %p, property %#x, value %p.\n", context, property, value);
81 if (!context)
82 return E_HANDLE;
83 if (!value)
84 return E_POINTER;
86 switch (property)
88 case INTERACTION_CONTEXT_PROPERTY_MEASUREMENT_UNITS:
89 case INTERACTION_CONTEXT_PROPERTY_INTERACTION_UI_FEEDBACK:
90 FIXME("Unhandled property %#x.\n", property);
91 *value = 0;
92 return E_NOTIMPL;
94 case INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS:
95 *value = context->filter_pointers;
96 return S_OK;
98 default:
99 WARN("Invalid property %#x.\n", property);
100 return E_INVALIDARG;
104 HRESULT WINAPI SetPropertyInteractionContext(HINTERACTIONCONTEXT handle,
105 INTERACTION_CONTEXT_PROPERTY property, UINT32 value)
107 struct interaction_context *context = context_from_handle(handle);
109 TRACE("context %p, property %#x, value %#x.\n", context, property, value);
111 if (!context)
112 return E_HANDLE;
114 switch (property)
116 case INTERACTION_CONTEXT_PROPERTY_MEASUREMENT_UNITS:
117 case INTERACTION_CONTEXT_PROPERTY_INTERACTION_UI_FEEDBACK:
118 FIXME("Unhandled property %#x.\n", property);
119 return E_NOTIMPL;
121 case INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS:
122 if (value != FALSE && value != TRUE)
123 return E_INVALIDARG;
124 context->filter_pointers = value;
125 return S_OK;
127 default:
128 WARN("Invalid property %#x.\n", property);
129 return E_INVALIDARG;
133 HRESULT WINAPI SetInteractionConfigurationInteractionContext(HINTERACTIONCONTEXT handle,
134 UINT32 count, const INTERACTION_CONTEXT_CONFIGURATION *configuration)
136 struct interaction_context *context = context_from_handle(handle);
138 FIXME("context %p, count %u, configuration %p: stub!.\n", context, count, configuration);
140 if (!context)
141 return E_HANDLE;
142 if (!count)
143 return E_INVALIDARG;
144 if (!configuration)
145 return E_POINTER;
147 return S_OK;
150 HRESULT WINAPI RegisterOutputCallbackInteractionContext(HINTERACTIONCONTEXT handle,
151 INTERACTION_CONTEXT_OUTPUT_CALLBACK callback, void *data)
153 struct interaction_context *context = context_from_handle(handle);
155 FIXME("context %p, callback %p, data %p: stub!.\n", context, callback, data);
157 if (!context)
158 return E_HANDLE;
160 return S_OK;
163 HRESULT WINAPI ProcessInertiaInteractionContext(HINTERACTIONCONTEXT context)
165 FIXME("context %p: stub!\n", context);
166 return E_NOTIMPL;