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

</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
GrabDeviceButton
	1	CARD8		input extension opcode
	1	17		GrabDeviceButton opcode
	2	5+n		request length
	4	WINDOW		grab-window
	1	CARD8		grabbed device
	1	CARD8		modifier device
		#x0FF	UseXKeyboard
	2	n		count of desired events
	2	SETofKEYMASK		modifiers
	1			this-device-mode
		0	Synchronous
		1	Asynchronous
	1			other-device-mode
		0	Synchronous
		1	Asynchronous
	1	BUTTON		button
		0	AnyButton
	1	BOOL		owner-events
		#x8000	AnyModifier
	2			unused
	4n	LISTofEVENTCLASS	event list
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
UngrabDeviceButton
	1	CARD8		input extension opcode
	1	18		UngrabDeviceButton opcode
	2	4		request length
	4	WINDOW		grab-window
	2	SETofKEYMASK		modifiers
		#x8000	AnyModifier
	1	CARD8		modifier device
		#x0FF	UseXKeyboard
	1	BUTTON		button
		0	AnyButton
	1	CARD8		grabbed device
	3			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
AllowDeviceEvents
	1	CARD8		input extension opcode
	1	19		AllowDeviceEvents opcode
	2	3		request length
	4	TIMESTAMP		time
		0	CurrentTime
	1			mode
		0	AsyncThisDevice
		1	SyncThisDevice
		2	ReplayThisDevice
		3	AsyncOtherDevices
		4	AsyncAll
		5	SyncAll
	1	CARD8		device id
	2			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
GetDeviceFocus
	1	CARD8		input extension opcode
	1	20		GetDeviceFocus opcode
	2	2		request length
	1	CARD8		device
	3			unused
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
 =&gt;
	1	1		Reply
	1	20		GetDeviceFocus opcode
	2	CARD16		sequence number
	4	0		reply length
	4	WINDOW		focus
		0	None
		1	PointerRoot
		3	FollowKeyboard
	4	TIMESTAMP	focus time
	1			revert-to
		0	None
		1	PointerRoot
		2	Parent
		3	FollowKeyboard
	15			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
SetDeviceFocus
	1	CARD8		input extension opcode
	1	21		SetDeviceFocus opcode
	2	4		request length
	4	WINDOW		focus
		0	None
		1	PointerRoot
		3	FollowKeyboard
	4	TIMESTAMP		time
		0	CurrentTime
	1			revert-to
		0	None
		1	PointerRoot
		2	Parent
		3	FollowKeyboard
	1	CARD8		device
	2			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
