6ba1377aadededbc3e9d38eabc10f34027869a01
[framework/uifw/xorg/proto/x11proto-input.git] / XI2.h
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 /* Indices into the versions[] array (XExtInt.c). Used as a index to
29  * retrieve the minimum version of XI from _XiCheckExtInit.
30  * For indices 0 to 6 see XI.h */
31 #ifndef Dont_Check /* defined in XI.h */
32 #define Dont_Check                              0
33 #endif
34 #define XInput_2_0                              7
35
36
37 #define XI_2_Major                              2
38 #define XI_2_Minor                              0
39
40 /* Property event flags */
41 #define XIPropertyDeleted                       0
42 #define XIPropertyCreated                       1
43 #define XIPropertyModified                      2
44
45 /* Enter/Leave and Focus In/Out modes */
46 #define XINotifyNormal                          0
47 #define XINotifyGrab                            1
48 #define XINotifyUngrab                          2
49 #define XINotifyWhileGrabbed                    3
50 #define XINotifyPassiveGrab                     4
51 #define XINotifyPassiveUngrab                   5
52
53 /* Enter/Leave and focus In/out detail */
54 #define XINotifyAncestor                        0
55 #define XINotifyVirtual                         1
56 #define XINotifyInferior                        2
57 #define XINotifyNonlinear                       3
58 #define XINotifyNonlinearVirtual                4
59 #define XINotifyPointer                         5
60 #define XINotifyPointerRoot                     6
61 #define XINotifyDetailNone                      7
62
63 /* Passive grab types */
64 #define XIGrabtypeButton                        0
65 #define XIGrabtypeKeycode                       1
66 #define XIGrabtypeEnter                         2
67 #define XIGrabtypeFocusIn                       3
68
69 /* Passive grab modifier */
70 #define XIAnyModifier                           (1U << 31)
71 #define XIAnyButton                             0
72 #define XIAnyKeycode                            0
73
74 /* XIAllowEvents event-modes */
75 #define XIAsyncDevice                           0
76 #define XISyncDevice                            1
77 #define XIReplayDevice                          2
78 #define XIAsyncPairedDevice                     3
79 #define XIAsyncPair                             4
80 #define XISyncPair                              5
81
82 /* DeviceChangedEvent change reasons */
83 #define XISlaveSwitch                           1
84 #define XIDeviceChange                          2
85
86 /* Hierarchy flags */
87 #define XIMasterAdded                           (1 << 0)
88 #define XIMasterRemoved                         (1 << 1)
89 #define XISlaveAdded                            (1 << 2)
90 #define XISlaveRemoved                          (1 << 3)
91 #define XISlaveAttached                         (1 << 4)
92 #define XISlaveDetached                         (1 << 5)
93 #define XIDeviceEnabled                         (1 << 6)
94 #define XIDeviceDisabled                        (1 << 7)
95
96 /* ChangeHierarchy constants */
97 #define XIAddMaster                             1
98 #define XIRemoveMaster                          2
99 #define XIAttachSlave                           3
100 #define XIDetachSlave                           4
101
102 #define XIAttachToMaster                        1
103 #define XIFloating                              2
104
105 /* Valuator modes */
106 #define XIModeRelative                          0
107 #define XIModeAbsolute                          1
108
109 /* Device types */
110 #define XIMasterPointer                         1
111 #define XIMasterKeyboard                        2
112 #define XISlavePointer                          3
113 #define XISlaveKeyboard                         4
114 #define XIFloatingSlave                         5
115
116 /* Device classes */
117 #define XIKeyClass                              0
118 #define XIButtonClass                           1
119 #define XIValuatorClass                         2
120
121 /* Device event flags (common) */
122 /* Device event flags (key events only) */
123 #define XIKeyRepeat                             (1 << 16)
124 /* Device event flags (pointer events only) */
125
126 /* XI2 event mask macros */
127 #define XISetMask(ptr, event)   (((unsigned char*)(ptr))[(event)>>3] |=  (1 << ((event) & 7)))
128 #define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7)))
129 #define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &   (1 << ((event) & 7)))
130 #define XIMaskLen(event)        (((event + 7) >> 3))
131
132 /* Fake device ID's for event selection */
133 #define XIAllDevices                            0
134 #define XIAllMasterDevices                      1
135
136 /* Event types */
137 #define XI_DeviceChanged                 1
138 #define XI_KeyPress                      2
139 #define XI_KeyRelease                    3
140 #define XI_ButtonPress                   4
141 #define XI_ButtonRelease                 5
142 #define XI_Motion                        6
143 #define XI_Enter                         7
144 #define XI_Leave                         8
145 #define XI_FocusIn                       9
146 #define XI_FocusOut                      10
147 #define XI_HierarchyChanged              11
148 #define XI_PropertyEvent                 12
149 #define XI_RawKeyPress                   13
150 #define XI_RawKeyRelease                 14
151 #define XI_RawButtonPress                15
152 #define XI_RawButtonRelease              16
153 #define XI_RawMotion                     17
154 #define XI_LASTEVENT                     XI_RawMotion
155 /* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
156  * as XI_LASTEVENT if the server is supposed to handle masks etc. for this
157  * type of event. */
158
159 /* Event masks.
160  * Note: the protocol spec defines a mask to be of (1 << type). Clients are
161  * free to create masks by bitshifting instead of using these defines.
162  */
163 #define XI_DeviceChangedMask             (1 << XI_DeviceChanged)
164 #define XI_KeyPressMask                  (1 << XI_KeyPress)
165 #define XI_KeyReleaseMask                (1 << XI_KeyRelease)
166 #define XI_ButtonPressMask               (1 << XI_ButtonPress)
167 #define XI_ButtonReleaseMask             (1 << XI_ButtonRelease)
168 #define XI_MotionMask                    (1 << XI_Motion)
169 #define XI_EnterMask                     (1 << XI_Enter)
170 #define XI_LeaveMask                     (1 << XI_Leave)
171 #define XI_FocusInMask                   (1 << XI_FocusIn)
172 #define XI_FocusOutMask                  (1 << XI_FocusOut)
173 #define XI_HierarchyChangedMask          (1 << XI_HierarchyChanged)
174 #define XI_PropertyEventMask             (1 << XI_PropertyEvent)
175 #define XI_RawKeyPressMask               (1 << XI_RawKeyPress)
176 #define XI_RawKeyReleaseMask             (1 << XI_RawKeyRelease)
177 #define XI_RawButtonPressMask            (1 << XI_RawButtonPress)
178 #define XI_RawButtonReleaseMask          (1 << XI_RawButtonRelease)
179 #define XI_RawMotionMask                 (1 << XI_RawMotion)
180
181 #endif /* _XI2_H_ */