summaryrefslogtreecommitdiff
path: root/specs/libX11/CH10.xml
blob: d3ddd34079edebd73b86acd9ce28c425c50010da (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
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
	  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id="events">
<title>Events</title>

<para>
A client application communicates with the X server through the connection you establish with
the XOpenDisplay function. A client application sends requests to the X server over this
connection. These requests are made by the Xlib functions that are called in the client application.
Many Xlib functions cause the X server to generate events, and the user’s typing or moving the
pointer can generate events asynchronously. The X server returns events to the client on the same
connection.
</para>
<para>
This chapter discusses the following topics associated with events:
</para>

<itemizedlist>
  <listitem><para>Event types</para></listitem>
  <listitem><para>Event structures</para></listitem>
  <listitem><para>Event masks</para></listitem>
  <listitem><para>Event processing</para></listitem>
</itemizedlist>

<para>
Functions for handling events are dealt with in
<link linkend="event_handling_functions">the next chapter</link>.
</para>

<sect1 id="Event_Types">
<title>Event Types</title>
<!-- .XS -->
<!-- (SN Event Types  -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Event</primary><secondary>types</secondary></indexterm>
An event is data generated asynchronously by the X server as a result of some 
device activity or as side effects of a request sent by an Xlib function.
<indexterm><primary>Event</primary></indexterm>
Device-related events propagate from the source window to ancestor windows
until some client application has selected that event type 
or until the event is explicitly discarded.
The X server generally sends an event to a client application
only if the client has specifically asked to be informed of that event type, 
typically by setting the event-mask attribute of the window.
The mask can also be set when you create a window
or by changing the window's
event-mask.
You can also mask out events that would propagate to ancestor windows
by manipulating the
do-not-propagate mask of the window's attributes.
However,
<symbol>MappingNotify</symbol>
events are always sent to all clients.
<indexterm><primary>Input Control</primary></indexterm>
<indexterm><primary>Output Control</primary></indexterm>
</para>
<para>
<!-- .LP -->
An event type describes a specific event generated by the X server.
For each event type, 
a corresponding constant name is defined in
<filename class="headerfile">&lt;X11/X.h&gt;</filename>,
<indexterm type="file"><primary><filename class="headerfile">X11/X.h</filename></primary></indexterm>
<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/X.h&gt;</filename></secondary></indexterm>
<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/X.h&gt;</filename></secondary></indexterm>
which is used when referring to an event type.
<indexterm><primary>Event</primary><secondary>categories</secondary></indexterm>
The following table lists the event category 
and its associated event type or types. 
The processing associated with these events is discussed in section 10.5.
</para>
<para>
<!-- .LP -->
<!-- .\".CP T 1 -->
<!-- .\"Event Categories and Event Types -->
</para>
<para>
<!-- .LP -->
<informaltable>
  <tgroup cols='2'>
  <colspec colname='c1'/>
  <colspec colname='c2'/>
  <thead>
    <row>
      <entry align='left'>Event Category</entry>
      <entry align='left'>Event Type</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry>Keyboard events</entry>
      <entry><symbol>KeyPress</symbol>,
      <symbol>KeyRelease</symbol></entry>
    </row>
    <row>
      <entry>Pointer events</entry>
      <entry><symbol>ButtonPress</symbol>,
      <symbol>ButtonRelease</symbol>,
      <symbol>MotionNotify</symbol></entry>
    </row>
    <row>
      <entry>Window crossing events</entry>
      <entry><symbol>EnterNotify</symbol>,
      <symbol>LeaveNotify</symbol></entry>
    </row>
    <row>
      <entry>Input focus events</entry>
      <entry><symbol>FocusIn</symbol>,
      <symbol>FocusOut</symbol></entry>
    </row>
    <row>
      <entry>Keymap state notification event</entry>
      <entry><symbol>KeymapNotify</symbol></entry>
    </row>
    <row>
      <entry>Exposure events</entry>
      <entry><symbol>Expose</symbol>,
      <symbol>GraphicsExpose</symbol>,
      <symbol>NoExpose</symbol></entry>
    </row>
    <row>
      <entry>Structure control events</entry>
      <entry><symbol>CirculateRequest</symbol>,
      <symbol>ConfigureRequest</symbol>,
      <symbol>MapRequest</symbol>,
      <symbol>ResizeRequest</symbol></entry>
    </row>
    <row>
      <entry>Window state notification events</entry>
      <entry>
      <symbol>CirculateNotify</symbol>,
      <symbol>ConfigureNotify</symbol>,
      <symbol>CreateNotify</symbol>,
      <symbol>DestroyNotify</symbol>,
      <symbol>GravityNotify</symbol>,
      <symbol>MapNotify</symbol>,
      <symbol>MappingNotify</symbol>,
      <symbol>ReparentNotify</symbol>,
      <symbol>UnmapNotify</symbol>,
      <symbol>VisibilityNotify</symbol></entry>
    </row>
    <row>
      <entry>Colormap state notification event</entry>
      <entry><symbol>ColormapNotify</symbol></entry>
    </row>
    <row>
      <entry>Client communication events</entry>
      <entry><symbol>ClientMessage</symbol>,
      <symbol>PropertyNotify</symbol>,
      <symbol>SelectionClear</symbol>,
      <symbol>SelectionNotify</symbol>,
      <symbol>SelectionRequest</symbol></entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>

<!-- .\".LP -->
<!-- .\"Table 8-1 lists the event types and the Xlib functions that could cause -->
<!-- .\"the X server to generate that event type. -->
<!-- .\"The event types are listed alphabetically. -->
<!-- .\"Note that the error event is not listed in this table. -->
<!-- .\"For a list of the constants associated with an error event, see the Handling -->
<!-- .\"Errors section in this chapter. -->
<!-- .\".LP -->
<!-- .\".so eventtable -->
</para>
</sect1>
<sect1 id="Event_Structures">
<title>Event Structures</title>
<!-- .XS -->
<!-- (SN Event Structures  -->
<!-- .XE -->
<para>
<!-- .LP -->
For each event type,
a corresponding structure is declared in
<filename class="headerfile">&lt;X11/Xlib.h&gt;</filename>.
<indexterm type="file"><primary><filename class="headerfile">X11/Xlib.h</filename></primary></indexterm>
<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/Xlib.h&gt;</filename></secondary></indexterm>
<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/Xlib.h&gt;</filename></secondary></indexterm>
All the event structures have the following common members:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XAnyEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        window;
} XAnyEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The type member is set to the event type constant name that uniquely identifies
it.
For example, when the X server reports a
<symbol>GraphicsExpose</symbol>
event to a client application, it sends an
<structname>XGraphicsExposeEvent</structname>
structure with the type member set to
<symbol>GraphicsExpose</symbol>.
The display member is set to a pointer to the display the event was read on.
The send_event member is set to
<symbol>True</symbol>
if the event came from a
<systemitem>SendEvent</systemitem>
protocol request.
The serial member is set from the serial number reported in the protocol
but expanded from the 16-bit least-significant bits to a full 32-bit value.
The window member is set to the window that is most useful to toolkit
dispatchers.
</para>
<para>
<!-- .LP -->
The X server can send events at any time in the input stream. 
Xlib stores any events received while waiting for a reply in an event queue 
for later use.
Xlib also provides functions that allow you to check events in the event queue
(see <link linkend="Event_Queue_Management">section 11.3</link>).
</para>
<para>
<!-- .LP -->
In addition to the individual structures declared for each event type, the
<structname>XEvent</structname>
structure is a union of the individual structures declared for each event type.
Depending on the type,
you should access members of each event by using the 
<structname>XEvent</structname>
union.
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XEvent</primary></indexterm>
<!-- .sM -->
</para>
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef union _XEvent {
     int                            type;          /* must not be changed */
     XAnyEvent                      xany;
     XKeyEvent                      xkey;
     XButtonEvent                   xbutton;
     XMotionEvent                   xmotion;
     XCrossingEvent                 xcrossing;
     XFocusChangeEvent              xfocus;
     XExposeEvent                   xexpose;
     XGraphicsExposeEvent           xgraphicsexpose;
     XNoExposeEvent                 xnoexpose;
     XVisibilityEvent               xvisibility;
     XCreateWindowEvent             xcreatewindow;
     XDestroyWindowEvent            xdestroywindow;
     XUnmapEvent                    xunmap;
     XMapEvent                      xmap;
     XMapRequestEvent               xmaprequest;
     XReparentEvent                 xreparent;
     XConfigureEvent                xconfigure;
     XGravityEvent                  xgravity;
     XResizeRequestEvent            xresizerequest;
     XConfigureRequestEvent         xconfigurerequest;
     XCirculateEvent                xcirculate;
     XCirculateRequestEvent         xcirculaterequest;
     XPropertyEvent                 xproperty;
     XSelectionClearEvent           xselectionclear;
     XSelectionRequestEvent         xselectionrequest;
     XSelectionEvent                xselection;
     XColormapEvent                 xcolormap;
     XClientMessageEvent            xclient;
     XMappingEvent                  xmapping;
     XErrorEvent                    xerror;
     XKeymapEvent                   xkeymap;
     long                           pad[24];
} XEvent;
</literallayout>

<para>
<!-- .LP -->
<!-- .eM -->
An
<structname>XEvent</structname>
structure's first entry always is the type member,
which is set to the event type.
The second member always is the serial number of the protocol request
that generated the event.
The third member always is send_event,
which is a
<type>Bool</type>
that indicates if the event was sent by a different client.
The fourth member always is a display,
which is the display that the event was read from.
Except for keymap events,
the fifth member always is a window,
which has been carefully selected to be useful to toolkit dispatchers.
To avoid breaking toolkits,
the order of these first five entries is not to change.
Most events also contain a time member,
which is the time at which an event occurred.
In addition, a pointer to the generic event must be cast before it
is used to access any other information in the structure.
</para>
</sect1>
<sect1 id="Event_Masks">
<title>Event Masks</title>
<!-- .XS -->
<!-- (SN Event Masks -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>Event mask</primary></indexterm>
Clients select event reporting of most events relative to a window.
To do this, pass an event mask to an Xlib event-handling
function that takes an event_mask argument.
The bits of the event mask are defined in
<filename class="headerfile">&lt;X11/X.h&gt;</filename>.
<indexterm type="file"><primary><filename class="headerfile">X11/X.h</filename></primary></indexterm>
<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/X.h&gt;</filename></secondary></indexterm>
<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/X.h&gt;</filename></secondary></indexterm>
Each bit in the event mask maps to an event mask name,
which describes the event or events you want the X server to
return to a client application.
</para>
<para>
<!-- .LP -->
Unless the client has specifically asked for them,
most events are not reported to clients when they are generated. 
Unless the client suppresses them by setting graphics-exposures in the GC to
<symbol>False</symbol>,
<symbol>GraphicsExpose</symbol>
and 
<symbol>NoExpose</symbol>
are reported by default as a result of
<function>XCopyPlane</function>
and
<function>XCopyArea</function>.
<symbol>SelectionClear</symbol>,
<symbol>SelectionRequest</symbol>,
<symbol>SelectionNotify</symbol>,
or
<symbol>ClientMessage</symbol>
cannot be masked.
Selection-related events are only sent to clients cooperating
with selections
(see <link linkend="Obtaining_and_Changing_Window_Properties">section 4.5</link>).
When the keyboard or pointer mapping is changed,
<symbol>MappingNotify</symbol>
is always sent to clients.
</para>
<para>
<!-- .LP -->
<!-- .\"Table 8-2  -->
The following table 
lists the event mask constants you can pass to
the event_mask argument and
the circumstances in which you would want to specify the
event mask:
</para>
<!-- .LP -->
<!-- .\" .CP T 2 -->
<!-- .\"Event Mask Definitions -->
<informaltable>
  <tgroup cols='2'>
  <colspec colname='c1'/>
  <colspec colname='c2'/>
  <thead>
    <row>
      <entry align='left'>Event Mask</entry>
      <entry align='left'>Circumstances</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry><symbol>NoEventMask</symbol></entry>
      <entry>No events wanted</entry>
    </row>
    <row>
      <entry><symbol>KeyPressMask</symbol></entry>
      <entry>Keyboard down events wanted</entry>
    </row>
    <row>
      <entry><symbol>KeyReleaseMask</symbol></entry>
      <entry>Keyboard up events wanted</entry>
    </row>
    <row>
      <entry><symbol>ButtonPressMask</symbol></entry>
      <entry>Pointer button down events wanted</entry>
    </row>
    <row>
      <entry><symbol>ButtonReleaseMask</symbol></entry>
      <entry>Pointer button up events wanted</entry>
    </row>
    <row>
      <entry><symbol>EnterWindowMask</symbol></entry>
      <entry>Pointer window entry events wanted</entry>
    </row>
    <row>
      <entry><symbol>LeaveWindowMask</symbol></entry>
      <entry>Pointer window leave events wanted</entry>
    </row>
    <row>
      <entry><symbol>PointerMotionMask</symbol></entry>
      <entry>Pointer motion events wanted</entry>
    </row>
    <row>
      <entry><symbol>PointerMotionHintMask</symbol></entry>
      <entry>Pointer motion hints wanted</entry>
    </row>
    <row>
      <entry><symbol>Button1MotionMask</symbol></entry>
      <entry>Pointer motion while button 1 down</entry>
    </row>
    <row>
      <entry><symbol>Button2MotionMask</symbol></entry>
      <entry>Pointer motion while button 2 down</entry>
    </row>
    <row>
      <entry><symbol>Button3MotionMask</symbol></entry>
      <entry>Pointer motion while button 3 down</entry>
    </row>
    <row>
      <entry><symbol>Button4MotionMask</symbol></entry>
      <entry>Pointer motion while button 4 down</entry>
    </row>
    <row>
      <entry><symbol>Button5MotionMask</symbol></entry>
      <entry>Pointer motion while button 5 down</entry>
    </row>
    <row>
      <entry><symbol>ButtonMotionMask</symbol></entry>
      <entry>Pointer motion while any button down</entry>
    </row>
    <row>
      <entry><symbol>KeymapStateMask</symbol></entry>
      <entry>Keyboard state wanted at window entry and focus in</entry>
    </row>
    <row>
      <entry><symbol>ExposureMask</symbol></entry>
      <entry>Any exposure wanted</entry>
    </row>
    <row>
      <entry><symbol>VisibilityChangeMask</symbol></entry>
      <entry>Any change in visibility wanted</entry>
    </row>
    <row>
      <entry><symbol>StructureNotifyMask</symbol></entry>
      <entry>Any change in window structure wanted</entry>
    </row>
    <row>
      <entry><symbol>ResizeRedirectMask</symbol></entry>
      <entry>Redirect resize of this window</entry>
    </row>
    <row>
      <entry><symbol>SubstructureNotifyMask</symbol></entry>
      <entry>Substructure notification wanted</entry>
    </row>
    <row>
      <entry><symbol>SubstructureRedirectMask</symbol></entry>
      <entry>Redirect structure requests on children</entry>
    </row>
    <row>
      <entry><symbol>FocusChangeMask</symbol></entry>
      <entry>Any change in input focus wanted</entry>
    </row>
    <row>
      <entry><symbol>PropertyChangeMask</symbol></entry>
      <entry>Any change in property wanted</entry>
    </row>
    <row>
      <entry><symbol>ColormapChangeMask</symbol></entry>
      <entry>Any change in colormap wanted</entry>
    </row>
    <row>
      <entry><symbol>OwnerGrabButtonMask</symbol></entry>
      <entry>Automatic grabs should activate with owner_events set to True</entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>

<para>
<!-- .LP -->
</para>
</sect1>
<sect1 id="Event_Processing_Overview">
<title>Event Processing Overview</title>
<!-- .XS -->
<!-- (SN Event Processing Overview -->
<!-- .XE -->
<para>
<!-- .LP -->
The event reported to a client application during event processing
depends on which event masks you provide as the event-mask attribute 
for a window.
For some event masks, there is a one-to-one correspondence between
the event mask constant and the event type constant.
For example, if you pass the event mask
<symbol>ButtonPressMask</symbol>,
the X server sends back only
<symbol>ButtonPress</symbol>
events.
<indexterm><primary>CurrentTime</primary></indexterm>
Most events contain a time member,
which is the time at which an event occurred.
</para>
<para>
<!-- .LP -->
In other cases, one event mask constant can map to several event type constants.
For example, if you pass the event mask
<symbol>SubstructureNotifyMask</symbol>,
the X server can send back
<symbol>CirculateNotify</symbol>,
<symbol>ConfigureNotify</symbol>,
<symbol>CreateNotify</symbol>,
<symbol>DestroyNotify</symbol>,
<symbol>GravityNotify</symbol>,
<symbol>MapNotify</symbol>,
<symbol>ReparentNotify</symbol>,
or
<symbol>UnmapNotify</symbol>
events.
</para>
<para>
<!-- .LP -->
In another case, 
two event masks can map to one event type.
For example, 
if you pass either
<symbol>PointerMotionMask</symbol>
or
<symbol>ButtonMotionMask</symbol>,
the X server sends back
a
<symbol>MotionNotify</symbol>
event.
</para>
<para>
<!-- .LP -->
The following table 
lists the event mask, 
its associated event type or types, 
and the structure name associated with the event type.
Some of these structures actually are typedefs to a generic structure
that is shared between two event types.
Note that N.A. appears in columns for which the information is not applicable.
</para>
<!-- .LP -->
<!-- .ps 9 -->
<!-- .nr PS 9 -->
<informaltable>
  <tgroup cols='4'>
  <colspec colname='c1'/>
  <colspec colname='c2'/>
  <colspec colname='c3'/>
  <colspec colname='c4'/>
  <thead>
    <row>
      <entry align='left'>Event Mask</entry>
      <entry align='left'>Event Type</entry>
      <entry align='left'>Structure</entry>
      <entry align='left'>Generic Structure</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry>
      <para>ButtonMotionMask</para>
      <para>Button1MotionMask</para>
      <para>Button2MotionMask</para>
      <para>Button3MotionMask</para>
      <para>Button4MotionMask</para>
      <para>Button5MotionMask</para>
      </entry>
      <entry>MotionNotify</entry>
      <entry>XPointerMovedEvent</entry>
      <entry>XMotionEvent</entry>
    </row>
    <row>
      <entry>ButtonPressMask</entry>
      <entry>ButtonPress</entry>
      <entry>XButtonPressedEvent</entry>
      <entry>XButtonEvent</entry>
    </row>
    <row>
      <entry>ButtonReleaseMask</entry>
      <entry>ButtonRelease</entry>
      <entry>XButtonReleasedEvent</entry>
      <entry>XButtonEvent</entry>
    </row>
    <row>
      <entry>ColormapChangeMask</entry>
      <entry>ColormapNotify</entry>
      <entry>XColormapEvent</entry>
    </row>
    <row>
      <entry>EnterWindowMask</entry>
      <entry>EnterNotify</entry>
      <entry>XEnterWindowEvent</entry>
      <entry>XCrossingEvent</entry>
    </row>
    <row>
      <entry>LeaveWindowMask</entry>
      <entry>LeaveNotify</entry>
      <entry>XLeaveWindowEvent</entry>
      <entry>XCrossingEvent</entry>
    </row>
    <row>
      <entry>ExposureMask</entry>
      <entry>Expose</entry>
      <entry>XExposeEvent </entry>
    </row>
    <row>
      <entry morerows='1'>GCGraphicsExposures in GC</entry>
      <entry>GraphicsExpose</entry>
      <entry>XGraphicsExposeEvent</entry>
    </row>
    <row>
      <entry>NoExpose</entry>
      <entry>XNoExposeEvent</entry>
    </row>
    <row>
      <entry morerows='1'>FocusChangeMask</entry>
      <entry>FocusIn</entry>
      <entry>XFocusInEvent</entry>
      <entry>XFocusChangeEvent</entry>
    </row>
    <row>
      <entry>FocusOut</entry>
      <entry>XFocusOutEvent</entry>
      <entry>XFocusChangeEvent</entry>
    </row>
    <row>
      <entry>KeymapStateMask</entry>
      <entry>KeymapNotify</entry>
      <entry>XKeymapEvent</entry>
    </row>
    <row>
      <entry>KeyPressMask</entry>
      <entry>KeyPress</entry>
      <entry>XKeyPressedEvent</entry>
      <entry>XKeyEvent</entry>
    </row>
    <row>
      <entry>KeyReleaseMask</entry>
      <entry>KeyRelease</entry>
      <entry>XKeyReleasedEvent</entry>
      <entry>XKeyEvent</entry>
    </row>
    <row>
      <entry>OwnerGrabButtonMask</entry>
      <entry>N.A.</entry>
      <entry>N.A.</entry>
    </row>
    <row>
      <entry>PointerMotionMask</entry>
      <entry>MotionNotify</entry>
      <entry>XPointerMovedEvent</entry>
      <entry>XMotionEvent</entry>
    </row>
    <row>
      <entry>PointerMotionHintMask</entry>
      <entry>N.A.</entry>
      <entry>N.A.</entry>
    </row>
    <row>
      <entry>PropertyChangeMask</entry>
      <entry>PropertyNotify</entry>
      <entry>XPropertyEvent</entry>
    </row>
    <row>
      <entry>ResizeRedirectMask</entry>
      <entry>ResizeRequest</entry>
      <entry>XResizeRequestEvent</entry>
    </row>
    <row>
      <entry morerows='6'>StructureNotifyMask</entry>
      <entry>CirculateNotify</entry>
      <entry>XCirculateEvent</entry>
    </row>
    <row>
      <entry>ConfigureNotify</entry>
      <entry>XConfigureEvent</entry>
    </row>
    <row>
      <entry>DestroyNotify</entry>
      <entry>XDestroyWindowEvent</entry>
    </row>
    <row>
      <entry>GravityNotify</entry>
      <entry>XGravityEvent</entry>
    </row>
    <row>
      <entry>MapNotify</entry>
      <entry>XMapEvent</entry>
    </row>
    <row>
      <entry>ReparentNotify</entry>
      <entry>XReparentEvent</entry>
    </row>
    <row>
      <entry>UnmapNotify</entry>
      <entry>XUnmapEvent</entry>
    </row>
    <row>
      <entry morerows='7'>SubstructureNotifyMask</entry>
      <entry>CirculateNotify</entry>
      <entry>XCirculateEvent</entry>
    </row>
    <row>
      <entry>ConfigureNotify</entry>
      <entry>XConfigureEvent</entry>
    </row>
    <row>
      <entry>CreateNotify</entry>
      <entry>XCreateWindowEvent</entry>
    </row>
    <row>
      <entry>DestroyNotify</entry>
      <entry>XDestroyWindowEvent</entry>
    </row>
    <row>
      <entry>GravityNotify</entry>
      <entry>XGravityEvent</entry>
    </row>
    <row>
      <entry>MapNotify</entry>
      <entry>XMapEvent</entry>
    </row>
    <row>
      <entry>ReparentNotify</entry>
      <entry>XReparentEvent</entry>
    </row>
    <row>
      <entry>UnmapNotify</entry>
      <entry>XUnmapEvent</entry>
    </row>
    <row>
      <entry morerows='2'>SubstructureRedirectMask</entry>
      <entry>CirculateRequest</entry>
      <entry>XCirculateRequestEvent</entry>
    </row>
    <row>
      <entry>ConfigureRequest</entry>
      <entry>XConfigureRequestEvent</entry>
    </row>
    <row>
      <entry>MapRequest</entry>
      <entry>XMapRequestEvent</entry>
    </row>
    <row>
      <entry>N.A.</entry>
      <entry>ClientMessage</entry>
      <entry>XClientMessageEvent</entry>
    </row>
    <row>
      <entry>N.A.</entry>
      <entry>MappingNotify</entry>
      <entry>XMappingEvent</entry>
    </row>
    <row>
      <entry>N.A.</entry>
      <entry>SelectionClear</entry>
      <entry>XSelectionClearEvent</entry>
    </row>
    <row>
      <entry>N.A.</entry>
      <entry>SelectionNotify</entry>
      <entry>XSelectionEvent</entry>
    </row>
    <row>
      <entry>N.A.</entry>
      <entry>SelectionRequest</entry>
      <entry>XSelectionRequestEvent</entry>
    </row>
    <row>
      <entry>VisibilityChangeMask</entry>
      <entry>VisibilityNotify</entry>
      <entry>XVisibilityEvent</entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>

<para>
<!-- .LP -->
The sections that follow describe the processing that occurs 
when you select the different event masks.
The sections are organized according to these processing categories:
</para>
<itemizedlist>
  <listitem>
    <para>
Keyboard and pointer events
    </para>
  </listitem>
  <listitem>
    <para>
Window crossing events
    </para>
  </listitem>
  <listitem>
    <para>
Input focus events
    </para>
  </listitem>
  <listitem>
    <para>
Keymap state notification events
    </para>
  </listitem>
  <listitem>
    <para>
Exposure events
    </para>
  </listitem>
  <listitem>
    <para>
Window state notification events
    </para>
  </listitem>
  <listitem>
    <para>
Structure control events
    </para>
  </listitem>
  <listitem>
    <para>
Colormap state notification events
    </para>
  </listitem>
  <listitem>
    <para>
Client communication events
    </para>
  </listitem>
</itemizedlist>

</sect1>

<sect1 id="Keyboard_and_Pointer_Events">
<title>Keyboard and Pointer Events</title>
<!-- .XS -->
<!-- (SN Keyboard and Pointer Events -->
<!-- .XE -->
<para>
<!-- .LP -->
This section discusses:
</para>
<itemizedlist>
  <listitem>
    <para>
Pointer button events
    </para>
  </listitem>
  <listitem>
    <para>
Keyboard and pointer events
    </para>
  </listitem>
</itemizedlist>
<sect2 id="Pointer_Button_Events">
<title>Pointer Button Events</title>
<!-- .XS -->
<!-- (SN Pointer Button Events -->
<!-- .XE -->
<para>
<!-- .LP -->
The following describes the event processing that occurs when a pointer button 
press is processed with the pointer in some window w and 
when no active pointer grab is in progress.
</para>
<para>
<!-- .LP -->
The X server searches the ancestors of w from the root down,
looking for a passive grab to activate.
If no matching passive grab on the button exists,
the X server automatically starts an active grab for the client receiving
the event and sets the last-pointer-grab time to the current server time.
The effect is essentially equivalent to an
<function>XGrabButton</function>
with these client passed arguments:
</para>
<informaltable>
  <tgroup cols='2'>
  <colspec colname='c1'/>
  <colspec colname='c2'/>
  <thead>
    <row>
      <entry align='left'>Argument</entry>
      <entry align='left'>Value</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry><emphasis remap='I'>w</emphasis></entry>
      <entry>The event window </entry>
    </row>
    <row>
      <entry><emphasis remap='I'>event_mask</emphasis></entry>
      <entry>The client's selected pointer events on the event window</entry>
    </row>
    <row>
      <entry><emphasis remap='I'>pointer_mode</emphasis></entry>
      <entry><symbol>GrabModeAsync</symbol></entry>
    </row>
    <row>
      <entry><emphasis remap='I'>keyboard_mode</emphasis></entry>
      <entry><symbol>GrabModeAsync</symbol></entry>
    </row>
    <row>
      <entry><emphasis remap='I'>owner_events</emphasis></entry>
      <entry><symbol>True</symbol>,
      if the client has selected
      <symbol>OwnerGrabButtonMask</symbol>
      on the event window,
      otherwise
      <symbol>False</symbol></entry>
    </row>
    <row>
      <entry><emphasis remap='I'>confine_to</emphasis></entry>
      <entry><symbol>None</symbol></entry>
    </row>
    <row>
      <entry><emphasis remap='I'>cursor</emphasis></entry>
      <entry><symbol>None</symbol></entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>

<para>
<!-- .LP -->
The active grab is automatically terminated when 
the logical state of the pointer has all buttons released.
Clients can modify the active grab by calling
<function>XUngrabPointer</function>
and
<function>XChangeActivePointerGrab</function>.
</para>
</sect2>

<sect2 id="Keyboard_and_Pointer_Events_b">
<title>Keyboard and Pointer Events</title>
<!-- .XS -->
<!-- (SN Keyboard and Pointer Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>ButtonPress</secondary></indexterm>
<indexterm><primary>Events</primary><secondary>ButtonRelease</secondary></indexterm>
<indexterm><primary>Events</primary><secondary>KeyPress</secondary></indexterm>
<indexterm><primary>Events</primary><secondary>KeyRelease</secondary></indexterm>
<indexterm><primary>Events</primary><secondary>MotionNotify</secondary></indexterm>
This section discusses the processing that occurs for the
keyboard events
<symbol>KeyPress</symbol>
and 
<symbol>KeyRelease</symbol>
and the pointer events
<symbol>ButtonPress</symbol>,
<symbol>ButtonRelease</symbol>,
and
<symbol>MotionNotify</symbol>.
For information about the keyboard event-handling utilities,
see <link linkend="event_handling_functions">chapter 11</link>.
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>KeyPress</primary></indexterm>
<indexterm significance="preferred"><primary>KeyRelease</primary></indexterm>
The X server reports
<symbol>KeyPress</symbol>
or
<symbol>KeyRelease</symbol>
events to clients wanting information about keys that logically change state.
Note that these events are generated for all keys, 
even those mapped to modifier bits.
<indexterm significance="preferred"><primary>ButtonPress</primary></indexterm>
<indexterm significance="preferred"><primary>ButtonRelease</primary></indexterm>
The X server reports
<symbol>ButtonPress</symbol>
or
<symbol>ButtonRelease</symbol>
events to clients wanting information about buttons that logically change state.
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>MotionNotify</primary></indexterm>
The X server reports
<symbol>MotionNotify</symbol>
events to clients wanting information about when the pointer logically moves.
The X server generates this event whenever the pointer is moved 
and the pointer motion begins and ends in the window.
The granularity of
<symbol>MotionNotify</symbol>
events is not guaranteed, 
but a client that selects this event type is guaranteed
to receive at least one event when the pointer moves and then rests.
</para>
<para>
<!-- .LP -->
The generation of the logical changes lags the physical changes 
if device event processing is frozen.
</para>
<para>
<!-- .LP -->
To receive
<symbol>KeyPress</symbol>,
<symbol>KeyRelease</symbol>,
<symbol>ButtonPress</symbol>,
and
<symbol>ButtonRelease</symbol>
events, set 
<symbol>KeyPressMask</symbol>,
<symbol>KeyReleaseMask</symbol>,
<symbol>ButtonPressMask</symbol>,
and
<symbol>ButtonReleaseMask</symbol>
bits in the event-mask attribute of the window.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>MotionNotify</symbol>
events, set one or more of the following event 
masks bits in the event-mask attribute of the window.
</para>
<itemizedlist>
  <listitem>
    <para>
<symbol>Button1MotionMask</symbol> - <symbol>Button5MotionMask</symbol>
    </para>
  </listitem>
  <listitem>
    <para>
The client application receives
<symbol>MotionNotify</symbol>
events only when one or more of the specified buttons is pressed.
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>ButtonMotionMask</symbol>
    </para>
  </listitem>
  <listitem>
    <para>
The client application receives
<symbol>MotionNotify</symbol>
events only when at least one button is pressed.
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>PointerMotionMask</symbol>
    </para>
  </listitem>
  <listitem>
    <para>
The client application receives 
<symbol>MotionNotify</symbol>
events independent of the state of
the pointer buttons.
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>PointerMotionHintMask</symbol>
    </para>
  </listitem>
  <listitem>
    <para>
If
<symbol>PointerMotionHintMask</symbol>
is selected in combination with one or more of the above masks, 
the X server is free to send only one
<symbol>MotionNotify</symbol>
event (with the is_hint member  of the
<type>XPointerMovedEvent</type>
structure set to
<symbol>NotifyHint</symbol>)
to the client for the event window, 
until either the key or button state changes,
the pointer leaves the event window, or the client calls
<function>XQueryPointer</function>
or
<function>XGetMotionEvents</function>.
The server still may send
<symbol>MotionNotify</symbol>
events without is_hint set to
<symbol>NotifyHint</symbol>.
    </para>
  </listitem>
</itemizedlist>
<para>
<!-- .LP -->
The source of the event is the viewable window that the pointer is in.
The window used by the X server to report these events depends on 
the window's position in the window hierarchy 
and whether any intervening window prohibits the generation of these events.
Starting with the source window, 
the X server searches up the window hierarchy until it locates the first 
window specified by a client as having an interest in these events.
If one of the intervening windows has its do-not-propagate-mask
set to prohibit generation of the event type,
the events of those types will be suppressed.
Clients can modify the actual window used for reporting by performing
active grabs and, in the case of keyboard events, by using the focus window.
</para>
<para>
<!-- .LP -->
The structures for these event types contain:
</para>
<literallayout class="monospaced">
typedef struct {
     int            type;            /* ButtonPress or ButtonRelease */
     unsigned long  serial;          /* # of last request processed by server */
     Bool           send_event;      /* true if this came from a SendEvent request */
     Display        *display;        /* Display the event was read from */
     Window         window;          /* ``event'' window it is reported relative to */
     Window         root;            /* root window that the event occurred on */
     Window         subwindow;       /* child window */
     Time           time;            /* milliseconds */
     int            x, y;            /* pointer x, y coordinates in event window */
     int            x_root, y_root;  /* coordinates relative to root */
     unsigned int   state;           /* key or button mask */
     unsigned int   button;          /* detail */
     Bool           same_screen;     /* same screen flag */
} XButtonEvent;
typedef XButtonEvent XButtonPressedEvent;
typedef XButtonEvent XButtonReleasedEvent;
</literallayout>

<literallayout class="monospaced">
typedef struct {
     int            type;            /* KeyPress or KeyRelease */
     unsigned long  serial;          /* # of last request processed by server */
     Bool           send_event;      /* true if this came from a SendEvent request */
     Display        *display;        /* Display the event was read from */
     Window         window;          /* ``event'' window it is reported relative to */
     Window         root;            /* root window that the event occurred on */
     Window         subwindow;       /* child window */
     Time           time;            /* milliseconds */
     int            x, y;            /* pointer x, y coordinates in event window */
     int            x_root, y_root;  /* coordinates relative to root */
     unsigned int   state;           /* key or button mask */
     unsigned int   keycode;         /* detail */
     Bool           same_screen;     /* same screen flag */
} XKeyEvent;
typedef XKeyEvent XKeyPressedEvent;
typedef XKeyEvent XKeyReleasedEvent;
</literallayout>

<literallayout class="monospaced">
typedef struct {
     int            type;              /* MotionNotify */
     unsigned long  serial;            /* # of last request processed by server */
     Bool           send_event;        /* true if this came from a SendEvent request */
     Display        *display;          /* Display the event was read from */
     Window         window;            /* ``event'' window reported relative to */
     Window         root;              /* root window that the event occurred on */
     Window         subwindow;         /* child window */
     Time           time;              /* milliseconds */
     int            x, y;              /* pointer x, y coordinates in event window */
     int            x_root, y_root;    /* coordinates relative to root */
     unsigned int   state;             /* key or button mask */
     char           is_hint;           /* detail */
     Bool           same_screen;       /* same screen flag */
} XMotionEvent;
typedef XMotionEvent XPointerMovedEvent;
</literallayout>

<para>
These structures have the following common members:
window, root, subwindow, time, x, y, x_root, y_root, state, and same_screen.
The window member is set to the window on which the
event was generated and is referred to as the event window. 
As long as the conditions previously discussed are met,
this is the window used by the X server to report the event.
The root member is set to the source window's root window.
The x_root and y_root members are set to the pointer's coordinates
relative to the root window's origin at the time of the event.
</para>

<para>
<!-- .LP -->
The same_screen member is set to indicate whether the event 
window is on the same screen
as the root window and can be either
<symbol>True</symbol>
or
<symbol>False</symbol>.
If
<symbol>True</symbol>,
the event and root windows are on the same screen.
If
<symbol>False</symbol>,
the event and root windows are not on the same screen.
</para>
<para>
<!-- .LP -->
If the source window is an inferior of the event window, 
the subwindow member of the structure is set to the child of the event window
that is the source window or the child of the event window that is
an ancestor of the source window.
Otherwise, the X server sets the subwindow member to
<symbol>None</symbol>.
The time member is set to the time when the event was generated 
and is expressed in milliseconds.
</para>
<para>
<!-- .LP -->
If the event window is on the same screen as the root window, 
the x and y members
are set to the coordinates relative to the event window's origin.
Otherwise, these members are set to zero.
</para>
<para>
<!-- .LP -->
The state member is set to indicate the logical state of the pointer buttons 
and modifier keys just prior to the event,
which is the bitwise inclusive OR of one or more of the
button or modifier key masks:
<symbol>Button1Mask</symbol>,
<symbol>Button2Mask</symbol>,
<symbol>Button3Mask</symbol>,
<symbol>Button4Mask</symbol>,
<symbol>Button5Mask</symbol>,
<symbol>ShiftMask</symbol>,
<symbol>LockMask</symbol>,
<symbol>ControlMask</symbol>,
<symbol>Mod1Mask</symbol>,
<symbol>Mod2Mask</symbol>,
<symbol>Mod3Mask</symbol>,
<symbol>Mod4Mask</symbol>,
and
<symbol>Mod5Mask</symbol>.
</para>
<para>
<!-- .LP -->
Each of these structures also has a member that indicates the detail.
For the
<type>XKeyPressedEvent</type>
and
<type>XKeyReleasedEvent</type>
structures, this member is called a keycode.
It is set to a number that represents a physical key on the keyboard.
The keycode is an arbitrary representation for any key on the keyboard
(see sections <link linkend="Manipulating_the_Keyboard_Encoding">12.7</link>
 and <link linkend="Using_Keyboard_Utility_Functions">16.1</link>).
</para>
<para>
<!-- .LP -->
For the
<type>XButtonPressedEvent</type>
and
<type>XButtonReleasedEvent</type>
structures, this member is called button.
It represents the pointer button that changed state and can be the
<symbol>Button1</symbol>,
<symbol>Button2</symbol>,
<symbol>Button3</symbol>,
<symbol>Button4</symbol>,
or
<symbol>Button5</symbol>
value.
For the
<type>XPointerMovedEvent</type>
structure, this member is called is_hint.
It can be set to 
<symbol>NotifyNormal</symbol>
or
<symbol>NotifyHint</symbol>.
</para>
<para>
<!-- .LP -->
Some of the symbols mentioned in this section have fixed values, as
follows:
</para>
<informaltable>
  <tgroup cols='2'>
  <colspec colname='c1'/>
  <colspec colname='c2'/>
  <thead>
    <row>
      <entry align='left'>Symbol</entry>
      <entry align='left'>Value</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry><symbol>Button1MotionMask</symbol></entry>
      <entry>(1L&lt;&lt;8)</entry>
    </row>
    <row>
      <entry><symbol>Button2MotionMask</symbol></entry>
      <entry>(1L&lt;&lt;9)</entry>
    </row>
    <row>
      <entry><symbol>Button3MotionMask</symbol></entry>
      <entry>(1L&lt;&lt;10)</entry>
    </row>
    <row>
      <entry><symbol>Button4MotionMask</symbol></entry>
      <entry>(1L&lt;&lt;11)</entry>
    </row>
    <row>
      <entry><symbol>Button5MotionMask</symbol></entry>
      <entry>(1L&lt;&lt;12)</entry>
    </row>
    <row>
      <entry><symbol>Button1Mask</symbol></entry>
      <entry>(1&lt;&lt;8)</entry>
    </row>
    <row>
      <entry><symbol>Button2Mask</symbol></entry>
      <entry>(1&lt;&lt;9)</entry>
    </row>
    <row>
      <entry><symbol>Button3Mask</symbol></entry>
      <entry>(1&lt;&lt;10)</entry>
    </row>
    <row>
      <entry><symbol>Button4Mask</symbol></entry>
      <entry>(1&lt;&lt;11)</entry>
    </row>
    <row>
      <entry><symbol>Button5Mask</symbol></entry>
      <entry>(1&lt;&lt;12)</entry>
    </row>
    <row>
      <entry><symbol>ShiftMask</symbol></entry>
      <entry>(1&lt;&lt;0)</entry>
    </row>
    <row>
      <entry><symbol>LockMask</symbol></entry>
      <entry>(1&lt;&lt;1)</entry>
    </row>
    <row>
      <entry><symbol>ControlMask</symbol></entry>
      <entry>(1&lt;&lt;2)</entry>
    </row>
    <row>
      <entry><symbol>Mod1Mask</symbol></entry>
      <entry>(1&lt;&lt;3)</entry>
    </row>
    <row>
      <entry><symbol>Mod2Mask</symbol></entry>
      <entry>(1&lt;&lt;4)</entry>
    </row>
    <row>
      <entry><symbol>Mod3Mask</symbol></entry>
      <entry>(1&lt;&lt;5)</entry>
    </row>
    <row>
      <entry><symbol>Mod4Mask</symbol></entry>
      <entry>(1&lt;&lt;6)</entry>
    </row>
    <row>
      <entry><symbol>Mod5Mask</symbol></entry>
      <entry>(1&lt;&lt;7)</entry>
    </row>
    <row>
      <entry><symbol>Button1</symbol></entry>
      <entry>1</entry>
    </row>
    <row>
      <entry><symbol>Button2</symbol></entry>
      <entry>2</entry>
    </row>
    <row>
      <entry><symbol>Button3</symbol></entry>
      <entry>3</entry>
    </row>
    <row>
      <entry><symbol>Button4</symbol></entry>
      <entry>4</entry>
    </row>
    <row>
      <entry><symbol>Button5</symbol></entry>
      <entry>5</entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>

</sect2>
</sect1>
<sect1 id="Window_Entry_Exit_Events">
<title>Window Entry/Exit Events</title>
<!-- .XS -->
<!-- (SN Window Entry/Exit Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>EnterNotify</secondary></indexterm>
<indexterm><primary>Events</primary><secondary>LeaveNotify</secondary></indexterm>
This section describes the processing that 
occurs for the window crossing events
<symbol>EnterNotify</symbol>
and
<symbol>LeaveNotify</symbol>.
<indexterm significance="preferred"><primary>EnterNotify</primary></indexterm>
<indexterm significance="preferred"><primary>LeaveNotify</primary></indexterm>
If a pointer motion or a window hierarchy change causes the
pointer to be in a different window than before, the X server reports
<symbol>EnterNotify</symbol>
or
<symbol>LeaveNotify</symbol>
events to clients who have selected for these events.
All 
<symbol>EnterNotify</symbol>
and 
<symbol>LeaveNotify</symbol>
events caused by a hierarchy change are
generated after any hierarchy event
(<symbol>UnmapNotify</symbol>,
<symbol>MapNotify</symbol>,
<symbol>ConfigureNotify</symbol>,
<symbol>GravityNotify</symbol>,
<symbol>CirculateNotify</symbol>)
caused by that change;
however, the X protocol does not constrain the ordering of 
<symbol>EnterNotify</symbol>
and 
<symbol>LeaveNotify</symbol>
events with respect to
<symbol>FocusOut</symbol>,
<symbol>VisibilityNotify</symbol>,
and 
<symbol>Expose</symbol>
events.
</para>
<para>
<!-- .LP -->
This contrasts with
<symbol>MotionNotify</symbol>
events, which are also generated when the pointer moves
but only when the pointer motion begins and ends in a single window.
An
<symbol>EnterNotify</symbol>
or
<symbol>LeaveNotify</symbol>
event also can be generated when some client application calls
<function>XGrabPointer</function>
and
<function>XUngrabPointer</function>.
</para>
<para>
<!-- .LP -->
To receive
<symbol>EnterNotify</symbol>
or
<symbol>LeaveNotify</symbol>
events, set the
<symbol>EnterWindowMask</symbol>
or
<symbol>LeaveWindowMask</symbol>
bits of the event-mask attribute of the window.
</para>
<para>
<!-- .LP -->
The structure for these event types contains:
</para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XCrossingEvent</primary></indexterm>
<indexterm significance="preferred"><primary>XEnterWindowEvent</primary></indexterm>
<indexterm significance="preferred"><primary>XLeaveWindowEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;           /* EnterNotify or LeaveNotify */
     unsigned long serial;         /* # of last request processed by server */
     Bool          send_event;     /* true if this came from a SendEvent request */
     Display       *display;       /* Display the event was read from */
     Window        window;         /* ``event'' window reported relative to */
     Window        root;           /* root window that the event occurred on */
     Window        subwindow;      /* child window */
     Time          time;           /* milliseconds */
     int           x, y;           /* pointer x, y coordinates in event window */
     int           x_root, y_root; /* coordinates relative to root */
     int           mode;           /* NotifyNormal, NotifyGrab, NotifyUngrab */
     int           detail;
                   /*
                    * NotifyAncestor, NotifyVirtual, NotifyInferior, 
                    * NotifyNonlinear,NotifyNonlinearVirtual
                    */
     Bool          same_screen;    /* same screen flag */
     Bool          focus;          /* boolean focus */
     unsigned int  state;          /* key or button mask */
} XCrossingEvent;
typedef XCrossingEvent XEnterWindowEvent;
typedef XCrossingEvent XLeaveWindowEvent;
</literallayout>

<para>
<!-- .LP -->
<!-- .eM -->
The window member is set to the window on which the
<symbol>EnterNotify</symbol>
or
<symbol>LeaveNotify</symbol>
event was generated and is referred to as the event window. 
This is the window used by the X server to report the event, 
and is relative to the root
window on which the event occurred. 
The root member is set to the root window of the screen
on which the event occurred.
</para>
<para>
<!-- .LP -->
For a
<symbol>LeaveNotify</symbol>
event,
if a child of the event window contains the initial position of the pointer,
the subwindow component is set to that child.
Otherwise, the X server sets the subwindow member to
<symbol>None</symbol>.
For an
<symbol>EnterNotify</symbol>
event, if a child of the event window contains the final pointer position, 
the subwindow component is set to that child or
<symbol>None</symbol>.
</para>
<para>
<!-- .LP -->
The time member is set to the time when the event was generated
and is expressed in milliseconds.
The x and y members are set to the coordinates of the pointer position in 
the event window.
This position is always the pointer's final position,
not its initial position.
If the event window is on the same
screen as the root window, x and y are the pointer coordinates
relative to the event window's origin. 
Otherwise, x and y are set to zero.
The x_root and y_root members are set to the pointer's coordinates relative to the
root window's origin at the time of the event.
</para>
<para>
<!-- .LP -->
The same_screen member is set to indicate whether the event window is on the same screen
as the root window and can be either
<symbol>True</symbol>
or
<symbol>False</symbol>.
If
<symbol>True</symbol>,
the event and root windows are on the same screen.
If
<symbol>False</symbol>,
the event and root windows are not on the same screen.
</para>
<para>
<!-- .LP -->
The focus member is set to indicate whether the event window is the focus window or an
inferior of the focus window.
The X server can set this member to either
<symbol>True</symbol>
or
<symbol>False</symbol>.
If
<symbol>True</symbol>,
the event window is the focus window or an inferior of the focus window.
If
<symbol>False</symbol>,
the event window is not the focus window or an inferior of the focus window.
</para>
<para>
<!-- .LP -->
The state member is set to indicate the state of the pointer buttons and
modifier keys just prior to the
event.
The X server can set this member to the bitwise inclusive OR of one 
or more of the button or modifier key masks:
<symbol>Button1Mask</symbol>,
<symbol>Button2Mask</symbol>,
<symbol>Button3Mask</symbol>,
<symbol>Button4Mask</symbol>,
<symbol>Button5Mask</symbol>,
<symbol>ShiftMask</symbol>,
<symbol>LockMask</symbol>,
<symbol>ControlMask</symbol>,
<symbol>Mod1Mask</symbol>,
<symbol>Mod2Mask</symbol>,
<symbol>Mod3Mask</symbol>,
<symbol>Mod4Mask</symbol>,
<symbol>Mod5Mask</symbol>.
</para>
<para>
<!-- .LP -->
The mode member is set to indicate whether the events are normal events, 
pseudo-motion events
when a grab activates, or pseudo-motion events when a grab deactivates.
The X server can set this member to 
<symbol>NotifyNormal</symbol>,
<symbol>NotifyGrab</symbol>,
or
<symbol>NotifyUngrab</symbol>.
</para>
<para>
<!-- .LP -->
The detail member is set to indicate the notify detail and can be
<symbol>NotifyAncestor</symbol>,
<symbol>NotifyVirtual</symbol>,
<symbol>NotifyInferior</symbol>,
<symbol>NotifyNonlinear</symbol>,
or
<symbol>NotifyNonlinearVirtual</symbol>.
</para>
<sect2 id="Normal_Entry_Exit_Events">
<title>Normal Entry/Exit Events</title>
<!-- .XS -->
<!-- (SN Normal Entry/Exit Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<symbol>EnterNotify</symbol>
and
<symbol>LeaveNotify</symbol>
events are generated when the pointer moves from
one window to another window.
Normal events are identified by
<type>XEnterWindowEvent</type>
or
<type>XLeaveWindowEvent</type>
structures whose mode member is set to
<symbol>NotifyNormal</symbol>.
</para>
<itemizedlist>
  <listitem>
    <para>
When the pointer moves from window A to window B and A is an inferior of B, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>LeaveNotify</symbol>
event on window A, with the detail member of the
<type>XLeaveWindowEvent</type>
structure set to
<symbol>NotifyAncestor</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>LeaveNotify</symbol>
event on each window between window A and window B, exclusive,
with the detail member of each
<type>XLeaveWindowEvent</type>
structure set to
<symbol>NotifyVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates an
<symbol>EnterNotify</symbol>
event on window B, with the detail member of the 
<type>XEnterWindowEvent</type>
structure set to
<symbol>NotifyInferior</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the pointer moves from window A to window B and B is an inferior of A,
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>LeaveNotify</symbol>
event on window A,
with the detail member of the
<type>XLeaveWindowEvent</type>
structure set to
<symbol>NotifyInferior</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates an
<symbol>EnterNotify</symbol>
event on each window between window A and window B, exclusive, with the 
detail member of each 
<type>XEnterWindowEvent</type>
structure set to
<symbol>NotifyVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates an
<symbol>EnterNotify</symbol>
event on window B, with the detail member of the 
<type>XEnterWindowEvent</type>
structure set to
<symbol>NotifyAncestor</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the pointer moves from window A to window B 
and window C is their least common ancestor, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>LeaveNotify</symbol>
event on window A,
with the detail member of the
<type>XLeaveWindowEvent</type>
structure set to 
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>LeaveNotify</symbol>
event on each window between window A and window C, exclusive,
with the detail member of each
<type>XLeaveWindowEvent</type>
structure set to
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates an
<symbol>EnterNotify</symbol>
event on each window between window C and window B, exclusive, 
with the detail member of each
<type>XEnterWindowEvent</type>
structure set to
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates an
<symbol>EnterNotify</symbol>
event on window B, with the detail member of the 
<type>XEnterWindowEvent</type>
structure set to 
<symbol>NotifyNonlinear</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the pointer moves from window A to window B on different screens, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>LeaveNotify</symbol>
event on window A,
with the detail member of the
<type>XLeaveWindowEvent</type>
structure set to 
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window A is not a root window,
it generates a
<symbol>LeaveNotify</symbol>
event on each window above window A up to and including its root,
with the detail member of each
<type>XLeaveWindowEvent</type>
structure set to 
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window B is not a root window,
it generates an
<symbol>EnterNotify</symbol>
event on each window from window B's root down to but not including
window B, with the detail member of each
<type>XEnterWindowEvent</type>
structure set to 
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates an
<symbol>EnterNotify</symbol>
event on window B, with the detail member of the
<type>XEnterWindowEvent</type>
structure set to 
<symbol>NotifyNonlinear</symbol>.
<!-- .RE -->
<!-- .\".SH 3 -->
    </para>
  </listitem>
</itemizedlist>
</sect2>
<sect2 id="Grab_and_Ungrab_Entry_Exit_Events">
<title>Grab and Ungrab Entry/Exit Events</title>
<!-- .XS -->
<!-- (SN Grab and Ungrab Entry/Exit Events -->
<!-- .XE -->
<para>
<!-- .LP -->
Pseudo-motion mode
<symbol>EnterNotify</symbol>
and
<symbol>LeaveNotify</symbol>
events are generated when a pointer grab activates or deactivates.
Events in which the pointer grab activates
are identified by
<type>XEnterWindowEvent</type>
or
<type>XLeaveWindowEvent</type>
structures whose mode member is set to 
<symbol>NotifyGrab</symbol>.
Events in which the pointer grab deactivates
are identified by
<type>XEnterWindowEvent</type>
or
<type>XLeaveWindowEvent</type>
structures whose mode member is set to 
<symbol>NotifyUngrab</symbol>
(see
<function>XGrabPointer</function>).
</para>
<itemizedlist>
  <listitem>
    <para>
When a pointer grab activates after any initial warp into a confine_to
window and before generating any actual
<symbol>ButtonPress</symbol>
event that activates the grab, 
G is the grab_window for the grab, 
and P is the window the pointer is in, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates
<symbol>EnterNotify</symbol>
and
<symbol>LeaveNotify</symbol>
events (see <link linkend="Normal_Entry_Exit_Events">section 10.6.1</link>)
with the mode members of the 
<type>XEnterWindowEvent</type>
and
<type>XLeaveWindowEvent</type>
structures set to 
<symbol>NotifyGrab</symbol>.
These events are generated
as if the pointer were to suddenly warp from
its current position in P to some position in G.
However, the pointer does not warp, and the X server uses the pointer position 
as both the initial and final positions for the events.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When a pointer grab deactivates after generating any actual
<symbol>ButtonRelease</symbol>
event that deactivates the grab, 
G is the grab_window for the grab,
and P is the window the pointer is in, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates
<symbol>EnterNotify</symbol>
and
<symbol>LeaveNotify</symbol>
events (see <link linkend="Normal_Entry_Exit_Events">section 10.6.1</link>)
with the mode members of the
<type>XEnterWindowEvent</type>
and
<type>XLeaveWindowEvent</type>
structures set to 
<symbol>NotifyUngrab</symbol>.
These events are generated as if the pointer were to suddenly warp from
some position in G to its current position in P.
However, the pointer does not warp, and the X server uses the
current pointer position as both the
initial and final positions for the events.
<!-- .RE -->
    </para>
  </listitem>
</itemizedlist>
</sect2>
</sect1>
<sect1 id="Input_Focus_Events">
<title>Input Focus Events</title>
<!-- .XS -->
<!-- (SN Input Focus Events  -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>FocusIn</secondary></indexterm>
<indexterm><primary>Events</primary><secondary>FocusOut</secondary></indexterm>
This section describes the processing that occurs for the input focus events
<symbol>FocusIn</symbol>
and
<symbol>FocusOut</symbol>.
<indexterm significance="preferred"><primary>FocusIn</primary></indexterm>
<indexterm significance="preferred"><primary>FocusOut</primary></indexterm>
The X server can report
<symbol>FocusIn</symbol>
or
<symbol>FocusOut</symbol>
events to clients wanting information about when the input focus changes.
The keyboard is always attached to some window 
(typically, the root window or a top-level window), 
which is called the focus window.
The focus window and the position of the pointer determine the window that
receives keyboard input.
Clients may need to know when the input focus changes
to control highlighting of areas on the screen.
</para>
<para>
<!-- .LP -->
To receive
<symbol>FocusIn</symbol>
or
<symbol>FocusOut</symbol>
events, set the
<symbol>FocusChangeMask</symbol>
bit in the event-mask attribute of the window. 
</para>
<para>
<!-- .LP -->
The structure for these event types contains:
</para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XFocusChangeEvent</primary></indexterm>
<indexterm significance="preferred"><primary>XFocusInEvent</primary></indexterm>
<indexterm significance="preferred"><primary>XFocusOutEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* FocusIn or FocusOut */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        window;     /* window of event */
     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
     int           detail;
                   /*
                    * NotifyAncestor, NotifyVirtual, NotifyInferior, 
                    * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
                    * NotifyPointerRoot, NotifyDetailNone 
                    */
} XFocusChangeEvent;
typedef XFocusChangeEvent XFocusInEvent;
typedef XFocusChangeEvent XFocusOutEvent;
</literallayout>
<para>
<!-- .LP -->
<!-- .eM -->
The window member is set to the window on which the
<symbol>FocusIn</symbol>
or
<symbol>FocusOut</symbol>
event was generated.
This is the window used by the X server to report the event. 
The mode member is set to indicate whether the focus events 
are normal focus events, 
focus events while grabbed,
focus events
when a grab activates, or focus events when a grab deactivates.
The X server can set the mode member to 
<symbol>NotifyNormal</symbol>,
<symbol>NotifyWhileGrabbed</symbol>,
<symbol>NotifyGrab</symbol>,
or
<symbol>NotifyUngrab</symbol>.
</para>
<para>
<!-- .LP -->
All 
<symbol>FocusOut</symbol>
events caused by a window unmap are generated after any
<symbol>UnmapNotify</symbol>
event; however, the X protocol does not constrain the ordering of 
<symbol>FocusOut</symbol>
events with respect to
generated 
<symbol>EnterNotify</symbol>,
<symbol>LeaveNotify</symbol>,
<symbol>VisibilityNotify</symbol>,
and
<symbol>Expose</symbol>
events.
</para>
<para>
<!-- .LP -->
Depending on the event mode,
the detail member is set to indicate the notify detail and can be
<symbol>NotifyAncestor</symbol>,
<symbol>NotifyVirtual</symbol>,
<symbol>NotifyInferior</symbol>,
<symbol>NotifyNonlinear</symbol>,
<symbol>NotifyNonlinearVirtual</symbol>,
<symbol>NotifyPointer</symbol>,
<symbol>NotifyPointerRoot</symbol>,
or
<symbol>NotifyDetailNone</symbol>.
</para>
<sect2 id="Normal_Focus_Events_and_Focus_Events_While_Grabbed_">
<title>Normal Focus Events and Focus Events While Grabbed </title>
<!-- .XS -->
<!-- (SN Normal Focus Events and Focus Events While Grabbed  -->
<!-- .XE -->
<para>
<!-- .LP -->
Normal focus events are identified by
<type>XFocusInEvent</type>
or
<type>XFocusOutEvent</type>
structures whose mode member is set to 
<symbol>NotifyNormal</symbol>.
Focus events while grabbed are identified by
<type>XFocusInEvent</type>
or
<type>XFocusOutEvent</type>
structures whose mode member is set to 
<symbol>NotifyWhileGrabbed</symbol>.
The X server processes normal focus and focus events while grabbed according to 
the following:
</para>
<itemizedlist>
  <listitem>
    <para>
When the focus moves from window A to window B, A is an inferior of B, 
and the pointer is in window P, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on window A, with the detail member of the
<type>XFocusOutEvent</type>
structure set to 
<symbol>NotifyAncestor</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on each window between window A and window B, exclusive,
with the detail member of each
<type>XFocusOutEvent</type>
structure set to 
<symbol>NotifyVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on window B, with the detail member of the 
<type>XFocusOutEvent</type>
structure set to 
<symbol>NotifyInferior</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window B
but window P is not window A or an inferior or ancestor of window A,
it generates a
<symbol>FocusIn</symbol>
event on each window below window B, down to and including window P, 
with the detail member of each 
<type>XFocusInEvent</type>
structure set to 
<symbol>NotifyPointer</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the focus moves from window A to window B, B is an inferior of A, 
and the pointer is in window P, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window A
but P is not an inferior of window B or an ancestor of B,
it generates a
<symbol>FocusOut</symbol>
event on each window from window P up to but not including window A,
with the detail member of each 
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyPointer</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on window A,
with the detail member of the
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyInferior</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on each window between window A and window B, exclusive, with the 
detail member of each 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on window B, with the detail member of the 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyAncestor</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the focus moves from window A to window B, 
window C is their least common ancestor, 
and the pointer is in window P, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window A,
it generates a
<symbol>FocusOut</symbol>
event on each window from window P up to but not including window A, 
with the detail member of the 
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyPointer</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on window A,
with the detail member of the
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on each window between window A and window C, exclusive,
with the detail member of each
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on each window between C and B, exclusive,
with the detail member of each
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on window B, with the detail member of the 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window B, it generates a
<symbol>FocusIn</symbol>
event on each window below window B down to and including window P, 
with the detail member of the 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyPointer</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the focus moves from window A to window B on different screens 
and the pointer is in window P, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window A, it generates a
<symbol>FocusOut</symbol>
event on each window from window P up to but not including window A, 
with the detail member of each 
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyPointer</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on window A,
with the detail member of the
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window A is not a root window,
it generates a
<symbol>FocusOut</symbol>
event on each window above window A up to and including its root, 
with the detail member of each
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window B is not a root window,
it generates a
<symbol>FocusIn</symbol>
event on each window from window B's root down to but not including
window B, with the detail member of each
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on window B, with the detail member of each 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window B, it generates a
<symbol>FocusIn</symbol>
event on each window below window B down to and including window P, 
with the detail member of each 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyPointer</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the focus moves from window A to 
<symbol>PointerRoot</symbol>
(events sent to the window under the pointer)
or
<symbol>None</symbol>
(discard), and the pointer is in window P,
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window A, it generates a
<symbol>FocusOut</symbol>
event on each window from window P up to but not including window A, 
with the detail member of each 
<type>XFocusOutEvent</type>
structure set to  
<symbol>NotifyPointer</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on window A, with the detail member of the
<type>XFocusOutEvent</type>
structure set to
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window A is not a root window,
it generates a
<symbol>FocusOut</symbol>
event on each window above window A up to and including its root, 
with the detail member of each
<type>XFocusOutEvent</type>
structure set to
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on the root window of all screens, with the detail member of each
<type>XFocusInEvent</type>
structure set to
<symbol>NotifyPointerRoot</symbol>
(or
<symbol>NotifyDetailNone</symbol>).
    </para>
  </listitem>
  <listitem>
    <para>
If the new focus is
<symbol>PointerRoot</symbol>,
it generates a
<symbol>FocusIn</symbol>
event on each window from window P's root down to and including window P, 
with the detail member of each
<type>XFocusInEvent</type>
structure set to
<symbol>NotifyPointer</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the focus moves from 
<symbol>PointerRoot</symbol>
(events sent to the window under the pointer)
or
<symbol>None</symbol>
to window A, and the pointer is in window P, 
the X server does the following: 
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
If the old focus is
<symbol>PointerRoot</symbol>,
it generates a
<symbol>FocusOut</symbol>
event on each window from window P up to and including window P's root, 
with the detail member of each
<type>XFocusOutEvent</type>
structure set to
<symbol>NotifyPointer</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on all root windows,
with the detail member of each
<type>XFocusOutEvent</type>
structure set to
<symbol>NotifyPointerRoot</symbol>
(or
<symbol>NotifyDetailNone</symbol>).
    </para>
  </listitem>
  <listitem>
    <para>
If window A is not a root window,
it generates a
<symbol>FocusIn</symbol>
event on each window from window A's root down to but not including window A,
with the detail member of each
<type>XFocusInEvent</type>
structure set to
<symbol>NotifyNonlinearVirtual</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on window A,
with the detail member of the 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyNonlinear</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If window P is an inferior of window A, it generates a
<symbol>FocusIn</symbol>
event on each window below window A down to and including window P, 
with the detail member of each 
<type>XFocusInEvent</type>
structure set to  
<symbol>NotifyPointer</symbol>.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When the focus moves from 
<symbol>PointerRoot</symbol>
(events sent to the window under the pointer)
to
<symbol>None</symbol>
(or vice versa), and the pointer is in window P, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
If the old focus is
<symbol>PointerRoot</symbol>,
it generates a
<symbol>FocusOut</symbol>
event on each window from window P up to and including window P's root, 
with the detail member of each
<type>XFocusOutEvent</type>
structure set to
<symbol>NotifyPointer</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusOut</symbol>
event on all root windows,
with the detail member of each 
<type>XFocusOutEvent</type>
structure set to either
<symbol>NotifyPointerRoot</symbol>
or
<symbol>NotifyDetailNone</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
It generates a
<symbol>FocusIn</symbol>
event on all root windows,
with the detail member of each
<type>XFocusInEvent</type>
structure set to
<symbol>NotifyDetailNone</symbol>
or
<symbol>NotifyPointerRoot</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
If the new focus is
<symbol>PointerRoot</symbol>,
it generates a
<symbol>FocusIn</symbol>
event on each window from window P's root down to and including window P, 
with the detail member of each
<type>XFocusInEvent</type>
structure set to
<symbol>NotifyPointer</symbol>.
<!-- .RE -->
<!-- .\".SH 3 -->
    </para>
  </listitem>
</itemizedlist>
</sect2>
<sect2 id="Focus_Events_Generated_by_Grabs">
<title>Focus Events Generated by Grabs</title>
<!-- .XS -->
<!-- (SN Focus Events Generated by Grabs  -->
<!-- .XE -->
<para>
<!-- .LP -->
Focus events in which the keyboard grab activates
are identified by
<type>XFocusInEvent</type>
or
<type>XFocusOutEvent</type>
structures whose mode member is set to 
<symbol>NotifyGrab</symbol>.
Focus events in which the keyboard grab deactivates
are identified by
<type>XFocusInEvent</type>
or
<type>XFocusOutEvent</type>
structures whose mode member is set to 
<symbol>NotifyUngrab</symbol>
(see 
<function>XGrabKeyboard</function>).
</para>
<itemizedlist>
  <listitem>
    <para>
When a keyboard grab activates before generating any actual 
<symbol>KeyPress</symbol>
event that activates the grab,
G is the grab_window, and F is the current focus, 
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates 
<symbol>FocusIn</symbol>
and
<symbol>FocusOut</symbol>
events, with the mode members of the 
<type>XFocusInEvent</type>
and
<type>XFocusOutEvent</type>
structures set to 
<symbol>NotifyGrab</symbol>.
These events are generated
as if the focus were to change from
F to G.
<!-- .RE -->
    </para>
  </listitem>
  <listitem>
    <para>
When a keyboard grab deactivates after generating any actual
<symbol>KeyRelease</symbol>
event that deactivates the grab,
G is the grab_window, and F is the current focus,
the X server does the following:
<!-- .RS -->
    </para>
  </listitem>
  <listitem>
    <para>
It generates 
<symbol>FocusIn</symbol>
and
<symbol>FocusOut</symbol>
events, with the mode members of the 
<type>XFocusInEvent</type>
and
<type>XFocusOutEvent</type>
structures set to
<symbol>NotifyUngrab</symbol>.
These events are generated
as if the focus were to change from
G to F.
<!-- .RE -->
    </para>
  </listitem>
</itemizedlist>
</sect2>
</sect1>
<sect1 id="Key_Map_State_Notification_Events">
<title>Key Map State Notification Events</title>
<!-- .XS -->
<!-- (SN Key Map State Notification Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>KeymapNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>KeymapNotify</primary></indexterm>
The X server can report
<symbol>KeymapNotify</symbol>
events to clients that want information about changes in their keyboard state.
</para>
<para>
<!-- .LP -->
To receive
<symbol>KeymapNotify</symbol>
events, set the
<symbol>KeymapStateMask</symbol>
bit in the event-mask attribute of the window. 
The X server generates this event immediately after every
<symbol>EnterNotify</symbol>
and
<symbol>FocusIn</symbol>
event.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XKeymapEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
/* generated on EnterWindow and FocusIn when KeymapState selected */
typedef struct {
     int            type;           /* KeymapNotify */
     unsigned long  serial;         /* # of last request processed by server */
     Bool           send_event;     /* true if this came from a SendEvent request */
     Display        *display;       /* Display the event was read from */
     Window         window;
     char           key_vector[32];
} XKeymapEvent;     
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The window member is not used but is present to aid some toolkits.
The key_vector member is set to the bit vector of the keyboard.
Each bit set to 1 indicates that the corresponding key 
is currently pressed.
The vector is represented as 32 bytes.
Byte N (from 0) contains the bits for keys 8N to 8N + 7 
with the least significant bit in the byte representing key 8N.
</para>
</sect1>
<sect1 id="Exposure_Events">
<title>Exposure Events</title>
<!-- .XS -->
<!-- (SN Exposure Events -->
<!-- .XE -->
<para>
<!-- .LP -->
The X protocol does not guarantee to preserve the contents of window 
regions when
the windows are obscured or reconfigured.
Some implementations may preserve the contents of windows.
Other implementations are free to destroy the contents of windows
when exposed.
X expects client applications to assume the responsibility for
restoring the contents of an exposed window region. 
(An exposed window region describes a formerly obscured window whose 
region becomes visible.) 
Therefore, the X server sends 
<symbol>Expose</symbol>
events describing the window and the region of the window that has been exposed.
A naive client application usually redraws the entire window. 
A more sophisticated client application redraws only the exposed region.
</para>
<sect2 id="Expose_Events">
<title>Expose Events</title>
<!-- .XS -->
<!-- (SN Expose Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>Expose</secondary></indexterm>
<indexterm significance="preferred"><primary>Expose</primary></indexterm>
The X server can report
<symbol>Expose</symbol>
events to clients wanting information about when the contents of window regions
have been lost.
The circumstances in which the X server generates
<symbol>Expose</symbol>
events are not as definite as those for other events.
However, the X server never generates
<symbol>Expose</symbol>
events on windows whose class you specified as
<symbol>InputOnly</symbol>.
The X server can generate
<symbol>Expose</symbol>
events when no valid contents are available for regions of a window
and either the regions are visible, 
the regions are viewable and the server is (perhaps newly) maintaining 
backing store on the window,
or the window is not viewable but the server is (perhaps newly) honoring the
window's backing-store attribute of
<symbol>Always</symbol>
or
<symbol>WhenMapped</symbol>.
The regions decompose into an (arbitrary) set of rectangles,
and an
<symbol>Expose</symbol>
event is generated for each rectangle.
For any given window,
the X server guarantees to report contiguously 
all of the regions exposed by some action that causes 
<symbol>Expose</symbol>
events, such as raising a window.
</para>
<para>
<!-- .LP -->
To receive
<symbol>Expose</symbol>
events, set the
<symbol>ExposureMask</symbol>
bit in the event-mask attribute of the window. 
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XExposeEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;           /* Expose */
     unsigned long serial;         /* # of last request processed by server */
     Bool          send_event;     /* true if this came from a SendEvent request */
     Display       *display;       /* Display the event was read from */
     Window        window;
     int           x, y;
     int           width, height;
     int           count;          /* if nonzero, at least this many more */
} XExposeEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The window member is set to the exposed (damaged) window.
The x and y members are set to the coordinates relative to the window's origin
and indicate the upper-left corner of the rectangle.
The width and height members are set to the size (extent) of the rectangle.
The count member is set to the number of
<symbol>Expose</symbol>
events that are to follow.
If count is zero, no more
<symbol>Expose</symbol>
events follow for this window.
However, if count is nonzero, at least that number of 
<symbol>Expose</symbol>
events (and possibly more) follow for this window.
Simple applications that do not want to optimize redisplay by distinguishing
between subareas of its window can just ignore all
<symbol>Expose</symbol>
events with nonzero counts and perform full redisplays
on events with zero counts.
</para>
</sect2>
<sect2 id="GraphicsExpose_and_NoExpose_Events">
<title>GraphicsExpose and NoExpose Events</title>
<!-- .XS -->
<!-- (SN GraphicsExpose and NoExpose Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>GraphicsExpose</secondary></indexterm>
<indexterm><primary>Events</primary><secondary>NoExpose</secondary></indexterm>
<indexterm significance="preferred"><primary>GraphicsExpose</primary></indexterm>
The X server can report
<symbol>GraphicsExpose</symbol>
events to clients wanting information about when a destination region could not
be computed during certain graphics requests:
<function>XCopyArea</function>
or
<function>XCopyPlane</function>.
The X server generates this event whenever a destination region could not be
computed because of an obscured or out-of-bounds source region.
In addition, the X server guarantees to report contiguously all of the regions exposed by
some graphics request 
(for example, copying an area of a drawable to a destination
drawable).
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>NoExpose</primary></indexterm>
The X server generates a
<symbol>NoExpose</symbol>
event whenever a graphics request that might
produce a
<symbol>GraphicsExpose</symbol>
event does not produce any.
In other words, the client is really asking for a
<symbol>GraphicsExpose</symbol>
event but instead receives a
<symbol>NoExpose</symbol>
event.
</para>
<para>
<!-- .LP -->
To receive
<symbol>GraphicsExpose</symbol>
or
<symbol>NoExpose</symbol>
events, you must first set the graphics-exposure 
attribute of the graphics context to
<symbol>True</symbol>.
You also can set the graphics-expose attribute when creating a graphics
context using
<function>XCreateGC</function>
or by calling
<function>XSetGraphicsExposures</function>.
</para>
<para>
<!-- .LP -->
The structures for these event types contain:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XGraphicsExposeEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int            type;           /* GraphicsExpose */
     unsigned long  serial;         /* # of last request processed by server */
     Bool           send_event;     /* true if this came from a SendEvent request */
     Display        *display;       /* Display the event was read from */
     Drawable       drawable;
     int            x, y;
     int            width, height;
     int            count;          /* if nonzero, at least this many more */
     int            major_code;     /* core is CopyArea or CopyPlane */
     int            minor_code;     /* not defined in the core */
} XGraphicsExposeEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XNoExposeEvent</primary></indexterm>
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;         /* NoExpose */
     unsigned long serial;       /* # of last request processed by server */
     Bool          send_event;   /* true if this came from a SendEvent request */
     Display       *display;     /* Display the event was read from */
     Drawable      drawable;
     int           major_code;   /* core is CopyArea or CopyPlane */
     int           minor_code;   /* not defined in the core */
} XNoExposeEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
Both structures have these common members: drawable, major_code, and minor_code.
The drawable member is set to the drawable of the destination region on 
which the graphics request was to be performed.
The major_code member is set to the graphics request initiated by the client
and can be either
<symbol>X_CopyArea</symbol>
or
<symbol>X_CopyPlane</symbol>.
If it is
<symbol>X_CopyArea</symbol>,
a call to
<function>XCopyArea</function>
initiated the request.
If it is
<symbol>X_CopyPlane</symbol>,
a call to
<function>XCopyPlane</function>
initiated the request.
These constants are defined in 
<filename class="headerfile">&lt;X11/Xproto.h&gt;</filename>.
<indexterm type="file"><primary><filename class="headerfile">X11/Xproto.h</filename></primary></indexterm>
<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/Xproto.h&gt;</filename></secondary></indexterm>
<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/Xproto.h&gt;</filename></secondary></indexterm>
The minor_code member,
like the major_code member, 
indicates which graphics request was initiated by
the client. 
However, the minor_code member is not defined by the core
X protocol and will be zero in these cases, 
although it may be used by an extension.
</para>
<para>
<!-- .LP -->
The 
<structname>XGraphicsExposeEvent</structname>
structure has these additional members: x, y, width, height, and count. 
The x and y members are set to the coordinates relative to the drawable's origin
and indicate the upper-left corner of the rectangle.
The width and height members are set to the size (extent) of the rectangle.
The count member is set to the number of
<symbol>GraphicsExpose</symbol>
events to follow.
If count is zero, no more
<symbol>GraphicsExpose</symbol>
events follow for this window.
However, if count is nonzero, at least that number of
<symbol>GraphicsExpose</symbol>
events (and possibly more) are to follow for this window.
</para>
</sect2>
</sect1>
<sect1 id="Window_State_Change_Events_">
<title>Window State Change Events </title>
<!-- .XS -->
<!-- (SN Window State Change Events -->
<!-- .XE -->
<para>
<!-- .LP -->
The following sections discuss:
</para>
<itemizedlist>
  <listitem>
    <para>
<symbol>CirculateNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>ConfigureNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>CreateNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>DestroyNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>GravityNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>MapNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>MappingNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>ReparentNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>UnmapNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>VisibilityNotify</symbol>
events
<!-- .\" .SH 3 -->
    </para>
  </listitem>
</itemizedlist>
<sect2 id="CirculateNotify_Events">
<title>CirculateNotify Events</title>
<!-- .XS -->
<!-- (SN CirculateNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>CirculateNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>CirculateNotify</primary></indexterm>
The X server can report
<symbol>CirculateNotify</symbol>
events to clients wanting information about when a window changes 
its position in the stack.
The X server generates this event type whenever a window is actually restacked 
as a result of a client application calling
<function>XCirculateSubwindows</function>,
<function>XCirculateSubwindowsUp</function>,
or
<function>XCirculateSubwindowsDown</function>.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>CirculateNotify</symbol>
events, set the
<symbol>StructureNotifyMask</symbol>
bit in the event-mask attribute of the window
or the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of the parent window
(in which case, circulating any child generates an event).
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XCirculateEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int type;     /* CirculateNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool send_event;     /* true if this came from a SendEvent request */
     Display *display;     /* Display the event was read from */
     Window event;
     Window window;
     int place;     /* PlaceOnTop, PlaceOnBottom */
} XCirculateEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The event member is set either to the restacked window or to its parent,
depending on whether
<systemitem class="event">StructureNotify</systemitem>
or
<systemitem class="event">SubstructureNotify</systemitem>
was selected.
The window member is set to the window that was restacked.
The place member is set to the window's position after the restack occurs and
is either
<symbol>PlaceOnTop</symbol>
or
<symbol>PlaceOnBottom</symbol>.
If it is
<symbol>PlaceOnTop</symbol>,
the window is now on top of all siblings.
If it is
<symbol>PlaceOnBottom</symbol>,
the window is now below all siblings.
</para>
</sect2>
<sect2 id="ConfigureNotify_Events">
<title>ConfigureNotify Events</title>
<!-- .XS -->
<!-- (SN ConfigureNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>ConfigureNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>ConfigureNotify</primary></indexterm>
The X server can report
<symbol>ConfigureNotify</symbol>
events to clients wanting information about actual changes to a window's
state, such as size, position, border, and stacking order.
The X server generates this event type whenever one of the following configure 
window requests made by a client application actually completes:
</para>
<itemizedlist>
  <listitem>
    <para>
A window's size, position, border, and/or stacking order is reconfigured 
by calling
<function>XConfigureWindow</function>.
    </para>
  </listitem>
  <listitem>
    <para>
The window's position in the stacking order is changed by calling
<function>XLowerWindow</function>,
<function>XRaiseWindow</function>,
or
<function>XRestackWindows</function>.
    </para>
  </listitem>
  <listitem>
    <para>
A window is moved by calling
<function>XMoveWindow</function>.
    </para>
  </listitem>
  <listitem>
    <para>
A window's size is changed by calling
<function>XResizeWindow</function>.
    </para>
  </listitem>
  <listitem>
    <para>
A window's size and location is changed by calling
<function>XMoveResizeWindow</function>.
    </para>
  </listitem>
  <listitem>
    <para>
A window is mapped and its position in the stacking order is changed
by calling
<function>XMapRaised</function>.
    </para>
  </listitem>
  <listitem>
    <para>
A window's border width is changed by calling
<function>XSetWindowBorderWidth</function>.
    </para>
  </listitem>
</itemizedlist>
<para>
<!-- .LP -->
To receive 
<symbol>ConfigureNotify</symbol>
events, set the
<symbol>StructureNotifyMask</symbol>
bit in the event-mask attribute of the window or the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of the parent window
(in which case, configuring any child generates an event).
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XConfigureEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* ConfigureNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        event;
     Window        window;
     int           x, y;
     int           width, height;
     int           border_width;
     Window        above;
     Bool          override_redirect;
} XConfigureEvent;
</literallayout>
<para>
<!-- .LP -->
<!-- .eM -->
The event member is set either to the reconfigured window or to its parent,
depending on whether
<systemitem class="event">StructureNotify</systemitem>
or
<systemitem class="event">SubstructureNotify</systemitem>
was selected.
The window member is set to the window whose size, position, 
border, and/or stacking
order was changed.
</para>
<para>
<!-- .LP -->
The x and y members are set to the coordinates relative to the parent window's 
origin and indicate the position of the upper-left outside corner of the window.
The width and height members are set to the inside size of the window, 
not including
the border.
The border_width member is set to the width of the window's border, in pixels.
</para>
<para>
<!-- .LP -->
The above member is set to the sibling window and is used 
for stacking operations.
If the X server sets this member to
<symbol>None</symbol>,
the window whose state was changed is on the bottom of the stack
with respect to sibling windows.
However, if this member is set to a sibling window, 
the window whose state was changed is placed on top of this sibling window.
</para>
<para>
<!-- .LP -->
The override_redirect member is set to the override-redirect attribute of the
window.
Window manager clients normally should ignore this window if the 
override_redirect member
is
<symbol>True</symbol>.
</para>
</sect2>
<sect2 id="CreateNotify_Events">
<title>CreateNotify Events</title>
<!-- .XS -->
<!-- (SN CreateNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>CreateNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>CreateNotify</primary></indexterm>
The X server can report
<symbol>CreateNotify</symbol>
events to clients wanting information about creation of windows.
The X server generates this event whenever a client
application creates a window by calling
<function>XCreateWindow</function>
or
<function>XCreateSimpleWindow</function>.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>CreateNotify</symbol>
events, set the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of the window.
Creating any children then generates an event.
</para>
<para>
<!-- .LP -->
The structure for the event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XCreateWindowEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;               /* CreateNotify */
     unsigned long serial;             /* # of last request processed by server */
     Bool          send_event;         /* true if this came from a SendEvent request */
     Display       *display;           /* Display the event was read from */
     Window        parent;             /* parent of the window */
     Window        window;             /* window id of window created */
     int           x, y;               /* window location */
     int           width, height;      /* size of window */
     int           border_width;       /* border width */
     Bool          override_redirect;  /* creation should be overridden */
} XCreateWindowEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The parent member is set to the created window's parent.
The window member specifies the created window.
The x and y members are set to the created window's coordinates relative 
to the parent window's origin and indicate the position of the upper-left 
outside corner of the created window.
The width and height members are set to the inside size of the created window 
(not including the border) and are always nonzero.
The border_width member is set to the width of the created window's border, in pixels.
The override_redirect member is set to the override-redirect attribute of the
window.
Window manager clients normally should ignore this window 
if the override_redirect member is
<symbol>True</symbol>.
</para>
</sect2>
<sect2 id="DestroyNotify_Events">
<title>DestroyNotify Events</title>
<!-- .XS -->
<!-- (SN DestroyNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>DestroyNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>DestroyNotify</primary></indexterm>
The X server can report
<symbol>DestroyNotify</symbol>
events to clients wanting information about which windows are destroyed.
The X server generates this event whenever a client application destroys a 
window by calling
<function>XDestroyWindow</function>
or
<function>XDestroySubwindows</function>.
</para>
<para>
<!-- .LP -->
The ordering of the 
<symbol>DestroyNotify</symbol>
events is such that for any given window, 
<symbol>DestroyNotify</symbol>
is generated on all inferiors of the window
before being generated on the window itself.  
The X protocol does not constrain the ordering among
siblings and across subhierarchies.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>DestroyNotify</symbol>
events, set the
<symbol>StructureNotifyMask</symbol>
bit in the event-mask attribute of the window or the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of the parent window
(in which case, destroying any child generates an event).
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XDestroyWindowEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* DestroyNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        event;
     Window        window;
} XDestroyWindowEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The event member is set either to the destroyed window or to its parent,
depending on whether
<systemitem class="event">StructureNotify</systemitem>
or 
<systemitem class="event">SubstructureNotify</systemitem>
was selected.
The window member is set to the window that is destroyed.
</para>
</sect2>
<sect2 id="GravityNotify_Events">
<title>GravityNotify Events</title>
<!-- .XS -->
<!-- (SN GravityNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>GravityNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>GravityNotify</primary></indexterm>
The X server can report
<symbol>GravityNotify</symbol>
events to clients wanting information about when a window is moved because of a
change in the size of its parent.
The X server generates this event whenever a client
application actually moves a child window as a result of resizing its parent by calling
<function>XConfigureWindow</function>,
<function>XMoveResizeWindow</function>,
or
<function>XResizeWindow</function>.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>GravityNotify</symbol>
events, set the
<symbol>StructureNotifyMask</symbol>
bit in the event-mask attribute of the window or the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of the parent window
(in which case, any child that is moved because its parent has been resized
generates an event).
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XGravityEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* GravityNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        event;
     Window        window;
     int           x, y;
} XGravityEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The event member is set either to the window that was moved or to its parent,
depending on whether
<systemitem class="event">StructureNotify</systemitem>
or
<systemitem class="event">SubstructureNotify</systemitem>
was selected.
The window member is set to the child window that was moved.
The x and y members are set to the coordinates relative to the 
new parent window's origin
and indicate the position of the upper-left outside corner of the 
window.
</para>
</sect2>
<sect2 id="MapNotify_Events">
<title>MapNotify Events</title>
<!-- .XS -->
<!-- (SN MapNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>MapNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>MapNotify</primary></indexterm>
The X server can report
<symbol>MapNotify</symbol>
events to clients wanting information about which windows are mapped.
The X server generates this event type whenever a client application changes the
window's state from unmapped to mapped by calling
<function>XMapWindow</function>,
<function>XMapRaised</function>,
<function>XMapSubwindows</function>,
<function>XReparentWindow</function>,
or as a result of save-set processing.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>MapNotify</symbol>
events, set the
<symbol>StructureNotifyMask</symbol>
bit in the event-mask attribute of the window or the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of the parent window
(in which case, mapping any child generates an event).
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XMapEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;                  /* MapNotify */
     unsigned long serial;                /* # of last request processed by server */
     Bool          send_event;            /* true if this came from a SendEvent request */
     Display       *display;              /* Display the event was read from */
     Window        event;
     Window        window;
     Bool          override_redirect;     /* boolean, is override set... */
} XMapEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The event member is set either to the window that was mapped or to its parent,
depending on whether
<systemitem class="event">StructureNotify</systemitem>
or
<systemitem class="event">SubstructureNotify</systemitem>
was selected.
The window member is set to the window that was mapped.
The override_redirect member is set to the override-redirect attribute
of the window.
Window manager clients normally should ignore this window 
if the override-redirect attribute is
<symbol>True</symbol>,
because these events usually are generated from pop-ups,
which override structure control.
</para>
</sect2>
<sect2 id="MappingNotify_Events">
<title>MappingNotify Events</title>
<!-- .XS -->
<!-- (SN MappingNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>MappingNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>MappingNotify</primary></indexterm>
The X server reports
<symbol>MappingNotify</symbol>
events to all clients.
There is no mechanism to express disinterest in this event.
The X server generates this event type whenever a client application 
successfully calls:
</para>
<itemizedlist>
  <listitem>
    <para>
<function>XSetModifierMapping</function>
to indicate which KeyCodes are to be used as modifiers
    </para>
  </listitem>
  <listitem>
    <para>
<function>XChangeKeyboardMapping</function>
to change the keyboard mapping
    </para>
  </listitem>
  <listitem>
    <para>
<function>XSetPointerMapping</function>
to set the pointer mapping
    </para>
  </listitem>
</itemizedlist>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XMappingEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;           /* MappingNotify */
     unsigned long serial;         /* # of last request processed by server */
     Bool          send_event;     /* true if this came from a SendEvent request */
     Display       *display;       /* Display the event was read from */
     Window        window;         /* unused */
     int           request;        /* one of MappingModifier, MappingKeyboard,
                   MappingPointer  */
     int           first_keycode;  /* first keycode */
     int           count;          /* defines range of change w. first_keycode*/
} XMappingEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The request member is set to indicate the kind of mapping change that occurred
and can be
<symbol>MappingModifier</symbol>,
<symbol>MappingKeyboard</symbol>,
or
<symbol>MappingPointer</symbol>.
If it is
<symbol>MappingModifier</symbol>,
the modifier mapping was changed.
If it is
<symbol>MappingKeyboard</symbol>,
the keyboard mapping was changed.
If it is
<symbol>MappingPointer</symbol>,
the pointer button mapping was changed. 
The first_keycode and count members are set only 
if the request member was set to
<symbol>MappingKeyboard</symbol>.
The number in first_keycode represents the first number in the range 
of the altered mapping, 
and count represents the number of keycodes altered.
</para>
<para>
<!-- .LP -->
To update the client application's knowledge of the keyboard,
you should call
<function>XRefreshKeyboardMapping</function>.
</para>
</sect2>
<sect2 id="ReparentNotify_Events">
<title>ReparentNotify Events</title>
<!-- .XS -->
<!-- (SN ReparentNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>ReparentNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>ReparentNotify</primary></indexterm>
The X server can report
<symbol>ReparentNotify</symbol>
events to clients wanting information about changing a window's parent.
The X server generates this event whenever a client
application calls
<function>XReparentWindow</function>
and the window is actually reparented.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>ReparentNotify</symbol>
events, set the
<symbol>StructureNotifyMask</symbol>
bit in the event-mask attribute of the window or the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of either the old or the new parent window
(in which case, reparenting any child generates an event).
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XReparentEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* ReparentNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        event;
     Window        window;
     Window        parent;
     int           x, y;
     Bool          override_redirect;
} XReparentEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The event member is set either to the reparented window
or to the old or the new parent, depending on whether
<systemitem class="event">StructureNotify</systemitem>
or
<systemitem class="event">SubstructureNotify</systemitem>
was selected. 
The window member is set to the window that was reparented.
The parent member is set to the new parent window.
The x and y members are set to the reparented window's coordinates relative 
to the new parent window's
origin and define the upper-left outer corner of the reparented window.
The override_redirect member is set to the override-redirect attribute of the
window specified by the window member.
Window manager clients normally should ignore this window 
if the override_redirect member is
<symbol>True</symbol>.
</para>
</sect2>
<sect2 id="UnmapNotify_Events">
<title>UnmapNotify Events</title>
<!-- .XS -->
<!-- (SN UnmapNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>UnmapNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>UnmapNotify</primary></indexterm>
The X server can report
<symbol>UnmapNotify</symbol>
events to clients wanting information about which windows are unmapped.
The X server generates this event type whenever a client application changes the
window's state from mapped to unmapped.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>UnmapNotify</symbol>
events, set the
<symbol>StructureNotifyMask</symbol>
bit in the event-mask attribute of the window or the
<symbol>SubstructureNotifyMask</symbol>
bit in the event-mask attribute of the parent window
(in which case, unmapping any child window generates an event).
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XUnmapEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* UnmapNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        event;
     Window        window;
     Bool          from_configure;
} XUnmapEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The event member is set either to the unmapped window or to its parent,
depending on whether
<systemitem class="event">StructureNotify</systemitem>
or
<systemitem class="event">SubstructureNotify</systemitem>
was selected.
This is the window used by the X server to report the event.
The window member is set to the window that was unmapped.
The from_configure member is set to
<symbol>True</symbol>
if the event was generated as a result of a resizing of the window's parent when
the window itself had a win_gravity of
<symbol>UnmapGravity</symbol>.
</para>
</sect2>
<sect2 id="VisibilityNotify_Events">
<title>VisibilityNotify Events</title>
<!-- .XS -->
<!-- (SN VisibilityNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>VisibilityNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>VisibilityNotify</primary></indexterm>
The X server can report
<symbol>VisibilityNotify</symbol>
events to clients wanting any change in the visibility of the specified window.
A region of a window is visible if someone looking at the screen can
actually see it.
The X server generates this event whenever the visibility changes state. 
However, this event is never generated for windows whose class is
<symbol>InputOnly</symbol>.
</para>
<para>
<!-- .LP -->
All 
<symbol>VisibilityNotify</symbol>
events caused by a hierarchy change are generated
after any hierarchy event
(<symbol>UnmapNotify</symbol>,
<symbol>MapNotify</symbol>,
<symbol>ConfigureNotify</symbol>,
<symbol>GravityNotify</symbol>,
<symbol>CirculateNotify</symbol>)
caused by that change.  Any
<symbol>VisibilityNotify</symbol>
event on a given window is generated before any
<symbol>Expose</symbol>
events on that window, but it is not required that all
<symbol>VisibilityNotify</symbol>
events on all windows be generated before all 
<symbol>Expose</symbol>
events on all windows.  
The X protocol does not constrain the ordering of 
<symbol>VisibilityNotify</symbol>
events with
respect to 
<symbol>FocusOut</symbol>,
<symbol>EnterNotify</symbol>,
and 
<symbol>LeaveNotify</symbol>
events.
</para>
<para>
<!-- .LP -->
To receive 
<symbol>VisibilityNotify</symbol>
events, set the
<symbol>VisibilityChangeMask</symbol>
bit in the event-mask attribute of the window. 
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XVisibilityEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* VisibilityNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        window;
     int           state;
} XVisibilityEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The window member is set to the window whose visibility state changes.
The state member is set to the state of the window's visibility and can be
<symbol>VisibilityUnobscured</symbol>,
<symbol>VisibilityPartiallyObscured</symbol>,
or
<symbol>VisibilityFullyObscured</symbol>.
The X server ignores all of a window's subwindows
when determining the visibility state of the window and processes 
<symbol>VisibilityNotify</symbol>
events according to the following:
</para>
<itemizedlist>
  <listitem>
    <para>
When the window changes state from partially obscured, fully obscured,
or not viewable to viewable and completely unobscured,
the X server generates the event with the state member of the
<structname>XVisibilityEvent</structname>
structure set to
<symbol>VisibilityUnobscured</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
When the window changes state from viewable and completely unobscured or 
not viewable to viewable and partially obscured,
the X server generates the event with the state member of the
<structname>XVisibilityEvent</structname>
structure set to
<symbol>VisibilityPartiallyObscured</symbol>.
    </para>
  </listitem>
  <listitem>
    <para>
When the window changes state from viewable and completely unobscured, 
viewable and partially obscured, or not viewable to viewable and 
fully obscured,
the X server generates the event with the state member of the
<structname>XVisibilityEvent</structname>
structure set to
<symbol>VisibilityFullyObscured</symbol>.
    </para>
  </listitem>
</itemizedlist>
</sect2>
</sect1>
<sect1 id="Structure_Control_Events">
<title>Structure Control Events</title>
<!-- .XS -->
<!-- (SN Structure Control Events -->
<!-- .XE -->
<para>
<!-- .LP -->
This section discusses:
</para>
<itemizedlist>
  <listitem>
    <para>
<symbol>CirculateRequest</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>ConfigureRequest</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>MapRequest</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>ResizeRequest</symbol>
events
    </para>
  </listitem>
</itemizedlist>
<sect2 id="CirculateRequest_Events">
<title>CirculateRequest Events</title>
<!-- .XS -->
<!-- (SN CirculateRequest Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>CirculateRequest</secondary></indexterm>
<indexterm significance="preferred"><primary>CirculateRequest</primary></indexterm>
The X server can report
<symbol>CirculateRequest</symbol>
events to clients wanting information about 
when another client initiates a circulate window request 
on a specified window.
The X server generates this event type whenever a client initiates a circulate
window request on a window and a subwindow actually needs to be restacked. 
The client initiates a circulate window request on the window by calling
<function>XCirculateSubwindows</function>,
<function>XCirculateSubwindowsUp</function>,
or
<function>XCirculateSubwindowsDown</function>.
</para>
<para>
<!-- .LP -->
To receive
<symbol>CirculateRequest</symbol>
events, set the
<symbol>SubstructureRedirectMask</symbol>
in the event-mask attribute of the window. 
Then, in the future,
the circulate window request for the specified window is not executed,
and thus, any subwindow's position in the stack is not changed.
For example, suppose a client application calls
<function>XCirculateSubwindowsUp</function>
to raise a subwindow to the top of the stack.
If you had selected
<symbol>SubstructureRedirectMask</symbol>
on the window, the X server reports to you a
<symbol>CirculateRequest</symbol>
event and does not raise the subwindow to the top of the stack.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XCirculateRequestEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* CirculateRequest */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        parent;
     Window        window;
     int place;                /* PlaceOnTop, PlaceOnBottom */
} XCirculateRequestEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The parent member is set to the parent window.
The window member is set to the subwindow to be restacked.
The place member is set to what the new position in the stacking order should be
and is either
<symbol>PlaceOnTop</symbol>
or
<symbol>PlaceOnBottom</symbol>.
If it is
<symbol>PlaceOnTop</symbol>,
the subwindow should be on top of all siblings.
If it is
<symbol>PlaceOnBottom</symbol>,
the subwindow should be below all siblings.
</para>
</sect2>
<sect2 id="ConfigureRequest_Events">
<title>ConfigureRequest Events</title>
<!-- .XS -->
<!-- (SN ConfigureRequest Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>ConfigureRequest</secondary></indexterm>
<indexterm significance="preferred"><primary>ConfigureRequest</primary></indexterm>
The X server can report
<symbol>ConfigureRequest</symbol>
events to clients wanting information about when a different client initiates 
a configure window request on any child of a specified window. 
The configure window request attempts to 
reconfigure a window's size, position, border, and stacking order.
The X server generates this event whenever a different client initiates
a configure window request on a window by calling
<function>XConfigureWindow</function>,
<function>XLowerWindow</function>,
<function>XRaiseWindow</function>,
<function>XMapRaised</function>,
<function>XMoveResizeWindow</function>,
<function>XMoveWindow</function>,
<function>XResizeWindow</function>,
<function>XRestackWindows</function>,
or
<function>XSetWindowBorderWidth</function>.
</para>
<para>
<!-- .LP -->
To receive
<symbol>ConfigureRequest</symbol>
events, set the
<symbol>SubstructureRedirectMask</symbol>
bit in the event-mask attribute of the window. 
<symbol>ConfigureRequest</symbol>
events are generated when a
<systemitem>ConfigureWindow</systemitem>
protocol request is issued on a child window by another client.
For example, suppose a client application calls
<function>XLowerWindow</function>
to lower a window.
If you had selected
<symbol>SubstructureRedirectMask</symbol>
on the parent window and if the override-redirect attribute 
of the window is set to
<symbol>False</symbol>,
the X server reports a
<symbol>ConfigureRequest</symbol>
event to you and does not lower the specified window.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XConfigureRequestEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;         /* ConfigureRequest */
     unsigned long serial;       /* # of last request processed by server */
     Bool          send_event;   /* true if this came from a SendEvent request */
     Display       *display;     /* Display the event was read from */
     Window        parent;
     Window        window;
     int           x, y;
     int           width, height;
     int           border_width;
     Window        above;
     int           detail;       /* Above, Below, TopIf, BottomIf, Opposite */
     unsigned long value_mask;
} XConfigureRequestEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The parent member is set to the parent window.
The window member is set to the window whose size, position, border width, 
and/or stacking order is to be reconfigured.
The value_mask member indicates which components were specified in the
<systemitem>ConfigureWindow</systemitem>
protocol request.
The corresponding values are reported as given in the request.
The remaining values are filled in from the current geometry of the window,
except in the case of above (sibling) and detail (stack-mode),
which are reported as
<symbol>None</symbol>
and
<symbol>Above</symbol>,
respectively, if they are not given in the request.
</para>
</sect2>
<sect2 id="MapRequest_Events">
<title>MapRequest Events</title>
<!-- .XS -->
<!-- (SN MapRequest Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>MapRequest</secondary></indexterm>
<indexterm significance="preferred"><primary>MapRequest</primary></indexterm>
The X server can report
<symbol>MapRequest</symbol>
events to clients wanting information about a different client's desire 
to map windows.
A window is considered mapped when a map window request completes.
The X server generates this event whenever a different client initiates 
a map window request on an unmapped window whose override_redirect member 
is set to
<symbol>False</symbol>.
Clients initiate map window requests by calling
<function>XMapWindow</function>,
<function>XMapRaised</function>,
or
<function>XMapSubwindows</function>.
</para>
<para>
<!-- .LP -->
To receive
<symbol>MapRequest</symbol>
events, set the
<symbol>SubstructureRedirectMask</symbol>
bit in the event-mask attribute of the window. 
This means another client's attempts to map a child window by calling one of
the map window request functions is intercepted, and you are sent a 
<symbol>MapRequest</symbol>
instead.
For example, suppose a client application calls
<function>XMapWindow</function>
to map a window.
If you (usually a window manager) had selected
<symbol>SubstructureRedirectMask</symbol>
on the parent window and if the override-redirect attribute 
of the window is set to
<symbol>False</symbol>,
the X server reports a
<symbol>MapRequest</symbol>
event to you 
and does not map the specified window.
Thus, this event gives your window manager client the ability 
to control the placement of subwindows.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XMapRequestEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* MapRequest */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        parent;
     Window        window;
} XMapRequestEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The parent member is set to the parent window.
The window member is set to the window to be mapped.
</para>
</sect2>
<sect2 id="ResizeRequest_Events">
<title>ResizeRequest Events</title>
<!-- .XS -->
<!-- (SN ResizeRequest Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>ResizeRequest</secondary></indexterm>
<indexterm significance="preferred"><primary>ResizeRequest</primary></indexterm>
The X server can report
<symbol>ResizeRequest</symbol>
events to clients wanting information about another client's attempts to change the
size of a window.
The X server generates this event whenever some other client attempts to change
the size of the specified window by calling
<function>XConfigureWindow</function>,
<function>XResizeWindow</function>,
or
<function>XMoveResizeWindow</function>.
</para>
<para>
<!-- .LP -->
To receive
<symbol>ResizeRequest</symbol>
events, set the
<symbol>ResizeRedirect</symbol>
bit in the event-mask attribute of the window. 
Any attempts to change the size by other clients are then redirected.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XResizeRequestEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;        /* ResizeRequest */
     unsigned long serial;      /* # of last request processed by server */
     Bool          send_event;  /* true if this came from a SendEvent request */
     Display       *display;    /* Display the event was read from */
     Window        window;
     int           width, height;
} XResizeRequestEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The window member is set to the window whose size another 
client attempted to change.
The width and height members are set to the inside size of the window, 
excluding the border.
</para>
</sect2>
</sect1>
<sect1 id="Colormap_State_Change_Events">
<title>Colormap State Change Events</title>
<!-- .XS -->
<!-- (SN Colormap State Change Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>ColormapNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>ColormapNotify</primary></indexterm>
The X server can report
<symbol>ColormapNotify</symbol>
events to clients wanting information about when the colormap changes 
and when a colormap is installed or uninstalled. 
The X server generates this event type whenever a client application:
</para>
<itemizedlist>
  <listitem>
    <para>
Changes the colormap member of the
<structname>XSetWindowAttributes</structname>
structure by 
calling
<function>XChangeWindowAttributes</function>,
<function>XFreeColormap</function>,
or
<function>XSetWindowColormap</function>
    </para>
  </listitem>
  <listitem>
    <para>
Installs or uninstalls the colormap by calling
<function>XInstallColormap</function>
or
<function>XUninstallColormap</function>
    </para>
  </listitem>
</itemizedlist>
<para>
<!-- .LP -->
To receive 
<symbol>ColormapNotify</symbol>
events, set the
<symbol>ColormapChangeMask</symbol>
bit in the event-mask attribute of the window. 
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XColormapEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* ColormapNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        window;
     Colormap      colormap;   /* colormap or None */
     Bool          new;
     int           state;      /* ColormapInstalled, ColormapUninstalled */
} XColormapEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The window member is set to the window whose associated 
colormap is changed, installed, or uninstalled.
For a colormap that is changed, installed, or uninstalled,
the colormap member is set to the colormap associated with the window. 
For a colormap that is changed by a call to
<function>XFreeColormap</function>,
the colormap member is set to
<symbol>None</symbol>.
The new member is set to indicate whether the colormap 
for the specified window was changed or installed or uninstalled
and can be 
<symbol>True</symbol>
or
<symbol>False</symbol>.
If it is
<symbol>True</symbol>,
the colormap was changed.
If it is
<symbol>False</symbol>,
the colormap was installed or uninstalled.
The state member is always set to indicate whether the colormap is installed or
uninstalled and can be 
<symbol>ColormapInstalled</symbol>
or
<symbol>ColormapUninstalled</symbol>.
</para>
</sect1>
<sect1 id="Client_Communication_Events">
<title>Client Communication Events</title>
<!-- .XS -->
<!-- (SN Client Communication Events -->
<!-- .XE -->
<para>
<!-- .LP -->
This section discusses:
</para>
<itemizedlist>
  <listitem>
    <para>
<symbol>ClientMessage</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>PropertyNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>SelectionClear</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>SelectionNotify</symbol>
events
    </para>
  </listitem>
  <listitem>
    <para>
<symbol>SelectionRequest</symbol>
events
    </para>
  </listitem>
</itemizedlist>
<sect2 id="ClientMessage_Events">
<title>ClientMessage Events</title>
<!-- .XS -->
<!-- (SN ClientMessage Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>ClientMessage</secondary></indexterm>
<indexterm significance="preferred"><primary>ClientMessage</primary></indexterm>
The X server generates
<symbol>ClientMessage</symbol>
events only when a client calls the function
<function>XSendEvent</function>.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XClientMessageEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 1i 3i -->
<!-- .ta .5i 1i 3i -->
typedef struct {
     int           type;           /* ClientMessage */
     unsigned long serial;         /* # of last request processed by server */
     Bool          send_event;     /* true if this came from a SendEvent request */
     Display       *display;       /* Display the event was read from */
     Window        window;
     Atom          message_type;
     int           format;
     union         {
                     char  b[20];
                     short s[10];
                     long  l[5];
                   } data;
} XClientMessageEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The message_type member is set to an atom that indicates how the data 
should be interpreted by the receiving client.
The format member is set to 8, 16, or 32 and specifies whether the data
should be viewed as a list of bytes, shorts, or longs.
The data member is a union that contains the members b, s, and l.
The b, s, and l members represent data of twenty 8-bit values, 
ten 16-bit values, and five 32-bit values.
Particular message types might not make use of all these values.
The X server places no interpretation on the values in the window,
message_type, or data members.
</para>
</sect2>
<sect2 id="PropertyNotify_Events">
<title>PropertyNotify Events</title>
<!-- .XS -->
<!-- (SN PropertyNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>PropertyNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>PropertyNotify</primary></indexterm>
The X server can report
<symbol>PropertyNotify</symbol>
events to clients wanting information about property changes 
for a specified window.
</para>
<para>
<!-- .LP -->
To receive
<symbol>PropertyNotify</symbol>
events, set the
<symbol>PropertyChangeMask</symbol>
bit in the event-mask attribute of the window. 
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XPropertyEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* PropertyNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        window;
     Atom atom;
     Time time;
     int state;                /* PropertyNewValue or PropertyDelete */
} XPropertyEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The window member is set to the window whose associated 
property was changed.
The atom member is set to the property's atom and indicates which
property was changed or desired.
The time member is set to the server time when the property was changed.
The state member is set to indicate whether the property was changed 
to a new value or deleted and can be
<symbol>PropertyNewValue</symbol>
or
<symbol>PropertyDelete</symbol>.
The state member is set to
<symbol>PropertyNewValue</symbol>
when a property of the window is changed using
<function>XChangeProperty</function>
or
<function>XRotateWindowProperties</function>
(even when adding zero-length data using
<function>XChangeProperty</function>)
and when replacing all or part of a property with identical data using
<function>XChangeProperty</function>
or 
<function>XRotateWindowProperties</function>.
The state member is set to
<symbol>PropertyDelete</symbol>
when a property of the window is deleted using
<function>XDeleteProperty</function>
or, if the delete argument is 
<symbol>True</symbol>,
<function>XGetWindowProperty</function>.
</para>
</sect2>
<sect2 id="SelectionClear_Events">
<title>SelectionClear Events</title>
<!-- .XS -->
<!-- (SN SelectionClear Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm ><primary>Events</primary><secondary>SelectionClear</secondary></indexterm>
<indexterm significance="preferred"><primary>SelectionClear</primary></indexterm>
The X server reports
<symbol>SelectionClear</symbol>
events to the client losing ownership of a selection.
The X server generates this event type when another client
asserts ownership of the selection by calling
<function>XSetSelectionOwner</function>.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XSelectionClearEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* SelectionClear */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        window;
     Atom          selection;
     Time          time;
} XSelectionClearEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The selection member is set to the selection atom.
The time member is set to the last change time recorded for the 
selection.
The window member is the window that was specified by the current owner
(the owner losing the selection) in its
<function>XSetSelectionOwner</function>
call.
</para>
</sect2>
<sect2 id="SelectionRequest_Events">
<title>SelectionRequest Events</title>
<!-- .XS -->
<!-- (SN SelectionRequest Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>SelectionRequest</secondary></indexterm>
<indexterm significance="preferred"><primary>SelectionRequest</primary></indexterm>
The X server reports
<symbol>SelectionRequest</symbol>
events to the owner of a selection.
The X server generates this event whenever a client 
requests a selection conversion by calling 
<function>XConvertSelection</function>
for the owned selection.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XSelectionRequestEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* SelectionRequest */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        owner;
     Window        requestor;
     Atom          selection;
     Atom          target;
     Atom          property;
     Time          time;
} XSelectionRequestEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The owner member is set to the window
that was specified by the current owner in its
<function>XSetSelectionOwner</function>
call.
The requestor member is set to the window requesting the selection.
The selection member is set to the atom that names the selection.
For example, PRIMARY is used to indicate the primary selection.
The target member is set to the atom that indicates the type
the selection is desired in.
The property member can be a property name or 
<symbol>None</symbol>.
The time member is set to the timestamp or 
<symbol>CurrentTime</symbol>
value from the
<systemitem>ConvertSelection</systemitem>
request.
</para>
<para>
<!-- .LP -->
The owner should convert the selection based on the specified target type
and send a
<symbol>SelectionNotify</symbol>
event back to the requestor.
A complete specification for using selections is given in the X Consortium
standard <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>.
</para>
</sect2>
<sect2 id="SelectionNotify_Events">
<title>SelectionNotify Events</title>
<!-- .XS -->
<!-- (SN SelectionNotify Events -->
<!-- .XE -->
<para>
<!-- .LP -->
<indexterm><primary>Events</primary><secondary>SelectionNotify</secondary></indexterm>
<indexterm significance="preferred"><primary>SelectionNotify</primary></indexterm>
This event is generated by the X server in response to a
<systemitem>ConvertSelection</systemitem>
protocol request when there is no owner for the selection.
When there is an owner, it should be generated by the owner
of the selection by using
<function>XSendEvent</function>.
The owner of a selection should send this event to a requestor when a selection
has been converted and stored as a property
or when a selection conversion could
not be performed (which is indicated by setting the property member to
<symbol>None</symbol>).
</para>
<para>
<!-- .LP -->
If
<symbol>None</symbol>
is specified as the property in the 
<systemitem>ConvertSelection</systemitem>
protocol request, the owner should choose a property name,
store the result as that property on the requestor window,
and then send a 
<symbol>SelectionNotify</symbol>
giving that actual property name.
</para>
<para>
<!-- .LP -->
The structure for this event type contains:
</para>
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>XSelectionEvent</primary></indexterm>
<!-- .sM -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
     int           type;       /* SelectionNotify */
     unsigned long serial;     /* # of last request processed by server */
     Bool          send_event; /* true if this came from a SendEvent request */
     Display       *display;   /* Display the event was read from */
     Window        requestor;
     Atom          selection;
     Atom          target;
     Atom          property;   /* atom or None */
     Time          time;
} XSelectionEvent;
</literallayout>
</para>
<para>
<!-- .LP -->
<!-- .eM -->
The requestor member is set to the window associated with
the requestor of the selection.
The selection member is set to the atom that indicates the selection.
For example, PRIMARY is used for the primary selection.
The target member is set to the atom that indicates the converted type.
For example, PIXMAP is used for a pixmap.
The property member is set to the atom that indicates which
property the result was stored on.
If the conversion failed, 
the property member is set to
<symbol>None</symbol>.
The time member is set to the time the conversion took place and
can be a timestamp or
<symbol>CurrentTime</symbol>.
<!-- .bp -->


</para>
</sect2>
</sect1>
</chapter>