GetFeedbackControl
	1	CARD8		input extension opcode
	1	22		GetFeedbackControl opcode
	2	2		request length
	1	CARD8		device id
	3			unused
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
 =&gt;
	1	1		Reply
	1	22		GetFeedbackControl opcode
	2	CARD16		sequence number
	4	m/4			reply length
	2	n		number of feedbacks supported
	22			unused
	m	LISTofFEEDBACKSTATE	feedbacks
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  FEEDBACKSTATE	KBDFEEDBACKSTATE, PTRFEEDBACKSTATE, INTEGERFEEDBACKSTATE, 
  STRINGFEEDBACKSTATE, BELLFEEDBACKSTATE, or LEDFEEDBACKSTATE
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  KBDFEEDBACKSTATE
	1	0		feedback class id
	1	CARD8		id of this feedback
	2	20		length
	2	CARD16		pitch
	2	CARD16		duration
	4	CARD32		led_mask
	4	CARD32		led_values
	1	    		global_auto_repeat
		0	Off
		1	On
	1	CARD8		click
	1	CARD8		percent
	1	    		unused
	32	LISTofCARD8	auto_repeats
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  PTRFEEDBACKSTATE
	1	0		feedback class id
	1	CARD8		id of this feedback
	2	12		length
	2			unused
	2	CARD16		acceleration-numerator
	2	CARD16		acceleration-denominator
	2	CARD16		threshold
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  INTEGERFEEDBACKSTATE
	1	0		feedback class id
	1	CARD8		id of this feedback
	2	16		length
	4	CARD32		resolution
	4	INT32		minimum value
	4	INT32		maximum value
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  STRINGFEEDBACKSTATE
	1	1		feedback class id
	1	CARD8		id of this feedback
	2	4n+8		length
	2	CARD16		max_symbols
	2	n      		number of keysyms supported
	4n	LISTofKEYSYM		key symbols supported
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  BELLFEEDBACKSTATE
	1	1		feedback class id
	1	CARD8		id of this feedback
	2	12		length
	1	CARD8		percent
	3			unused
	2	CARD16		pitch
	2	CARD16		duration
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  LEDFEEDBACKSTATE
	1	1		feedback class id
	1	CARD8		id of this feedback
	2	12		length
	4	CARD32		led_mask
	4	BITMASK		led_values
		#x0001	On
		#x0002	Off
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
ChangeFeedbackControl
	1	CARD8		input extension opcode
	1	23		ChangeFeedbackControl opcode
	2	3+n/4		request length
	4	BITMASK		value-mask (has n bits set to 1)
		#x0001	keyclick-percent
		#x0002	bell-percent
		#x0004	bell-pitch
		#x0008	bell-duration
		#x0010	led
		#x0020	led-mode
		#x0040	key
		#x0080	auto-repeat-mode
		#x0001	string
		#x0001	integer
		#x0001	acceleration-numerator
		#x0002	acceleration-denominator
		#x0004	acceleration-threshold
	1	CARD8		device id
	1	CARD8		feedback class id
	2			unused
	n	FEEDBACKCLASS
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  FEEDBACKCLASS	KBDFEEDBACKCTL, PTRFEEDBACKCTL, INTEGERFEEDBACKCTL, 
  STRINGFEEDBACKCTL, BELLFEEDBACKCTL, or LEDFEEDBACKCTL 
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  KBDFEEDBACKCTL
	1	0		feedback class id
	1	CARD8		id of this feedback
	2	20		length
	1	KEYCODE		key
	1			auto-repeat-mode
		0	Off
		1	On
		2	Default
	1	INT8		key-click-percent
	1	INT8		bell-percent
	2	INT16		bell-pitch
	2	INT16		bell-duration
	4	CARD32		led_mask
	4	CARD32		led_values
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  PTRFEEDBACKCTL
	1	1		feedback class id
	1	CARD8		id of this feedback
	2	12		length
	2			unused
	2	INT16		numerator
	2	INT16		denominator
	2	INT16		threshold
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  STRINGCTL
	1	2		feedback class id
	1	CARD8		id of this feedback
	2	4n+8		length
	2			unused
	2	n		number of keysyms to display
	4n	LISTofKEYSYM		list of key symbols to display
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  INTEGERCTL
	1	3		feedback class id
	1	CARD8		id of this feedback
	2	8		length
	4	INT32		integer to display
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  LEDCTL
	1	4		feedback class id
	1	CARD8		id of this feedback
	2	12		length
	4	CARD32		led_mask
	4	BITMASK		led_values
		#x0001	On
		#x0002	Off
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  BELLCTL
	1	5		feedback class id
	1	CARD8		id of this feedback
	2	8		length
	1	INT8		percent
	3			unused
	2	INT16		pitch
	2	INT16		duration
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
GetDeviceKeyMapping
	1	CARD8		input extension opcode
	1	24		GetDeviceKeyMapping opcode
	2	2		request length
	1	CARD8		device
	1	KEYCODE		first-keycode
	1	CARD8		count
	1			unused
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .75i 2.0i 3.0i -->
<!-- .ta .2i .75i 2.0i 3.0i -->
 =&gt;
	1	1		Reply
	1	24		GetDeviceKeyMapping opcode
	2	CARD16		sequence number
	4	nm		reply length (m = count field from the request)
	1	n		keysyms-per-keycode
	23			unused
	4nm	LISTofKEYSYM		keysyms
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .75i 2.0i 3.0i -->
<!-- .ta .2i .75i 2.0i 3.0i -->
ChangeDeviceKeyMapping
	1	CARD8		input extension opcode
	1	25		ChangeDeviceKeyMapping opcode
	2	2+nm		request length
	1	CARD8		device
	1	KEYCODE		first-keycode
	1	m		keysyms-per-keycode
	1	n		keycode-count
	4nm	LISTofKEYSYM		keysyms
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
GetDeviceModifierMapping
	1	CARD8		input extension opcode
	1	26		GetDeviceModifierMapping opcode
	2	2		request length
	1	CARD8		device
	3			unused
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
 =&gt;
	1	1		Reply
	1	26		GetDeviceModifierMapping opcode
	2	CARD16		sequence number
	4	2n		reply length
	1	n		keycodes-per-modifier
	23			unused
	8n	LISTofKEYCODE		keycodes
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
SetDeviceModifierMapping
	1	CARD8		input extension opcode
	1	27		SetDeviceModifier opcode
	2	2+2n		request length
	1	CARD8		device
	1	n		keycodes-per-modifier
	2			unused
	8n	LISTofKEYCODE		keycodes
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
 =&gt;
	1	1		Reply
	1	27		SetDeviceModifierMapping opcode
	2	CARD16		sequence number
	4	0		reply length
	1			status
		0	Success
		1	Busy
		2	Failed
	23			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
