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 /* Conventions for this file: 26 * Names: 27 * structs: always typedef'd, prefixed with xXI, CamelCase 28 * struct members: lower_case_with_underscores 29 * Exceptions: reqType, ReqType, repType, RepType, sequenceNumber are 30 * named as such for historical reasons. 31 * request opcodes: X_XIRequestName as CamelCase 32 * defines: defines used in client applications must go in XI2.h 33 * defines used only in protocol handling: XISOMENAME 34 * 35 * Data types: unless there is a historical name for a datatype (e.g. 36 * Window), use stdint types specifying the size of the datatype. 37 * historical data type names must be defined and undefined at the top and 38 * end of the file. 39 * 40 * General: 41 * spaces, not tabs. 42 * structs specific to a request or reply added before the request 43 * definition. structs used in more than one request, reply or event 44 * appended to the common structs section before the definition of the 45 * first request. 46 * members of structs vertically aligned on column 16 if datatypes permit. 47 * otherwise alingned on next available 8n column. 48 */ 49 50 /** 51 * Protocol definitions for the XI2 protocol. 52 * This file should not be included by clients that merely use XI2, but do not 53 * need the wire protocol. Such clients should include XI2.h, or the matching 54 * header from the library. 55 * 56 */ 57 #ifndef _XI2PROTO_H_ 58 #define _XI2PROTO_H_ 59 60 #include <X11/Xproto.h> 61 #include <X11/X.h> 62 #include <X11/extensions/XI2.h> 63 #include <stdint.h> 64 65 /* make sure types have right sizes for protocol structures. */ 66 #define Window uint32_t 67 #define Time uint32_t 68 #define Atom uint32_t 69 #define Cursor uint32_t 70 71 /** 72 * XI2 Request opcodes 73 */ 74 #define X_XIQueryPointer 40 75 #define X_XIWarpPointer 41 76 #define X_XIChangeCursor 42 77 #define X_XIChangeHierarchy 43 78 #define X_XISetClientPointer 44 79 #define X_XIGetClientPointer 45 80 #define X_XISelectEvents 46 81 #define X_XIQueryVersion 47 82 #define X_XIQueryDevice 48 83 #define X_XISetFocus 49 84 #define X_XIGetFocus 50 85 #define X_XIGrabDevice 51 86 #define X_XIUngrabDevice 52 87 #define X_XIAllowEvents 53 88 #define X_XIPassiveGrabDevice 54 89 #define X_XIPassiveUngrabDevice 55 90 #define X_XIListProperties 56 91 #define X_XIChangeProperty 57 92 #define X_XIDeleteProperty 58 93 #define X_XIGetProperty 59 94 #define X_XIGetSelectedEvents 60 95 96 /** Number of XI requests */ 97 #define XI2REQUESTS (X_XIGetSelectedEvents - X_XIQueryPointer + 1) 98 /** Number of XI2 events */ 99 #define XI2EVENTS (XI_LASTEVENT + 1) 100 101 /************************************************************************************* 102 * * 103 * COMMON STRUCTS * 104 * * 105 *************************************************************************************/ 106 /** Fixed point 16.16 */ 107 typedef int32_t FP1616; 108 109 /** Fixed point 32.32 */ 110 typedef struct { 111 int32_t integral; 112 uint32_t frac; 113 } FP3232; 114 115 /** 116 * Struct to describe a device. 117 * 118 * For a MasterPointer or a MasterKeyboard, 'attachment' specifies the 119 * paired master device. 120 * For a SlaveKeyboard or SlavePointer, 'attachment' specifies the master 121 * device this device is attached to. 122 * For a FloatingSlave, 'attachment' is undefined. 123 */ 124 typedef struct { 125 uint16_t deviceid; 126 uint16_t use; /**< ::XIMasterPointer, ::XIMasterKeyboard, 127 ::XISlavePointer, ::XISlaveKeyboard, 128 ::XIFloatingSlave */ 129 uint16_t attachment; /**< Current attachment or pairing.*/ 130 uint16_t num_classes; /**< Number of classes following this struct. */ 131 uint16_t name_len; /**< Length of name in bytes. */ 132 uint8_t enabled; /**< TRUE if device is enabled. */ 133 uint8_t pad; 134 } xXIDeviceInfo; 135 136 /** 137 * Default template for a device class. 138 * A device class is equivalent to a device's capabilities. Multiple classes 139 * are supported per device. 140 */ 141 typedef struct { 142 uint16_t type; /**< One of *class */ 143 uint16_t length; /**< Length in 4 byte units */ 144 uint16_t sourceid; /**< source device for this class */ 145 uint16_t pad; 146 } xXIAnyInfo; 147 148 /** 149 * Denotes button capability on a device. 150 * Struct is followed by num_buttons * Atom that names the buttons in the 151 * device-native setup (i.e. ignoring button mappings). 152 */ 153 typedef struct { 154 uint16_t type; /**< Always ButtonClass */ 155 uint16_t length; /**< Length in 4 byte units */ 156 uint16_t sourceid; /**< source device for this class */ 157 uint16_t num_buttons; /**< Number of buttons provide */ 158 } xXIButtonInfo; 159 160 /** 161 * Denotes key capability on a device. 162 * Struct is followed by num_keys * CARD32 that lists the keycodes available 163 * on the device. 164 */ 165 typedef struct { 166 uint16_t type; /**< Always KeyClass */ 167 uint16_t length; /**< Length in 4 byte units */ 168 uint16_t sourceid; /**< source device for this class */ 169 uint16_t num_keycodes; /**< Number of keys provided */ 170 } xXIKeyInfo; 171 172 /** 173 * Denotes an valuator capability on a device. 174 * One XIValuatorInfo describes exactly one valuator (axis) on the device. 175 */ 176 typedef struct { 177 uint16_t type; /**< Always ValuatorClass */ 178 uint16_t length; /**< Length in 4 byte units */ 179 uint16_t sourceid; /**< source device for this class */ 180 uint16_t number; /**< Valuator number */ 181 Atom label; /**< Axis label */ 182 FP3232 min; /**< Min value */ 183 FP3232 max; /**< Max value */ 184 FP3232 value; /**< Last published value */ 185 uint32_t resolution; /**< Resolutions in units/m */ 186 uint8_t mode; /**< ModeRelative or ModeAbsolute */ 187 uint8_t pad1; 188 uint16_t pad2; 189 } xXIValuatorInfo; 190 191 /*** 192 * Denotes a scroll valuator on a device. 193 * One XIScrollInfo describes exactly one scroll valuator that must have a 194 * XIValuatorInfo struct. 195 */ 196 typedef struct { 197 uint16_t type; /**< Always ValuatorClass */ 198 uint16_t length; /**< Length in 4 byte units */ 199 uint16_t sourceid; /**< source device for this class */ 200 uint16_t number; /**< Valuator number */ 201 uint16_t scroll_type; /**< ::XIScrollTypeVertical, ::XIScrollTypeHorizontal */ 202 uint16_t pad0; 203 uint32_t flags; /**< ::XIScrollFlagEmulate, ::XIScrollFlagPreferred */ 204 FP3232 increment; /**< Increment for one unit of scrolling */ 205 } xXIScrollInfo; 206 207 /** 208 * Denotes multitouch capability on a device. 209 */ 210 typedef struct { 211 uint16_t type; /**< Always TouchClass */ 212 uint16_t length; /**< Length in 4 byte units */ 213 uint16_t sourceid; /**< source device for this class */ 214 uint8_t mode; /**< DirectTouch or DependentTouch */ 215 uint8_t num_touches; /**< Maximum number of touches (0==unlimited) */ 216 } xXITouchInfo; 217 218 /** 219 * Used to select for events on a given window. 220 * Struct is followed by (mask_len * CARD8), with each bit set representing 221 * the event mask for the given type. A mask bit represents an event type if 222 * (mask == (1 << type)). 223 */ 224 typedef struct { 225 uint16_t deviceid; /**< Device id to select for */ 226 uint16_t mask_len; /**< Length of mask in 4 byte units */ 227 } xXIEventMask; 228 229 /** 230 * XKB modifier information. 231 * The effective modifier is a binary mask of base, latched, and locked 232 * modifiers. 233 */ 234 typedef struct 235 { 236 uint32_t base_mods; /**< Logically pressed modifiers */ 237 uint32_t latched_mods; /**< Logically latched modifiers */ 238 uint32_t locked_mods; /**< Logically locked modifiers */ 239 uint32_t effective_mods; /**< Effective modifiers */ 240 } xXIModifierInfo; 241 242 /** 243 * XKB group information. 244 * The effective group is the mathematical sum of base, latched, and locked 245 * group after group wrapping is taken into account. 246 */ 247 typedef struct 248 { 249 uint8_t base_group; /**< Logically "pressed" group */ 250 uint8_t latched_group; /**< Logically latched group */ 251 uint8_t locked_group; /**< Logically locked group */ 252 uint8_t effective_group; /**< Effective group */ 253 } xXIGroupInfo; 254 255 256 /************************************************************************************* 257 * * 258 * REQUESTS * 259 * * 260 *************************************************************************************/ 261 262 /** 263 * Query the server for the supported X Input extension version. 264 */ 265 266 typedef struct { 267 uint8_t reqType; /**< Input extension major code */ 268 uint8_t ReqType; /**< Always ::X_XIQueryVersion */ 269 uint16_t length; /**< Length in 4 byte units */ 270 uint16_t major_version; 271 uint16_t minor_version; 272 } xXIQueryVersionReq; 273 #define sz_xXIQueryVersionReq 8 274 275 typedef struct { 276 uint8_t repType; /**< ::X_Reply */ 277 uint8_t RepType; /**< Always ::X_XIQueryVersion */ 278 uint16_t sequenceNumber; 279 uint32_t length; 280 uint16_t major_version; 281 uint16_t minor_version; 282 uint32_t pad1; 283 uint32_t pad2; 284 uint32_t pad3; 285 uint32_t pad4; 286 uint32_t pad5; 287 } xXIQueryVersionReply; 288 #define sz_xXIQueryVersionReply 32 289 290 /** 291 * Query the server for information about a specific device or all input 292 * devices. 293 */ 294 typedef struct { 295 uint8_t reqType; /**< Input extension major code */ 296 uint8_t ReqType; /**< Always ::X_XIQueryDevice */ 297 uint16_t length; /**< Length in 4 byte units */ 298 uint16_t deviceid; 299 uint16_t pad; 300 } xXIQueryDeviceReq; 301 #define sz_xXIQueryDeviceReq 8 302 303 typedef struct { 304 uint8_t repType; /**< ::X_Reply */ 305 uint8_t RepType; /**< Always ::X_XIQueryDevice */ 306 uint16_t sequenceNumber; 307 uint32_t length; 308 uint16_t num_devices; 309 uint16_t pad0; 310 uint32_t pad1; 311 uint32_t pad2; 312 uint32_t pad3; 313 uint32_t pad4; 314 uint32_t pad5; 315 } xXIQueryDeviceReply; 316 #define sz_xXIQueryDeviceReply 32 317 318 /** 319 * Select for events on a given window. 320 */ 321 typedef struct { 322 uint8_t reqType; /**< Input extension major code */ 323 uint8_t ReqType; /**< Always ::X_XISelectEvents */ 324 uint16_t length; /**< Length in 4 byte units */ 325 Window win; 326 uint16_t num_masks; 327 uint16_t pad; 328 } xXISelectEventsReq; 329 #define sz_xXISelectEventsReq 12 330 331 /** 332 * Query for selected events on a given window. 333 */ 334 typedef struct { 335 uint8_t reqType; /**< Input extension major code */ 336 uint8_t ReqType; /**< Always ::X_XIGetSelectedEvents */ 337 uint16_t length; /**< Length in 4 byte units */ 338 Window win; 339 } xXIGetSelectedEventsReq; 340 #define sz_xXIGetSelectedEventsReq 8 341 342 typedef struct { 343 uint8_t repType; /**< Input extension major opcode */ 344 uint8_t RepType; /**< Always ::X_XIGetSelectedEvents */ 345 uint16_t sequenceNumber; 346 uint32_t length; 347 uint16_t num_masks; /**< Number of xXIEventMask structs 348 trailing the reply */ 349 uint16_t pad0; 350 uint32_t pad1; 351 uint32_t pad2; 352 uint32_t pad3; 353 uint32_t pad4; 354 uint32_t pad5; 355 } xXIGetSelectedEventsReply; 356 #define sz_xXIGetSelectedEventsReply 32 357 358 /** 359 * Query the given device's screen/window coordinates. 360 */ 361 362 typedef struct { 363 uint8_t reqType; /**< Input extension major code */ 364 uint8_t ReqType; /**< Always ::X_XIQueryPointer */ 365 uint16_t length; /**< Length in 4 byte units */ 366 Window win; 367 uint16_t deviceid; 368 uint16_t pad1; 369 } xXIQueryPointerReq; 370 #define sz_xXIQueryPointerReq 12 371 372 373 typedef struct { 374 uint8_t repType; /**< Input extension major opcode */ 375 uint8_t RepType; /**< Always ::X_XIQueryPointer */ 376 uint16_t sequenceNumber; 377 uint32_t length; 378 Window root; 379 Window child; 380 FP1616 root_x; 381 FP1616 root_y; 382 FP1616 win_x; 383 FP1616 win_y; 384 uint8_t same_screen; 385 uint8_t pad0; 386 uint16_t buttons_len; 387 xXIModifierInfo mods; 388 xXIGroupInfo group; 389 } xXIQueryPointerReply; 390 #define sz_xXIQueryPointerReply 56 391 392 /** 393 * Warp the given device's pointer to the specified position. 394 */ 395 396 typedef struct { 397 uint8_t reqType; /**< Input extension major code */ 398 uint8_t ReqType; /**< Always ::X_XIWarpPointer */ 399 uint16_t length; /**< Length in 4 byte units */ 400 Window src_win; 401 Window dst_win; 402 FP1616 src_x; 403 FP1616 src_y; 404 uint16_t src_width; 405 uint16_t src_height; 406 FP1616 dst_x; 407 FP1616 dst_y; 408 uint16_t deviceid; 409 uint16_t pad1; 410 } xXIWarpPointerReq; 411 #define sz_xXIWarpPointerReq 36 412 413 /** 414 * Change the given device's sprite to the given cursor. 415 */ 416 417 typedef struct { 418 uint8_t reqType; /**< Input extension major code */ 419 uint8_t ReqType; /**< Always ::X_XIChangeCursor */ 420 uint16_t length; /**< Length in 4 byte units */ 421 Window win; 422 Cursor cursor; 423 uint16_t deviceid; 424 uint16_t pad1; 425 } xXIChangeCursorReq; 426 #define sz_xXIChangeCursorReq 16 427 428 /** 429 * Modify the device hierarchy. 430 */ 431 432 typedef struct { 433 uint8_t reqType; /**< Input extension major code */ 434 uint8_t ReqType; /**< Always ::X_XIChangeHierarchy */ 435 uint16_t length; /**< Length in 4 byte units */ 436 uint8_t num_changes; 437 uint8_t pad0; 438 uint16_t pad1; 439 } xXIChangeHierarchyReq; 440 #define sz_xXIChangeHierarchyReq 8 441 442 /** 443 * Generic header for any hierarchy change. 444 */ 445 typedef struct { 446 uint16_t type; 447 uint16_t length; /**< Length in 4 byte units */ 448 } xXIAnyHierarchyChangeInfo; 449 450 /** 451 * Create a new master device. 452 * Name of new master follows struct (4-byte padded) 453 */ 454 typedef struct { 455 uint16_t type; /**< Always ::XIAddMaster */ 456 uint16_t length; /**< 2 + (namelen + padding)/4 */ 457 uint16_t name_len; 458 uint8_t send_core; 459 uint8_t enable; 460 } xXIAddMasterInfo; 461 462 /** 463 * Delete a master device. Will automatically delete the master device paired 464 * with the given master device. 465 */ 466 typedef struct { 467 uint16_t type; /**< Always ::XIRemoveMaster */ 468 uint16_t length; /**< 3 */ 469 uint16_t deviceid; 470 uint8_t return_mode; /**< ::XIAttachToMaster, ::XIFloating */ 471 uint8_t pad; 472 uint16_t return_pointer; /**< Pointer to attach slave ptr devices to */ 473 uint16_t return_keyboard; /**< keyboard to attach slave keybd devices to*/ 474 } xXIRemoveMasterInfo; 475 476 /** 477 * Attach an SD to a new device. 478 * NewMaster has to be of same type (pointer->pointer, keyboard->keyboard); 479 */ 480 typedef struct { 481 uint16_t type; /**< Always ::XIAttachSlave */ 482 uint16_t length; /**< 2 */ 483 uint16_t deviceid; 484 uint16_t new_master; /**< id of new master device */ 485 } xXIAttachSlaveInfo; 486 487 /** 488 * Detach an SD from its current master device. 489 */ 490 typedef struct { 491 uint16_t type; /**< Always ::XIDetachSlave */ 492 uint16_t length; /**< 2 */ 493 uint16_t deviceid; 494 uint16_t pad; 495 } xXIDetachSlaveInfo; 496 497 498 /** 499 * Set the window/client's ClientPointer. 500 */ 501 typedef struct { 502 uint8_t reqType; 503 uint8_t ReqType; /**< Always ::X_XISetClientPointer */ 504 uint16_t length; /**< Length in 4 byte units */ 505 Window win; 506 uint16_t deviceid; 507 uint16_t pad1; 508 } xXISetClientPointerReq; 509 #define sz_xXISetClientPointerReq 12 510 511 /** 512 * Query the given window/client's ClientPointer setting. 513 */ 514 typedef struct { 515 uint8_t reqType; 516 uint8_t ReqType; /**< Always ::X_GetClientPointer */ 517 uint16_t length; /**< Length in 4 byte units */ 518 Window win; 519 } xXIGetClientPointerReq; 520 #define sz_xXIGetClientPointerReq 8 521 522 typedef struct { 523 uint8_t repType; /**< Input extension major opcode */ 524 uint8_t RepType; /**< Always ::X_GetClientPointer */ 525 uint16_t sequenceNumber; 526 uint32_t length; 527 BOOL set; /**< client pointer is set? */ 528 uint8_t pad0; 529 uint16_t deviceid; 530 uint32_t pad1; 531 uint32_t pad2; 532 uint32_t pad3; 533 uint32_t pad4; 534 uint32_t pad5; 535 } xXIGetClientPointerReply; 536 #define sz_xXIGetClientPointerReply 32 537 538 /** 539 * Set the input focus to the specified window. 540 */ 541 typedef struct { 542 uint8_t reqType; 543 uint8_t ReqType; /**< Always ::X_XISetFocus */ 544 uint16_t length; /**< Length in 4 byte units */ 545 Window focus; 546 Time time; 547 uint16_t deviceid; 548 uint16_t pad0; 549 } xXISetFocusReq; 550 #define sz_xXISetFocusReq 16 551 552 /** 553 * Query the current input focus. 554 */ 555 typedef struct { 556 uint8_t reqType; 557 uint8_t ReqType; /**< Always ::X_XIGetDeviceFocus */ 558 uint16_t length; /**< Length in 4 byte units */ 559 uint16_t deviceid; 560 uint16_t pad0; 561 } xXIGetFocusReq; 562 #define sz_xXIGetFocusReq 8 563 564 typedef struct { 565 uint8_t repType; /**< Input extension major opcode */ 566 uint8_t RepType; /**< Always ::X_XIGetFocus */ 567 uint16_t sequenceNumber; 568 uint32_t length; 569 Window focus; 570 uint32_t pad1; 571 uint32_t pad2; 572 uint32_t pad3; 573 uint32_t pad4; 574 uint32_t pad5; 575 } xXIGetFocusReply; 576 #define sz_xXIGetFocusReply 32 577 578 579 /** 580 * Grab the given device. 581 */ 582 typedef struct { 583 uint8_t reqType; 584 uint8_t ReqType; /**< Always ::X_XIGrabDevice */ 585 uint16_t length; /**< Length in 4 byte units */ 586 Window grab_window; 587 Time time; 588 Cursor cursor; 589 uint16_t deviceid; 590 uint8_t grab_mode; 591 uint8_t paired_device_mode; 592 uint8_t owner_events; 593 uint8_t pad; 594 uint16_t mask_len; 595 } xXIGrabDeviceReq; 596 #define sz_xXIGrabDeviceReq 24 597 598 /** 599 * Return codes from a XIPassiveGrabDevice request. 600 */ 601 typedef struct { 602 uint32_t modifiers; /**< Modifier state */ 603 uint8_t status; /**< Grab status code */ 604 uint8_t pad0; 605 uint16_t pad1; 606 } xXIGrabModifierInfo; 607 608 typedef struct { 609 uint8_t repType; /**< Input extension major opcode */ 610 uint8_t RepType; /**< Always ::X_XIGrabDevice */ 611 uint16_t sequenceNumber; 612 uint32_t length; 613 uint8_t status; 614 uint8_t pad0; 615 uint16_t pad1; 616 uint32_t pad2; 617 uint32_t pad3; 618 uint32_t pad4; 619 uint32_t pad5; 620 uint32_t pad6; 621 } xXIGrabDeviceReply; 622 #define sz_xXIGrabDeviceReply 32 623 624 /** 625 * Ungrab the specified device. 626 * 627 */ 628 typedef struct { 629 uint8_t reqType; 630 uint8_t ReqType; /**< Always ::X_XIUngrabDevice */ 631 uint16_t length; /**< Length in 4 byte units */ 632 Time time; 633 uint16_t deviceid; 634 uint16_t pad; 635 } xXIUngrabDeviceReq; 636 #define sz_xXIUngrabDeviceReq 12 637 638 639 /** 640 * Allow or replay events on the specified grabbed device. 641 */ 642 typedef struct { 643 uint8_t reqType; 644 uint8_t ReqType; /**< Always ::X_XIAllowEvents */ 645 uint16_t length; /**< Length in 4 byte units */ 646 Time time; 647 uint16_t deviceid; 648 uint8_t mode; 649 uint8_t pad; 650 } xXIAllowEventsReq; 651 #define sz_xXIAllowEventsReq 12 652 653 /** 654 * Allow or replay events on the specified grabbed device. 655 * Since XI 2.2 656 */ 657 typedef struct { 658 uint8_t reqType; 659 uint8_t ReqType; /**< Always ::X_XIAllowEvents */ 660 uint16_t length; /**< Length in 4 byte units */ 661 Time time; 662 uint16_t deviceid; 663 uint8_t mode; 664 uint8_t pad; 665 uint32_t touchid; /**< Since XI 2.2 */ 666 Window grab_window; /**< Since XI 2.2 */ 667 } xXI2_2AllowEventsReq; 668 #define sz_xXI2_2AllowEventsReq 20 669 670 671 /** 672 * Passively grab the device. 673 */ 674 typedef struct { 675 uint8_t reqType; 676 uint8_t ReqType; /**< Always ::X_XIPassiveGrabDevice */ 677 uint16_t length; /**< Length in 4 byte units */ 678 Time time; 679 Window grab_window; 680 Cursor cursor; 681 uint32_t detail; 682 uint16_t deviceid; 683 uint16_t num_modifiers; 684 uint16_t mask_len; 685 uint8_t grab_type; 686 uint8_t grab_mode; 687 uint8_t paired_device_mode; 688 uint8_t owner_events; 689 uint16_t pad1; 690 } xXIPassiveGrabDeviceReq; 691 #define sz_xXIPassiveGrabDeviceReq 32 692 693 typedef struct { 694 uint8_t repType; /**< Input extension major opcode */ 695 uint8_t RepType; /**< Always ::X_XIPassiveGrabDevice */ 696 uint16_t sequenceNumber; 697 uint32_t length; 698 uint16_t num_modifiers; 699 uint16_t pad1; 700 uint32_t pad2; 701 uint32_t pad3; 702 uint32_t pad4; 703 uint32_t pad5; 704 uint32_t pad6; 705 } xXIPassiveGrabDeviceReply; 706 #define sz_xXIPassiveGrabDeviceReply 32 707 708 /** 709 * Delete a passive grab for the given device. 710 */ 711 typedef struct { 712 uint8_t reqType; 713 uint8_t ReqType; /**< Always ::X_XIPassiveUngrabDevice */ 714 uint16_t length; /**< Length in 4 byte units */ 715 Window grab_window; 716 uint32_t detail; 717 uint16_t deviceid; 718 uint16_t num_modifiers; 719 uint8_t grab_type; 720 uint8_t pad0; 721 uint16_t pad1; 722 } xXIPassiveUngrabDeviceReq; 723 #define sz_xXIPassiveUngrabDeviceReq 20 724 725 /** 726 * List all device properties on the specified device. 727 */ 728 typedef struct { 729 uint8_t reqType; 730 uint8_t ReqType; /**< Always ::X_XIListProperties */ 731 uint16_t length; /**< Length in 4 byte units */ 732 uint16_t deviceid; 733 uint16_t pad; 734 } xXIListPropertiesReq; 735 #define sz_xXIListPropertiesReq 8 736 737 typedef struct { 738 uint8_t repType; /**< Input extension major opcode */ 739 uint8_t RepType; /**< Always ::X_XIListProperties */ 740 uint16_t sequenceNumber; 741 uint32_t length; 742 uint16_t num_properties; 743 uint16_t pad0; 744 uint32_t pad1; 745 uint32_t pad2; 746 uint32_t pad3; 747 uint32_t pad4; 748 uint32_t pad5; 749 } xXIListPropertiesReply; 750 #define sz_xXIListPropertiesReply 32 751 752 /** 753 * Change a property on the specified device. 754 */ 755 typedef struct { 756 uint8_t reqType; 757 uint8_t ReqType; /**< Always ::X_XIChangeProperty */ 758 uint16_t length; /**< Length in 4 byte units */ 759 uint16_t deviceid; 760 uint8_t mode; 761 uint8_t format; 762 Atom property; 763 Atom type; 764 uint32_t num_items; 765 } xXIChangePropertyReq; 766 #define sz_xXIChangePropertyReq 20 767 768 /** 769 * Delete the specified property. 770 */ 771 typedef struct { 772 uint8_t reqType; 773 uint8_t ReqType; /**< Always X_XIDeleteProperty */ 774 uint16_t length; /**< Length in 4 byte units */ 775 uint16_t deviceid; 776 uint16_t pad0; 777 Atom property; 778 } xXIDeletePropertyReq; 779 #define sz_xXIDeletePropertyReq 12 780 781 /** 782 * Query the specified property's values. 783 */ 784 typedef struct { 785 uint8_t reqType; 786 uint8_t ReqType; /**< Always X_XIGetProperty */ 787 uint16_t length; /**< Length in 4 byte units */ 788 uint16_t deviceid; 789 #if defined(__cplusplus) || defined(c_plusplus) 790 uint8_t c_delete; 791 #else 792 uint8_t delete; 793 #endif 794 uint8_t pad0; 795 Atom property; 796 Atom type; 797 uint32_t offset; 798 uint32_t len; 799 } xXIGetPropertyReq; 800 #define sz_xXIGetPropertyReq 24 801 802 typedef struct { 803 uint8_t repType; /**< Input extension major opcode */ 804 uint8_t RepType; /**< Always X_XIGetProperty */ 805 uint16_t sequenceNumber; 806 uint32_t length; 807 Atom type; 808 uint32_t bytes_after; 809 uint32_t num_items; 810 uint8_t format; 811 uint8_t pad0; 812 uint16_t pad1; 813 uint32_t pad2; 814 uint32_t pad3; 815 } xXIGetPropertyReply; 816 #define sz_xXIGetPropertyReply 32 817 818 /************************************************************************************* 819 * * 820 * EVENTS * 821 * * 822 *************************************************************************************/ 823 824 /** 825 * Generic XI2 event header. All XI2 events use the same header. 826 */ 827 typedef struct 828 { 829 uint8_t type; 830 uint8_t extension; /**< XI extension offset */ 831 uint16_t sequenceNumber; 832 uint32_t length; 833 uint16_t evtype; 834 uint16_t deviceid; 835 Time time; 836 } xXIGenericDeviceEvent; 837 838 /** 839 * Device hierarchy information. 840 */ 841 typedef struct 842 { 843 uint16_t deviceid; 844 uint16_t attachment; /**< ID of master or paired device */ 845 uint8_t use; /**< ::XIMasterKeyboard, 846 ::XIMasterPointer, 847 ::XISlaveKeyboard, 848 ::XISlavePointer, 849 ::XIFloatingSlave */ 850 BOOL enabled; /**< TRUE if the device is enabled */ 851 uint16_t pad; 852 uint32_t flags; /**< ::XIMasterAdded, ::XIMasterRemoved, 853 ::XISlaveAttached, ::XISlaveDetached, 854 ::XISlaveAdded, ::XISlaveRemoved, 855 ::XIDeviceEnabled, ::XIDeviceDisabled */ 856 } xXIHierarchyInfo; 857 858 /** 859 * The device hierarchy has been modified. This event includes the device 860 * hierarchy after the modification has been applied. 861 */ 862 typedef struct 863 { 864 uint8_t type; /**< Always GenericEvent */ 865 uint8_t extension; /**< XI extension offset */ 866 uint16_t sequenceNumber; 867 uint32_t length; /**< Length in 4 byte units */ 868 uint16_t evtype; /**< ::XI_Hierarchy */ 869 uint16_t deviceid; 870 Time time; 871 uint32_t flags; /**< ::XIMasterAdded, ::XIMasterDeleted, 872 ::XISlaveAttached, ::XISlaveDetached, 873 ::XISlaveAdded, ::XISlaveRemoved, 874 ::XIDeviceEnabled, ::XIDeviceDisabled */ 875 uint16_t num_info; 876 uint16_t pad0; 877 uint32_t pad1; 878 uint32_t pad2; 879 } xXIHierarchyEvent; 880 881 /** 882 * A device has changed capabilities. 883 */ 884 typedef struct 885 { 886 uint8_t type; /**< Always GenericEvent */ 887 uint8_t extension; /**< XI extension offset */ 888 uint16_t sequenceNumber; 889 uint32_t length; /**< Length in 4 byte units */ 890 uint16_t evtype; /**< XI_DeviceChanged */ 891 uint16_t deviceid; /**< Device that has changed */ 892 Time time; 893 uint16_t num_classes; /**< Number of classes that have changed */ 894 uint16_t sourceid; /**< Source of the new classes */ 895 uint8_t reason; /**< ::XISlaveSwitch, ::XIDeviceChange */ 896 uint8_t pad0; 897 uint16_t pad1; 898 uint32_t pad2; 899 uint32_t pad3; 900 } xXIDeviceChangedEvent; 901 902 /** 903 * The owner of a touch stream has passed on ownership to another client. 904 */ 905 typedef struct 906 { 907 uint8_t type; /**< Always GenericEvent */ 908 uint8_t extension; /**< XI extension offset */ 909 uint16_t sequenceNumber; 910 uint32_t length; /**< Length in 4 byte units */ 911 uint16_t evtype; /**< XI_TouchOwnership */ 912 uint16_t deviceid; /**< Device that has changed */ 913 Time time; 914 uint32_t touchid; 915 Window root; 916 Window event; 917 Window child; 918 /* 32 byte boundary */ 919 uint16_t sourceid; 920 uint16_t pad0; 921 uint32_t flags; 922 uint32_t pad1; 923 uint32_t pad2; 924 } xXITouchOwnershipEvent; 925 926 /** 927 * Default input event for pointer, keyboard or touch input. 928 */ 929 typedef struct 930 { 931 uint8_t type; /**< Always GenericEvent */ 932 uint8_t extension; /**< XI extension offset */ 933 uint16_t sequenceNumber; 934 uint32_t length; /**< Length in 4 byte uints */ 935 uint16_t evtype; 936 uint16_t deviceid; 937 Time time; 938 uint32_t detail; /**< Keycode or button */ 939 Window root; 940 Window event; 941 Window child; 942 /* 32 byte boundary */ 943 FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ 944 FP1616 root_y; 945 FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ 946 FP1616 event_y; 947 uint16_t buttons_len; /**< Len of button flags in 4 b units */ 948 uint16_t valuators_len; /**< Len of val. flags in 4 b units */ 949 uint16_t sourceid; /**< The source device */ 950 uint16_t pad0; 951 uint32_t flags; /**< ::XIKeyRepeat */ 952 xXIModifierInfo mods; 953 xXIGroupInfo group; 954 } xXIDeviceEvent; 955 956 957 /** 958 * Sent when an input event is generated. RawEvents include valuator 959 * information in both device-specific data (i.e. unaccelerated) and 960 * processed data (i.e. accelerated, if applicable). 961 */ 962 typedef struct 963 { 964 uint8_t type; /**< Always GenericEvent */ 965 uint8_t extension; /**< XI extension offset */ 966 uint16_t sequenceNumber; 967 uint32_t length; /**< Length in 4 byte uints */ 968 uint16_t evtype; /**< ::XI_RawEvent */ 969 uint16_t deviceid; 970 Time time; 971 uint32_t detail; 972 uint16_t sourceid; /**< The source device (XI 2.1) */ 973 uint16_t valuators_len; /**< Length of trailing valuator 974 mask in 4 byte units */ 975 uint32_t flags; /**< ::XIKeyRepeat */ 976 uint32_t pad2; 977 } xXIRawEvent; 978 979 /** 980 * Note that the layout of root, event, child, root_x, root_y, event_x, 981 * event_y must be identical to the xXIDeviceEvent. 982 */ 983 typedef struct 984 { 985 uint8_t type; /**< Always GenericEvent */ 986 uint8_t extension; /**< XI extension offset */ 987 uint16_t sequenceNumber; 988 uint32_t length; /**< Length in 4 byte uints */ 989 uint16_t evtype; /**< ::XI_Enter */ 990 uint16_t deviceid; 991 Time time; 992 uint16_t sourceid; 993 uint8_t mode; 994 uint8_t detail; 995 Window root; 996 Window event; 997 Window child; 998 /* 32 byte boundary */ 999 FP1616 root_x; 1000 FP1616 root_y; 1001 FP1616 event_x; 1002 FP1616 event_y; 1003 BOOL same_screen; 1004 BOOL focus; 1005 uint16_t buttons_len; /**< Length of trailing button mask 1006 in 4 byte units */ 1007 xXIModifierInfo mods; 1008 xXIGroupInfo group; 1009 } xXIEnterEvent; 1010 1011 typedef xXIEnterEvent xXILeaveEvent; 1012 typedef xXIEnterEvent xXIFocusInEvent; 1013 typedef xXIEnterEvent xXIFocusOutEvent; 1014 1015 /** 1016 * Sent when a device property is created, modified or deleted. Does not 1017 * include property data, the client is required to query the data. 1018 */ 1019 typedef struct 1020 { 1021 uint8_t type; /**< Always GenericEvent */ 1022 uint8_t extension; /**< XI extension offset */ 1023 uint16_t sequenceNumber; 1024 uint32_t length; /**< Length in 4 byte uints */ 1025 uint16_t evtype; /**< ::XI_PropertyEvent */ 1026 uint16_t deviceid; 1027 Time time; 1028 Atom property; 1029 uint8_t what; /**< ::XIPropertyDeleted, 1030 ::XIPropertyCreated, 1031 ::XIPropertyMotified */ 1032 uint8_t pad0; 1033 uint16_t pad1; 1034 uint32_t pad2; 1035 uint32_t pad3; 1036 } xXIPropertyEvent; 1037 1038 1039 #undef Window 1040 #undef Time 1041 #undef Atom 1042 #undef Cursor 1043 1044 #endif /* _XI2PROTO_H_ */ 1045