1 module x11.extensions.XI; 2 3 version(Posix): 4 5 import core.stdc.config; 6 7 /* Definitions used by the server, library and client */ 8 9 const int sz_xGetExtensionVersionReq = 8; 10 const int sz_xGetExtensionVersionReply = 32; 11 const int sz_xListInputDevicesReq = 4; 12 const int sz_xListInputDevicesReply = 32; 13 const int sz_xOpenDeviceReq = 8; 14 const int sz_xOpenDeviceReply = 32; 15 const int sz_xCloseDeviceReq = 8; 16 const int sz_xSetDeviceModeReq = 8; 17 const int sz_xSetDeviceModeReply = 32; 18 const int sz_xSelectExtensionEventReq = 12; 19 const int sz_xGetSelectedExtensionEventsReq = 8; 20 const int sz_xGetSelectedExtensionEventsReply = 32; 21 const int sz_xChangeDeviceDontPropagateListReq = 12; 22 const int sz_xGetDeviceDontPropagateListReq = 8; 23 const int sz_xGetDeviceDontPropagateListReply = 32; 24 const int sz_xGetDeviceMotionEventsReq = 16; 25 const int sz_xGetDeviceMotionEventsReply = 32; 26 const int sz_xChangeKeyboardDeviceReq = 8; 27 const int sz_xChangeKeyboardDeviceReply = 32; 28 const int sz_xChangePointerDeviceReq = 8; 29 const int sz_xChangePointerDeviceReply = 32; 30 const int sz_xGrabDeviceReq = 20; 31 const int sz_xGrabDeviceReply = 32; 32 const int sz_xUngrabDeviceReq = 12; 33 const int sz_xGrabDeviceKeyReq = 20; 34 const int sz_xGrabDeviceKeyReply = 32; 35 const int sz_xUngrabDeviceKeyReq = 16; 36 const int sz_xGrabDeviceButtonReq = 20; 37 const int sz_xGrabDeviceButtonReply = 32; 38 const int sz_xUngrabDeviceButtonReq = 16; 39 const int sz_xAllowDeviceEventsReq = 12; 40 const int sz_xGetDeviceFocusReq = 8; 41 const int sz_xGetDeviceFocusReply = 32; 42 const int sz_xSetDeviceFocusReq = 16; 43 const int sz_xGetFeedbackControlReq = 8; 44 const int sz_xGetFeedbackControlReply = 32; 45 const int sz_xChangeFeedbackControlReq = 12; 46 const int sz_xGetDeviceKeyMappingReq = 8; 47 const int sz_xGetDeviceKeyMappingReply = 32; 48 const int sz_xChangeDeviceKeyMappingReq = 8; 49 const int sz_xGetDeviceModifierMappingReq = 8; 50 const int sz_xSetDeviceModifierMappingReq = 8; 51 const int sz_xSetDeviceModifierMappingReply = 32; 52 const int sz_xGetDeviceButtonMappingReq = 8; 53 const int sz_xGetDeviceButtonMappingReply = 32; 54 const int sz_xSetDeviceButtonMappingReq = 8; 55 const int sz_xSetDeviceButtonMappingReply = 32; 56 const int sz_xQueryDeviceStateReq = 8; 57 const int sz_xQueryDeviceStateReply = 32; 58 const int sz_xSendExtensionEventReq = 16; 59 const int sz_xDeviceBellReq = 8; 60 const int sz_xSetDeviceValuatorsReq = 8; 61 const int sz_xSetDeviceValuatorsReply = 32; 62 const int sz_xGetDeviceControlReq = 8; 63 const int sz_xGetDeviceControlReply = 32; 64 const int sz_xChangeDeviceControlReq = 8; 65 const int sz_xChangeDeviceControlReply = 32; 66 const int sz_xListDevicePropertiesReq = 8; 67 const int sz_xListDevicePropertiesReply = 32; 68 const int sz_xChangeDevicePropertyReq = 20; 69 const int sz_xDeleteDevicePropertyReq = 12; 70 const int sz_xGetDevicePropertyReq = 24; 71 const int sz_xGetDevicePropertyReply = 32; 72 73 const string INAME = "XInputExtension"; 74 75 enum { 76 XI_KEYBOARD = "KEYBOARD", 77 XI_MOUSE = "MOUSE", 78 XI_TABLET = "TABLET", 79 XI_TOUCHSCREEN = "TOUCHSCREEN", 80 XI_TOUCHPAD = "TOUCHPAD", 81 XI_BARCODE = "BARCODE", 82 XI_BUTTONBOX = "BUTTONBOX", 83 XI_KNOB_BOX = "KNOB_BOX", 84 XI_ONE_KNOB = "ONE_KNOB", 85 XI_NINE_KNOB = "NINE_KNOB", 86 XI_TRACKBALL = "TRACKBALL", 87 XI_QUADRATURE = "QUADRATURE", 88 XI_ID_MODULE = "ID_MODULE", 89 XI_SPACEBALL = "SPACEBALL", 90 XI_DATAGLOVE = "DATAGLOVE", 91 XI_EYETRACKER = "EYETRACKER", 92 XI_CURSORKEYS = "CURSORKEYS", 93 XI_FOOTMOUSE = "FOOTMOUSE", 94 XI_JOYSTICK = "JOYSTICK" 95 } 96 97 /* Indices into the versions[] array (XExtInt.c). Used as a index to 98 * retrieve the minimum version of XI from _XiCheckExtInit */ 99 enum { 100 Dont_Check = 0, 101 XInput_Initial_Release = 1, 102 XInput_Add_XDeviceBell = 2, 103 XInput_Add_XSetDeviceValuators = 3, 104 XInput_Add_XChangeDeviceControl = 4, 105 XInput_Add_DevicePresenceNotify = 5, 106 XInput_Add_DeviceProperties = 6 107 } 108 /* DO NOT ADD TO HERE -> XI2 */ 109 110 enum { 111 XI_Absent = 0, 112 XI_Present = 1 113 } 114 115 enum { 116 XI_Initial_Release_Major = 1, 117 XI_Initial_Release_Minor = 0 118 } 119 120 enum { 121 XI_Add_XDeviceBell_Major = 1, 122 XI_Add_XDeviceBell_Minor = 1 123 } 124 125 enum { 126 XI_Add_XSetDeviceValuators_Major = 1, 127 XI_Add_XSetDeviceValuators_Minor = 2 128 } 129 130 enum { 131 XI_Add_XChangeDeviceControl_Major = 1, 132 XI_Add_XChangeDeviceControl_Minor = 3 133 } 134 135 enum { 136 XI_Add_DevicePresenceNotify_Major = 1, 137 XI_Add_DevicePresenceNotify_Minor = 4 138 } 139 140 enum { 141 XI_Add_DeviceProperties_Major = 1, 142 XI_Add_DeviceProperties_Minor = 5 143 } 144 145 enum { 146 DEVICE_RESOLUTION = 1, 147 DEVICE_ABS_CALIB = 2, 148 DEVICE_CORE = 3, 149 DEVICE_ENABLE = 4, 150 DEVICE_ABS_AREA = 5 151 } 152 153 const int NoSuchExtension = 1; 154 155 const int COUNT = 0; 156 const int CREATE = 1; 157 158 const int NewPointer = 0; 159 const int NewKeyboard = 1; 160 161 const int XPOINTER = 0; 162 const int XKEYBOARD = 1; 163 164 const int UseXKeyboard = 0xFF; 165 166 enum { 167 IsXPointer = 0, 168 IsXKeyboard = 1, 169 IsXExtensionDevice = 2, 170 IsXExtensionKeyboard = 3, 171 IsXExtensionPointer = 4 172 } 173 174 enum { 175 AsyncThisDevice = 0, 176 SyncThisDevice = 1, 177 ReplayThisDevice = 2, 178 AsyncOtherDevices = 3, 179 AsyncAll = 4, 180 SyncAll = 5 181 } 182 183 const int FollowKeyboard = 3; 184 const int RevertToFollowKeyboard = 3; 185 186 const c_long DvAccelNum = (1L << 0); 187 const c_long DvAccelDenom = (1L << 1); 188 const c_long DvThreshold = (1L << 2); 189 190 const c_long DvKeyClickPercent = (1L<<0); 191 const c_long DvPercent = (1L<<1); 192 const c_long DvPitch = (1L<<2); 193 const c_long DvDuration = (1L<<3); 194 const c_long DvLed = (1L<<4); 195 const c_long DvLedMode = (1L<<5); 196 const c_long DvKey = (1L<<6); 197 const c_long DvAutoRepeatMode = (1L<<7); 198 199 const c_long DvString = (1L << 0); 200 201 const c_long DvInteger = (1L << 0); 202 203 enum { 204 DeviceMode = (1L << 0), 205 Relative = 0, 206 Absolute = 1 207 } 208 209 enum { 210 ProximityState = (1L << 1), 211 InProximity = (0L << 1), 212 OutOfProximity = (1L << 1) 213 } 214 215 const int AddToList = 0; 216 const int DeleteFromList = 1; 217 218 enum { 219 KeyClass = 0, 220 ButtonClass = 1, 221 ValuatorClass = 2, 222 FeedbackClass = 3, 223 ProximityClass = 4, 224 FocusClass = 5, 225 OtherClass = 6, 226 AttachClass = 7 227 } 228 229 enum { 230 KbdFeedbackClass = 0, 231 PtrFeedbackClass = 1, 232 StringFeedbackClass = 2, 233 IntegerFeedbackClass = 3, 234 LedFeedbackClass = 4, 235 BellFeedbackClass = 5 236 } 237 238 enum { 239 _devicePointerMotionHint = 0, 240 _deviceButton1Motion = 1, 241 _deviceButton2Motion = 2, 242 _deviceButton3Motion = 3, 243 _deviceButton4Motion = 4, 244 _deviceButton5Motion = 5, 245 _deviceButtonMotion = 6, 246 _deviceButtonGrab = 7, 247 _deviceOwnerGrabButton = 8, 248 _noExtensionEvent = 9 249 } 250 251 const int _devicePresence = 0; 252 253 const int _deviceEnter = 0; 254 const int _deviceLeave = 1; 255 256 /* Device presence notify states */ 257 enum { 258 DeviceAdded = 0, 259 DeviceRemoved = 1, 260 DeviceEnabled = 2, 261 DeviceDisabled = 3, 262 DeviceUnrecoverable = 4, 263 DeviceControlChanged = 5 264 } 265 266 /* XI Errors */ 267 enum { 268 XI_BadDevice = 0, 269 XI_BadEvent = 1, 270 XI_BadMode = 2, 271 XI_DeviceBusy = 3, 272 XI_BadClass = 4 273 } 274 275 /* 276 * Make XEventClass be a CARD32 for 64 bit servers. Don't affect client 277 * definition of XEventClass since that would be a library interface change. 278 * See the top of X.h for more _XSERVER64 magic. 279 * 280 * But, don't actually use the CARD32 type. We can't get it defined here 281 * without polluting the namespace. 282 */ 283 version(_XSERVER64){ 284 alias XEventClass = uint; 285 }else{ 286 alias XEventClass = c_ulong; 287 } 288 289 /******************************************************************* 290 * 291 * Extension version structure. 292 * 293 */ 294 295 struct XExtensionVersion{ 296 int present; 297 short major_version; 298 short minor_version; 299 }