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