117ca54c3Smrg/*
217ca54c3Smrg * Copyright © 2009 Red Hat, Inc.
317ca54c3Smrg *
417ca54c3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
517ca54c3Smrg * copy of this software and associated documentation files (the "Software"),
617ca54c3Smrg * to deal in the Software without restriction, including without limitation
717ca54c3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
817ca54c3Smrg * and/or sell copies of the Software, and to permit persons to whom the
917ca54c3Smrg * Software is furnished to do so, subject to the following conditions:
1017ca54c3Smrg *
1117ca54c3Smrg * The above copyright notice and this permission notice (including the next
1217ca54c3Smrg * paragraph) shall be included in all copies or substantial portions of the
1317ca54c3Smrg * Software.
1417ca54c3Smrg *
1517ca54c3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1617ca54c3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717ca54c3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1817ca54c3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1917ca54c3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2017ca54c3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2117ca54c3Smrg * DEALINGS IN THE SOFTWARE.
2217ca54c3Smrg *
2317ca54c3Smrg */
2417ca54c3Smrg
2517ca54c3Smrg#ifndef _XI2_H_
2617ca54c3Smrg#define _XI2_H_
2717ca54c3Smrg
2817ca54c3Smrg#define XInput_2_0                              7
2917ca54c3Smrg/* DO NOT ADD TO THIS LIST. These are libXi-specific defines.
3017ca54c3Smrg   See commit libXi-1.4.2-21-ge8531dd */
3117ca54c3Smrg
3217ca54c3Smrg#define XI_2_Major                              2
33f2ea6e01Smrg#define XI_2_Minor                              4
3417ca54c3Smrg
3517ca54c3Smrg/* Property event flags */
3617ca54c3Smrg#define XIPropertyDeleted                       0
3717ca54c3Smrg#define XIPropertyCreated                       1
3817ca54c3Smrg#define XIPropertyModified                      2
3917ca54c3Smrg
4017ca54c3Smrg/* Property modes */
4117ca54c3Smrg#define XIPropModeReplace                       0
4217ca54c3Smrg#define XIPropModePrepend                       1
4317ca54c3Smrg#define XIPropModeAppend                        2
4417ca54c3Smrg
4517ca54c3Smrg/* Special property type used for XIGetProperty */
4617ca54c3Smrg#define XIAnyPropertyType                       0L
4717ca54c3Smrg
4817ca54c3Smrg/* Enter/Leave and Focus In/Out modes */
4917ca54c3Smrg#define XINotifyNormal                          0
5017ca54c3Smrg#define XINotifyGrab                            1
5117ca54c3Smrg#define XINotifyUngrab                          2
5217ca54c3Smrg#define XINotifyWhileGrabbed                    3
5317ca54c3Smrg#define XINotifyPassiveGrab                     4
5417ca54c3Smrg#define XINotifyPassiveUngrab                   5
5517ca54c3Smrg
5617ca54c3Smrg/* Enter/Leave and focus In/out detail */
5717ca54c3Smrg#define XINotifyAncestor                        0
5817ca54c3Smrg#define XINotifyVirtual                         1
5917ca54c3Smrg#define XINotifyInferior                        2
6017ca54c3Smrg#define XINotifyNonlinear                       3
6117ca54c3Smrg#define XINotifyNonlinearVirtual                4
6217ca54c3Smrg#define XINotifyPointer                         5
6317ca54c3Smrg#define XINotifyPointerRoot                     6
6417ca54c3Smrg#define XINotifyDetailNone                      7
6517ca54c3Smrg
6617ca54c3Smrg/* Grab modes */
6717ca54c3Smrg#define XIGrabModeSync                          0
6817ca54c3Smrg#define XIGrabModeAsync                         1
6917ca54c3Smrg#define XIGrabModeTouch                         2
7017ca54c3Smrg
7117ca54c3Smrg/* Grab reply status codes */
7217ca54c3Smrg#define XIGrabSuccess                           0
7317ca54c3Smrg#define XIAlreadyGrabbed                        1
7417ca54c3Smrg#define XIGrabInvalidTime                       2
7517ca54c3Smrg#define XIGrabNotViewable                       3
7617ca54c3Smrg#define XIGrabFrozen                            4
7717ca54c3Smrg
7817ca54c3Smrg/* Grab owner events values */
7917ca54c3Smrg#define XIOwnerEvents                           True
8017ca54c3Smrg#define XINoOwnerEvents                         False
8117ca54c3Smrg
8217ca54c3Smrg/* Passive grab types */
8317ca54c3Smrg#define XIGrabtypeButton                        0
8417ca54c3Smrg#define XIGrabtypeKeycode                       1
8517ca54c3Smrg#define XIGrabtypeEnter                         2
8617ca54c3Smrg#define XIGrabtypeFocusIn                       3
8717ca54c3Smrg#define XIGrabtypeTouchBegin                    4
88f2ea6e01Smrg#define XIGrabtypeGesturePinchBegin             5
89f2ea6e01Smrg#define XIGrabtypeGestureSwipeBegin             6
9017ca54c3Smrg
9117ca54c3Smrg/* Passive grab modifier */
9217ca54c3Smrg#define XIAnyModifier                           (1U << 31)
9317ca54c3Smrg#define XIAnyButton                             0
9417ca54c3Smrg#define XIAnyKeycode                            0
9517ca54c3Smrg
9617ca54c3Smrg/* XIAllowEvents event-modes */
9717ca54c3Smrg#define XIAsyncDevice                           0
9817ca54c3Smrg#define XISyncDevice                            1
9917ca54c3Smrg#define XIReplayDevice                          2
10017ca54c3Smrg#define XIAsyncPairedDevice                     3
10117ca54c3Smrg#define XIAsyncPair                             4
10217ca54c3Smrg#define XISyncPair                              5
10317ca54c3Smrg#define XIAcceptTouch                           6
10417ca54c3Smrg#define XIRejectTouch                           7
10517ca54c3Smrg
10617ca54c3Smrg/* DeviceChangedEvent change reasons */
10717ca54c3Smrg#define XISlaveSwitch                           1
10817ca54c3Smrg#define XIDeviceChange                          2
10917ca54c3Smrg
11017ca54c3Smrg/* Hierarchy flags */
11117ca54c3Smrg#define XIMasterAdded                           (1 << 0)
11217ca54c3Smrg#define XIMasterRemoved                         (1 << 1)
11317ca54c3Smrg#define XISlaveAdded                            (1 << 2)
11417ca54c3Smrg#define XISlaveRemoved                          (1 << 3)
11517ca54c3Smrg#define XISlaveAttached                         (1 << 4)
11617ca54c3Smrg#define XISlaveDetached                         (1 << 5)
11717ca54c3Smrg#define XIDeviceEnabled                         (1 << 6)
11817ca54c3Smrg#define XIDeviceDisabled                        (1 << 7)
11917ca54c3Smrg
12017ca54c3Smrg/* ChangeHierarchy constants */
12117ca54c3Smrg#define XIAddMaster                             1
12217ca54c3Smrg#define XIRemoveMaster                          2
12317ca54c3Smrg#define XIAttachSlave                           3
12417ca54c3Smrg#define XIDetachSlave                           4
12517ca54c3Smrg
12617ca54c3Smrg#define XIAttachToMaster                        1
12717ca54c3Smrg#define XIFloating                              2
12817ca54c3Smrg
12917ca54c3Smrg/* Valuator modes */
13017ca54c3Smrg#define XIModeRelative                          0
13117ca54c3Smrg#define XIModeAbsolute                          1
13217ca54c3Smrg
13317ca54c3Smrg/* Device types */
13417ca54c3Smrg#define XIMasterPointer                         1
13517ca54c3Smrg#define XIMasterKeyboard                        2
13617ca54c3Smrg#define XISlavePointer                          3
13717ca54c3Smrg#define XISlaveKeyboard                         4
13817ca54c3Smrg#define XIFloatingSlave                         5
13917ca54c3Smrg
14017ca54c3Smrg/* Device classes: classes that are not identical to Xi 1.x classes must be
14117ca54c3Smrg * numbered starting from 8. */
14217ca54c3Smrg#define XIKeyClass                              0
14317ca54c3Smrg#define XIButtonClass                           1
14417ca54c3Smrg#define XIValuatorClass                         2
14517ca54c3Smrg#define XIScrollClass                           3
14617ca54c3Smrg#define XITouchClass                            8
147f2ea6e01Smrg#define XIGestureClass                          9
14817ca54c3Smrg
14917ca54c3Smrg/* Scroll class types */
15017ca54c3Smrg#define XIScrollTypeVertical                    1
15117ca54c3Smrg#define XIScrollTypeHorizontal                  2
15217ca54c3Smrg
15317ca54c3Smrg/* Scroll class flags */
15417ca54c3Smrg#define XIScrollFlagNoEmulation                 (1 << 0)
15517ca54c3Smrg#define XIScrollFlagPreferred                   (1 << 1)
15617ca54c3Smrg
15717ca54c3Smrg/* Device event flags (common) */
15817ca54c3Smrg/* Device event flags (key events only) */
15917ca54c3Smrg#define XIKeyRepeat                             (1 << 16)
16017ca54c3Smrg/* Device event flags (pointer events only) */
16117ca54c3Smrg#define XIPointerEmulated                       (1 << 16)
16217ca54c3Smrg/* Device event flags (touch events only) */
16317ca54c3Smrg#define XITouchPendingEnd                       (1 << 16)
16417ca54c3Smrg#define XITouchEmulatingPointer                 (1 << 17)
16517ca54c3Smrg
16617ca54c3Smrg/* Barrier event flags */
16717ca54c3Smrg#define XIBarrierPointerReleased                (1 << 0)
16817ca54c3Smrg#define XIBarrierDeviceIsGrabbed                (1 << 1)
16917ca54c3Smrg
170f2ea6e01Smrg/* Gesture pinch event flags */
171f2ea6e01Smrg#define XIGesturePinchEventCancelled            (1 << 0)
172f2ea6e01Smrg
173f2ea6e01Smrg/* Gesture swipe event flags */
174f2ea6e01Smrg#define XIGestureSwipeEventCancelled            (1 << 0)
17517ca54c3Smrg
17617ca54c3Smrg/* Touch modes */
17717ca54c3Smrg#define XIDirectTouch                           1
17817ca54c3Smrg#define XIDependentTouch                        2
17917ca54c3Smrg
18017ca54c3Smrg/* XI2 event mask macros */
18117ca54c3Smrg#define XISetMask(ptr, event)   (((unsigned char*)(ptr))[(event)>>3] |=  (1 << ((event) & 7)))
18217ca54c3Smrg#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7)))
18317ca54c3Smrg#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &   (1 << ((event) & 7)))
18417ca54c3Smrg#define XIMaskLen(event)        (((event) >> 3) + 1)
18517ca54c3Smrg
18617ca54c3Smrg/* Fake device ID's for event selection */
18717ca54c3Smrg#define XIAllDevices                            0
18817ca54c3Smrg#define XIAllMasterDevices                      1
18917ca54c3Smrg
19017ca54c3Smrg/* Event types */
19117ca54c3Smrg#define XI_DeviceChanged                 1
19217ca54c3Smrg#define XI_KeyPress                      2
19317ca54c3Smrg#define XI_KeyRelease                    3
19417ca54c3Smrg#define XI_ButtonPress                   4
19517ca54c3Smrg#define XI_ButtonRelease                 5
19617ca54c3Smrg#define XI_Motion                        6
19717ca54c3Smrg#define XI_Enter                         7
19817ca54c3Smrg#define XI_Leave                         8
19917ca54c3Smrg#define XI_FocusIn                       9
20017ca54c3Smrg#define XI_FocusOut                      10
20117ca54c3Smrg#define XI_HierarchyChanged              11
20217ca54c3Smrg#define XI_PropertyEvent                 12
20317ca54c3Smrg#define XI_RawKeyPress                   13
20417ca54c3Smrg#define XI_RawKeyRelease                 14
20517ca54c3Smrg#define XI_RawButtonPress                15
20617ca54c3Smrg#define XI_RawButtonRelease              16
20717ca54c3Smrg#define XI_RawMotion                     17
20817ca54c3Smrg#define XI_TouchBegin                    18 /* XI 2.2 */
20917ca54c3Smrg#define XI_TouchUpdate                   19
21017ca54c3Smrg#define XI_TouchEnd                      20
21117ca54c3Smrg#define XI_TouchOwnership                21
21217ca54c3Smrg#define XI_RawTouchBegin                 22
21317ca54c3Smrg#define XI_RawTouchUpdate                23
21417ca54c3Smrg#define XI_RawTouchEnd                   24
21517ca54c3Smrg#define XI_BarrierHit                    25 /* XI 2.3 */
21617ca54c3Smrg#define XI_BarrierLeave                  26
217f2ea6e01Smrg#define XI_GesturePinchBegin             27 /* XI 2.4 */
218f2ea6e01Smrg#define XI_GesturePinchUpdate            28
219f2ea6e01Smrg#define XI_GesturePinchEnd               29
220f2ea6e01Smrg#define XI_GestureSwipeBegin             30
221f2ea6e01Smrg#define XI_GestureSwipeUpdate            31
222f2ea6e01Smrg#define XI_GestureSwipeEnd               32
223f2ea6e01Smrg#define XI_LASTEVENT                     XI_GestureSwipeEnd
22417ca54c3Smrg/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
22517ca54c3Smrg * as XI_LASTEVENT if the server is supposed to handle masks etc. for this
22617ca54c3Smrg * type of event. */
22717ca54c3Smrg
22817ca54c3Smrg/* Event masks.
22917ca54c3Smrg * Note: the protocol spec defines a mask to be of (1 << type). Clients are
23017ca54c3Smrg * free to create masks by bitshifting instead of using these defines.
23117ca54c3Smrg */
23217ca54c3Smrg#define XI_DeviceChangedMask             (1 << XI_DeviceChanged)
23317ca54c3Smrg#define XI_KeyPressMask                  (1 << XI_KeyPress)
23417ca54c3Smrg#define XI_KeyReleaseMask                (1 << XI_KeyRelease)
23517ca54c3Smrg#define XI_ButtonPressMask               (1 << XI_ButtonPress)
23617ca54c3Smrg#define XI_ButtonReleaseMask             (1 << XI_ButtonRelease)
23717ca54c3Smrg#define XI_MotionMask                    (1 << XI_Motion)
23817ca54c3Smrg#define XI_EnterMask                     (1 << XI_Enter)
23917ca54c3Smrg#define XI_LeaveMask                     (1 << XI_Leave)
24017ca54c3Smrg#define XI_FocusInMask                   (1 << XI_FocusIn)
24117ca54c3Smrg#define XI_FocusOutMask                  (1 << XI_FocusOut)
24217ca54c3Smrg#define XI_HierarchyChangedMask          (1 << XI_HierarchyChanged)
24317ca54c3Smrg#define XI_PropertyEventMask             (1 << XI_PropertyEvent)
24417ca54c3Smrg#define XI_RawKeyPressMask               (1 << XI_RawKeyPress)
24517ca54c3Smrg#define XI_RawKeyReleaseMask             (1 << XI_RawKeyRelease)
24617ca54c3Smrg#define XI_RawButtonPressMask            (1 << XI_RawButtonPress)
24717ca54c3Smrg#define XI_RawButtonReleaseMask          (1 << XI_RawButtonRelease)
24817ca54c3Smrg#define XI_RawMotionMask                 (1 << XI_RawMotion)
24917ca54c3Smrg#define XI_TouchBeginMask                (1 << XI_TouchBegin)
25017ca54c3Smrg#define XI_TouchEndMask                  (1 << XI_TouchEnd)
25117ca54c3Smrg#define XI_TouchOwnershipChangedMask     (1 << XI_TouchOwnership)
25217ca54c3Smrg#define XI_TouchUpdateMask               (1 << XI_TouchUpdate)
25317ca54c3Smrg#define XI_RawTouchBeginMask             (1 << XI_RawTouchBegin)
25417ca54c3Smrg#define XI_RawTouchEndMask               (1 << XI_RawTouchEnd)
25517ca54c3Smrg#define XI_RawTouchUpdateMask            (1 << XI_RawTouchUpdate)
25617ca54c3Smrg#define XI_BarrierHitMask                (1 << XI_BarrierHit)
25717ca54c3Smrg#define XI_BarrierLeaveMask              (1 << XI_BarrierLeave)
25817ca54c3Smrg
25917ca54c3Smrg#endif /* _XI2_H_ */
260