GetDeviceButtonMapping
	1	CARD8		input extension opcode
	1	28		GetDeviceButtonMapping opcode
	2	2		request length
	1	CARD8		device
	3			unused
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
 =&gt;
	1	1		Reply
	1	28		GetDeviceButtonMapping opcode
	2	CARD16		sequence number
	4	(n+p)/4		reply length
	1	n		number of elements in map list
	23			unused
	n	LISTofCARD8			map
	p			unused, p=pad(n)
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
SetDeviceButtonMapping
	1	CARD8		input extension opcode
	1	29		SetDeviceButtonMapping opcode
	2	2+(n+p)/4		request length
	1	CARD8		device
	1	n		length of map
	2			unused
	n	LISTofCARD8			map
	p			unused, p=pad(n)
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
 =&gt;
	1	1		Reply
	1	29		SetDeviceButtonMapping opcode
	2	CARD16		sequence number
	4	0		reply length
	1			status
		0	Success
		1	Busy
	23			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
QueryDeviceState
	1	CARD8		input extension opcode
	1	30		QueryDeviceState opcode
	2	2		request length
	1	CARD8		device
	3			unused
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
 =&gt;
	1	1			Reply
	1	30			QueryDeviceState opcode
	2	CARD16			sequence number
	4	m/4			reply length
	1	n     	 		number of input classes
	23				unused
	m	LISTofINPUTSTATE
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  INPUTSTATE	KEYSTATE or BUTTONSTATE or VALUATORSTATE
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  KEYSTATE
	1	CARD8		key input class id
	1	36		length
	1	CARD8		num_keys
	1			unused
	32	LISTofCARD8		status of keys
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  BUTTONSTATE
	1	CARD8		button input class id
	1	36		length
	1	CARD8		num_buttons
	1			unused
	32	LISTofCARD8			status of buttons
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
  VALUATORSTATE
	1	CARD8		valuator input class id
	1	4n + 4		length
	1	n		number of valuators
	1			mode
		#x01	DeviceMode (0 = Relative, 1 = Absolute)
		#x02	ProximityState (0 = InProximity, 1 = OutOfProximity)
	4n	LISTofCARD32		status of valuators
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
SendExtensionEvent
	1	CARD8			input extension opcode
	1	31			SendExtensionEvent opcode
	2	4 + 8n + m		request length
	4	WINDOW			destination
	1	CARD8			device
	1	BOOL			propagate
	2	CARD16			eventclass count
	1	CARD8			num_events
	3				unused
	32n	LISTofEVENTS		events to send
	4m	LISTofEVENTCLASS	desired events
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceBell
	1	CARD8		input extension opcode
	1	32		DeviceBell opcode
	2	2		request length
	1	CARD8		device id
	1	CARD8		feedback id
	1	CARD8		feedback class
	1	INT8		percent
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
SetDeviceValuators
	1	CARD8		input extension opcode
	1	33		SetDeviceValuators opcode
	2	2 + n		request length
	1	CARD8		device id
	1	CARD8		first valuator
	1	n    		number of valuators
	1			unused
	4n	LISTofINT32	valuator values to set
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 3.5i -->
<!-- .ta .2i .5i 1.5i 3.5i -->
 =&gt;
	1	1			Reply
	1	33			SetDeviceValuators opcode
	2	CARD16			sequence number
	4	0			reply length
	1	CARD8			status
		0	Success
		1	AlreadyGrabbed
	23				unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
