Bug 1829659 - Remove `import.py` because it's not used anymore r=glandium,bwc
[gecko.git] / widget / windows / touchinjection_sdk80.h
blob7e9f5410d21f0046c55c1ced57a86372ff040184
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef touchinjection_sdk80_h
6 #define touchinjection_sdk80_h
8 #include <windows.h>
10 // Note, this isn't inclusive of all touch injection header info.
11 // You may need to add more to expand on current apis.
13 #ifndef TOUCH_FEEDBACK_DEFAULT
15 # define TOUCH_FEEDBACK_DEFAULT 0x1
16 # define TOUCH_FEEDBACK_INDIRECT 0x2
17 # define TOUCH_FEEDBACK_NONE 0x3
19 enum POINTER_FEEDBACK_MODE {
20 POINTER_FEEDBACK_DEFAULT =
21 1, // The injected pointer input feedback may get suppressed by the
22 // end-user settings in the Pen and Touch control panel.
23 POINTER_FEEDBACK_INDIRECT =
24 2, // The injected pointer input feedback overrides the end-user settings
25 // in the Pen and Touch control panel.
26 POINTER_FEEDBACK_NONE = 3, // No touch visualizations.
29 enum {
30 PT_POINTER = 0x00000001, // Generic pointer
31 PT_TOUCH = 0x00000002, // Touch
32 PT_PEN = 0x00000003, // Pen
33 PT_MOUSE = 0x00000004, // Mouse
34 PT_TOUCHPAD = 0x00000005, // Touch pad
37 using POINTER_INPUT_TYPE = DWORD;
38 using POINTER_FLAGS = UINT32;
40 enum POINTER_BUTTON_CHANGE_TYPE {
41 POINTER_CHANGE_NONE,
42 POINTER_CHANGE_FIRSTBUTTON_DOWN,
43 POINTER_CHANGE_FIRSTBUTTON_UP,
44 POINTER_CHANGE_SECONDBUTTON_DOWN,
45 POINTER_CHANGE_SECONDBUTTON_UP,
46 POINTER_CHANGE_THIRDBUTTON_DOWN,
47 POINTER_CHANGE_THIRDBUTTON_UP,
48 POINTER_CHANGE_FOURTHBUTTON_DOWN,
49 POINTER_CHANGE_FOURTHBUTTON_UP,
50 POINTER_CHANGE_FIFTHBUTTON_DOWN,
51 POINTER_CHANGE_FIFTHBUTTON_UP,
54 struct POINTER_INFO {
55 POINTER_INPUT_TYPE pointerType;
56 UINT32 pointerId;
57 UINT32 frameId;
58 POINTER_FLAGS pointerFlags;
59 HANDLE sourceDevice;
60 HWND hwndTarget;
61 POINT ptPixelLocation;
62 POINT ptHimetricLocation;
63 POINT ptPixelLocationRaw;
64 POINT ptHimetricLocationRaw;
65 DWORD dwTime;
66 UINT32 historyCount;
67 INT32 InputData;
68 DWORD dwKeyStates;
69 UINT64 PerformanceCount;
70 POINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
73 using TOUCH_FLAGS = UINT32;
74 using TOUCH_MASK = UINT32;
76 struct POINTER_TOUCH_INFO {
77 POINTER_INFO pointerInfo;
78 TOUCH_FLAGS touchFlags;
79 TOUCH_MASK touchMask;
80 RECT rcContact;
81 RECT rcContactRaw;
82 UINT32 orientation;
83 UINT32 pressure;
86 # define PEN_FLAG_NONE 0x00000000 // Default
87 # define PEN_FLAG_BARREL 0x00000001 // The barrel button is pressed
88 # define PEN_FLAG_INVERTED 0x00000002 // The pen is inverted
89 # define PEN_FLAG_ERASER 0x00000004 // The eraser button is pressed
91 # define PEN_MASK_NONE \
92 0x00000000 // Default - none of the optional fields are valid
93 # define PEN_MASK_PRESSURE 0x00000001 // The pressure field is valid
94 # define PEN_MASK_ROTATION 0x00000002 // The rotation field is valid
95 # define PEN_MASK_TILT_X 0x00000004 // The tiltX field is valid
96 # define PEN_MASK_TILT_Y 0x00000008 // The tiltY field is valid
98 using PEN_FLAGS = UINT32;
99 using PEN_MASK = UINT32;
101 struct POINTER_PEN_INFO {
102 POINTER_INFO pointerInfo;
103 PEN_FLAGS penFlags;
104 PEN_MASK penMask;
105 UINT32 pressure;
106 UINT32 rotation;
107 INT32 tiltX;
108 INT32 tiltY;
111 struct POINTER_TYPE_INFO {
112 POINTER_INPUT_TYPE type;
113 union {
114 POINTER_TOUCH_INFO touchInfo;
115 POINTER_PEN_INFO penInfo;
119 # define TOUCH_FLAG_NONE 0x00000000 // Default
121 # define TOUCH_MASK_NONE \
122 0x00000000 // Default - none of the optional fields are valid
123 # define TOUCH_MASK_CONTACTAREA 0x00000001 // The rcContact field is valid
124 # define TOUCH_MASK_ORIENTATION 0x00000002 // The orientation field is valid
125 # define TOUCH_MASK_PRESSURE 0x00000004 // The pressure field is valid
127 # define POINTER_FLAG_NONE 0x00000000 // Default
128 # define POINTER_FLAG_NEW 0x00000001 // New pointer
129 # define POINTER_FLAG_INRANGE 0x00000002 // Pointer has not departed
130 # define POINTER_FLAG_INCONTACT 0x00000004 // Pointer is in contact
131 # define POINTER_FLAG_FIRSTBUTTON 0x00000010 // Primary action
132 # define POINTER_FLAG_SECONDBUTTON 0x00000020 // Secondary action
133 # define POINTER_FLAG_THIRDBUTTON 0x00000040 // Third button
134 # define POINTER_FLAG_FOURTHBUTTON 0x00000080 // Fourth button
135 # define POINTER_FLAG_FIFTHBUTTON 0x00000100 // Fifth button
136 # define POINTER_FLAG_PRIMARY 0x00002000 // Pointer is primary
137 # define POINTER_FLAG_CONFIDENCE \
138 0x00004000 // Pointer is considered unlikely to be accidental
139 # define POINTER_FLAG_CANCELED \
140 0x00008000 // Pointer is departing in an abnormal manner
141 # define POINTER_FLAG_DOWN \
142 0x00010000 // Pointer transitioned to down state (made contact)
143 # define POINTER_FLAG_UPDATE 0x00020000 // Pointer update
144 # define POINTER_FLAG_UP \
145 0x00040000 // Pointer transitioned from down state (broke contact)
146 # define POINTER_FLAG_WHEEL 0x00080000 // Vertical wheel
147 # define POINTER_FLAG_HWHEEL 0x00100000 // Horizontal wheel
148 # define POINTER_FLAG_CAPTURECHANGED 0x00200000 // Lost capture
150 #endif // TOUCH_FEEDBACK_DEFAULT
152 #define TOUCH_FLAGS_CONTACTUPDATE \
153 (POINTER_FLAG_UPDATE | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT)
154 #define TOUCH_FLAGS_CONTACTDOWN \
155 (POINTER_FLAG_DOWN | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT)
157 using InitializeTouchInjectionPtr = BOOL(WINAPI*)(UINT32, DWORD);
158 using InjectTouchInputPtr = BOOL(WINAPI*)(UINT32, const POINTER_TOUCH_INFO*);
160 #if !defined(NTDDI_WIN10_RS5) || (NTDDI_VERSION < NTDDI_WIN10_RS5)
161 # define HSYNTHETICPOINTERDEVICE intptr_t
162 #endif // NTDDI_VERSION < NTDDI_WIN10_RS5
164 using CreateSyntheticPointerDevicePtr = HSYNTHETICPOINTERDEVICE(WINAPI*)(
165 POINTER_INPUT_TYPE, ULONG, POINTER_FEEDBACK_MODE);
166 using DestroySyntheticPointerDevicePtr = void(WINAPI*)(HSYNTHETICPOINTERDEVICE);
167 using InjectSyntheticPointerInputPtr = BOOL(WINAPI*)(HSYNTHETICPOINTERDEVICE,
168 const POINTER_TYPE_INFO*,
169 UINT32);
171 #endif // touchinjection_sdk80_h