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 4
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#define XIGrabtypeGesturePinchBegin 5
89#define XIGrabtypeGestureSwipeBegin 6
90
91/* Passive grab modifier */
92#define XIAnyModifier (1U << 31)
93#define XIAnyButton 0
94#define XIAnyKeycode 0
95
96/* XIAllowEvents event-modes */
97#define XIAsyncDevice 0
98#define XISyncDevice 1
99#define XIReplayDevice 2
100#define XIAsyncPairedDevice 3
101#define XIAsyncPair 4
102#define XISyncPair 5
103#define XIAcceptTouch 6
104#define XIRejectTouch 7
105
106/* DeviceChangedEvent change reasons */
107#define XISlaveSwitch 1
108#define XIDeviceChange 2
109
110/* Hierarchy flags */
111#define XIMasterAdded (1 << 0)
112#define XIMasterRemoved (1 << 1)
113#define XISlaveAdded (1 << 2)
114#define XISlaveRemoved (1 << 3)
115#define XISlaveAttached (1 << 4)
116#define XISlaveDetached (1 << 5)
117#define XIDeviceEnabled (1 << 6)
118#define XIDeviceDisabled (1 << 7)
119
120/* ChangeHierarchy constants */
121#define XIAddMaster 1
122#define XIRemoveMaster 2
123#define XIAttachSlave 3
124#define XIDetachSlave 4
125
126#define XIAttachToMaster 1
127#define XIFloating 2
128
129/* Valuator modes */
130#define XIModeRelative 0
131#define XIModeAbsolute 1
132
133/* Device types */
134#define XIMasterPointer 1
135#define XIMasterKeyboard 2
136#define XISlavePointer 3
137#define XISlaveKeyboard 4
138#define XIFloatingSlave 5
139
140/* Device classes: classes that are not identical to Xi 1.x classes must be
141 * numbered starting from 8. */
142#define XIKeyClass 0
143#define XIButtonClass 1
144#define XIValuatorClass 2
145#define XIScrollClass 3
146#define XITouchClass 8
147#define XIGestureClass 9
148
149/* Scroll class types */
150#define XIScrollTypeVertical 1
151#define XIScrollTypeHorizontal 2
152
153/* Scroll class flags */
154#define XIScrollFlagNoEmulation (1 << 0)
155#define XIScrollFlagPreferred (1 << 1)
156
157/* Device event flags (common) */
158/* Device event flags (key events only) */
159#define XIKeyRepeat (1 << 16)
160/* Device event flags (pointer events only) */
161#define XIPointerEmulated (1 << 16)
162/* Device event flags (touch events only) */
163#define XITouchPendingEnd (1 << 16)
164#define XITouchEmulatingPointer (1 << 17)
165
166/* Barrier event flags */
167#define XIBarrierPointerReleased (1 << 0)
168#define XIBarrierDeviceIsGrabbed (1 << 1)
169
170/* Gesture pinch event flags */
171#define XIGesturePinchEventCancelled (1 << 0)
172
173/* Gesture swipe event flags */
174#define XIGestureSwipeEventCancelled (1 << 0)
175
176/* Touch modes */
177#define XIDirectTouch 1
178#define XIDependentTouch 2
179
180/* XI2 event mask macros */
181#define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7)))
182#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7)))
183#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7)))
184#define XIMaskLen(event) (((event) >> 3) + 1)
185
186/* Fake device ID's for event selection */
187#define XIAllDevices 0
188#define XIAllMasterDevices 1
189
190/* Event types */
191#define XI_DeviceChanged 1
192#define XI_KeyPress 2
193#define XI_KeyRelease 3
194#define XI_ButtonPress 4
195#define XI_ButtonRelease 5
196#define XI_Motion 6
197#define XI_Enter 7
198#define XI_Leave 8
199#define XI_FocusIn 9
200#define XI_FocusOut 10
201#define XI_HierarchyChanged 11
202#define XI_PropertyEvent 12
203#define XI_RawKeyPress 13
204#define XI_RawKeyRelease 14
205#define XI_RawButtonPress 15
206#define XI_RawButtonRelease 16
207#define XI_RawMotion 17
208#define XI_TouchBegin 18 /* XI 2.2 */
209#define XI_TouchUpdate 19
210#define XI_TouchEnd 20
211#define XI_TouchOwnership 21
212#define XI_RawTouchBegin 22
213#define XI_RawTouchUpdate 23
214#define XI_RawTouchEnd 24
215#define XI_BarrierHit 25 /* XI 2.3 */
216#define XI_BarrierLeave 26
217#define XI_GesturePinchBegin 27 /* XI 2.4 */
218#define XI_GesturePinchUpdate 28
219#define XI_GesturePinchEnd 29
220#define XI_GestureSwipeBegin 30
221#define XI_GestureSwipeUpdate 31
222#define XI_GestureSwipeEnd 32
223#define XI_LASTEVENT XI_GestureSwipeEnd
224/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
225 * as XI_LASTEVENT if the server is supposed to handle masks etc. for this
226 * type of event. */
227
228/* Event masks.
229 * Note: the protocol spec defines a mask to be of (1 << type). Clients are
230 * free to create masks by bitshifting instead of using these defines.
231 */
232#define XI_DeviceChangedMask (1 << XI_DeviceChanged)
233#define XI_KeyPressMask (1 << XI_KeyPress)
234#define XI_KeyReleaseMask (1 << XI_KeyRelease)
235#define XI_ButtonPressMask (1 << XI_ButtonPress)
236#define XI_ButtonReleaseMask (1 << XI_ButtonRelease)
237#define XI_MotionMask (1 << XI_Motion)
238#define XI_EnterMask (1 << XI_Enter)
239#define XI_LeaveMask (1 << XI_Leave)
240#define XI_FocusInMask (1 << XI_FocusIn)
241#define XI_FocusOutMask (1 << XI_FocusOut)
242#define XI_HierarchyChangedMask (1 << XI_HierarchyChanged)
243#define XI_PropertyEventMask (1 << XI_PropertyEvent)
244#define XI_RawKeyPressMask (1 << XI_RawKeyPress)
245#define XI_RawKeyReleaseMask (1 << XI_RawKeyRelease)
246#define XI_RawButtonPressMask (1 << XI_RawButtonPress)
247#define XI_RawButtonReleaseMask (1 << XI_RawButtonRelease)
248#define XI_RawMotionMask (1 << XI_RawMotion)
249#define XI_TouchBeginMask (1 << XI_TouchBegin)
250#define XI_TouchEndMask (1 << XI_TouchEnd)
251#define XI_TouchOwnershipChangedMask (1 << XI_TouchOwnership)
252#define XI_TouchUpdateMask (1 << XI_TouchUpdate)
253#define XI_RawTouchBeginMask (1 << XI_RawTouchBegin)
254#define XI_RawTouchEndMask (1 << XI_RawTouchEnd)
255#define XI_RawTouchUpdateMask (1 << XI_RawTouchUpdate)
256#define XI_BarrierHitMask (1 << XI_BarrierHit)
257#define XI_BarrierLeaveMask (1 << XI_BarrierLeave)
258
259#endif /* _XI2_H_ */
260