home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / extensions / xinput / encoding.ms next >
Encoding:
Text File  |  1991-07-26  |  35.7 KB  |  2,013 lines

  1. \&
  2. .sp 1
  3. .XS
  4. Appendix A \- Input Extension Protocol Encoding
  5. .XE
  6. .ce 2
  7. .ps 11
  8. .nr PS 11
  9. .ps +2
  10. \fBAppendix A\fP
  11.  
  12. \fBInput Extension Protocol Encoding\fP
  13. .ps
  14. .sp 2
  15. .LP
  16. .ps 9
  17. .nr PS 9
  18. .vs 10
  19. .nr VS 10
  20. .\"The sections in this appendix correspond to their number counterparts
  21. .\"in the protocol document.
  22. .ps +2
  23. \fBSyntactic Conventions\fP
  24. .ps -3
  25. .LP
  26. All numbers are in decimal, 
  27. unless prefixed with #x, in which case they are in hexadecimal (base 16).
  28. .LP
  29. The general syntax used to describe requests, replies, errors, events, and
  30. compound types is:
  31. .LP
  32. .DS I
  33. \fBNameofThing\fP
  34.   encode-form
  35.   ...
  36.   encode-form
  37. .DE
  38. Each encode-form describes a single component.
  39. .LP
  40. For components described in the protocol as:
  41. .LP
  42. .DS I
  43. name: TYPE
  44. .DE
  45. the encode-form is:
  46. .LP
  47. .DS I
  48. .TA 1i 1.5i 2.5i
  49. .ta 1i 1.5i 2.5i
  50. N    TYPE    name
  51. .DE
  52. N is the number of bytes occupied in the data stream, 
  53. and TYPE is the interpretation of those bytes.
  54. For example,
  55. .LP
  56. .DS I
  57. .TA 1i 1.5i
  58. .ta 1i 1.5i
  59. depth: CARD8
  60. .DE
  61. becomes:
  62. .LP
  63. .DS I
  64. .TA 1i 1.5i 2.5i 
  65. .ta 1i 1.5i 2.5i
  66. 1    CARD8    depth
  67. .DE
  68. For components with a static numeric value the encode-form is:
  69. .LP
  70. .DS I
  71. .TA 1i 1.5i 2.5i
  72. .ta 1i 1.5i 2.5i
  73. N    value    name
  74. .DE
  75. The value is always interpreted as an N-byte unsigned integer.
  76. For example, 
  77. the first two bytes of a Window error are always zero (indicating an
  78. error in general) and three (indicating the Window error in particular):
  79. .LP
  80. .DS I
  81. .TA 1i 1.5i 2.5i
  82. .ta 1i 1.5i 2.5i
  83. 1    0    Error
  84. 1    3    code
  85. .DE
  86. For components described in the protocol as:
  87. .LP
  88. .DS I
  89. name: \fB{Name1, ..., NameI}\fP
  90. .DE
  91. .LP
  92. the encode-form is:
  93. .LP
  94. .DS I
  95. .TA 1i 1.5i 2.5i
  96. .ta 1i 1.5i 2.5i
  97. N        name
  98.     value1 Name1
  99.     ...
  100.     valueI NameI
  101. .DE
  102. The value is always interpreted as an N-byte unsigned integer.
  103. Note that the size of N is sometimes larger than that strictly required 
  104. to encode the values.
  105. For example:
  106. .LP
  107. .DS I
  108. class: \fB{InputOutput, InputOnly, CopyFromParent}\fP
  109. .DE
  110. .LP
  111. becomes:
  112. .LP
  113. .DS I
  114. .TA 1i 1.5i 2.5i 3i
  115. .ta 1i 1.5i 2.5i 3i
  116. 2            class
  117.     0    CopyFromParent
  118.     1    InputOutput
  119.     2    InputOnly
  120. .DE
  121. For components described in the protocol as:
  122. .DS I
  123. .LP
  124. NAME: TYPE or \fBAlternative1 ... or AlternativeI\fP
  125. .DE
  126. .LP
  127. the encode-form is:
  128. .LP
  129. .DS I
  130. .TA 1i 1.5i 2i 2.5i 3i
  131. .ta 1i 1.5i 2i 2.5i 3i
  132. N    TYPE            NAME
  133.     value1    Alternative1
  134.     ...
  135.     valueI    AlternativeI
  136. .DE
  137. The alternative values are guaranteed not to conflict with the encoding
  138. of TYPE.  
  139. For example:
  140. .DS
  141. .LP
  142. destination: WINDOW or \fBPointerWindow\fP or \fBInputFocus\fP
  143. .DE
  144. .LP
  145. becomes:
  146. .LP
  147. .DS I
  148. .TA 1i 1.5i 2.5i
  149. .ta 1i 1.5i 2.5i
  150. 4    WINDOW        destination
  151.     0    PointerWindow
  152.     1    InputFocus
  153. .DE
  154. For components described in the protocol as:
  155. .LP
  156. .DS I
  157. .TA 1i 1.5i
  158. .ta 1i 1.5i
  159. value-mask: BITMASK
  160. .DE
  161. the encode-form is:
  162. .LP
  163. .DS I
  164. .TA 1i 1.5i 2i 2.5i 
  165. .ta 1i 1.5i 2i 2.5i
  166. N    BITMASK            value-mask
  167.     mask1    mask-name1
  168.     ...
  169.     maskI    mask-nameI
  170. .DE
  171. The individual bits in the mask are specified and named, 
  172. and N is 2 or 4.
  173. The most-significant bit in a BITMASK is reserved for use in defining
  174. chained (multiword) bitmasks, as extensions augment existing core requests.
  175. The precise interpretation of this bit is not yet defined here, 
  176. although a probable mechanism is that a 1-bit indicates that another N bytes 
  177. of bitmask follows, with bits within the overall mask still interpreted 
  178. from least-significant to most-significant with an N-byte unit, with N-byte units 
  179. interpreted in stream order, and with the overall mask being byte-swapped 
  180. in individual N-byte units.
  181. .LP
  182. For LISTofVALUE encodings, the request is followed by a section of the form:
  183. .LP
  184. .DS I
  185. .TA 1i 1.5i
  186. .ta 1i 1.5i
  187. VALUEs
  188.  encode-form
  189.  ...
  190.  encode-form
  191. .DE
  192. listing an encode-form for each VALUE.
  193. The NAME in each encode-form keys to the corresponding BITMASK bit.
  194. The encoding of a VALUE always occupies four bytes, 
  195. but the number of bytes specified in the encoding-form indicates how
  196. many of the least-significant bytes are actually used; 
  197. the remaining bytes are unused and their values do not matter.
  198. .LP
  199. In various cases, the number of bytes occupied by a component will be specified
  200. by a lowercase single-letter variable name instead of a specific numeric
  201. value, and often some other component will have its value specified as a
  202. simple numeric expression involving these variables.
  203. Components specified with such expressions are always interpreted 
  204. as unsigned integers.
  205. The scope of such variables is always just the enclosing request, reply, 
  206. error, event, or compound type structure.
  207. For example:
  208. .LP
  209. .DS I
  210. .TA 1i 1.5i 2i 2.5i
  211. .ta 1i 1.5i 2i 2.5i
  212. 2    3+n            request length
  213. 4n    LISTofPOINT        points
  214. .DE
  215. For unused bytes (the values of the bytes are undefined and do not matter),
  216. the encode-form is:
  217. .LP
  218. .DS I
  219. .TA 1i 1.5i 2i 2.5i
  220. .ta 1i 1.5i 2i 2.5i
  221. N            unused
  222. .DE
  223. If the number of unused bytes is variable, the encode-form typically is:
  224. .LP
  225. .DS I
  226. .TA 1i 1.5i 2i 2.5i
  227. .ta 1i 1.5i 2i 2.5i
  228. p            unused, p=pad(E)
  229. .DE
  230. where E is some expression,
  231. and pad(E) is the number of bytes needed to round E up to a multiple of four.
  232. .LP
  233. .DS I
  234. .TA 1i 1.5i 2i 2.5i
  235. .ta 1i 1.5i 2i 2.5i
  236. pad(E) = (4 - (E mod 4)) mod 4
  237. .DE
  238. .ps +2
  239. \fBCommon Types\fP
  240. .ps
  241. .LP
  242. LISTofFOO
  243. .IP
  244. In this document the LISTof notation strictly means some number of repetitions
  245. of the FOO encoding; 
  246. the actual length of the list is encoded elsewhere.
  247. .LP
  248. SETofFOO
  249. .P 1
  250. A set is always represented by a bitmask, with a 1-bit indicating presence in
  251. the set.
  252. .LP
  253. BITMASK: CARD32
  254. .LP
  255. WINDOW: CARD32
  256. .LP
  257. BYTE: 8-bit value
  258. .LP
  259. INT8: 8-bit signed integer
  260. .LP
  261. INT16: 16-bit signed integer
  262. .LP
  263. INT32: 32-bit signed integer
  264. .LP
  265. CARD8: 8-bit unsigned integer
  266. .LP
  267. CARD16: 16-bit unsigned integer
  268. .LP
  269. CARD32: 32-bit unsigned integer
  270. .LP
  271. TIMESTAMP: CARD32
  272. .LP
  273. EVENTCLASS: CARD32
  274. .LP
  275. .DS 0
  276. .TA .75i 1.75i
  277. .ta .75i 1.75i
  278. INPUTCLASS
  279.     0    KeyClass
  280.     1    ButtonClass
  281.     2    ValuatorClass
  282.     3    FeedbackClass
  283.     4    ProximityClass
  284.     5    FocusClass
  285.     6    OtherClass
  286. .DE
  287. .LP
  288. .DS 0
  289. .TA .75i 1.75i
  290. .ta .75i 1.75i
  291. INPUTCLASS
  292.     0    KbdFeedbackClass
  293.     1    PtrFeedbackClass
  294.     2    StringFeedbackClass
  295.     3    IntegerFeedbackClass
  296.     4    LedFeedbackClass
  297.     5    BellFeedbackClass
  298. .DE
  299. .LP
  300. .DS 0
  301. .TA .75i 1.75i
  302. .ta .75i 1.75i
  303. INPUTINFO
  304.     0    KEYINFO
  305.     1    BUTTONINFO
  306.     2    VALUATORINFO
  307. .DE
  308. .LP
  309. .DS 0
  310. .TA .75i 1.75i
  311. .ta .75i 1.75i
  312. DEVICEMODE
  313.     0    Relative
  314.     1    Absolute
  315. .DE
  316. .LP
  317. .DS 0
  318. .TA .75i 1.75i
  319. .ta .75i 1.75i
  320. PROXIMITYSTATE
  321.     0    InProximity
  322.     1    OutOfProximity
  323. .DE
  324. .LP
  325. .DS 0
  326. .TA .75i 1.75i
  327. .ta .75i 1.75i
  328. BOOL
  329.     0    False
  330.     1    True
  331. .DE
  332. .LP
  333. KEYSYM: CARD32
  334. .LP
  335. KEYCODE: CARD8
  336. .LP
  337. BUTTON: CARD8
  338. .LP
  339. .DS 0
  340. .TA .75i 1.75i
  341. .ta .75i 1.75i
  342. SETofKEYBUTMASK
  343.     #x0001    Shift
  344.     #x0002    Lock
  345.     #x0004    Control
  346.     #x0008    Mod1
  347.     #x0010    Mod2
  348.     #x0020    Mod3
  349.     #x0040    Mod4
  350.     #x0080    Mod5
  351.     #x0100    Button1
  352.     #x0200    Button2
  353.     #x0400    Button3
  354.     #x0800    Button4
  355.     #x1000    Button5
  356.     #xe000    unused but must be zero
  357. .DE
  358. .LP
  359. .DS 0
  360. .TA .75i 1.75i
  361. .ta .75i 1.75i
  362. SETofKEYMASK
  363.     encodings are the same as for SETofKEYBUTMASK, except with
  364.     #xff00        unused but must be zero
  365. .DE
  366. .LP
  367. STRING8: LISTofCARD8
  368. .LP
  369. .DS 0
  370. .TA .2i .5i 1.5i 2.5i
  371. .ta .2i .5i 1.5i 2.5i
  372. STR
  373.     1    n        length of name in bytes
  374.     n    STRING8        name
  375. .DE
  376. .ps +2
  377. \fBErrors\fP
  378. .ps
  379. .LP
  380. .DS 0
  381. .TA .2i .5i 1.5i 2.5i
  382. .ta .2i .5i 1.5i 2.5i
  383. Request
  384.     1    0        Error
  385.     1    1        code
  386.     2    CARD16        sequence number
  387.     4            unused
  388.     2    CARD16        minor opcode
  389.     1    CARD8        major opcode
  390.     21            unused
  391. .DE
  392. .LP
  393. .DS 0
  394. .TA .2i .5i 1.5i 2.5i
  395. .ta .2i .5i 1.5i 2.5i
  396. Value
  397.     1    0        Error
  398.     1    2        code
  399.     2    CARD16        sequence number
  400.     4    <32-bits>        bad value
  401.     2    CARD16        minor opcode
  402.     1    CARD8        major opcode
  403.     21            unused
  404. .DE
  405. .LP
  406. .DS 0
  407. .TA .2i .5i 1.5i 2.5i
  408. .ta .2i .5i 1.5i 2.5i
  409. Window
  410.     1    0        Error
  411.     1    3        code
  412.     2    CARD16        sequence number
  413.     4    CARD32        bad resource id
  414.     2    CARD16        minor opcode
  415.     1    CARD8        major opcode
  416.     21            unused
  417. .DE
  418. .LP
  419. .DS 0
  420. .TA .2i .5i 1.5i 2.5i
  421. .ta .2i .5i 1.5i 2.5i
  422. Match
  423.     1    0        Error
  424.     1    8        code
  425.     2    CARD16        sequence number
  426.     4            unused
  427.     2    CARD16        minor opcode
  428.     1    CARD8        major opcode
  429.     21            unused
  430. .DE
  431. .LP
  432. .DS 0
  433. .TA .2i .5i 1.5i 2.5i
  434. .ta .2i .5i 1.5i 2.5i
  435. Access
  436.     1    0        Error
  437.     1    10        code
  438.     2    CARD16        sequence number
  439.     4            unused
  440.     2    CARD16        minor opcode
  441.     1    CARD8        major opcode
  442.     21            unused
  443. .DE
  444. .LP
  445. .DS 0
  446. .TA .2i .5i 1.5i 2.5i
  447. .ta .2i .5i 1.5i 2.5i
  448. Alloc
  449.     1    0        Error
  450.     1    11        code
  451.     2    CARD16        sequence number
  452.     4            unused
  453.     2    CARD16        minor opcode
  454.     1    CARD8        major opcode
  455.     21            unused
  456. .DE
  457. .LP
  458. .DS 0
  459. .TA .2i .5i 1.5i 2.5i
  460. .ta .2i .5i 1.5i 2.5i
  461. Name
  462.     1    0        Error
  463.     1    15        code
  464.     2    CARD16        sequence number
  465.     4            unused
  466.     2    CARD16        minor opcode
  467.     1    CARD8        major opcode
  468.     21            unused
  469. .DE
  470. .LP
  471. .DS 0
  472. .TA .2i .5i 1.5i 2.5i
  473. .ta .2i .5i 1.5i 2.5i
  474. Device
  475.     1    0        Error
  476.     1    CARD8        code
  477.     2    CARD16        sequence number
  478.     4            unused
  479.     2    CARD16        minor opcode
  480.     1    CARD8        major opcode
  481.     21            unused
  482. .DE
  483. .LP
  484. .DS 0
  485. .TA .2i .5i 1.5i 2.5i
  486. .ta .2i .5i 1.5i 2.5i
  487. Event
  488.     1    0        Error
  489.     1    CARD8        code
  490.     2    CARD16        sequence number
  491.     4            unused
  492.     2    CARD16        minor opcode
  493.     1    CARD8        major opcode
  494.     21            unused
  495. .DE
  496. .LP
  497. .DS 0
  498. .TA .2i .5i 1.5i 2.5i
  499. .ta .2i .5i 1.5i 2.5i
  500. Mode
  501.     1    0        Error
  502.     1    CARD8        code
  503.     2    CARD16        sequence number
  504.     4            unused
  505.     2    CARD16        minor opcode
  506.     1    CARD8        major opcode
  507.     21            unused
  508. .DE
  509. .LP
  510. .DS 0
  511. .TA .2i .5i 1.5i 2.5i
  512. .ta .2i .5i 1.5i 2.5i
  513. Class
  514.     1    0        Error
  515.     1    CARD8        code
  516.     2    CARD16        sequence number
  517.     4            unused
  518.     2    CARD16        minor opcode
  519.     1    CARD8        major opcode
  520.     21            unused
  521. .DE
  522. .ps +2
  523. Keyboards
  524. .ps
  525. .LP
  526. KEYCODE values are always greater than 7 (and less than 256).
  527. .LP
  528. KEYSYM values with the bit #x10000000 set are reserved as vendor-specific.
  529. .LP
  530. The names and encodings of the standard KEYSYM values are contained in 
  531. .\"Appendix B, Keysym Encoding.
  532. appendix F.
  533. .LP
  534. .ps +2
  535. Pointers
  536. .ps
  537. .LP
  538. BUTTON values are numbered starting with one.
  539. .LP
  540. .ps +2
  541. Requests
  542. .ps
  543. .LP
  544. .DS 0
  545. .TA .2i .5i 1.5i 2.5i
  546. .ta .2i .5i 1.5i 2.5i
  547. GetExtensionVersion
  548.     1    CARD8        input extension opcode
  549.     1    1        GetExtensionVersion opcode
  550.     2    2+(n+p)/4        request length
  551.     2    n        length of name
  552.     2            unused
  553.     n    STRING8        name
  554.     p            unused, p=pad(n)
  555. .DE
  556. .DS 0
  557. .TA .2i .5i 1.5i 2.5i
  558. .ta .2i .5i 1.5i 2.5i
  559.  =>
  560.     1    1        Reply
  561.     1    1        GetExtensionVersion opcode
  562.     2    CARD16        sequence number
  563.     4    0        reply length
  564.     2    CARD16        major version
  565.     2    CARD16        minor version
  566.     1    BOOL        present
  567.     19            unused
  568. .DE
  569. .LP
  570. .DS 0
  571. .TA .2i .5i 1.5i 2.5i
  572. .ta .2i .5i 1.5i 2.5i
  573. ListInputDevices
  574.     1    CARD8        input extension opcode
  575.     1    2        ListInputDevices opcode
  576.     2    1        request length
  577. .DE
  578. .DS 0
  579. .TA .2i .5i 1.5i 2.5i
  580. .ta .2i .5i 1.5i 2.5i
  581.  =>
  582.     1    1            Reply
  583.     1    2            ListInputDevices opcode
  584.     2    CARD16            sequence number
  585.     4    (n+p)/4            reply length
  586.     1    CARD8            number of input devices
  587.     23                unused
  588.     n    LISTofDEVICEINFO    info for each input device
  589.     p                unused, p=pad(n)
  590. .DE
  591. .LP
  592. .DS 0
  593. .TA .2i .5i 1.5i 2.5i
  594. .ta .2i .5i 1.5i 2.5i
  595.   DEVICEINFO
  596.     4    CARD32        device type
  597.     1    CARD8        device id
  598.     1    CARD8        number of input classes this device reports
  599.     1    CARD8        device use
  600.             0    IsXPointer
  601.             1    IsXKeyboard
  602.             2    IsXExtensionDevice
  603.     1            unused
  604.     n    LISTofINPUTINFO         input info for each input class
  605.     m    STR            name
  606.     p                unused, p=pad(m)
  607. .DE
  608. .LP
  609. .DS 0
  610. .TA .2i .5i 1.5i 2.5i
  611. .ta .2i .5i 1.5i 2.5i
  612.   INPUTINFO    KEYINFO or BUTTONINFO or VALUATORINFO
  613. .DE
  614. .LP
  615. .DS 0
  616. .TA .2i .5i 1.5i 2.5i
  617. .ta .2i .5i 1.5i 2.5i
  618.   KEYINFO
  619.     1    0        class id
  620.     1    8        length
  621.     1    KEYCODE        minimum keycode
  622.     1    KEYCODE        maximum keycode
  623.     2    CARD16        number of keys
  624.     2            unused
  625. .DE
  626. .LP
  627. .DS 0
  628. .TA .2i .5i 1.5i 2.5i
  629. .ta .2i .5i 1.5i 2.5i
  630. BUTTONINFO
  631.     1    1        class id
  632.     1    4        length
  633.     2    CARD16        number of buttons
  634. .DE
  635. .LP
  636. .DS 0
  637. .TA .2i .75i 2.0i 3.0i
  638. .ta .2i .75i 2.0i 3.0i
  639. VALUATORINFO
  640.     1    2        class id
  641.     1    8+12n        length
  642.     1    n        number of axes
  643.     1    SETofDEVICEMODE            mode
  644.     4    CARD32        size of motion buffer
  645.     12n    LISTofAXISINFO        valuator limits
  646. .DE
  647. .LP
  648. .DS 0
  649. .TA .2i .5i 1.5i 2.5i
  650. .ta .2i .5i 1.5i 2.5i
  651. AXISINFO
  652.     4    CARD32        resolution
  653.     4    CARD32        minimum value
  654.     4    CARD32        maximum value
  655. .DE
  656. .LP
  657. .DS 0
  658. .TA .2i .5i 1.5i 2.5i
  659. .ta .2i .5i 1.5i 2.5i
  660. OpenDevice
  661.     1    CARD8        input extension opcode
  662.     1    3        OpenDevice opcode
  663.     2    2        request length
  664.     1    CARD8        device id
  665.     3            unused
  666. .DE
  667. .DS 0
  668. .TA .2i .5i 1.5i 3.5i
  669. .ta .2i .5i 1.5i 3.5i
  670.  =>
  671.     1    1            Reply
  672.     1    3            OpenDevice opcode
  673.     2    CARD16            sequence number
  674.     4    (n+p)/4            reply length
  675.     1    CARD8            number of input classes
  676.     23                unused
  677.     n    LISTofINPUTCLASSINFO    input class information
  678.     p                unused, p=pad(n)
  679. .DE
  680. .LP
  681. .DS 0
  682. .TA .2i .5i 1.5i 2.5i
  683. .ta .2i .5i 1.5i 2.5i
  684.   INPUTCLASSINFO
  685.     1    CARD8        input class id
  686.         0    KEY
  687.         1    BUTTON
  688.         2    VALUATOR
  689.         3    FEEDBACK
  690.         4    PROXIMITY
  691.         5    FOCUS
  692.         6    OTHER
  693.     1    CARD8        event type base code for this class
  694. .DE
  695. .LP
  696. .DS 0
  697. .TA .2i .5i 1.5i 2.5i
  698. .ta .2i .5i 1.5i 2.5i
  699. CloseDevice
  700.     1    CARD8        input extension opcode
  701.     1    4        CloseDevice opcode
  702.     2    2        request length
  703.     1    CARD8        device id
  704.     3            unused
  705. .DE
  706. .LP
  707. .DS 0
  708. .TA .2i .5i 1.5i 2.5i
  709. .ta .2i .5i 1.5i 2.5i
  710. SetDeviceMode
  711.     1    CARD8        input extension opcode
  712.     1    5        SetDeviceMode opcode
  713.     2    2        request length
  714.     1    CARD8        device id
  715.     1    CARD8        mode
  716.     2            unused
  717. .DE
  718. .DS 0
  719. .TA .2i .5i 1.5i 3.5i
  720. .ta .2i .5i 1.5i 3.5i
  721.  =>
  722.     1    1            Reply
  723.     1    5            SetDeviceMode opcode
  724.     2    CARD16            sequence number
  725.     4    0            reply length
  726.     1    CARD8            status
  727.         0        Success
  728.             1    AlreadyGrabbed
  729.         3 + first_error    DeviceBusy
  730.     23                unused
  731. .DE
  732. .LP
  733. .DS 0
  734. .TA .2i .5i 1.5i 2.5i
  735. .ta .2i .5i 1.5i 2.5i
  736. SelectExtensionEvent
  737.     1    CARD8            input extension opcode
  738.     1    6            SelectExtensionEvent opcode
  739.     2    3+n                request length
  740.     4    Window            event window
  741.     2    CARD16            count
  742.     2                unused
  743.     4n    LISTofEVENTCLASS    desired events
  744. .DE
  745. .LP
  746. .DS 0
  747. .TA .2i .5i 1.5i 2.5i
  748. .ta .2i .5i 1.5i 2.5i
  749. GetSelectedExtensionEvents
  750.     1    CARD8        input extension opcode
  751.     1    7        GetSelectedExtensionEvents opcode
  752.     2    2        request length
  753.     4    Window        event window
  754. .DE
  755. .DS 0
  756. .TA .2i .5i 1.5i 2.5i
  757. .ta .2i .5i 1.5i 2.5i
  758.  =>
  759.     1    1        Reply
  760.     1    7        GetSelecteExtensionEvents opcode
  761.     2    CARD16        sequence number
  762.     4    n + m          reply length
  763.     2    n             this client count
  764.     2    m             all clients count
  765.     20            unused
  766.     4n    LISTofEVENTCLASS    this client list
  767.     4m    LISTofEVENTCLASS    all clients list
  768. .DE
  769. .LP
  770. .DS 0
  771. .TA .2i .5i 1.5i 2.5i
  772. .ta .2i .5i 1.5i 2.5i
  773. ChangeDeviceDontPropagateList
  774.     1    CARD8            input extension opcode
  775.     1    8            ChangeDeviceDontPropagateList opcode
  776.     2    3+n                request length
  777.     4    Window            event window
  778.     2    n            count of events
  779.     1    mode
  780.         0    AddToList
  781.         1    DeleteFromList
  782.     1                unused
  783.     4n    LISTofEVENTCLASS    desired events
  784. .DE
  785. .LP
  786. .DS 0
  787. .TA .2i .5i 1.5i 2.5i
  788. .ta .2i .5i 1.5i 2.5i
  789. GetDeviceDontPropagateList
  790.     1    CARD8        input extension opcode
  791.     1    9        GetDeviceDontPropagateList opcode
  792.     2    2        request length
  793.     4    Window        event window
  794. .DE
  795. .DS 0
  796. .TA .2i .5i 1.5i 2.5i
  797. .ta .2i .5i 1.5i 2.5i
  798.  =>
  799.     1    1            Reply
  800.     1    9            GetDeviceDontPropagateList opcode
  801.     2    CARD16            sequence number
  802.     4    n              reply length
  803.     2    n            count of events
  804.     22                unused
  805.     4n    LISTofEVENTCLASS    don't propagate list
  806. .DE
  807. .LP
  808. .DS 0
  809. .TA .2i .5i 1.5i 2.5i
  810. .ta .2i .5i 1.5i 2.5i
  811. GetDeviceMotionEvents
  812.     1    CARD8        input extension opcode
  813.     1    10        GetDeviceMotionEvents opcode
  814.     2    4        request length
  815.     4    TIMESTAMP        start
  816.         0    CurrentTime
  817.     4    TIMESTAMP        stop
  818.         0    CurrentTime
  819.     1    CARD8        device id
  820.     3            unused
  821. .DE
  822. .DS 0
  823. .TA .2i .5i 1.5i 3.5i
  824. .ta .2i .5i 1.5i 3.5i
  825.  =>
  826.     1        1        Reply
  827.     1        10    GetDeviceMotionEvents opcode
  828.     2        CARD16    sequence number
  829.     4        (m+1)n    reply length
  830.     4        n        number of DEVICETIMECOORDs in events
  831.     1        m        number of valuators per event
  832.     1        CARD8        mode of the device
  833.             0    Absolute
  834.             1    Relative
  835.     18                unused
  836.     (4m+4)n    LISTofDEVICETIMECOORD    events
  837. .DE
  838. .LP
  839. .DS 0
  840. .TA .2i .5i 1.5i 2.5i
  841. .ta .2i .5i 1.5i 2.5i
  842.   DEVICETIMECOORD
  843.     4    TIMESTAMP        time
  844.     4m    LISTofINT32        valuators
  845. .DE
  846. .LP
  847. .DS 0
  848. .TA .2i .5i 1.5i 2.5i
  849. .ta .2i .5i 1.5i 2.5i
  850. ChangeKeyboardDevice
  851.     1    CARD8        input extension opcode
  852.     1    11        ChangeKeyboardDevice opcode
  853.     2    2        request length
  854.     1    CARD8        device id
  855.     3            unused
  856. .DE
  857. .DS 0
  858. .TA .2i .5i 1.5i 2.5i
  859. .ta .2i .5i 1.5i 2.5i
  860.  =>
  861.     1    1        Reply
  862.     1    11        ChangeKeyboardDevice opcode
  863.     2    CARD16        sequence number
  864.     4    0        reply length
  865.     1            status
  866.         0    Success
  867.         1    AlreadyGrabbed
  868.         2    DeviceFrozen
  869.     23            unused
  870. .DE
  871. .LP
  872. .DS 0
  873. .TA .2i .5i 1.5i 2.5i
  874. .ta .2i .5i 1.5i 2.5i
  875. ChangePointerDevice
  876.     1    CARD8        input extension opcode
  877.     1    12        ChangePointerDevice opcode
  878.     2    2        request length
  879.     1    CARD8        x-axis
  880.     1    CARD8        y-axis
  881.     1    CARD8        device id
  882.     1            unused
  883. .DE
  884. .DS 0
  885. .TA .2i .5i 1.5i 2.5i
  886. .ta .2i .5i 1.5i 2.5i
  887.  =>
  888.     1    1        Reply
  889.     1    12        ChangePointerDevice opcode
  890.     2    CARD16        sequence number
  891.     4    0        reply length
  892.     1            status
  893.         0    Success
  894.         1    AlreadyGrabbed
  895.         2    DeviceFrozen
  896.     23            unused
  897. .DE
  898. .LP
  899. .DS 0
  900. .TA .2i .5i 1.5i 2.5i
  901. .ta .2i .5i 1.5i 2.5i
  902. GrabDevice
  903.     1    CARD8        input extension opcode
  904.     1    13        GrabDevice opcode
  905.     2    5+n            request length
  906.     4    WINDOW        grab-window
  907.     4    TIMESTAMP        time
  908.         0    CurrentTime
  909.     2    n        count of events
  910.     1            this-device-mode
  911.         0    Synchronous
  912.         1    Asynchronous
  913.     1            other-devices-mode
  914.         0    Synchronous
  915.         1    Asynchronous
  916.     1    BOOL        owner-events
  917.     1    CARD8        device id
  918.     2            unused
  919.     4n    LISTofEVENTCLASS    event list
  920. .DE
  921. .DS 0
  922. .TA .2i .5i 1.5i 2.5i
  923. .ta .2i .5i 1.5i 2.5i
  924.  =>
  925.     1    1        Reply
  926.     1    13        GrabDevice opcode
  927.     2    CARD16        sequence number
  928.     4    0        reply length
  929.     1            status
  930.         0    Success
  931.         1    AlreadyGrabbed
  932.         2    InvalidTime
  933.         3    NotViewable
  934.         4    Frozen
  935.     23            unused
  936. .DE
  937. .LP
  938. .DS 0
  939. .TA .2i .5i 1.5i 2.5i
  940. .ta .2i .5i 1.5i 2.5i
  941. UngrabDevice
  942.     1    CARD8        input extension opcode
  943.     1    14        UngrabDevice opcode
  944.     2    3        request length
  945.     4    TIMESTAMP        time
  946.         0    CurrentTime
  947.     1    CARD8        device id
  948.     3            unused
  949. .DE
  950. .LP
  951. .DS 0
  952. .TA .2i .5i 1.5i 2.5i
  953. .ta .2i .5i 1.5i 2.5i
  954. GrabDeviceKey
  955.     1    CARD8        input extension opcode
  956.     1    15        GrabDeviceKey opcode
  957.     2    5+n        request length
  958.     4    WINDOW        grab-window
  959.     2    n        count of events
  960.     2    SETofKEYMASK        modifiers
  961.         #x8000    AnyModifier
  962.     1    CARD8        modifier device
  963.         #x0FF    UseXKeyboard
  964.     1    CARD8        grabbed device
  965.     1    KEYCODE            key
  966.         0    AnyKey
  967.     1            this-device-mode
  968.         0    Synchronous
  969.         1    Asynchronous
  970.     1            other-devices-mode
  971.         0    Synchronous
  972.         1    Asynchronous
  973.     1    BOOL        owner-events
  974.     2            unused
  975.     4n    LISTofEVENTCLASS    event list
  976. .DE
  977. .LP
  978. .DS 0
  979. .TA .2i .5i 1.5i 2.5i
  980. .ta .2i .5i 1.5i 2.5i
  981. UngrabDeviceKey
  982.     1    CARD8        input extension opcode
  983.     1    16        UngrabDeviceKey opcode
  984.     2    4        request length
  985.     4    WINDOW        grab-window
  986.     2    SETofKEYMASK        modifiers
  987.         #x8000    AnyModifier
  988.     1    CARD8        modifier device
  989.         #x0FF    UseXKeyboard
  990.     1    KEYCODE            key
  991.         0    AnyKey
  992.     1    CARD8        grabbed device
  993.     3            unused
  994.  
  995. .DE
  996. .LP
  997. .DS 0
  998. .TA .2i .5i 1.5i 2.5i
  999. .ta .2i .5i 1.5i 2.5i
  1000. GrabDeviceButton
  1001.     1    CARD8        input extension opcode
  1002.     1    17        GrabDeviceButton opcode
  1003.     2    5+n        request length
  1004.     4    WINDOW        grab-window
  1005.     1    CARD8        grabbed device
  1006.     1    CARD8        modifier device
  1007.         #x0FF    UseXKeyboard
  1008.     2    n        count of desired events
  1009.     2    SETofKEYMASK        modifiers
  1010.     1            this-device-mode
  1011.         0    Synchronous
  1012.         1    Asynchronous
  1013.     1            other-device-mode
  1014.         0    Synchronous
  1015.         1    Asynchronous
  1016.     1    BUTTON        button
  1017.         0    AnyButton
  1018.     1    BOOL        owner-events
  1019.         #x8000    AnyModifier
  1020.     2            unused
  1021.     4n    LISTofEVENTCLASS    event list
  1022. .DE
  1023. .LP
  1024. .DS 0
  1025. .TA .2i .5i 1.5i 2.5i
  1026. .ta .2i .5i 1.5i 2.5i
  1027. UngrabDeviceButton
  1028.     1    CARD8        input extension opcode
  1029.     1    18        UngrabDeviceButton opcode
  1030.     2    4        request length
  1031.     4    WINDOW        grab-window
  1032.     2    SETofKEYMASK        modifiers
  1033.         #x8000    AnyModifier
  1034.     1    CARD8        modifier device
  1035.         #x0FF    UseXKeyboard
  1036.     1    BUTTON        button
  1037.         0    AnyButton
  1038.     1    CARD8        grabbed device
  1039.     3            unused
  1040. .DE
  1041. .LP
  1042. .DS 0
  1043. .TA .2i .5i 1.5i 2.5i
  1044. .ta .2i .5i 1.5i 2.5i
  1045. AllowDeviceEvents
  1046.     1    CARD8        input extension opcode
  1047.     1    19        AllowDeviceEvents opcode
  1048.     2    3        request length
  1049.     4    TIMESTAMP        time
  1050.         0    CurrentTime
  1051.     1            mode
  1052.         0    AsyncThisDevice
  1053.         1    SyncThisDevice
  1054.         2    ReplayThisDevice
  1055.         3    AsyncOtherDevices
  1056.         4    AsyncAll
  1057.         5    SyncAll
  1058.     1    CARD8        device id
  1059.     2            unused
  1060. .DE
  1061. .LP
  1062. .DS 0
  1063. .TA .2i .5i 1.5i 2.5i
  1064. .ta .2i .5i 1.5i 2.5i
  1065. GetDeviceFocus
  1066.     1    CARD8        input extension opcode
  1067.     1    20        GetDeviceFocus opcode
  1068.     2    2        request length
  1069.     1    CARD8        device
  1070.     3            unused
  1071. .DE
  1072. .DS 0
  1073. .TA .2i .5i 1.5i 2.5i
  1074. .ta .2i .5i 1.5i 2.5i
  1075.  =>
  1076.     1    1        Reply
  1077.     1    20        GetDeviceFocus opcode
  1078.     2    CARD16        sequence number
  1079.     4    0        reply length
  1080.     4    WINDOW        focus
  1081.         0    None
  1082.         1    PointerRoot
  1083.         3    FollowKeyboard
  1084.     4    TIMESTAMP    focus time
  1085.     1            revert-to
  1086.         0    None
  1087.         1    PointerRoot
  1088.         2    Parent
  1089.         3    FollowKeyboard
  1090.     15            unused
  1091. .DE
  1092. .LP
  1093. .DS 0
  1094. .TA .2i .5i 1.5i 2.5i
  1095. .ta .2i .5i 1.5i 2.5i
  1096. SetDeviceFocus
  1097.     1    CARD8        input extension opcode
  1098.     1    21        SetDeviceFocus opcode
  1099.     2    4        request length
  1100.     4    WINDOW        focus
  1101.         0    None
  1102.         1    PointerRoot
  1103.         3    FollowKeyboard
  1104.     4    TIMESTAMP        time
  1105.         0    CurrentTime
  1106.     1            revert-to
  1107.         0    None
  1108.         1    PointerRoot
  1109.         2    Parent
  1110.         3    FollowKeyboard
  1111.     1    CARD8        device
  1112.     2            unused
  1113. .DE
  1114. .LP
  1115. .DS 0
  1116. .TA .2i .5i 1.5i 2.5i
  1117. .ta .2i .5i 1.5i 2.5i
  1118. GetFeedbackControl
  1119.     1    CARD8        input extension opcode
  1120.     1    22        GetFeedbackControl opcode
  1121.     2    2        request length
  1122.     1    CARD8        device id
  1123.     3            unused
  1124. .DE
  1125. .DS 0
  1126. .TA .2i .5i 1.5i 2.5i
  1127. .ta .2i .5i 1.5i 2.5i
  1128.  =>
  1129.     1    1        Reply
  1130.     1    22        GetFeedbackControl opcode
  1131.     2    CARD16        sequence number
  1132.     4    m/4            reply length
  1133.     2    n        number of feedbacks supported
  1134.     22            unused
  1135.     m    LISTofFEEDBACKSTATE    feedbacks
  1136. .DE
  1137. .LP
  1138. .DS 0
  1139. .TA .2i .5i 1.5i 2.5i
  1140. .ta .2i .5i 1.5i 2.5i
  1141.   FEEDBACKSTATE    KBDFEEDBACKSTATE, PTRFEEDBACKSTATE, INTEGERFEEDBACKSTATE, 
  1142.   STRINGFEEDBACKSTATE, BELLFEEDBACKSTATE, or LEDFEEDBACKSTATE
  1143. .DE
  1144. .LP
  1145. .DS 0
  1146. .TA .2i .5i 1.5i 2.5i
  1147. .ta .2i .5i 1.5i 2.5i
  1148.   KBDFEEDBACKSTATE
  1149.     1    0        feedback class id
  1150.     1    CARD8        id of this feedback
  1151.     2    20        length
  1152.     2    CARD16        pitch
  1153.     2    CARD16        duration
  1154.     4    CARD32        led_mask
  1155.     4    CARD32        led_values
  1156.     1                global_auto_repeat
  1157.         0    Off
  1158.         1    On
  1159.     1    CARD8        click
  1160.     1    CARD8        percent
  1161.     1                unused
  1162.     32    LISTofCARD8    auto_repeats
  1163. .DE
  1164. .LP
  1165. .DS 0
  1166. .TA .2i .5i 1.5i 2.5i
  1167. .ta .2i .5i 1.5i 2.5i
  1168.   PTRFEEDBACKSTATE
  1169.     1    0        feedback class id
  1170.     1    CARD8        id of this feedback
  1171.     2    12        length
  1172.     2            unused
  1173.     2    CARD16        acceleration-numerator
  1174.     2    CARD16        acceleration-denominator
  1175.     2    CARD16        threshold
  1176. .DE
  1177. .LP
  1178. .DS 0
  1179. .TA .2i .5i 1.5i 2.5i
  1180. .ta .2i .5i 1.5i 2.5i
  1181.   INTEGERFEEDBACKSTATE
  1182.     1    0        feedback class id
  1183.     1    CARD8        id of this feedback
  1184.     2    16        length
  1185.     4    CARD32        resolution
  1186.     4    INT32        minimum value
  1187.     4    INT32        maximum value
  1188. .DE
  1189. .LP
  1190. .DS 0
  1191. .TA .2i .5i 1.5i 2.5i
  1192. .ta .2i .5i 1.5i 2.5i
  1193.   STRINGFEEDBACKSTATE
  1194.     1    1        feedback class id
  1195.     1    CARD8        id of this feedback
  1196.     2    4n+8        length
  1197.     2    CARD16        max_symbols
  1198.     2    n              number of keysyms supported
  1199.     4n    LISTofKEYSYM        key symbols supported
  1200. .DE
  1201. .LP
  1202. .DS 0
  1203. .TA .2i .5i 1.5i 2.5i
  1204. .ta .2i .5i 1.5i 2.5i
  1205.   BELLFEEDBACKSTATE
  1206.     1    1        feedback class id
  1207.     1    CARD8        id of this feedback
  1208.     2    12        length
  1209.     1    CARD8        percent
  1210.     3            unused
  1211.     2    CARD16        pitch
  1212.     2    CARD16        duration
  1213. .DE
  1214. .LP
  1215. .DS 0
  1216. .TA .2i .5i 1.5i 2.5i
  1217. .ta .2i .5i 1.5i 2.5i
  1218.   LEDFEEDBACKSTATE
  1219.     1    1        feedback class id
  1220.     1    CARD8        id of this feedback
  1221.     2    12        length
  1222.     4    CARD32        led_mask
  1223.     4    BITMASK        led_values
  1224.         #x0001    On
  1225.         #x0002    Off
  1226. .DE
  1227. .LP
  1228. .DS 0
  1229. .TA .2i .5i 1.5i 2.5i
  1230. .ta .2i .5i 1.5i 2.5i
  1231. ChangeFeedbackControl
  1232.     1    CARD8        input extension opcode
  1233.     1    23        ChangeFeedbackControl opcode
  1234.     2    3+n/4        request length
  1235.     4    BITMASK        value-mask (has n bits set to 1)
  1236.         #x0001    keyclick-percent
  1237.         #x0002    bell-percent
  1238.         #x0004    bell-pitch
  1239.         #x0008    bell-duration
  1240.         #x0010    led
  1241.         #x0020    led-mode
  1242.         #x0040    key
  1243.         #x0080    auto-repeat-mode
  1244.         #x0001    string
  1245.         #x0001    integer
  1246.         #x0001    acceleration-numerator
  1247.         #x0002    acceleration-denominator
  1248.         #x0004    acceleration-threshold
  1249.     1    CARD8        device id
  1250.     1    CARD8        feedback class id
  1251.     2            unused
  1252.     n    FEEDBACKCLASS
  1253. .DE
  1254. .LP
  1255. .DS 0
  1256. .TA .2i .5i 1.5i 2.5i
  1257. .ta .2i .5i 1.5i 2.5i
  1258.   FEEDBACKCLASS    KBDFEEDBACKCTL, PTRFEEDBACKCTL, INTEGERFEEDBACKCTL, 
  1259.   STRINGFEEDBACKCTL, BELLFEEDBACKCTL, or LEDFEEDBACKCTL 
  1260. .DE
  1261. .LP
  1262. .DS 0
  1263. .TA .2i .5i 1.5i 2.5i
  1264. .ta .2i .5i 1.5i 2.5i
  1265.   KBDFEEDBACKCTL
  1266.     1    0        feedback class id
  1267.     1    CARD8        id of this feedback
  1268.     2    20        length
  1269.     1    KEYCODE        key
  1270.     1            auto-repeat-mode
  1271.         0    Off
  1272.         1    On
  1273.         2    Default
  1274.     1    INT8        key-click-percent
  1275.     1    INT8        bell-percent
  1276.     2    INT16        bell-pitch
  1277.     2    INT16        bell-duration
  1278.     4    CARD32        led_mask
  1279.     4    CARD32        led_values
  1280. .DE
  1281. .LP
  1282. .DS 0
  1283. .TA .2i .5i 1.5i 2.5i
  1284. .ta .2i .5i 1.5i 2.5i
  1285.   PTRFEEDBACKCTL
  1286.     1    1        feedback class id
  1287.     1    CARD8        id of this feedback
  1288.     2    12        length
  1289.     2            unused
  1290.     2    INT16        numerator
  1291.     2    INT16        denominator
  1292.     2    INT16        threshold
  1293. .DE
  1294. .LP
  1295. .DS 0
  1296. .TA .2i .5i 1.5i 2.5i
  1297. .ta .2i .5i 1.5i 2.5i
  1298.   STRINGCTL
  1299.     1    2        feedback class id
  1300.     1    CARD8        id of this feedback
  1301.     2    4n+8        length
  1302.     2            unused
  1303.     2    n        number of keysyms to display
  1304.     4n    LISTofKEYSYM        list of key symbols to display
  1305. .DE
  1306. .LP
  1307. .DS 0
  1308. .TA .2i .5i 1.5i 2.5i
  1309. .ta .2i .5i 1.5i 2.5i
  1310.   INTEGERCTL
  1311.     1    3        feedback class id
  1312.     1    CARD8        id of this feedback
  1313.     2    8        length
  1314.     4    INT32        integer to display
  1315. .DE
  1316. .LP
  1317. .DS 0
  1318. .TA .2i .5i 1.5i 2.5i
  1319. .ta .2i .5i 1.5i 2.5i
  1320.   LEDCTL
  1321.     1    4        feedback class id
  1322.     1    CARD8        id of this feedback
  1323.     2    12        length
  1324.     4    CARD32        led_mask
  1325.     4    BITMASK        led_values
  1326.         #x0001    On
  1327.         #x0002    Off
  1328. .DE
  1329. .LP
  1330. .DS 0
  1331. .TA .2i .5i 1.5i 2.5i
  1332. .ta .2i .5i 1.5i 2.5i
  1333.   BELLCTL
  1334.     1    5        feedback class id
  1335.     1    CARD8        id of this feedback
  1336.     2    8        length
  1337.     1    INT8        percent
  1338.     3            unused
  1339.     2    INT16        pitch
  1340.     2    INT16        duration
  1341. .DE
  1342. .LP
  1343. .DS 0
  1344. .TA .2i .5i 1.5i 2.5i
  1345. .ta .2i .5i 1.5i 2.5i
  1346. GetDeviceKeyMapping
  1347.     1    CARD8        input extension opcode
  1348.     1    24        GetDeviceKeyMapping opcode
  1349.     2    2        request length
  1350.     1    CARD8        device
  1351.     1    KEYCODE        first-keycode
  1352.     1    CARD8        count
  1353.     1            unused
  1354. .DE
  1355. .DS 0
  1356. .TA .2i .75i 2.0i 3.0i
  1357. .ta .2i .75i 2.0i 3.0i
  1358.  =>
  1359.     1    1        Reply
  1360.     1    24        GetDeviceKeyMapping opcode
  1361.     2    CARD16        sequence number
  1362.     4    nm        reply length (m = count field from the request)
  1363.     1    n        keysyms-per-keycode
  1364.     23            unused
  1365.     4nm    LISTofKEYSYM        keysyms
  1366. .DE
  1367. .LP
  1368. .DS 0
  1369. .TA .2i .75i 2.0i 3.0i
  1370. .ta .2i .75i 2.0i 3.0i
  1371. ChangeDeviceKeyMapping
  1372.     1    CARD8        input extension opcode
  1373.     1    25        ChangeDeviceKeyMapping opcode
  1374.     2    2+nm        request length
  1375.     1    CARD8        device
  1376.     1    KEYCODE        first-keycode
  1377.     1    m        keysyms-per-keycode
  1378.     1    n        keycode-count
  1379.     4nm    LISTofKEYSYM        keysyms
  1380. .DE
  1381. .LP
  1382. .DS 0
  1383. .TA .2i .5i 1.5i 2.5i
  1384. .ta .2i .5i 1.5i 2.5i
  1385. GetDeviceModifierMapping
  1386.     1    CARD8        input extension opcode
  1387.     1    26        GetDeviceModifierMapping opcode
  1388.     2    2        request length
  1389.     1    CARD8        device
  1390.     3            unused
  1391. .DE
  1392. .DS 0
  1393. .TA .2i .5i 1.5i 2.5i
  1394. .ta .2i .5i 1.5i 2.5i
  1395.  =>
  1396.     1    1        Reply
  1397.     1    26        GetDeviceModifierMapping opcode
  1398.     2    CARD16        sequence number
  1399.     4    2n        reply length
  1400.     1    n        keycodes-per-modifier
  1401.     23            unused
  1402.     8n    LISTofKEYCODE        keycodes
  1403. .DE
  1404. .LP
  1405. .DS 0
  1406. .TA .2i .5i 1.5i 2.5i
  1407. .ta .2i .5i 1.5i 2.5i
  1408. SetDeviceModifierMapping
  1409.     1    CARD8        input extension opcode
  1410.     1    27        SetDeviceModifier opcode
  1411.     2    2+2n        request length
  1412.     1    CARD8        device
  1413.     1    n        keycodes-per-modifier
  1414.     2            unused
  1415.     8n    LISTofKEYCODE        keycodes
  1416. .DE
  1417. .DS 0
  1418. .TA .2i .5i 1.5i 2.5i
  1419. .ta .2i .5i 1.5i 2.5i
  1420.  =>
  1421.     1    1        Reply
  1422.     1    27        SetDeviceModifierMapping opcode
  1423.     2    CARD16        sequence number
  1424.     4    0        reply length
  1425.     1            status
  1426.         0    Success
  1427.         1    Busy
  1428.         2    Failed
  1429.     23            unused
  1430. .DE
  1431. .LP
  1432. .DS 0
  1433. .TA .2i .5i 1.5i 2.5i
  1434. .ta .2i .5i 1.5i 2.5i
  1435. GetDeviceButtonMapping
  1436.     1    CARD8        input extension opcode
  1437.     1    28        GetDeviceButtonMapping opcode
  1438.     2    2        request length
  1439.     1    CARD8        device
  1440.     3            unused
  1441. .DE
  1442. .DS 0
  1443. .TA .2i .5i 1.5i 2.5i
  1444. .ta .2i .5i 1.5i 2.5i
  1445.  =>
  1446.     1    1        Reply
  1447.     1    28        GetDeviceButtonMapping opcode
  1448.     2    CARD16        sequence number
  1449.     4    (n+p)/4        reply length
  1450.     1    n        number of elements in map list
  1451.     23            unused
  1452.     n    LISTofCARD8            map
  1453.     p            unused, p=pad(n)
  1454. .DE
  1455. .LP
  1456. .DS 0
  1457. .TA .2i .5i 1.5i 2.5i
  1458. .ta .2i .5i 1.5i 2.5i
  1459. SetDeviceButtonMapping
  1460.     1    CARD8        input extension opcode
  1461.     1    29        SetDeviceButtonMapping opcode
  1462.     2    2+(n+p)/4        request length
  1463.     1    CARD8        device
  1464.     1    n        length of map
  1465.     2            unused
  1466.     n    LISTofCARD8            map
  1467.     p            unused, p=pad(n)
  1468. .DE
  1469. .DS 0
  1470. .TA .2i .5i 1.5i 2.5i
  1471. .ta .2i .5i 1.5i 2.5i
  1472.  =>
  1473.     1    1        Reply
  1474.     1    29        SetDeviceButtonMapping opcode
  1475.     2    CARD16        sequence number
  1476.     4    0        reply length
  1477.     1            status
  1478.         0    Success
  1479.         1    Busy
  1480.     23            unused
  1481. .DE
  1482. .LP
  1483. .DS 0
  1484. .TA .2i .5i 1.5i 2.5i
  1485. .ta .2i .5i 1.5i 2.5i
  1486. QueryDeviceState
  1487.     1    CARD8        input extension opcode
  1488.     1    30        QueryDeviceState opcode
  1489.     2    2        request length
  1490.     1    CARD8        device
  1491.     3            unused
  1492. .DE
  1493. .DS 0
  1494. .TA .2i .5i 1.5i 2.5i
  1495. .ta .2i .5i 1.5i 2.5i
  1496.  =>
  1497.     1    1            Reply
  1498.     1    30            QueryDeviceState opcode
  1499.     2    CARD16            sequence number
  1500.     4    m/4            reply length
  1501.     1    n                  number of input classes
  1502.     23                unused
  1503.     m    LISTofINPUTSTATE
  1504. .DE
  1505. .DS 0
  1506. .TA .2i .5i 1.5i 2.5i
  1507. .ta .2i .5i 1.5i 2.5i
  1508.   INPUTSTATE    KEYSTATE or BUTTONSTATE or VALUATORSTATE
  1509. .DE
  1510. .LP
  1511. .DS 0
  1512. .TA .2i .5i 1.5i 2.5i
  1513. .ta .2i .5i 1.5i 2.5i
  1514.   KEYSTATE
  1515.     1    CARD8        key input class id
  1516.     1    36        length
  1517.     1    CARD8        num_keys
  1518.     1            unused
  1519.     32    LISTofCARD8        status of keys
  1520. .DE
  1521. .DS 0
  1522. .TA .2i .5i 1.5i 2.5i
  1523. .ta .2i .5i 1.5i 2.5i
  1524.   BUTTONSTATE
  1525.     1    CARD8        button input class id
  1526.     1    36        length
  1527.     1    CARD8        num_buttons
  1528.     1            unused
  1529.     32    LISTofCARD8            status of buttons
  1530. .DE
  1531. .DS 0
  1532. .TA .2i .5i 1.5i 2.5i
  1533. .ta .2i .5i 1.5i 2.5i
  1534.   VALUATORSTATE
  1535.     1    CARD8        valuator input class id
  1536.     1    4n + 4        length
  1537.     1    n        number of valuators
  1538.     1            mode
  1539.         #x01    DeviceMode (0 = Relative, 1 = Absolute)
  1540.         #x02    ProximityState (0 = InProximity, 1 = OutOfProximity)
  1541.     4n    LISTofCARD32        status of valuators
  1542. .DE
  1543. .LP
  1544. .DS 0
  1545. .TA .2i .5i 1.5i 2.5i
  1546. .ta .2i .5i 1.5i 2.5i
  1547. SendExtensionEvent
  1548.     1    CARD8            input extension opcode
  1549.     1    31            SendExtensionEvent opcode
  1550.     2    4 + 8n + m        request length
  1551.     4    WINDOW            destination
  1552.     1    CARD8            device
  1553.     1    BOOL            propagate
  1554.     2    CARD16            eventclass count
  1555.     1    CARD8            num_events
  1556.     3                unused
  1557.     32n    LISTofEVENTS        events to send
  1558.     4m    LISTofEVENTCLASS    desired events
  1559. .DE
  1560. .LP
  1561. .DS 0
  1562. .TA .2i .5i 1.5i 2.5i
  1563. .ta .2i .5i 1.5i 2.5i
  1564. DeviceBell
  1565.     1    CARD8        input extension opcode
  1566.     1    32        DeviceBell opcode
  1567.     2    2        request length
  1568.     1    CARD8        device id
  1569.     1    CARD8        feedback id
  1570.     1    CARD8        feedback class
  1571.     1    INT8        percent
  1572. .DE
  1573. .LP
  1574. .DS 0
  1575. .TA .2i .5i 1.5i 2.5i
  1576. .ta .2i .5i 1.5i 2.5i
  1577. SetDeviceValuators
  1578.     1    CARD8        input extension opcode
  1579.     1    33        SetDeviceValuators opcode
  1580.     2    2 + n        request length
  1581.     1    CARD8        device id
  1582.     1    CARD8        first valuator
  1583.     1    n            number of valuators
  1584.     1            unused
  1585.     4n    LISTofINT32    valuator values to set
  1586. .DE
  1587. .DS 0
  1588. .TA .2i .5i 1.5i 3.5i
  1589. .ta .2i .5i 1.5i 3.5i
  1590.  =>
  1591.     1    1            Reply
  1592.     1    33            SetDeviceValuators opcode
  1593.     2    CARD16            sequence number
  1594.     4    0            reply length
  1595.     1    CARD8            status
  1596.         0    Success
  1597.         1    AlreadyGrabbed
  1598.     23                unused
  1599. .DE
  1600. .LP
  1601. .DS 0
  1602. .TA .2i .5i 1.5i 2.5i
  1603. .ta .2i .5i 1.5i 2.5i
  1604. GetDeviceControl
  1605.     1    CARD8        input extension opcode
  1606.     1    34        GetDeviceControl opcode
  1607.     2    2        request length
  1608.     2    CARD16        device control type
  1609.     1    CARD8        device id
  1610.     1            unused
  1611. .DE
  1612. .DS 0
  1613. .TA .2i .5i 1.5i 3.5i
  1614. .ta .2i .5i 1.5i 3.5i
  1615.  =>
  1616.     1    1            Reply
  1617.     1    34            GetDeviceControl opcode
  1618.     2    CARD16            sequence number
  1619.     4    n/4            reply length
  1620.     1    CARD8            status
  1621.         0            Success
  1622.         1            AlreadyGrabbed
  1623.         3 + first_error        DeviceBusy
  1624.     23                unused
  1625.     n                DEVICESTATE
  1626. .DE
  1627. .DS 0
  1628. .TA .2i .5i 1.5i 2.5i
  1629. .ta .2i .5i 1.5i 2.5i
  1630. DEVICESTATE            DEVICERESOLUTIONSTATE
  1631. .DE
  1632. .LP
  1633. .DS 0
  1634. .TA .2i .5i 1.5i 2.5i
  1635. .ta .2i .5i 1.5i 2.5i
  1636. DEVICERESOLUTIONSTATE
  1637.      2    0        control type
  1638.      2    8 + 12n        length
  1639.      4    n            num_valuators
  1640.      4n    LISTOfCARD32    resolution values
  1641.      4n    LISTOfCARD32    resolution min_values
  1642.      4n    LISTOfCARD32    resolution max_values
  1643. .DE
  1644. .LP
  1645. .DS 0
  1646. .TA .2i .5i 1.5i 2.5i
  1647. .ta .2i .5i 1.5i 2.5i
  1648. .LP
  1649. ChangeDeviceControl
  1650.      1    CARD8        input extension opcode
  1651.      1    35        ChangeDeviceControl opcode
  1652.      2    2+n/4        request length
  1653.      2    CARD16        control type
  1654.      1    CARD8        device id
  1655.      1            unused
  1656.      n            DEVICECONTROL
  1657. .DE
  1658. .DS 0
  1659. .TA .2i .5i 1.5i 2.5i
  1660. .ta .2i .5i 1.5i 2.5i
  1661. DEVICECONTROL        DEVICERESOLUTIONCTL
  1662. .DE
  1663. .LP
  1664. .DS 0
  1665. .TA .2i .5i 1.5i 2.5i
  1666. .ta .2i .5i 1.5i 2.5i
  1667. DEVICERESOLUTIONCTL
  1668.      2    0        control type
  1669.      2    8 + 4n        length
  1670.      1    CARD8        first_valuator
  1671.      1    n            num_valuators
  1672.      2            unused
  1673.      4n    LISTOfCARD32    resolution values
  1674. .DE
  1675. .LP
  1676. .DS 0
  1677. .TA .2i .5i 1.5i 3.5i
  1678. .ta .2i .5i 1.5i 3.5i
  1679.  =>
  1680.      1    1            Reply
  1681.      1    35            ChangeDeviceControl opcode
  1682.      2    CARD16            sequence number
  1683.      4    0            reply length
  1684.      1    CARD8            status
  1685.          0            Success
  1686.          1            AlreadyGrabbed
  1687.          3 + first_error        DeviceBusy
  1688.      23                unused
  1689. .DE
  1690. .ps +2
  1691. Events
  1692. .ps
  1693. .LP
  1694. DeviceKeyPress, DeviceKeyRelease, DeviceButtonPress, DeviceButtonRelease,
  1695. ProximityIn, ProximityOut, and DeviceStateNotify  events may be followed by 
  1696. zero or more DeviceValuator events.  DeviceMotionNotify events will be 
  1697. followed by one or more DeviceValuator events.
  1698. .LP
  1699. .DS 0
  1700. .TA .2i .5i 1.5i 2.5i
  1701. .ta .2i .5i 1.5i 2.5i
  1702. DeviceValuator
  1703.     1    CARD8        code
  1704.     1    CARD8        device id
  1705.     2    CARD16        sequence number
  1706.     2    SETofKEYBUTMASK        state
  1707.     1    n        number of valuators this device reports
  1708.     1    m        number of first valuator in this event
  1709.     24    LISTofINT32    valuators
  1710. .DE
  1711. .LP
  1712. .DS 0
  1713. .TA .2i .5i 1.5i 2.5i
  1714. .ta .2i .5i 1.5i 2.5i
  1715. DeviceKeyPress
  1716.     1    CARD8        code
  1717.     1    KEYCODE        detail
  1718.     2    CARD16        sequence number
  1719.     4    TIMESTAMP        time
  1720.     4    WINDOW        root
  1721.     4    WINDOW        event
  1722.     4    WINDOW        child
  1723.         0    None
  1724.     2    INT16        root-x
  1725.     2    INT16        root-y
  1726.     2    INT16        event-x
  1727.     2    INT16        event-y
  1728.     2    SETofKEYBUTMASK        state
  1729.     1    BOOL        same-screen
  1730.     1    CARD8        device id
  1731.         #x80        MORE_EVENTS follow
  1732. .DE
  1733. .LP
  1734. .DS 0
  1735. .TA .2i .5i 1.5i 2.5i
  1736. .ta .2i .5i 1.5i 2.5i
  1737. DeviceKeyRelease
  1738.     1    CARD8        code
  1739.     1    KEYCODE        detail
  1740.     2    CARD16        sequence number
  1741.     4    TIMESTAMP        time
  1742.     4    WINDOW        root
  1743.     4    WINDOW        event
  1744.     4    WINDOW        child
  1745.         0    None
  1746.     2    INT16        root-x
  1747.     2    INT16        root-y
  1748.     2    INT16        event-x
  1749.     2    INT16        event-y
  1750.     2    SETofKEYBUTMASK            state
  1751.     1    BOOL        same-screen
  1752.     1    CARD8        device id
  1753.         #x80        MORE_EVENTS follow
  1754. .DE
  1755. .LP
  1756. .DS 0
  1757. .TA .2i .5i 1.5i 2.5i
  1758. .ta .2i .5i 1.5i 2.5i
  1759. DeviceButtonPress
  1760.     1    CARD8        code
  1761.     1    BUTTON        detail
  1762.     2    CARD16        sequence number
  1763.     4    TIMESTAMP        time
  1764.     4    WINDOW        root
  1765.     4    WINDOW        event
  1766.     4    WINDOW        child
  1767.         0    None
  1768.     2    INT16        root-x
  1769.     2    INT16        root-y
  1770.     2    INT16        event-x
  1771.     2    INT16        event-y
  1772.     2    SETofKEYBUTMASK        state
  1773.     1    BOOL        same-screen
  1774.     1    CARD8        device id
  1775.         #x80        MORE_EVENTS follow
  1776. .DE
  1777. .LP
  1778. .DS 0
  1779. .TA .2i .5i 1.5i 2.5i
  1780. .ta .2i .5i 1.5i 2.5i
  1781. DeviceButtonRelease
  1782.     1    CARD8        code
  1783.     1    BUTTON        detail
  1784.     2    CARD16        sequence number
  1785.     4    TIMESTAMP        time
  1786.     4    WINDOW        root
  1787.     4    WINDOW        event
  1788.     4    WINDOW        child
  1789.         0    None
  1790.     2    INT16        root-x
  1791.     2    INT16        root-y
  1792.     2    INT16        event-x
  1793.     2    INT16        event-y
  1794.     2    SETofKEYBUTMASK        state
  1795.     1    BOOL        same-screen
  1796.     1    CARD8        device id
  1797.         #x80        MORE_EVENTS follow
  1798. .DE
  1799. .LP
  1800. .DS 0
  1801. .TA .2i .5i 1.5i 2.5i
  1802. .ta .2i .5i 1.5i 2.5i
  1803. DeviceMotionNotify
  1804.     1    CARD8        code
  1805.     1            detail
  1806.         0    Normal
  1807.         1    Hint
  1808.     2    CARD16        sequence number
  1809.     4    TIMESTAMP        time
  1810.     4    WINDOW        root
  1811.     4    WINDOW        event
  1812.     4    WINDOW        child
  1813.          0    None
  1814.     2    INT16        root-x
  1815.     2    INT16        root-y
  1816.     2    INT16        event-x
  1817.     2    INT16        event-y
  1818.     2    SETofKEYBUTMASK        state
  1819.     1    BOOL        same-screen
  1820.     1    CARD8        device id
  1821.         #x80        MORE_EVENTS follow
  1822. .DE
  1823. .DS 0
  1824. .TA .2i .5i 1.5i 2.5i
  1825. .ta .2i .5i 1.5i 2.5i
  1826. DeviceFocusIn
  1827.     1    CARD8        code
  1828.     1            detail
  1829.         0    Ancestor
  1830.         1    Virtual
  1831.         2    Inferior
  1832.         3    Nonlinear
  1833.         4    NonlinearVirtual
  1834.         5    Pointer
  1835.         6    PointerRoot
  1836.         7    None
  1837.     2    CARD16        sequence number
  1838.     4    TIMESTAMP        time
  1839.     4    WINDOW        event
  1840.     1            mode
  1841.         0    Normal
  1842.         1    Grab
  1843.         2    Ungrab
  1844.         3    WhileGrabbed
  1845.     1    CARD8        device id
  1846.     18            unused
  1847. .DE
  1848. .LP
  1849. .DS 0
  1850. .TA .2i .5i 1.5i 2.5i
  1851. .ta .2i .5i 1.5i 2.5i
  1852. DeviceFocusOut
  1853.     1    CARD8        code
  1854.     1            detail
  1855.         0    Ancestor
  1856.         1    Virtual
  1857.         2    Inferior
  1858.         3    Nonlinear
  1859.         4    NonlinearVirtual
  1860.         5    Pointer
  1861.         6    PointerRoot
  1862.         7    None
  1863.     2    CARD16        sequence number
  1864.     4    TIMESTAMP        time
  1865.     4    WINDOW        event
  1866.     1            mode
  1867.         0    Normal
  1868.         1    Grab
  1869.         2    Ungrab
  1870.         3    WhileGrabbed
  1871.     1    CARD8        device id
  1872.     18            unused
  1873. .DE
  1874. .LP
  1875. .DS 0
  1876. .TA .2i .5i 1.5i 2.5i
  1877. .ta .2i .5i 1.5i 2.5i
  1878. ProximityIn
  1879.     1    CARD8        code
  1880.     1            unused
  1881.     2    CARD16        sequence number
  1882.     4    TIMESTAMP        time
  1883.     4    WINDOW        root
  1884.     4    WINDOW        event
  1885.     4    WINDOW        child
  1886.         0    None
  1887.     2    INT16        root-x
  1888.     2    INT16        root-y
  1889.     2    INT16        event-x
  1890.     2    INT16        event-y
  1891.     2    SETofKEYBUTMASK            state
  1892.     1    BOOL        same-screen
  1893.     1    CARD8        device id
  1894.         #x80        MORE_EVENTS follow
  1895. .DE
  1896. .LP
  1897. .DS 0
  1898. .TA .2i .5i 1.5i 2.5i
  1899. .ta .2i .5i 1.5i 2.5i
  1900. ProximityOut
  1901.     1    CARD8        code
  1902.     1            unused
  1903.     2    CARD16        sequence number
  1904.     4    TIMESTAMP        time
  1905.     4    WINDOW        root
  1906.     4    WINDOW        event
  1907.     4    WINDOW        child
  1908.         0    None
  1909.     2    INT16        root-x
  1910.     2    INT16        root-y
  1911.     2    INT16        event-x
  1912.     2    INT16        event-y
  1913.     2    SETofKEYBUTMASK            state
  1914.     1    BOOL        same-screen
  1915.     1    CARD8        device id
  1916.         #x80        MORE_EVENTS follow
  1917. .DE
  1918. .LP
  1919. DeviceStateNotify events may be immediately followed by zero or one
  1920. DeviceKeyStateNotify and/ or zero or more DeviceValuator events.
  1921. .LP
  1922. .DS 0
  1923. .TA .2i .5i 1.5i 2.5i
  1924. .ta .2i .5i 1.5i 2.5i
  1925. DeviceStateNotify
  1926.     1    CARD8        code
  1927.     1    CARD8        device id
  1928.         #x80        MORE_EVENTS follow
  1929.     2    CARD16        sequence number
  1930.     4    TIMESTAMP        time
  1931.     1    CARD8        num_keys
  1932.     1    CARD8        num_buttons
  1933.     1    CARD8        num_valuators
  1934.      1    CARD8        valuator mode and input classes reported
  1935.          #x01    reporting keys
  1936.          #x02    reporting buttons
  1937.          #x04    reporting valuators
  1938.          #x40    device mode (0 = Relative, 1 = Absolute)
  1939.          #x80    proximity state (0 = InProximity, 1 = OutOfProximity)
  1940.     4    LISTofCARD8        first 32 keys (if reported)
  1941.     4    LISTofCARD8        first 32 buttons (if reported)
  1942.     12    LISTofCARD32        first 3 valuators (if reported)
  1943. .DE
  1944. .LP
  1945. .DS 0
  1946. .TA .2i .5i 1.5i 2.5i
  1947. .ta .2i .5i 1.5i 2.5i
  1948. DeviceKeyStateNotify
  1949.     1    CARD8        code
  1950.     1    CARD8        device id
  1951.         #x80        MORE_EVENTS follow
  1952.     2    CARD16        sequence number
  1953.     28    LISTofCARD8        state of keys 33-255
  1954. .DE
  1955. .LP
  1956. .DS 0
  1957. .TA .2i .5i 1.5i 2.5i
  1958. .ta .2i .5i 1.5i 2.5i
  1959. DeviceButtonStateNotify
  1960.     1    CARD8        code
  1961.     1    CARD8        device id
  1962.         #x80        MORE_EVENTS follow
  1963.     2    CARD16        sequence number
  1964.     28    LISTofCARD8        state of buttons 33-255
  1965. .DE
  1966. .LP
  1967. .DS 0
  1968. .TA .2i .5i 1.5i 2.5i
  1969. .ta .2i .5i 1.5i 2.5i
  1970. DeviceValuator
  1971.     1    CARD8        code
  1972.     1    CARD8        device id
  1973.     2    CARD16        sequence number
  1974.     2    SETofKEYBUTMASK        state
  1975.     1    n        number of valuators this device reports
  1976.     1    n        number of first valuator in this event
  1977.     24    LISTofINT32    valuators
  1978. .DE
  1979. .LP
  1980. .DS 0
  1981. .TA .2i .5i 1.5i 2.5i
  1982. .ta .2i .5i 1.5i 2.5i
  1983. DeviceMappingNotify
  1984.     1    CARD8        code
  1985.     1    CARD8        device id
  1986.     2    CARD16        sequence number
  1987.     1            request
  1988.         0    MappingModifier
  1989.         1    MappingKeyboard
  1990.         2    MappingPointer
  1991.     1    KEYCODE        first-keycode
  1992.     1    CARD8        count
  1993.     1            unused
  1994.     4    TIMESTAMP        time
  1995.     20            unused
  1996. .DE
  1997. .LP
  1998. .DS 0
  1999. .TA .2i .5i 1.5i 2.5i
  2000. .ta .2i .5i 1.5i 2.5i
  2001. ChangeDeviceNotify
  2002.     1    CARD8        code
  2003.     1    CARD8        id of device specified on change request
  2004.     2    CARD16        sequence number
  2005.     4    TIMESTAMP        time
  2006.     1            request
  2007.         0    NewPointer
  2008.         1    NewKeyboard
  2009.     23            unused
  2010. .DE
  2011. .bp
  2012. .PX
  2013.