1 module x11.extensions.XInput2; 2 3 import x11.Xlib; 4 import x11.X; 5 import x11.extensions.XI2; 6 import x11.extensions.Xge; 7 import core.stdc.config; 8 9 extern (C) nothrow: 10 11 /******************************************************************* 12 * 13 */ 14 struct XIAddMasterInfo{ 15 int type; 16 char* name; 17 Bool send_core; 18 Bool enable; 19 } 20 21 struct XIRemoveMasterInfo{ 22 int type; 23 int deviceid; 24 int return_mode; /* AttachToMaster, Floating */ 25 int return_pointer; 26 int return_keyboard; 27 } 28 29 struct XIAttachSlaveInfo{ 30 int type; 31 int deviceid; 32 int new_master; 33 } 34 35 struct XIDetachSlaveInfo{ 36 int type; 37 int deviceid; 38 } 39 40 union XIAnyHierarchyChangeInfo{ 41 int type; /* must be first element */ 42 XIAddMasterInfo add; 43 XIRemoveMasterInfo remove; 44 XIAttachSlaveInfo attach; 45 XIDetachSlaveInfo detach; 46 } 47 48 struct XIModifierState{ 49 int base; 50 int latched; 51 int locked; 52 int effective; 53 } 54 55 alias XIModifierState XIGroupState; 56 57 struct XIButtonState{ 58 int mask_len; 59 ubyte* mask; 60 } 61 62 struct XIValuatorState{ 63 int mask_len; 64 ubyte mask; 65 double* values; 66 } 67 68 69 struct XIEventMask{ 70 int deviceid; 71 int mask_len; 72 ubyte* mask; 73 } 74 75 struct XIAnyClassInfo{ 76 int type; 77 int sourceid; 78 } 79 80 struct XIButtonClassInfo{ 81 int type; 82 int sourceid; 83 int num_buttons; 84 Atom* labels; 85 XIButtonState state; 86 } 87 88 struct XIKeyClassInfo{ 89 int type; 90 int sourceid; 91 int num_keycodes; 92 int* keycodes; 93 } 94 95 struct XIValuatorClassInfo{ 96 int type; 97 int sourceid; 98 int number; 99 Atom label; 100 double min; 101 double max; 102 double value; 103 int resolution; 104 int mode; 105 } 106 107 struct XIDeviceInfo{ 108 int deviceid; 109 char* name; 110 int use; 111 int attachment; 112 Bool enabled; 113 int num_classes; 114 XIAnyClassInfo** classes; 115 } 116 117 struct XIGrabModifiers{ 118 int modifiers; 119 int status; 120 } 121 122 /** 123 * Generic XI2 event. All XI2 events have the same header. 124 */ 125 struct XIEvent{ 126 int type; /* GenericEvent */ 127 c_ulong serial; /* # of last request processed by server */ 128 Bool send_event; /* true if this came from a SendEvent request */ 129 Display* display; /* Display the event was read from */ 130 int extension; /* XI extension offset */ 131 int evtype; 132 Time time; 133 } 134 135 136 struct XIHierarchyInfo{ 137 int deviceid; 138 int attachment; 139 int use; 140 Bool enabled; 141 int flags; 142 } 143 144 /* 145 * Notifies the client that the device hierarchy has been changed. The client 146 * is expected to re-query the server for the device hierarchy. 147 */ 148 struct XIHierarchyEvent{ 149 int type; /* GenericEvent */ 150 c_ulong serial; /* # of last request processed by server */ 151 Bool send_event; /* true if this came from a SendEvent request */ 152 Display* display; /* Display the event was read from */ 153 int extension; /* XI extension offset */ 154 int evtype; /* XI_HierarchyChanged */ 155 Time time; 156 int flags; 157 int num_info; 158 XIHierarchyInfo* info; 159 } 160 161 /* 162 * Notifies the client that the classes have been changed. This happens when 163 * the slave device that sends through the master changes. 164 */ 165 struct XIDeviceChangedEvent{ 166 int type; /* GenericEvent */ 167 c_ulong serial; /* # of last request processed by server */ 168 Bool send_event; /* true if this came from a SendEvent request */ 169 Display* display; /* Display the event was read from */ 170 int extension; /* XI extension offset */ 171 int evtype; /* XI_DeviceChanged */ 172 Time time; 173 int deviceid; /* id of the device that changed */ 174 int sourceid; /* Source for the new classes. */ 175 int reason; /* Reason for the change */ 176 int num_classes; 177 XIAnyClassInfo** classes; /* same as in XIDeviceInfo */ 178 } 179 180 struct XIDeviceEvent{ 181 int type; /* GenericEvent */ 182 c_ulong serial; /* # of last request processed by server */ 183 Bool send_event; /* true if this came from a SendEvent request */ 184 Display* display; /* Display the event was read from */ 185 int extension; /* XI extension offset */ 186 int evtype; 187 Time time; 188 int deviceid; 189 int sourceid; 190 int detail; 191 Window root; 192 Window event; 193 Window child; 194 double root_x; 195 double root_y; 196 double event_x; 197 double event_y; 198 int flags; 199 XIButtonState buttons; 200 XIValuatorState valuators; 201 XIModifierState mods; 202 XIGroupState group; 203 } 204 205 struct XIRawEvent{ 206 int type; /* GenericEvent */ 207 c_ulong serial; /* # of last request processed by server */ 208 Bool send_event; /* true if this came from a SendEvent request */ 209 Display* display; /* Display the event was read from */ 210 int extension; /* XI extension offset */ 211 int evtype; /* XI_RawKeyPress, XI_RawKeyRelease, etc. */ 212 Time time; 213 int deviceid; 214 int sourceid; /* Bug: Always 0. https://bugs.freedesktop.org//show_bug.cgi?id=34240 */ 215 int detail; 216 int flags; 217 XIValuatorState valuators; 218 double* raw_values; 219 } 220 221 struct XIEnterEvent{ 222 int type; /* GenericEvent */ 223 c_ulong serial; /* # of last request processed by server */ 224 Bool send_event; /* true if this came from a SendEvent request */ 225 Display* display; /* Display the event was read from */ 226 int extension; /* XI extension offset */ 227 int evtype; 228 Time time; 229 int deviceid; 230 int sourceid; 231 int detail; 232 Window root; 233 Window event; 234 Window child; 235 double root_x; 236 double root_y; 237 double event_x; 238 double event_y; 239 int mode; 240 Bool focus; 241 Bool same_screen; 242 XIButtonState buttons; 243 XIModifierState mods; 244 XIGroupState group; 245 } 246 247 alias XIEnterEvent XILeaveEvent; 248 alias XIEnterEvent XIFocusInEvent; 249 alias XIEnterEvent XIFocusOutEvent; 250 251 struct XIPropertyEvent{ 252 int type; /* GenericEvent */ 253 c_ulong serial; /* # of last request processed by server */ 254 Bool send_event; /* true if this came from a SendEvent request */ 255 Display* display; /* Display the event was read from */ 256 int extension; /* XI extension offset */ 257 int evtype; /* XI_PropertyEvent */ 258 Time time; 259 int deviceid; /* id of the device that changed */ 260 Atom property; 261 int what; 262 } 263 264 extern Bool XIQueryPointer( 265 Display* display, 266 int deviceid, 267 Window win, 268 Window* root, 269 Window* child, 270 double* root_x, 271 double* root_y, 272 double* win_x, 273 double* win_y, 274 XIButtonState* buttons, 275 XIModifierState* mods, 276 XIGroupState* group 277 ); 278 279 extern Bool XIWarpPointer( 280 Display* display, 281 int deviceid, 282 Window src_win, 283 Window dst_win, 284 double src_x, 285 double src_y, 286 uint src_width, 287 uint src_height, 288 double dst_x, 289 double dst_y 290 ); 291 292 extern Status XIDefineCursor( 293 Display* display, 294 int deviceid, 295 Window win, 296 Cursor cursor 297 ); 298 299 extern Status XIUndefineCursor( 300 Display* display, 301 int deviceid, 302 Window win 303 ); 304 305 extern Status XIChangeHierarchy( 306 Display* display, 307 XIAnyHierarchyChangeInfo* changes, 308 int num_changes 309 ); 310 311 extern Status XISetClientPointer( 312 Display* dpy, 313 Window win, 314 int deviceid 315 ); 316 317 extern Bool XIGetClientPointer( 318 Display* dpy, 319 Window win, 320 int* deviceid 321 ); 322 323 extern int XISelectEvents( 324 Display* dpy, 325 Window win, 326 XIEventMask* masks, 327 int num_masks 328 ); 329 330 extern XIEventMask *XIGetSelectedEvents( 331 Display* dpy, 332 Window win, 333 int* num_masks_return 334 ); 335 336 extern Status XIQueryVersion( 337 Display* dpy, 338 int* major_version_inout, 339 int* minor_version_inout 340 ); 341 342 extern XIDeviceInfo* XIQueryDevice( 343 Display* dpy, 344 int deviceid, 345 int* ndevices_return 346 ); 347 348 extern Status XISetFocus( 349 Display* dpy, 350 int deviceid, 351 Window focus, 352 Time time 353 ); 354 355 extern Status XIGetFocus( 356 Display* dpy, 357 int deviceid, 358 Window* focus_return); 359 360 extern Status XIGrabDevice( 361 Display* dpy, 362 int deviceid, 363 Window grab_window, 364 Time time, 365 Cursor cursor, 366 int grab_mode, 367 int paired_device_mode, 368 Bool owner_events, 369 XIEventMask* mask 370 ); 371 372 extern Status XIUngrabDevice( 373 Display* dpy, 374 int deviceid, 375 Time time 376 ); 377 378 extern Status XIAllowEvents( 379 Display* display, 380 int deviceid, 381 int event_mode, 382 Time time 383 ); 384 385 extern int XIGrabButton( 386 Display* display, 387 int deviceid, 388 int button, 389 Window grab_window, 390 Cursor cursor, 391 int grab_mode, 392 int paired_device_mode, 393 int owner_events, 394 XIEventMask* mask, 395 int num_modifiers, 396 XIGrabModifiers* modifiers_inout 397 ); 398 399 extern int XIGrabKeycode( 400 Display* display, 401 int deviceid, 402 int keycode, 403 Window grab_window, 404 int grab_mode, 405 int paired_device_mode, 406 int owner_events, 407 XIEventMask* mask, 408 int num_modifiers, 409 XIGrabModifiers* modifiers_inout 410 ); 411 412 extern int XIGrabEnter( 413 Display* display, 414 int deviceid, 415 Window grab_window, 416 Cursor cursor, 417 int grab_mode, 418 int paired_device_mode, 419 int owner_events, 420 XIEventMask* mask, 421 int num_modifiers, 422 XIGrabModifiers* modifiers_inout 423 ); 424 425 extern int XIGrabFocusIn( 426 Display* display, 427 int deviceid, 428 Window grab_window, 429 int grab_mode, 430 int paired_device_mode, 431 int owner_events, 432 XIEventMask* mask, 433 int num_modifiers, 434 XIGrabModifiers* modifiers_inout 435 ); 436 extern Status XIUngrabButton( 437 Display* display, 438 int deviceid, 439 int button, 440 Window grab_window, 441 int num_modifiers, 442 XIGrabModifiers* modifiers 443 ); 444 445 extern Status XIUngrabKeycode( 446 Display* display, 447 int deviceid, 448 int keycode, 449 Window grab_window, 450 int num_modifiers, 451 XIGrabModifiers* modifiers 452 ); 453 454 extern Status XIUngrabEnter( 455 Display* display, 456 int deviceid, 457 Window grab_window, 458 int num_modifiers, 459 XIGrabModifiers* modifiers 460 ); 461 462 extern Status XIUngrabFocusIn( 463 Display* display, 464 int deviceid, 465 Window grab_window, 466 int num_modifiers, 467 XIGrabModifiers* modifiers 468 ); 469 470 471 extern Atom *XIListProperties( 472 Display* display, 473 int deviceid, 474 int* num_props_return 475 ); 476 477 extern void XIChangeProperty( 478 Display* display, 479 int deviceid, 480 Atom property, 481 Atom type, 482 int format, 483 int mode, 484 ubyte* data, 485 int num_items 486 ); 487 488 extern void 489 XIDeleteProperty( 490 Display* display, 491 int deviceid, 492 Atom property 493 ); 494 495 extern Status 496 XIGetProperty( 497 Display* display, 498 int deviceid, 499 Atom property, 500 long offset, 501 long length, 502 Bool delete_property, 503 Atom type, 504 Atom* type_return, 505 int* format_return, 506 c_ulong* num_items_return, 507 c_ulong* bytes_after_return, 508 ubyte** data 509 ); 510 511 extern void XIFreeDeviceInfo(XIDeviceInfo* info);