Debian Codegraph @

gdk/win32/winpointer.h

raw
1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2021 the GTK team
3 *
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 of the License, or (at your option) any later version.
8 *
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.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /* This code is derived from portions provided by the mingw-w64 project
19 * (mingw-w64.org), originally licensed under the Zope Public License
20 * (ZPL) version 2.1, with modifications made on May 12, 2021.
21 * Legal notice of the Zope Public License version 2.1 follows:
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are met:
25 *
26 * 1. Redistributions in source code must retain the accompanying copyright
27 * notice, this list of conditions, and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the accompanying
29 * copyright notice, this list of conditions, and the following disclaimer
30 * in the documentation and/or other materials provided with the
31 * distribution.
32 * 3. Names of the copyright holders must not be used to endorse or promote
33 * products derived from this software without prior written permission
34 * from the copyright holders.
35 * 4. The right to distribute this software or to use it for any purpose does
36 * not give you the right to use Servicemarks (sm) or Trademarks (tm) of
37 * the copyright holders. Use of them is covered by separate agreement
38 * with the copyright holders.
39 * 5. If any files are modified, you must cause the modified files to carry
40 * prominent notices stating that you changed the files and the date of
41 * any change.
42 */
43
44 #ifndef POINTER_FLAG_NONE
45
46 #include <windows.h>
47 #include <tchar.h>
48
49 #define WM_POINTERDEVICECHANGE 0x238
50 #define WM_POINTERDEVICEINRANGE 0x239
51 #define WM_POINTERDEVICEOUTOFRANGE 0x23a
52
53 #define WM_NCPOINTERUPDATE 0x0241
54 #define WM_NCPOINTERDOWN 0x0242
55 #define WM_NCPOINTERUP 0x0243
56 #define WM_POINTERUPDATE 0x0245
57 #define WM_POINTERDOWN 0x0246
58 #define WM_POINTERUP 0x0247
59 #define WM_POINTERENTER 0x0249
60 #define WM_POINTERLEAVE 0x024a
61 #define WM_POINTERACTIVATE 0x024b
62 #define WM_POINTERCAPTURECHANGED 0x024c
63 #define WM_TOUCHHITTESTING 0x024d
64 #define WM_POINTERWHEEL 0x024e
65 #define WM_POINTERHWHEEL 0x024f
66 #define DM_POINTERHITTEST 0x0250
67 #define WM_POINTERROUTEDTO 0x0251
68 #define WM_POINTERROUTEDAWAY 0x0252
69 #define WM_POINTERROUTEDRELEASED 0x0253
70
71 #define POINTER_FLAG_NONE 0x00000000
72 #define POINTER_FLAG_NEW 0x00000001
73 #define POINTER_FLAG_INRANGE 0x00000002
74 #define POINTER_FLAG_INCONTACT 0x00000004
75 #define POINTER_FLAG_FIRSTBUTTON 0x00000010
76 #define POINTER_FLAG_SECONDBUTTON 0x00000020
77 #define POINTER_FLAG_THIRDBUTTON 0x00000040
78 #define POINTER_FLAG_FOURTHBUTTON 0x00000080
79 #define POINTER_FLAG_FIFTHBUTTON 0x00000100
80 #define POINTER_FLAG_PRIMARY 0x00002000
81 #define POINTER_FLAG_CONFIDENCE 0x00004000
82 #define POINTER_FLAG_CANCELED 0x00008000
83 #define POINTER_FLAG_DOWN 0x00010000
84 #define POINTER_FLAG_UPDATE 0x00020000
85 #define POINTER_FLAG_UP 0x00040000
86 #define POINTER_FLAG_WHEEL 0x00080000
87 #define POINTER_FLAG_HWHEEL 0x00100000
88 #define POINTER_FLAG_CAPTURECHANGED 0x00200000
89 #define POINTER_FLAG_HASTRANSFORM 0x00400000
90
91 #define POINTER_MOD_SHIFT (0x0004)
92 #define POINTER_MOD_CTRL (0x0008)
93
94 #define TOUCH_FLAG_NONE 0x00000000
95
96 #define TOUCH_MASK_NONE 0x00000000
97 #define TOUCH_MASK_CONTACTAREA 0x00000001
98 #define TOUCH_MASK_ORIENTATION 0x00000002
99 #define TOUCH_MASK_PRESSURE 0x00000004
100
101 #define PEN_FLAG_NONE 0x00000000
102 #define PEN_FLAG_BARREL 0x00000001
103 #define PEN_FLAG_INVERTED 0x00000002
104 #define PEN_FLAG_ERASER 0x00000004
105
106 #define PEN_MASK_NONE 0x00000000
107 #define PEN_MASK_PRESSURE 0x00000001
108 #define PEN_MASK_ROTATION 0x00000002
109 #define PEN_MASK_TILT_X 0x00000004
110 #define PEN_MASK_TILT_Y 0x00000008
111
112 #define POINTER_MESSAGE_FLAG_NEW 0x00000001
113 #define POINTER_MESSAGE_FLAG_INRANGE 0x00000002
114 #define POINTER_MESSAGE_FLAG_INCONTACT 0x00000004
115 #define POINTER_MESSAGE_FLAG_FIRSTBUTTON 0x00000010
116 #define POINTER_MESSAGE_FLAG_SECONDBUTTON 0x00000020
117 #define POINTER_MESSAGE_FLAG_THIRDBUTTON 0x00000040
118 #define POINTER_MESSAGE_FLAG_FOURTHBUTTON 0x00000080
119 #define POINTER_MESSAGE_FLAG_FIFTHBUTTON 0x00000100
120 #define POINTER_MESSAGE_FLAG_PRIMARY 0x00002000
121 #define POINTER_MESSAGE_FLAG_CONFIDENCE 0x00004000
122 #define POINTER_MESSAGE_FLAG_CANCELED 0x00008000
123
124 #define GET_POINTERID_WPARAM(wParam) (LOWORD (wParam))
125 #define IS_POINTER_FLAG_SET_WPARAM(wParam, flag) (((DWORD)HIWORD (wParam) &(flag)) == (flag))
126 #define IS_POINTER_NEW_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_NEW)
127 #define IS_POINTER_INRANGE_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_INRANGE)
128 #define IS_POINTER_INCONTACT_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_INCONTACT)
129 #define IS_POINTER_FIRSTBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_FIRSTBUTTON)
130 #define IS_POINTER_SECONDBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_SECONDBUTTON)
131 #define IS_POINTER_THIRDBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_THIRDBUTTON)
132 #define IS_POINTER_FOURTHBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_FOURTHBUTTON)
133 #define IS_POINTER_FIFTHBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_FIFTHBUTTON)
134 #define IS_POINTER_PRIMARY_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_PRIMARY)
135 #define HAS_POINTER_CONFIDENCE_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_CONFIDENCE)
136 #define IS_POINTER_CANCELED_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_CANCELED)
137
138 #define PA_ACTIVATE MA_ACTIVATE
139 #define PA_NOACTIVATE MA_NOACTIVATE
140
141 #ifndef GC_ALLGESTURES
142 #define GC_ALLGESTURES 0x1
143 #endif
144
145 typedef DWORD POINTER_INPUT_TYPE;
146 typedef UINT32 POINTER_FLAGS;
147 typedef UINT32 TOUCH_FLAGS;
148 typedef UINT32 TOUCH_MASK;
149 typedef UINT32 PEN_FLAGS;
150 typedef UINT32 PEN_MASK;
151
152 enum tagPOINTER_INPUT_TYPE {
153 PT_POINTER = 0x00000001,
154 PT_TOUCH = 0x00000002,
155 PT_PEN = 0x00000003,
156 PT_MOUSE = 0x00000004,
157 PT_TOUCHPAD = 0x00000005
158 };
159
160 typedef enum tagFEEDBACK_TYPE {
161 FEEDBACK_TOUCH_CONTACTVISUALIZATION = 1,
162 FEEDBACK_PEN_BARRELVISUALIZATION = 2,
163 FEEDBACK_PEN_TAP = 3,
164 FEEDBACK_PEN_DOUBLETAP = 4,
165 FEEDBACK_PEN_PRESSANDHOLD = 5,
166 FEEDBACK_PEN_RIGHTTAP = 6,
167 FEEDBACK_TOUCH_TAP = 7,
168 FEEDBACK_TOUCH_DOUBLETAP = 8,
169 FEEDBACK_TOUCH_PRESSANDHOLD = 9,
170 FEEDBACK_TOUCH_RIGHTTAP = 10,
171 FEEDBACK_GESTURE_PRESSANDTAP = 11,
172 FEEDBACK_MAX = 0xffffffff
173 } FEEDBACK_TYPE;
174
175 typedef enum tagPOINTER_BUTTON_CHANGE_TYPE {
176 POINTER_CHANGE_NONE,
177 POINTER_CHANGE_FIRSTBUTTON_DOWN,
178 POINTER_CHANGE_FIRSTBUTTON_UP,
179 POINTER_CHANGE_SECONDBUTTON_DOWN,
180 POINTER_CHANGE_SECONDBUTTON_UP,
181 POINTER_CHANGE_THIRDBUTTON_DOWN,
182 POINTER_CHANGE_THIRDBUTTON_UP,
183 POINTER_CHANGE_FOURTHBUTTON_DOWN,
184 POINTER_CHANGE_FOURTHBUTTON_UP,
185 POINTER_CHANGE_FIFTHBUTTON_DOWN,
186 POINTER_CHANGE_FIFTHBUTTON_UP,
187 } POINTER_BUTTON_CHANGE_TYPE;
188
189 typedef struct tagPOINTER_INFO {
190 POINTER_INPUT_TYPE pointerType;
191 UINT32 pointerId;
192 UINT32 frameId;
193 POINTER_FLAGS pointerFlags;
194 HANDLE sourceDevice;
195 HWND hwndTarget;
196 POINT ptPixelLocation;
197 POINT ptHimetricLocation;
198 POINT ptPixelLocationRaw;
199 POINT ptHimetricLocationRaw;
200 DWORD dwTime;
201 UINT32 historyCount;
202 INT32 InputData;
203 DWORD dwKeyStates;
204 UINT64 PerformanceCount;
205 POINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
206 } POINTER_INFO;
207
208 typedef struct tagPOINTER_TOUCH_INFO {
209 POINTER_INFO pointerInfo;
210 TOUCH_FLAGS touchFlags;
211 TOUCH_MASK touchMask;
212 RECT rcContact;
213 RECT rcContactRaw;
214 UINT32 orientation;
215 UINT32 pressure;
216 } POINTER_TOUCH_INFO;
217
218 typedef struct tagPOINTER_PEN_INFO {
219 POINTER_INFO pointerInfo;
220 PEN_FLAGS penFlags;
221 PEN_MASK penMask;
222 UINT32 pressure;
223 UINT32 rotation;
224 INT32 tiltX;
225 INT32 tiltY;
226 } POINTER_PEN_INFO;
227
228 typedef enum {
229 POINTER_FEEDBACK_DEFAULT = 1,
230 POINTER_FEEDBACK_INDIRECT = 2,
231 POINTER_FEEDBACK_NONE = 3
232 } POINTER_FEEDBACK_MODE;
233
234 typedef struct tagUSAGE_PROPERTIES {
235 USHORT level;
236 USHORT page;
237 USHORT usage;
238 INT32 logicalMinimum;
239 INT32 logicalMaximum;
240 USHORT unit;
241 USHORT exponent;
242 BYTE count;
243 INT32 physicalMinimum;
244 INT32 physicalMaximum;
245 } USAGE_PROPERTIES, *PUSAGE_PROPERTIES;
246
247 typedef struct tagPOINTER_TYPE_INFO {
248 POINTER_INPUT_TYPE type;
249 union {
250 POINTER_TOUCH_INFO touchInfo;
251 POINTER_PEN_INFO penInfo;
252 } DUMMYUNIONNAME;
253 } POINTER_TYPE_INFO, *PPOINTER_TYPE_INFO;
254
255 #define POINTER_DEVICE_PRODUCT_STRING_MAX 520
256 #define PDC_ARRIVAL 0x001
257 #define PDC_REMOVAL 0x002
258 #define PDC_ORIENTATION_0 0x004
259 #define PDC_ORIENTATION_90 0x008
260 #define PDC_ORIENTATION_180 0x010
261 #define PDC_ORIENTATION_270 0x020
262 #define PDC_MODE_DEFAULT 0x040
263 #define PDC_MODE_CENTERED 0x080
264 #define PDC_MAPPING_CHANGE 0x100
265 #define PDC_RESOLUTION 0x200
266 #define PDC_ORIGIN 0x400
267 #define PDC_MODE_ASPECTRATIOPRESERVED 0x800
268
269 typedef enum tagPOINTER_DEVICE_TYPE {
270 POINTER_DEVICE_TYPE_INTEGRATED_PEN = 0x00000001,
271 POINTER_DEVICE_TYPE_EXTERNAL_PEN = 0x00000002,
272 POINTER_DEVICE_TYPE_TOUCH = 0x00000003,
273 POINTER_DEVICE_TYPE_TOUCH_PAD = 0x00000004,
274 POINTER_DEVICE_TYPE_MAX = 0xffffffff
275 } POINTER_DEVICE_TYPE;
276
277 typedef struct tagPOINTER_DEVICE_INFO {
278 DWORD displayOrientation;
279 HANDLE device;
280 POINTER_DEVICE_TYPE pointerDeviceType;
281 HMONITOR monitor;
282 ULONG startingCursorId;
283 USHORT maxActiveContacts;
284 WCHAR productString[POINTER_DEVICE_PRODUCT_STRING_MAX];
285 } POINTER_DEVICE_INFO;
286
287 typedef struct tagPOINTER_DEVICE_PROPERTY {
288 INT32 logicalMin;
289 INT32 logicalMax;
290 INT32 physicalMin;
291 INT32 physicalMax;
292 UINT32 unit;
293 UINT32 unitExponent;
294 USHORT usagePageId;
295 USHORT usageId;
296 } POINTER_DEVICE_PROPERTY;
297
298 typedef enum tagPOINTER_DEVICE_CURSOR_TYPE {
299 POINTER_DEVICE_CURSOR_TYPE_UNKNOWN = 0x00000000,
300 POINTER_DEVICE_CURSOR_TYPE_TIP = 0x00000001,
301 POINTER_DEVICE_CURSOR_TYPE_ERASER = 0x00000002,
302 POINTER_DEVICE_CURSOR_TYPE_MAX = 0xffffffff
303 } POINTER_DEVICE_CURSOR_TYPE;
304
305 typedef struct tagPOINTER_DEVICE_CURSOR_INFO {
306 UINT32 cursorId;
307 POINTER_DEVICE_CURSOR_TYPE cursor;
308 } POINTER_DEVICE_CURSOR_INFO;
309
310 #endif /* POINTER_FLAG_NONE */
311
312 #if WINVER < 0x0601
313
314 typedef struct tagGESTURECONFIG {
315 DWORD dwID;
316 DWORD dwWant;
317 DWORD dwBlock;
318 } GESTURECONFIG,*PGESTURECONFIG;
319
320 #endif /* WINVER < 0x0601 */
321
322 #ifndef MICROSOFT_TABLETPENSERVICE_PROPERTY
323 #define MICROSOFT_TABLETPENSERVICE_PROPERTY _T("MicrosoftTabletPenServiceProperty")
324 #endif