1 | /* |
2 | * Copyright © 2009 Red Hat, Inc. |
3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), |
6 | * to deal in the Software without restriction, including without limitation |
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
8 | * and/or sell copies of the Software, and to permit persons to whom the |
9 | * Software is furnished to do so, subject to the following conditions: |
10 | * |
11 | * The above copyright notice and this permission notice (including the next |
12 | * paragraph) shall be included in all copies or substantial portions of the |
13 | * Software. |
14 | * |
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | * DEALINGS IN THE SOFTWARE. |
22 | * |
23 | */ |
24 | |
25 | #ifndef _XI2_H_ |
26 | #define _XI2_H_ |
27 | |
28 | #define XInput_2_0 7 |
29 | /* DO NOT ADD TO THIS LIST. These are libXi-specific defines. |
30 | See commit libXi-1.4.2-21-ge8531dd */ |
31 | |
32 | #define XI_2_Major 2 |
33 | #define XI_2_Minor 3 |
34 | |
35 | /* Property event flags */ |
36 | #define XIPropertyDeleted 0 |
37 | #define XIPropertyCreated 1 |
38 | #define XIPropertyModified 2 |
39 | |
40 | /* Property modes */ |
41 | #define XIPropModeReplace 0 |
42 | #define XIPropModePrepend 1 |
43 | #define XIPropModeAppend 2 |
44 | |
45 | /* Special property type used for XIGetProperty */ |
46 | #define XIAnyPropertyType 0L |
47 | |
48 | /* Enter/Leave and Focus In/Out modes */ |
49 | #define XINotifyNormal 0 |
50 | #define XINotifyGrab 1 |
51 | #define XINotifyUngrab 2 |
52 | #define XINotifyWhileGrabbed 3 |
53 | #define XINotifyPassiveGrab 4 |
54 | #define XINotifyPassiveUngrab 5 |
55 | |
56 | /* Enter/Leave and focus In/out detail */ |
57 | #define XINotifyAncestor 0 |
58 | #define XINotifyVirtual 1 |
59 | #define XINotifyInferior 2 |
60 | #define XINotifyNonlinear 3 |
61 | #define XINotifyNonlinearVirtual 4 |
62 | #define XINotifyPointer 5 |
63 | #define XINotifyPointerRoot 6 |
64 | #define XINotifyDetailNone 7 |
65 | |
66 | /* Grab modes */ |
67 | #define XIGrabModeSync 0 |
68 | #define XIGrabModeAsync 1 |
69 | #define XIGrabModeTouch 2 |
70 | |
71 | /* Grab reply status codes */ |
72 | #define XIGrabSuccess 0 |
73 | #define XIAlreadyGrabbed 1 |
74 | #define XIGrabInvalidTime 2 |
75 | #define XIGrabNotViewable 3 |
76 | #define XIGrabFrozen 4 |
77 | |
78 | /* Grab owner events values */ |
79 | #define XIOwnerEvents True |
80 | #define XINoOwnerEvents False |
81 | |
82 | /* Passive grab types */ |
83 | #define XIGrabtypeButton 0 |
84 | #define XIGrabtypeKeycode 1 |
85 | #define XIGrabtypeEnter 2 |
86 | #define XIGrabtypeFocusIn 3 |
87 | #define XIGrabtypeTouchBegin 4 |
88 | |
89 | /* Passive grab modifier */ |
90 | #define XIAnyModifier (1U << 31) |
91 | #define XIAnyButton 0 |
92 | #define XIAnyKeycode 0 |
93 | |
94 | /* XIAllowEvents event-modes */ |
95 | #define XIAsyncDevice 0 |
96 | #define XISyncDevice 1 |
97 | #define XIReplayDevice 2 |
98 | #define XIAsyncPairedDevice 3 |
99 | #define XIAsyncPair 4 |
100 | #define XISyncPair 5 |
101 | #define XIAcceptTouch 6 |
102 | #define XIRejectTouch 7 |
103 | |
104 | /* DeviceChangedEvent change reasons */ |
105 | #define XISlaveSwitch 1 |
106 | #define XIDeviceChange 2 |
107 | |
108 | /* Hierarchy flags */ |
109 | #define XIMasterAdded (1 << 0) |
110 | #define XIMasterRemoved (1 << 1) |
111 | #define XISlaveAdded (1 << 2) |
112 | #define XISlaveRemoved (1 << 3) |
113 | #define XISlaveAttached (1 << 4) |
114 | #define XISlaveDetached (1 << 5) |
115 | #define XIDeviceEnabled (1 << 6) |
116 | #define XIDeviceDisabled (1 << 7) |
117 | |
118 | /* ChangeHierarchy constants */ |
119 | #define XIAddMaster 1 |
120 | #define XIRemoveMaster 2 |
121 | #define XIAttachSlave 3 |
122 | #define XIDetachSlave 4 |
123 | |
124 | #define XIAttachToMaster 1 |
125 | #define XIFloating 2 |
126 | |
127 | /* Valuator modes */ |
128 | #define XIModeRelative 0 |
129 | #define XIModeAbsolute 1 |
130 | |
131 | /* Device types */ |
132 | #define XIMasterPointer 1 |
133 | #define XIMasterKeyboard 2 |
134 | #define XISlavePointer 3 |
135 | #define XISlaveKeyboard 4 |
136 | #define XIFloatingSlave 5 |
137 | |
138 | /* Device classes: classes that are not identical to Xi 1.x classes must be |
139 | * numbered starting from 8. */ |
140 | #define XIKeyClass 0 |
141 | #define XIButtonClass 1 |
142 | #define XIValuatorClass 2 |
143 | #define XIScrollClass 3 |
144 | #define XITouchClass 8 |
145 | |
146 | /* Scroll class types */ |
147 | #define XIScrollTypeVertical 1 |
148 | #define XIScrollTypeHorizontal 2 |
149 | |
150 | /* Scroll class flags */ |
151 | #define XIScrollFlagNoEmulation (1 << 0) |
152 | #define XIScrollFlagPreferred (1 << 1) |
153 | |
154 | /* Device event flags (common) */ |
155 | /* Device event flags (key events only) */ |
156 | #define XIKeyRepeat (1 << 16) |
157 | /* Device event flags (pointer events only) */ |
158 | #define XIPointerEmulated (1 << 16) |
159 | /* Device event flags (touch events only) */ |
160 | #define XITouchPendingEnd (1 << 16) |
161 | #define XITouchEmulatingPointer (1 << 17) |
162 | |
163 | /* Barrier event flags */ |
164 | #define XIBarrierPointerReleased (1 << 0) |
165 | #define XIBarrierDeviceIsGrabbed (1 << 1) |
166 | |
167 | |
168 | /* Touch modes */ |
169 | #define XIDirectTouch 1 |
170 | #define XIDependentTouch 2 |
171 | |
172 | /* XI2 event mask macros */ |
173 | #define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7))) |
174 | #define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7))) |
175 | #define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7))) |
176 | #define XIMaskLen(event) (((event) >> 3) + 1) |
177 | |
178 | /* Fake device ID's for event selection */ |
179 | #define XIAllDevices 0 |
180 | #define XIAllMasterDevices 1 |
181 | |
182 | /* Event types */ |
183 | #define XI_DeviceChanged 1 |
184 | #define XI_KeyPress 2 |
185 | #define XI_KeyRelease 3 |
186 | #define XI_ButtonPress 4 |
187 | #define XI_ButtonRelease 5 |
188 | #define XI_Motion 6 |
189 | #define XI_Enter 7 |
190 | #define XI_Leave 8 |
191 | #define XI_FocusIn 9 |
192 | #define XI_FocusOut 10 |
193 | #define XI_HierarchyChanged 11 |
194 | #define XI_PropertyEvent 12 |
195 | #define XI_RawKeyPress 13 |
196 | #define XI_RawKeyRelease 14 |
197 | #define XI_RawButtonPress 15 |
198 | #define XI_RawButtonRelease 16 |
199 | #define XI_RawMotion 17 |
200 | #define XI_TouchBegin 18 /* XI 2.2 */ |
201 | #define XI_TouchUpdate 19 |
202 | #define XI_TouchEnd 20 |
203 | #define XI_TouchOwnership 21 |
204 | #define XI_RawTouchBegin 22 |
205 | #define XI_RawTouchUpdate 23 |
206 | #define XI_RawTouchEnd 24 |
207 | #define XI_BarrierHit 25 /* XI 2.3 */ |
208 | #define XI_BarrierLeave 26 |
209 | #define XI_LASTEVENT XI_BarrierLeave |
210 | /* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value |
211 | * as XI_LASTEVENT if the server is supposed to handle masks etc. for this |
212 | * type of event. */ |
213 | |
214 | /* Event masks. |
215 | * Note: the protocol spec defines a mask to be of (1 << type). Clients are |
216 | * free to create masks by bitshifting instead of using these defines. |
217 | */ |
218 | #define XI_DeviceChangedMask (1 << XI_DeviceChanged) |
219 | #define XI_KeyPressMask (1 << XI_KeyPress) |
220 | #define XI_KeyReleaseMask (1 << XI_KeyRelease) |
221 | #define XI_ButtonPressMask (1 << XI_ButtonPress) |
222 | #define XI_ButtonReleaseMask (1 << XI_ButtonRelease) |
223 | #define XI_MotionMask (1 << XI_Motion) |
224 | #define XI_EnterMask (1 << XI_Enter) |
225 | #define XI_LeaveMask (1 << XI_Leave) |
226 | #define XI_FocusInMask (1 << XI_FocusIn) |
227 | #define XI_FocusOutMask (1 << XI_FocusOut) |
228 | #define XI_HierarchyChangedMask (1 << XI_HierarchyChanged) |
229 | #define XI_PropertyEventMask (1 << XI_PropertyEvent) |
230 | #define XI_RawKeyPressMask (1 << XI_RawKeyPress) |
231 | #define XI_RawKeyReleaseMask (1 << XI_RawKeyRelease) |
232 | #define XI_RawButtonPressMask (1 << XI_RawButtonPress) |
233 | #define XI_RawButtonReleaseMask (1 << XI_RawButtonRelease) |
234 | #define XI_RawMotionMask (1 << XI_RawMotion) |
235 | #define XI_TouchBeginMask (1 << XI_TouchBegin) |
236 | #define XI_TouchEndMask (1 << XI_TouchEnd) |
237 | #define XI_TouchOwnershipChangedMask (1 << XI_TouchOwnership) |
238 | #define XI_TouchUpdateMask (1 << XI_TouchUpdate) |
239 | #define XI_RawTouchBeginMask (1 << XI_RawTouchBegin) |
240 | #define XI_RawTouchEndMask (1 << XI_RawTouchEnd) |
241 | #define XI_RawTouchUpdateMask (1 << XI_RawTouchUpdate) |
242 | #define XI_BarrierHitMask (1 << XI_BarrierHit) |
243 | #define XI_BarrierLeaveMask (1 << XI_BarrierLeave) |
244 | |
245 | #endif /* _XI2_H_ */ |
246 | |