GetDeviceControl
	1	CARD8		input extension opcode
	1	34		GetDeviceControl opcode
	2	2		request length
	2	CARD16		device control type
	1	CARD8		device id
	1			unused
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 3.5i -->
<!-- .ta .2i .5i 1.5i 3.5i -->
 =&gt;
	1	1			Reply
	1	34			GetDeviceControl opcode
	2	CARD16			sequence number
	4	n/4			reply length
	1	CARD8			status
		0			Success
		1			AlreadyGrabbed
		3 + first_error		DeviceBusy
	23				unused
	n				DEVICESTATE
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DEVICESTATE			DEVICERESOLUTIONSTATE
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DEVICERESOLUTIONSTATE
 	2	0		control type
 	2	8 + 12n		length
 	4	n    		num_valuators
 	4n	LISTOfCARD32	resolution values
 	4n	LISTOfCARD32	resolution min_values
 	4n	LISTOfCARD32	resolution max_values
</literallayout>
</para>
<para>
<!-- .LP -->
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
ChangeDeviceControl
 	1	CARD8		input extension opcode
 	1	35		ChangeDeviceControl opcode
 	2	2+n/4		request length
 	2	CARD16		control type
 	1	CARD8		device id
 	1			unused
 	n			DEVICECONTROL
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DEVICECONTROL		DEVICERESOLUTIONCTL
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DEVICERESOLUTIONCTL
 	2	1		control type
 	2	8 + 4n		length
 	1	CARD8		first_valuator
 	1	n    		num_valuators
 	2			unused
 	4n	LISTOfCARD32	resolution values
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 3.5i -->
<!-- .ta .2i .5i 1.5i 3.5i -->
 =&gt;
 	1	1			Reply
 	1	35			ChangeDeviceControl opcode
 	2	CARD16			sequence number
 	4	0			reply length
 	1	CARD8			status
 		0			Success
 		1			AlreadyGrabbed
 		3 + first_error		DeviceBusy
 	23				unused
</literallayout>
<!-- .ps +2 -->
Events
<!-- .ps -->
</para>
<para>
<!-- .LP -->
DeviceKeyPress, DeviceKeyRelease, DeviceButtonPress, DeviceButtonRelease,
ProximityIn, ProximityOut, and DeviceStateNotify  events may be followed by 
zero or more DeviceValuator events.  DeviceMotionNotify events will be 
followed by one or more DeviceValuator events.
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceValuator
	1	CARD8		code
	1	CARD8		device id
	2	CARD16		sequence number
	2	SETofKEYBUTMASK		state
	1	n		number of valuators this device reports
	1	m		number of first valuator in this event
	24	LISTofINT32	valuators
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceKeyPress
	1	CARD8		code
	1	KEYCODE		detail
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		root
	4	WINDOW		event
	4	WINDOW		child
		0	None
	2	INT16		root-x
	2	INT16		root-y
	2	INT16		event-x
	2	INT16		event-y
	2	SETofKEYBUTMASK		state
	1	BOOL		same-screen
	1	CARD8		device id
		#x80		MORE_EVENTS follow
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceKeyRelease
	1	CARD8		code
	1	KEYCODE		detail
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		root
	4	WINDOW		event
	4	WINDOW		child
		0	None
	2	INT16		root-x
	2	INT16		root-y
	2	INT16		event-x
	2	INT16		event-y
	2	SETofKEYBUTMASK			state
	1	BOOL		same-screen
	1	CARD8		device id
		#x80		MORE_EVENTS follow
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceButtonPress
	1	CARD8		code
	1	BUTTON		detail
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		root
	4	WINDOW		event
	4	WINDOW		child
		0	None
	2	INT16		root-x
	2	INT16		root-y
	2	INT16		event-x
	2	INT16		event-y
	2	SETofKEYBUTMASK		state
	1	BOOL		same-screen
	1	CARD8		device id
		#x80		MORE_EVENTS follow
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceButtonRelease
	1	CARD8		code
	1	BUTTON		detail
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		root
	4	WINDOW		event
	4	WINDOW		child
		0	None
	2	INT16		root-x
	2	INT16		root-y
	2	INT16		event-x
	2	INT16		event-y
	2	SETofKEYBUTMASK		state
	1	BOOL		same-screen
	1	CARD8		device id
		#x80		MORE_EVENTS follow
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceMotionNotify
	1	CARD8		code
	1			detail
		0	Normal
		1	Hint
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		root
	4	WINDOW		event
	4	WINDOW		child
	 	0	None
	2	INT16		root-x
	2	INT16		root-y
	2	INT16		event-x
	2	INT16		event-y
	2	SETofKEYBUTMASK		state
	1	BOOL		same-screen
	1	CARD8		device id
		#x80		MORE_EVENTS follow
</literallayout>
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceFocusIn
	1	CARD8		code
	1			detail
		0	Ancestor
		1	Virtual
		2	Inferior
		3	Nonlinear
		4	NonlinearVirtual
		5	Pointer
		6	PointerRoot
		7	None
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		event
	1			mode
		0	Normal
		1	Grab
		2	Ungrab
		3	WhileGrabbed
	1	CARD8		device id
	18			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceFocusOut
	1	CARD8		code
	1			detail
		0	Ancestor
		1	Virtual
		2	Inferior
		3	Nonlinear
		4	NonlinearVirtual
		5	Pointer
		6	PointerRoot
		7	None
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		event
	1			mode
		0	Normal
		1	Grab
		2	Ungrab
		3	WhileGrabbed
	1	CARD8		device id
	18			unused
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
ProximityIn
	1	CARD8		code
	1			unused
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		root
	4	WINDOW		event
	4	WINDOW		child
		0	None
	2	INT16		root-x
	2	INT16		root-y
	2	INT16		event-x
	2	INT16		event-y
	2	SETofKEYBUTMASK			state
	1	BOOL		same-screen
	1	CARD8		device id
		#x80		MORE_EVENTS follow
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
ProximityOut
	1	CARD8		code
	1			unused
	2	CARD16		sequence number
	4	TIMESTAMP		time
	4	WINDOW		root
	4	WINDOW		event
	4	WINDOW		child
		0	None
	2	INT16		root-x
	2	INT16		root-y
	2	INT16		event-x
	2	INT16		event-y
	2	SETofKEYBUTMASK			state
	1	BOOL		same-screen
	1	CARD8		device id
		#x80		MORE_EVENTS follow
</literallayout>
</para>
<para>
<!-- .LP -->
DeviceStateNotify events may be immediately followed by zero or one
DeviceKeyStateNotify and/ or zero or more DeviceValuator events.
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceStateNotify
	1	CARD8		code
	1	CARD8		device id
		#x80		MORE_EVENTS follow
	2	CARD16		sequence number
	4	TIMESTAMP		time
	1	CARD8		num_keys
	1	CARD8		num_buttons
	1	CARD8		num_valuators
 	1	CARD8		valuator mode and input classes reported
 		#x01	reporting keys
 		#x02	reporting buttons
 		#x04	reporting valuators
 		#x40	device mode (0 = Relative, 1 = Absolute)
 		#x80	proximity state (0 = InProximity, 1 = OutOfProximity)
	4	LISTofCARD8		first 32 keys (if reported)
	4	LISTofCARD8		first 32 buttons (if reported)
	12	LISTofCARD32		first 3 valuators (if reported)
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceKeyStateNotify
	1	CARD8		code
	1	CARD8		device id
		#x80		MORE_EVENTS follow
	2	CARD16		sequence number
	28	LISTofCARD8		state of keys 33-255
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceButtonStateNotify
	1	CARD8		code
	1	CARD8		device id
		#x80		MORE_EVENTS follow
	2	CARD16		sequence number
	28	LISTofCARD8		state of buttons 33-255
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceValuator
	1	CARD8		code
	1	CARD8		device id
	2	CARD16		sequence number
	2	SETofKEYBUTMASK		state
	1	n		number of valuators this device reports
	1	n		number of first valuator in this event
	24	LISTofINT32	valuators
</literallayout>
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
DeviceMappingNotify
	1	CARD8		code
	1	CARD8		device id
	2	CARD16		sequence number
	1			request
		0	MappingModifier
		1	MappingKeyboard
		2	MappingPointer
	1	KEYCODE		first-keycode
	1	CARD8		count
	1			unused
	4	TIMESTAMP		time
	20			unused
</literallayout>
</para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .2i .5i 1.5i 2.5i -->
<!-- .ta .2i .5i 1.5i 2.5i -->
ChangeDeviceNotify
	1	CARD8		code
	1	CARD8		id of device specified on change request
	2	CARD16		sequence number
	4	TIMESTAMP		time
	1			request
		0	NewPointer
		1	NewKeyboard
	23			unused
</literallayout>
<!-- .\" print Table of Contents -->
<!-- .if o .bp \" blank page to make count even -->
<!-- .bp 1 -->
<!-- .af PN i -->
<!-- .PX -->

</appendix>