aboutsummaryrefslogtreecommitdiff
path: root/libX11/specs/libX11/CH14
blob: 34c09da8b504b83d64f14c05c031d2dcb672fe53 (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
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining
.\" a copy of this software and associated documentation files (the
.\" "Software"), to deal in the Software without restriction, including
.\" without limitation the rights to use, copy, modify, merge, publish,
.\" distribute, sublicense, and/or sell copies of the Software, and to
.\" permit persons to whom the Software is furnished to do so, subject to
.\" the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included
.\" in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of the X Consortium shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from the X Consortium.
.\"
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
.\" Digital Equipment Corporation
.\"
.\" Portions Copyright \(co 1990, 1991 by
.\" Tektronix, Inc.
.\"
.\" Permission to use, copy, modify and distribute this documentation for
.\" any purpose and without fee is hereby granted, provided that the above
.\" copyright notice appears in all copies and that both that copyright notice
.\" and this permission notice appear in all copies, and that the names of
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
.\" to this documentation without specific, written prior permission.
.\" Digital and Tektronix makes no representations about the suitability
.\" of this documentation for any purpose.
.\" It is provided ``as is'' without express or implied warranty.
.\" 
\&
.sp 1
.ce 3
\s+1\fBChapter 14\fP\s-1

\s+1\fBInter-Client Communication Functions\fP\s-1
.sp 2
.nr H1 14
.nr H2 0
.nr H3 0
.nr H4 0
.nr H5 0
.na
.LP
.XS
Chapter 14: Inter-Client Communication Functions
.XE
The \fIInter-Client Communication Conventions Manual\fP,
hereafter referred to as the ICCCM, details the
X Consortium approved conventions that govern inter-client communications.
These conventions ensure peer-to-peer client cooperation in the use 
of selections, cut buffers, and shared resources as well as client cooperation
with window and session managers.
For further information,
see the \fIInter-Client Communication Conventions Manual\fP.
.LP
Xlib provides a number of standard properties and programming interfaces
that are ICCCM compliant.
The predefined atoms for some of these properties are defined in the
.hN X11/Xatom.h
header file, where
to avoid name conflicts with user symbols their
.PN #define
name has an XA_ prefix.
For further information about atoms and properties,
see section 4.3.
.LP
Xlib's selection and cut buffer mechanisms provide the primary programming 
interfaces by which peer client applications communicate with each other 
(see sections 4.5 and 16.6).
The functions discussed in this chapter provide 
the primary programming interfaces by which client applications communicate 
with their window and session managers as well as share standard colormaps.
.LP
The standard properties that are of special interest for communicating 
with window and session managers are:
.IN "Atom" "predefined"
.TS H
lw(2i) lw(1.1i) lw(.4i) lw(2.25i)
lw(2i) lw(1.1i) cw(.4i) lw(2.25i).
_
.sp 6p
.B
Name	Type	Format	Description
.sp 6p
_
.TH
.R
T{
\s-1WM_CLASS\s+1
T}	T{
\s-1STRING\s+1
T}	T{
8
T}	T{
Set by application programs to allow window and session
managers to obtain the application's resources from the resource database.
T}
.sp 6p
T{
\s-1WM_CLIENT_MACHINE\s+1
T}	T{
\s-1TEXT\s+1
T}	T{
T}	T{
The string name of the machine on which the client application is running.
T}
.sp 6p
T{
\s-1WM_COLORMAP_WINDOWS\s+1
T}	T{
\s-1WINDOW\s+1
T}	T{
32
T}	T{
The list of window IDs that may need a different colormap
from that of their top-level window.
T}
.sp 6p
T{
\s-1WM_COMMAND\s+1
T}	T{
\s-1TEXT\s+1
T}	T{
T}	T{
The command and arguments, null-separated, used to invoke the
application.
T}
.sp 6p
T{
\s-1WM_HINTS\s+1
T}	T{
\s-1WM_HINTS\s+1
T}	T{
32
T}	T{
Additional hints set by the client for use by the window manager.
The C type of this property is 
.PN XWMHints .
T}
.sp 6p
T{
\s-1WM_ICON_NAME\s+1
T}	T{
\s-1TEXT\s+1
T}	T{
T}	T{
The name to be used in an icon.
T}
.sp 6p
T{
\s-1WM_ICON_SIZE\s+1
T}	T{
\s-1WM_ICON_SIZE\s+1
T}	T{
32
T}	T{
The window manager may set this property on the root window to
specify the icon sizes it supports.
The C type of this property is 
.PN XIconSize .
T}
.sp 6p
T{
\s-1WM_NAME\s+1
T}	T{
\s-1TEXT\s+1
T}	T{
T}	T{
The name of the application.
T}
.sp 6p
T{
\s-1WM_NORMAL_HINTS\s+1
T}	T{
\s-1WM_SIZE_HINTS\s+1
T}	T{
32
T}	T{
Size hints for a window in its normal state.
The C type of this property is
.PN XSizeHints .
T}
.sp 6p
T{
\s-1WM_PROTOCOLS\s+1
T}	T{
\s-1ATOM\s+1
T}	T{
32
T}	T{
List of atoms that identify the communications protocols between the
client and window manager in which the client is willing to participate.
T}
.sp 6p
T{
\s-1WM_STATE\s+1
T}	T{
\s-1WM_STATE\s+1
T}	T{
32
T}	T{
Intended for communication between window and session managers only.
T}
.sp 6p
T{
\s-1WM_TRANSIENT_FOR\s+1
T}	T{
\s-1WINDOW\s+1
T}	T{
32
T}	T{
Set by application programs to indicate to the window manager that a transient
top-level window, such as a dialog box.
T}
.sp 6p
_
.TE
.LP
The remainder of this chapter discusses:
.IP \(bu 5
Client to window manager communication
.IP \(bu 5
Client to session manager communication
.IP \(bu 5
Standard colormaps
.NH 2
Client to Window Manager Communication
.XS
\*(SN Client to Window Manager Communication
.XE
.LP
This section discusses how to:
.IP \(bu 5
Manipulate top-level windows
.IP \(bu 5
Convert string lists
.IP \(bu 5
Set and read text properties
.IP \(bu 5
Set and read the WM_NAME property
.IP \(bu 5
Set and read the WM_ICON_NAME property
.IP \(bu 5
Set and read the WM_HINTS property
.IP \(bu 5
Set and read the WM_NORMAL_HINTS property
.IP \(bu 5
Set and read the WM_CLASS property
.IP \(bu 5
Set and read the WM_TRANSIENT_FOR property
.IP \(bu 5
Set and read the WM_PROTOCOLS property
.IP \(bu 5
Set and read the WM_COLORMAP_WINDOWS property
.IP \(bu 5
Set and read the WM_ICON_SIZE property
.IP \(bu 5
Use window manager convenience functions
.NH 3
Manipulating Top-Level Windows
.XS
\*(SN Manipulating Top-Level Windows
.XE
.LP
Xlib provides functions that you can use to change the visibility or size
of top-level windows (that is, those that were created as children 
of the root window).
Note that the subwindows that you create are ignored by window managers.
Therefore,
you should use the basic window functions described in chapter 3
to manipulate your application's subwindows.
.LP
To request that a top-level window be iconified, use
.PN XIconifyWindow .
.IN "XIconifyWindow" "" "@DEF@"
.sM
.FD 0
Status XIconifyWindow\^(\^\fIdisplay\fP, \fIw\fP, \fIscreen_number\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP;
.br
      int \fIscreen_number\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIscreen_number\fP 1i
Specifies the appropriate screen number on the host server.
.LP
.eM
The 
.PN XIconifyWindow 
function sends a WM_CHANGE_STATE 
.PN ClientMessage 
event with a format of 32 and a first data element of 
.PN IconicState 
(as described in section 4.1.4 of the 
\fIInter-Client Communication Conventions Manual\fP)
and a window of w
to the root window of the specified screen
with an event mask set to
.PN SubstructureNotifyMask |
.PN SubstructureRedirectMask .
Window managers may elect to receive this message and
if the window is in its normal state, 
may treat it as a request to change the window's state from normal to iconic.
If the WM_CHANGE_STATE property cannot be interned, 
.PN XIconifyWindow
does not send a message and returns a zero status.
It returns a nonzero status if the client message is sent successfully;
otherwise, it returns a zero status.
.sp
.LP
To request that a top-level window be withdrawn, use
.PN XWithdrawWindow .
.IN "XWithdrawWindow" "" "@DEF@"
.sM
.FD 0
Status XWithdrawWindow\^(\^\fIdisplay\fP, \fIw\fP, \fIscreen_number\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      int \fIscreen_number\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIscreen_number\fP 1i
Specifies the appropriate screen number on the host server.
.LP
.eM
The 
.PN XWithdrawWindow 
function unmaps the specified window 
and sends a synthetic 
.PN UnmapNotify 
event to the root window of the specified screen.
Window managers may elect to receive this message 
and may treat it as a request to change the window's state to withdrawn.
When a window is in the withdrawn state, 
neither its normal nor its iconic representations is visible.
It returns a nonzero status if the 
.PN UnmapNotify 
event is successfully sent; 
otherwise, it returns a zero status.
.LP
.PN XWithdrawWindow
can generate a
.PN BadWindow
error.
.sp
.LP
To request that a top-level window be reconfigured, use
.PN XReconfigureWMWindow .
.IN "XReconfigureWMWindow" "" "@DEF@"
.sM
.FD 0
Status XReconfigureWMWindow\^(\^\fIdisplay\fP, \fIw\fP, \fIscreen_number\fP, \
\fIvalue_mask\fP, \fIvalues\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      int \fIscreen_number\fP\^;
.br
      unsigned int \fIvalue_mask\fP\^;
.br
      XWindowChanges *\fIvalues\fP;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIscreen_number\fP 1i
Specifies the appropriate screen number on the host server.
.IP \fIvalue_mask\fP 1i
Specifies which values are to be set using information in
the values structure.
This mask is the bitwise inclusive OR of the valid configure window values bits.
.IP \fIvalues\fP 1i
Specifies the 
.PN XWindowChanges 
structure.
.LP
.eM
The 
.PN XReconfigureWMWindow 
function issues a 
.PN ConfigureWindow 
request on the specified top-level window.
If the stacking mode is changed and the request fails with a 
.PN BadMatch 
error, 
the error is trapped by Xlib and a synthetic 
.PN ConfigureRequestEvent 
containing the same configuration parameters is sent to the root 
of the specified window.
Window managers may elect to receive this event 
and treat it as a request to reconfigure the indicated window.
It returns a nonzero status if the request or event is successfully sent;
otherwise, it returns a zero status.
.LP
.PN XReconfigureWMWindow 
can generate
.PN BadValue 
and 
.PN BadWindow 
errors.
.NH 3
Converting String Lists
.XS
\*(SN Converting String Lists
.XE
.LP
Many of the text properties allow a variety of types and formats.
Because the data stored in these properties are not
simple null-terminated strings, an
.PN XTextProperty
structure is used to describe the encoding, type, and length of the text 
as well as its value.
The
.PN XTextProperty
structure contains:
.IN "XTextProperty" "" "@DEF@"
.sM
.Ds 0
.TA .5i 2.5i
.ta .5i 2.5i
typedef struct {
	unsigned char *value;	/* property data */
	Atom encoding;	/* type of property */
	int format;	/* 8, 16, or 32 */
	unsigned long nitems;	/* number of items in value */
} XTextProperty;
.De
.LP
.eM
Xlib provides functions to convert localized text to or from encodings
that support the inter-client communication conventions for text.
In addition, functions are provided for converting between lists of pointers 
to character strings and text properties in the STRING encoding.
.LP
The functions for localized text return a signed integer error status 
that encodes 
.PN Success
as zero, specific error conditions as negative numbers, and partial conversion
as a count of unconvertible characters.
.LP
.IN "XICCEncodingStyle" "" "@DEF@"
.sM
.TS
lw(.5i) lw(2i) lw(2.5i).
T{
#define
T}	T{
.PN XNoMemory
T}	T{
\-1
T}
T{
#define
T}	T{
.PN XLocaleNotSupported
T}	T{
\-2
T}
T{
#define
T}	T{
.PN XConverterNotFound
T}	T{
\-3
T}
.TE
.Ds 0
.TA .5i 2.5i
.ta .5i 2.5i
typedef enum {
	XStringStyle,		/* STRING */
	XCompoundTextStyle,	/* COMPOUND_TEXT */
	XTextStyle,		/* text in owner's encoding (current locale) */
	XStdICCTextStyle	/* STRING, else COMPOUND_TEXT */
} XICCEncodingStyle;
.De
.LP
.eM
.sp
.LP
To convert a list of text strings to an 
.PN XTextProperty
structure, use
.PN XmbTextListToTextProperty
or
.PN XwcTextListToTextProperty .
.IN "XmbTextListToTextProperty" "" "@DEF@"
.IN "XwcTextListToTextProperty" "" "@DEF@"
.sM
.FD 0
int XmbTextListToTextProperty\^(\^\fIdisplay\fP\^, \fIlist\fP\^, \fIcount\fP\^, \fIstyle\fP\^, \fItext_prop_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      char **\fIlist\fP\^;
.br
      int \fIcount\fP\^;
.br
      XICCEncodingStyle \fIstyle\fP\^;
.br
      XTextProperty *\fItext_prop_return\fP\^;
.FN
.FD 0
int XwcTextListToTextProperty\^(\^\fIdisplay\fP\^, \fIlist\fP\^, \fIcount\fP\^, \fIstyle\fP\^, \fItext_prop_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      wchar_t **\fIlist\fP\^;
.br
      int \fIcount\fP\^;
.br
      XICCEncodingStyle \fIstyle\fP\^;
.br
      XTextProperty *\fItext_prop_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIlist\fP 1i
Specifies a list of null-terminated character strings.
.IP \fIcount\fP 1i
Specifies the number of strings specified.
.IP \fIstyle\fP 1i
Specifies the manner in which the property is encoded.
.IP \fItext_prop_return\fP 1i
Returns the
.PN XTextProperty
structure.
.LP
.eM
The
.PN XmbTextListToTextProperty
and
.PN XwcTextListToTextProperty
functions set the specified 
.PN XTextProperty
value to a set of null-separated elements representing the concatenation
of the specified list of null-terminated text strings.
A final terminating null is stored at the end of the value field 
of text_prop_return but is not included in the nitems member.
.LP
The functions set the encoding field of text_prop_return to an
.PN Atom 
for the specified display 
naming the encoding determined by the specified style
and convert the specified text list to this encoding for storage in
the text_prop_return value field.
If the style 
.PN XStringStyle
or 
.PN XCompoundTextStyle
is specified,
this encoding is ``STRING'' or ``COMPOUND_TEXT'', respectively.
If the style 
.PN XTextStyle
is specified,
this encoding is the encoding of the current locale.
If the style 
.PN XStdICCTextStyle
is specified,
this encoding is ``STRING'' if the text is fully convertible to STRING,
else ``COMPOUND_TEXT''.
.LP
If insufficient memory is available for the new value string,
the functions return 
.PN XNoMemory .
If the current locale is not supported,
the functions return 
.PN XLocaleNotSupported .
In both of these error cases,
the functions do not set text_prop_return.
.LP
To determine if the functions are guaranteed not to return
.PN XLocaleNotSupported ,
use
.PN XSupportsLocale .
.LP
If the supplied text is not fully convertible to the specified encoding,
the functions return the number of unconvertible characters.
Each unconvertible character is converted to an implementation-defined and
encoding-specific default string.
Otherwise, the functions return 
.PN Success .
Note that full convertibility to all styles except 
.PN XStringStyle
is guaranteed.
.LP
To free the storage for the value field, use
.PN XFree .
.sp
.LP
To obtain a list of text strings from an 
.PN XTextProperty 
structure, use
.PN XmbTextPropertyToTextList
or
.PN XwcTextPropertyToTextList .
.IN "XmbTextPropertyToTextList" "" "@DEF@"
.IN "XwcTextPropertyToTextList" "" "@DEF@"
.sM
.FD 0
int XmbTextPropertyToTextList\^(\^\fIdisplay\fP\^, \fItext_prop\fP\^, \fIlist_return\fP\^, \fIcount_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      XTextProperty *\fItext_prop\fP\^;
.br
      char ***\fIlist_return\fP\^;
.br
      int *\fIcount_return\fP\^;
.FN
.FD 0
int XwcTextPropertyToTextList\^(\^\fIdisplay\fP\^, \fItext_prop\fP\^, \fIlist_return\fP\^, \fIcount_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      XTextProperty *\fItext_prop\fP\^;
.br
      wchar_t ***\fIlist_return\fP\^;
.br
      int *\fIcount_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fItext_prop\fP 1i
Specifies the
.PN XTextProperty
structure to be used.
.IP \fIlist_return\fP 1i
Returns a list of null-terminated character strings.
.ds Cn strings
.IP \fIcount_return\fP 1i
Returns the number of \*(Cn.
.LP
.eM
The 
.PN XmbTextPropertyToTextList
and 
.PN XwcTextPropertyToTextList
functions return a list of text strings in the current locale representing the
null-separated elements of the specified
.PN XTextProperty
structure.
The data in text_prop must be format 8.
.LP
Multiple elements of the property (for example, the strings in a disjoint
text selection) are separated by a null byte.
The contents of the property are not required to be null-terminated;
any terminating null should not be included in text_prop.nitems.
.LP
If insufficient memory is available for the list and its elements,
.PN XmbTextPropertyToTextList
and
.PN XwcTextPropertyToTextList
return 
.PN XNoMemory .
If the current locale is not supported,
the functions return
.PN XLocaleNotSupported .
Otherwise, if the encoding field of text_prop is not convertible 
to the encoding of the current locale,
the functions return
.PN XConverterNotFound .
For supported locales,
existence of a converter from COMPOUND_TEXT, STRING
or the encoding of the current locale is guaranteed if
.PN XSupportsLocale 
returns 
.PN True
for the current locale (but the actual text
may contain unconvertible characters).
Conversion of other encodings is implementation-dependent.
In all of these error cases,
the functions do not set any return values.
.LP
Otherwise, 
.PN XmbTextPropertyToTextList
and
.PN XwcTextPropertyToTextList
return the list of null-terminated text strings to list_return
and the number of text strings to count_return.
.LP
If the value field of text_prop is not fully convertible to the encoding of
the current locale,
the functions return the number of unconvertible characters.
Each unconvertible character is converted to a string in the
current locale that is specific to the current locale.
To obtain the value of this string, 
use
.PN XDefaultString .
Otherwise,
.PN XmbTextPropertyToTextList
and
.PN XwcTextPropertyToTextList
return 
.PN Success .
.LP
To free the storage for the list and its contents returned by
.PN XmbTextPropertyToTextList ,
use
.PN XFreeStringList .
To free the storage for the list and its contents returned by
.PN XwcTextPropertyToTextList ,
use
.PN XwcFreeStringList .
.sp
.LP
To free the in-memory data associated with the specified
wide character string list, use
.PN XwcFreeStringList .
.IN "XwcFreeStringList" "" "@DEF@"
.sM
.FD 0
void XwcFreeStringList\^(\^\fIlist\fP\^)
.br
      wchar_t **\fIlist\fP\^;
.FN
.IP \fIlist\fP 1i
Specifies the list of strings to be freed.
.LP
.eM
The
.PN XwcFreeStringList
function frees memory allocated by
.PN XwcTextPropertyToTextList .
.sp
.LP
To obtain the default string for text conversion in the current locale,
use
.PN XDefaultString .
.IN "XDefaultString" "" "@DEF@"
.sM
.FD 0
char *XDefaultString\^(\|)
.FN
.LP
.eM
The
.PN XDefaultString
function returns the default string used by Xlib for text conversion
(for example, in 
.PN XmbTextPropertyToTextList ).
The default string is the string in the current locale that is output 
when an unconvertible character is found during text conversion.
If the string returned by
.PN XDefaultString
is the empty string ("\^"),
no character is output in the converted text.
.PN XDefaultString
does not return NULL.
.LP
The string returned by 
.PN XDefaultString
is independent of the default string for text drawing;
see 
.PN XCreateFontSet
to obtain the default string for an
.PN XFontSet .
.LP
The behavior when an invalid codepoint is supplied to any Xlib function is
undefined.
.LP
The returned string is null-terminated.
It is owned by Xlib and should not be modified or freed by the client.
It may be freed after the current locale is changed.
Until freed, it will not be modified by Xlib.
.sp
.LP
To set the specified list of strings in the STRING encoding to a 
.PN XTextProperty
structure, use
.PN XStringListToTextProperty .
.IN "XStringListToTextProperty" "" "@DEF@"
.sM
.FD 0
Status XStringListToTextProperty\^(\^\fIlist\fP, \fIcount\fP, \
\fItext_prop_return\fP\^)
.br
      char **\fIlist\fP\^;
.br
      int \fIcount\fP\^;
.br
      XTextProperty *\fItext_prop_return\fP\^;
.FN
.IP \fIlist\fP 1i
Specifies a list of null-terminated character strings.
.ds Cn strings
.IP \fIcount\fP 1i
Specifies the number of \*(Cn.
.IP \fItext_prop_return\fP 1i
Returns the
.PN XTextProperty
structure.
.LP
.eM
The 
.PN XStringListToTextProperty 
function sets the specified 
.PN XTextProperty
to be of type STRING (format 8) with a value representing the
concatenation of the specified list of null-separated character strings.
An extra null byte (which is not included in the nitems member) 
is stored at the end of the value field of text_prop_return.
The strings are assumed (without verification) to be in the STRING encoding.
If insufficient memory is available for the new value string, 
.PN XStringListToTextProperty
does not set any fields in the
.PN XTextProperty
structure and returns a zero status.
Otherwise, it returns a nonzero status.
To free the storage for the value field, use 
.PN XFree .
.sp
.LP
To obtain a list of strings from a specified
.PN XTextProperty
structure in the STRING encoding, use
.PN XTextPropertyToStringList .
.IN "XTextPropertyToStringList" "" "@DEF@"
.sM
.FD 0
Status XTextPropertyToStringList\^(\^\fItext_prop\fP, \fIlist_return\fP, \
\fIcount_return\fP\^)
.br
       XTextProperty *\fItext_prop\fP\^;
.br
       char ***\fIlist_return\fP\^;
.br
       int *\fIcount_return\fP\^;
.FN
.IP \fItext_prop\fP 1i
Specifies the
.PN XTextProperty
structure to be used.
.IP \fIlist_return\fP 1i
Returns a list of null-terminated character strings.
.ds Cn strings
.IP \fIcount_return\fP 1i
Returns the number of \*(Cn.
.LP
.eM
The 
.PN XTextPropertyToStringList 
function returns a list of strings representing the null-separated elements 
of the specified
.PN XTextProperty
structure.
The data in text_prop must be of type STRING and format 8. 
Multiple elements of the property 
(for example, the strings in a disjoint text selection) 
are separated by NULL (encoding 0).
The contents of the property are not null-terminated.
If insufficient memory is available for the list and its elements, 
.PN XTextPropertyToStringList
sets no return values and returns a zero status.
Otherwise, it returns a nonzero status.
To free the storage for the list and its contents, use 
.PN XFreeStringList .
.sp
.LP
To free the in-memory data associated with the specified string list, use
.PN XFreeStringList .
.IN "XFreeStringList" "" "@DEF@"
.sM
.FD 0
void XFreeStringList\^(\^\fIlist\fP\^)
.br
      char **\fIlist\fP\^;
.FN
.IP \fIlist\fP 1i
Specifies the list of strings to be freed.
.LP
.eM
The 
.PN XFreeStringList 
function releases memory allocated by 
.PN XmbTextPropertyToTextList
and
.PN XTextPropertyToStringList
and the missing charset list allocated by 
.PN XCreateFontSet .
.NH 3
Setting and Reading Text Properties
.XS
\*(SN Setting and Reading Text Properties
.XE
.LP
Xlib provides two functions that you can use to set and read
the text properties for a given window.
You can use these functions to set and read those properties of type TEXT
(WM_NAME, WM_ICON_NAME, WM_COMMAND, and WM_CLIENT_MACHINE).
In addition,
Xlib provides separate convenience functions that you can use to set each 
of these properties.
For further information about these convenience functions,
see sections 14.1.4, 14.1.5, 14.2.1, and 14.2.2, respectively.
.sp
.LP
To set one of a window's text properties, use
.PN XSetTextProperty .
.IN "XSetTextProperty" "" "@DEF@"
.sM
.FD 0
void XSetTextProperty\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop\fP, \
\fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fItext_prop\fP\^;
.br
      Atom \fIproperty\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop\fP 1i
Specifies the
.PN XTextProperty
structure to be used.
.IP \fIproperty\fP 1i
Specifies the property name.
.LP
.eM
The
.PN XSetTextProperty
function replaces the existing specified property for the named window 
with the data, type, format, and number of items determined 
by the value field, the encoding field, the format field, 
and the nitems field, respectively, of the specified
.PN XTextProperty
structure.
If the property does not already exist,
.PN XSetTextProperty
sets it for the specified window.
.LP
.PN XSetTextProperty
can generate
.PN BadAlloc ,
.PN BadAtom , 
.PN BadValue , 
and 
.PN BadWindow  
errors.
.sp
.LP
To read one of a window's text properties, use
.PN XGetTextProperty .
.IN "XGetTextProperty" "" "@DEF@"
.sM
.FD 0
Status XGetTextProperty\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop_return\fP, \
\fIproperty\fP\^)
.br
       Display *\fIdisplay\fP\^;
.br
       Window \fIw\fP\^;
.br
       XTextProperty *\fItext_prop_return\fP\^;
.br
       Atom \fIproperty\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop_return\fP 1i
Returns the
.PN XTextProperty
structure.
.IP \fIproperty\fP 1i
Specifies the property name.
.LP
.eM
The
.PN XGetTextProperty 
function reads the specified property from the window
and stores the data in the returned
.PN XTextProperty
structure.
It stores the data in the value field,
the type of the data in the encoding field,
the format of the data in the format field, 
and the number of items of data in the nitems field.
An extra byte containing null (which is not included in the nitems member) 
is stored at the end of the value field of text_prop_return.
The particular interpretation of the property's encoding 
and data as text is left to the calling application.
If the specified property does not exist on the window,
.PN XGetTextProperty
sets the value field to NULL, 
the encoding field to
.PN None , 
the format field to zero, 
and the nitems field to zero.
.LP
If it was able to read and store the data in the
.PN XTextProperty
structure,
.PN XGetTextProperty
returns a nonzero status; 
otherwise, it returns a zero status.
.LP
.PN XGetTextProperty
can generate
.PN BadAtom 
and 
.PN BadWindow 
errors.
.NH 3
Setting and Reading the WM_NAME Property
.XS
\*(SN Setting and Reading the WM_NAME Property
.XE
.LP
Xlib provides convenience functions that you can use to set and read 
the WM_NAME property for a given window.
.sp
.LP
To set a window's WM_NAME property with the supplied convenience function, use
.PN XSetWMName .
.IN "XSetWMName" "" "@DEF@"
.sM
.FD 0
void XSetWMName\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fItext_prop\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop\fP 1i
Specifies the
.PN XTextProperty
structure to be used.
.LP
.eM
The
.PN XSetWMName
convenience function calls
.PN XSetTextProperty 
to set the WM_NAME property.
.sp
.LP
To read a window's WM_NAME property with the supplied convenience function, use
.PN XGetWMName .
.IN "XGetWMName" "" "@DEF@"
.sM
.FD 0
Status XGetWMName\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fItext_prop_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop_return\fP 1i
Returns the
.PN XTextProperty
structure.
.LP
.eM
The
.PN XGetWMName 
convenience function calls
.PN XGetTextProperty 
to obtain the WM_NAME property.
It returns a nonzero status on success;
otherwise, it returns a zero status.
.LP
The following two functions have been superseded by
.PN XSetWMName
and
.PN XGetWMName ,
respectively. 
You can use these additional convenience functions 
for window names that are encoded as STRING properties.
.sp
.LP
To assign a name to a window, use
.PN XStoreName .
.IN "Window" "name"
.IN "XStoreName" "" "@DEF@"
.sM
.FD 0
XStoreName\^(\^\fIdisplay\fP, \fIw\fP\^, \fIwindow_name\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      char *\fIwindow_name\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIwindow_name\fP 1i
Specifies the window name,
which should be a null-terminated string.
.LP
.eM
The
.PN XStoreName
function assigns the name passed to window_name to the specified window.
A window manager can display the window name in some prominent
place, such as the title bar, to allow users to identify windows easily.
Some window managers may display a window's name in the window's icon,
although they are encouraged to use the window's icon name
if one is provided by the application.
If the string is not in the Host Portable Character Encoding,
the result is implementation-dependent.
.LP
.PN XStoreName
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.LP
.sp
To get the name of a window, use
.PN XFetchName .
.IN "XFetchName" "" "@DEF@"
.sM
.FD 0
Status XFetchName\^(\^\fIdisplay\fP, \fIw\fP\^, \fIwindow_name_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      char **\fIwindow_name_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIwindow_name_return\fP 1i
Returns the window name, which is a null-terminated string.
.LP
.eM
The
.PN XFetchName
function returns the name of the specified window.
If it succeeds,
it returns a nonzero status; 
otherwise, no name has been set for the window,
and it returns zero.
If the WM_NAME property has not been set for this window,
.PN XFetchName
sets window_name_return to NULL.
If the data returned by the server is in the Latin Portable Character Encoding,
then the returned string is in the Host Portable Character Encoding.
Otherwise, the result is implementation-dependent.
When finished with it, a client must free
the window name string using
.PN XFree .
.LP
.PN XFetchName
can generate a
.PN BadWindow
error.
.NH 3
Setting and Reading the WM_ICON_NAME Property
.XS
\*(SN Setting and Reading the WM_ICON_NAME Property
.XE
.LP
Xlib provides convenience functions that you can use to set and read 
the WM_ICON_NAME property for a given window.
.LP
.sp
To set a window's WM_ICON_NAME property,
use
.PN XSetWMIconName .
.IN "XSetWMIconName" "" "@DEF@"
.sM
.FD 0
void XSetWMIconName\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fItext_prop\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop\fP 1i
Specifies the
.PN XTextProperty
structure to be used.
.LP
.eM
The
.PN XSetWMIconName
convenience function calls
.PN XSetTextProperty
to set the WM_ICON_NAME property.
.sp
.LP
To read a window's WM_ICON_NAME property,
use
.PN XGetWMIconName .
.IN "XGetWMIconName" "" "@DEF@"
.sM
.FD 0
Status XGetWMIconName\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fItext_prop_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop_return\fP 1i
Returns the
.PN XTextProperty
structure.
.LP
.eM
The 
.PN XGetWMIconName 
convenience function calls
.PN XGetTextProperty 
to obtain the WM_ICON_NAME property.
It returns a nonzero status on success;
otherwise, it returns a zero status.
.LP
The next two functions have been superseded by
.PN XSetWMIconName
and
.PN XGetWMIconName ,
respectively.
You can use these additional convenience functions 
for window names that are encoded as STRING properties.
.sp
.LP
.sp
To set the name to be displayed in a window's icon, use
.PN XSetIconName .
.IN "Window" "icon name"
.IN "XSetIconName" "" "@DEF@"
.sM
.FD 0
XSetIconName\^(\^\fIdisplay\fP, \fIw\fP\^, \fIicon_name\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      char *\fIicon_name\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIicon_name\fP 1i
Specifies the icon name,
which should be a null-terminated string.
.LP
.eM
If the string is not in the Host Portable Character Encoding,
the result is implementation-dependent.
.PN XSetIconName
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.LP
.sp
To get the name a window wants displayed in its icon, use
.PN XGetIconName .
.IN "XGetIconName" "" "@DEF@"
.sM
.FD 0
Status XGetIconName\^(\^\fIdisplay\fP, \fIw\fP\^, \fIicon_name_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      char **\fIicon_name_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIicon_name_return\fP 1i
Returns the window's icon name,
which is a null-terminated string.
.LP
.eM
The
.PN XGetIconName
function returns the name to be displayed in the specified window's icon.
If it succeeds, it returns a nonzero status; otherwise, 
if no icon name has been set for the window,
it returns zero.
If you never assigned a name to the window,
.PN XGetIconName
sets icon_name_return to NULL.
If the data returned by the server is in the Latin Portable Character Encoding,
then the returned string is in the Host Portable Character Encoding.
Otherwise, the result is implementation-dependent.
When finished with it, a client must free
the icon name string using
.PN XFree .
.LP
.PN XGetIconName
can generate a
.PN BadWindow
error.
.NH 3
Setting and Reading the WM_HINTS Property
.XS
\*(SN Setting and Reading the WM_HINTS Property
.XE
.LP
Xlib provides functions that you can use to set and read 
the WM_HINTS property for a given window.
These functions use the flags and the
.PN XWMHints 
structure, as defined in the
.hN X11/Xutil.h
header file.
.sp
.LP
To allocate an
.PN XWMHints
structure, use
.PN XAllocWMHints .
.IN "XAllocWMHints" "" "@DEF@"
.sM
.FD 0
XWMHints *XAllocWMHints\^(\|)
.FN
.LP
.eM
The
.PN XAllocWMHints
function allocates and returns a pointer to an
.PN XWMHints
structure.
Note that all fields in the
.PN XWMHints
structure are initially set to zero.
If insufficient memory is available, 
.PN XAllocWMHints
returns NULL.
To free the memory allocated to this structure,
use
.PN XFree .
.LP
The
.PN XWMHints
structure contains:
.LP
.sM
/* Window manager hints mask bits */
.TS
lw(.5i) lw(2.5i) lw(2.5i).
T{
#define
T}	T{
.PN InputHint
T}	T{
(1L << 0)
T}
T{
#define
T}	T{
.PN StateHint
T}	T{
(1L << 1)
T}
T{
#define
T}	T{
.PN IconPixmapHint
T}	T{
(1L << 2)
T}
T{
#define
T}	T{
.PN IconWindowHint
T}	T{
(1L << 3)
T}
T{
#define
T}	T{
.PN IconPositionHint
T}	T{
(1L << 4)
T}
T{
#define
T}	T{
.PN IconMaskHint
T}	T{
(1L << 5)
T}
T{
#define
T}	T{
.PN WindowGroupHint
T}	T{
(1L << 6)
T}
T{
#define
T}	T{
.PN UrgencyHint
T}	T{
(1L << 8)
T}
T{
#define
T}	T{
.PN AllHints
T}	T{
(InputHint|StateHint|IconPixmapHint|
.br
IconWindowHint|IconPositionHint|
.br
IconMaskHint|WindowGroupHint)
T}
.TE
.IN "XWMHints" "" "@DEF@"
.Ds 0
.TA .5i 2.5i
.ta .5i 2.5i
/* Values */

typedef struct {
	long flags;	/* marks which fields in this structure are defined */
	Bool input;	/* does this application rely on the window manager to
			get keyboard input? */
	int initial_state;	/* see below */
	Pixmap icon_pixmap;	/* pixmap to be used as icon */
	Window icon_window;	/* window to be used as icon */
	int icon_x, icon_y;	/* initial position of icon */
	Pixmap icon_mask;	/* pixmap to be used as mask for icon_pixmap */
	XID window_group;	/* id of related window group */
	/* this structure may be extended in the future */
} XWMHints;
.De
.LP
.eM
The input member is used to communicate to the window manager the input focus
model used by the application.
Applications that expect input but never explicitly set focus to any 
of their subwindows (that is, use the push model of focus management), 
such as X Version 10 style applications that use real-estate
driven focus, should set this member to 
.PN True .  
Similarly, applications
that set input focus to their subwindows only when it is given to their
top-level window by a window manager should also set this member to 
.PN True .
Applications that manage their own input focus by explicitly setting
focus to one of their subwindows whenever they want keyboard input 
(that is, use the pull model of focus management) should set this member to 
.PN False .
Applications that never expect any keyboard input also should set this member
to 
.PN False .
.LP
Pull model window managers should make it possible for push model
applications to get input by setting input focus to the top-level windows of
applications whose input member is 
.PN True .  
Push model window managers should
make sure that pull model applications do not break them 
by resetting input focus to 
.PN PointerRoot 
when it is appropriate (for example, whenever an application whose
input member is 
.PN False 
sets input focus to one of its subwindows).
.LP
The definitions for the initial_state flag are:
.TS
lw(.5i) lw(2i) lw(.2i) lw(2.8i).
T{
#define
T}	T{
.PN WithdrawnState
T}	T{
0
T}	T{
T}
T{
#define
T}	T{
.PN NormalState
T}	T{
1
T}	T{
/* most applications start this way */
T}
T{
#define
T}	T{
.PN IconicState
T}	T{
3
T}	T{
/* application wants to start as an icon */
T}
.TE
The icon_mask specifies which pixels of the icon_pixmap should be used as the
icon.  
This allows for nonrectangular icons.
Both icon_pixmap and icon_mask must be bitmaps.
The icon_window lets an application provide a window for use as an icon
for window managers that support such use.
The window_group lets you specify that this window belongs to a group
of other windows.
For example, if a single application manipulates multiple 
top-level windows, this allows you to provide enough
information that a window manager can iconify all of the windows
rather than just the one window.
.LP
The
.PN UrgencyHint
flag, if set in the flags field, indicates that the client deems the window
contents to be urgent, requiring the timely response of the user.  The
window manager will make some effort to draw the user's attention to this
window while this flag is set.  The client must provide some means by which the
user can cause the urgency flag to be cleared (either mitigating
the condition that made the window urgent or merely shutting off the alarm)
or the window to be withdrawn.
.LP
.sp
To set a window's WM_HINTS property, use
.PN XSetWMHints .
.IN "XSetWMHints" "" "@DEF@"
.sM
.FD 0
XSetWMHints\^(\^\fIdisplay\fP, \fIw\fP, \fIwmhints\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XWMHints *\fIwmhints\fP\^;

.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIwmhints\fP 1i
Specifies the 
.PN XWMHints
structure to be used.
.LP
.eM
The
.PN XSetWMHints
function sets the window manager hints that include icon information and location,
the initial state of the window, and whether the application relies on the
window manager to get keyboard input.
.LP
.PN XSetWMHints
can generate
.PN BadAlloc
and
.PN BadWindow 
errors.
.LP
.sp
To read a window's WM_HINTS property, use
.PN XGetWMHints .
.IN "XGetWMHints" "" "@DEF@"
.sM
.FD 0
XWMHints *XGetWMHints\^(\^\fIdisplay\fP, \fIw\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.LP
.eM
The
.PN XGetWMHints
function reads the window manager hints and 
returns NULL if no WM_HINTS property was set on the window 
or returns a pointer to an 
.PN XWMHints 
structure if it succeeds.
When finished with the data,
free the space used for it by calling
.PN XFree .
.LP
.PN XGetWMHints
can generate a
.PN BadWindow 
error.
.NH 3
Setting and Reading the WM_NORMAL_HINTS Property
.XS
\*(SN Setting and Reading the WM_NORMAL_HINTS Property
.XE
.LP
Xlib provides functions that you can use to set or read 
the WM_NORMAL_HINTS property for a given window.
The functions use the flags and the
.PN XSizeHints 
structure, as defined in the
.hN X11/Xutil.h
header file.
.LP
The size of the
.PN XSizeHints
structure may grow in future releases, as new components are
added to support new ICCCM features.
Passing statically allocated instances of this structure into
Xlib may result in memory corruption when running against a
future release of the library.
As such, it is recommended that only dynamically allocated
instances of the structure be used.
.sp
.LP
To allocate an
.PN XSizeHints
structure, use
.PN XAllocSizeHints .
.IN "XAllocSizeHints" "" "@DEF@"
.sM
.FD 0
XSizeHints *XAllocSizeHints\^(\|)
.FN
.LP
.eM
The
.PN XAllocSizeHints
function allocates and returns a pointer to an
.PN XSizeHints
structure.
Note that all fields in the
.PN XSizeHints
structure are initially set to zero.
If insufficient memory is available, 
.PN XAllocSizeHints
returns NULL.
To free the memory allocated to this structure,
use
.PN XFree .
.LP
The
.PN XSizeHints
structure contains:
.LP
.sM
/* Size hints mask bits */
.TS
lw(.5i) lw(1.1i) lw(1.5i) lw(3.1i).
T{
#define
T}	T{
.PN USPosition
T}	T{
(1L << 0)
T}	T{
/* user specified x, y */
T}
T{
#define
T}	T{
.PN USSize
T}	T{
(1L << 1)
T}	T{
/* user specified width, height */
T}
T{
#define
T}	T{
.PN PPosition
T}	T{
(1L << 2)
T}	T{
/* program specified position */
T}
T{
#define
T}	T{
.PN PSize
T}	T{
(1L << 3)
T}	T{
/* program specified size */
T}
T{
#define
T}	T{
.PN PMinSize
T}	T{
(1L << 4)
T}	T{
/* program specified minimum size */
T}
T{
#define
T}	T{
.PN PMaxSize
T}	T{
(1L << 5)
T}	T{
/* program specified maximum size */
T}
T{
#define
T}	T{
.PN PResizeInc
T}	T{
(1L << 6)
T}	T{
/* program specified resize increments */
T}
T{
#define
T}	T{
.PN PAspect
T}	T{
(1L << 7)
T}	T{
/* program specified min and max aspect ratios */
T}
T{
#define
T}	T{
.PN PBaseSize
T}	T{
(1L << 8)
T}
T{
#define
T}	T{
.PN PWinGravity
T}	T{
(1L << 9)
T}
T{
#define
T}	T{
.PN PAllHints
T}	T{
(PPosition|PSize|
.br
PMinSize|PMaxSize|
.br
PResizeInc|PAspect)
T}	T{
T}
.TE
.IN "XSizeHints" "" "@DEF@"
.Ds 0
.TA .5i 2.5i
.ta .5i 2.5i
/* Values */

typedef struct {
	long flags;	/* marks which fields in this structure are defined */
	int x, y;	/* Obsolete */
	int width, height;	/* Obsolete */
	int min_width, min_height;
	int max_width, max_height;
	int width_inc, height_inc;
	struct {
	       int x;	/* numerator */
	       int y;	/* denominator */
	} min_aspect, max_aspect;
	int base_width, base_height;
	int win_gravity;
	/* this structure may be extended in the future */
} XSizeHints;
.De
.LP
.eM
The x, y, width, and height members are now obsolete
and are left solely for compatibility reasons.
The min_width and min_height members specify the
minimum window size that still allows the application to be useful.
The max_width and max_height members specify the maximum window size.
The width_inc and height_inc members define an arithmetic progression of
sizes (minimum to maximum) into which the window prefers to be resized.
The min_aspect and max_aspect members are expressed
as ratios of x and y, 
and they allow an application to specify the range of aspect
ratios it prefers.
The base_width and base_height members define the desired size of the window.
The window manager will interpret the position of the window 
and its border width to position the point of the outer rectangle 
of the overall window specified by the win_gravity member.
The outer rectangle of the window includes any borders or decorations
supplied by the window manager.
In other words,
if the window manager decides to place the window where the client asked,
the position on the parent window's border named by the win_gravity 
will be placed where the client window would have been placed 
in the absence of a window manager.
.LP
Note that use of the
.PN PAllHints
macro is highly discouraged.
.sp
.LP
To set a window's WM_NORMAL_HINTS property, use
.PN XSetWMNormalHints .
.IN "XSetWMNormalHints" "" "@DEF@"
.sM
.FD 0
void XSetWMNormalHints\^(\^\fIdisplay\fP, \fIw\fP, \fIhints\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XSizeHints *\fIhints\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIhints\fP 1i
Specifies the size hints for the window in its normal state.
.LP
.eM
The 
.PN XSetWMNormalHints 
function replaces the size hints for the WM_NORMAL_HINTS property 
on the specified window.
If the property does not already exist,
.PN XSetWMNormalHints
sets the size hints for the WM_NORMAL_HINTS property on the specified window.
The property is stored with a type of WM_SIZE_HINTS and a format of 32.
.LP
.PN XSetWMNormalHints
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.sp
.LP
To read a window's WM_NORMAL_HINTS property, use
.PN XGetWMNormalHints .
.IN "XGetWMNormalHints" "" "@DEF@"
.sM
.FD 0
Status XGetWMNormalHints\^(\^\fIdisplay\fP, \fIw\fP, \fIhints_return\fP, \
\fIsupplied_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XSizeHints *\fIhints_return\fP\^;
.br
      long *\fIsupplied_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIhints_return\fP 1i
Returns the size hints for the window in its normal state.
.IP \fIsupplied_return\fP 1i
Returns the hints that were supplied by the user.
.LP
.eM
The 
.PN XGetWMNormalHints 
function returns the size hints stored in the WM_NORMAL_HINTS property 
on the specified window.
If the property is of type WM_SIZE_HINTS, is of format 32,
and is long enough to contain either an old (pre-ICCCM) 
or new size hints structure, 
.PN XGetWMNormalHints
sets the various fields of the 
.PN XSizeHints
structure, sets the supplied_return argument to the list of fields 
that were supplied by the user (whether or not they contained defined values),
and returns a nonzero status.
Otherwise, it returns a zero status.
.LP
If 
.PN XGetWMNormalHints
returns successfully and a pre-ICCCM size hints property is read, 
the supplied_return argument will contain the following bits:
.LP
.Ds
(USPosition|USSize|PPosition|PSize|PMinSize|
 PMaxSize|PResizeInc|PAspect)
.De
.LP
If the property is large enough to contain the base size 
and window gravity fields as well, 
the supplied_return argument will also contain the following bits:
.LP
.Ds
PBaseSize|PWinGravity
.De
.LP
.PN XGetWMNormalHints
can generate a
.PN BadWindow
error.
.sp
.LP
To set a window's WM_SIZE_HINTS property, use
.PN XSetWMSizeHints .
.IN "XSetWMSizeHints" "" "@DEF@"
.sM
.FD 0
void XSetWMSizeHints\^(\^\fIdisplay\fP, \fIw\fP, \fIhints\fP, \fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XSizeHints *\fIhints\fP\^;
.br
      Atom \fIproperty\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIhints\fP 1i
Specifies the
.PN XSizeHints
structure to be used.
.IP \fIproperty\fP 1i
Specifies the property name.
.LP
.eM
The 
.PN XSetWMSizeHints 
function replaces the size hints for the specified property 
on the named window.
If the specified property does not already exist,
.PN XSetWMSizeHints
sets the size hints for the specified property
on the named window.
The property is stored with a type of WM_SIZE_HINTS and a format of 32.
To set a window's normal size hints, 
you can use the 
.PN XSetWMNormalHints
function.
.LP
.PN XSetWMSizeHints
can generate
.PN BadAlloc ,
.PN BadAtom , 
and 
.PN BadWindow
errors.
.sp
.LP
To read a window's WM_SIZE_HINTS property, use
.PN XGetWMSizeHints .
.IN "XGetWMSizeHints" "" "@DEF@"
.sM
.FD 0
Status XGetWMSizeHints\^(\^\fIdisplay\fP, \fIw\fP, \fIhints_return\fP, \
\fIsupplied_return\fP, \fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XSizeHints *\fIhints_return\fP\^;
.br
      long *\fIsupplied_return\fP\^;
.br
      Atom \fIproperty\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIhints_return\fP 1i
Returns the
.PN XSizeHints
structure.
.IP \fIsupplied_return\fP 1i
Returns the hints that were supplied by the user.
.IP \fIproperty\fP 1i
Specifies the property name.
.LP
.eM
The 
.PN XGetWMSizeHints
function returns the size hints stored in the specified property 
on the named window.
If the property is of type WM_SIZE_HINTS, is of format 32, 
and is long enough to contain either an old (pre-ICCCM) 
or new size hints structure, 
.PN XGetWMSizeHints
sets the various fields of the 
.PN XSizeHints
structure, sets the supplied_return argument to the
list of fields that were supplied by the user 
(whether or not they contained defined values), 
and returns a nonzero status.
Otherwise, it returns a zero status.
To get a window's normal size hints, 
you can use the 
.PN XGetWMNormalHints 
function.
.LP
If 
.PN XGetWMSizeHints
returns successfully and a pre-ICCCM size hints property is read, 
the supplied_return argument will contain the following bits:
.LP
.Ds
(USPosition|USSize|PPosition|PSize|PMinSize|
 PMaxSize|PResizeInc|PAspect)
.De
.LP
If the property is large enough to contain the base size 
and window gravity fields as well, 
the supplied_return argument will also contain the following bits:
.LP
.Ds
PBaseSize|PWinGravity
.De
.LP
.PN XGetWMSizeHints
can generate
.PN BadAtom 
and 
.PN BadWindow
errors.
.NH 3
Setting and Reading the WM_CLASS Property
.XS
\*(SN Setting and Reading the WM_CLASS Property
.XE
.LP
Xlib provides functions that you can use to set and get 
the WM_CLASS property for a given window.
These functions use the
.PN XClassHint 
structure, which is defined in the
.hN X11/Xutil.h
header file.
.sp
.LP
To allocate an
.PN XClassHint
structure, use
.PN XAllocClassHint .
.IN "XAllocClassHint" "" "@DEF@"
.sM
.FD 0
XClassHint *XAllocClassHint\^(\|)
.FN
.LP
.eM
The
.PN XAllocClassHint
function allocates and returns a pointer to an
.PN XClassHint
structure.
Note that the pointer fields in the
.PN XClassHint
structure are initially set to NULL.
If insufficient memory is available, 
.PN XAllocClassHint
returns NULL.
To free the memory allocated to this structure,
use
.PN XFree .
.LP
The
.PN XClassHint
contains:
.LP
.sM
.IN "XClassHint" "" "@DEF@"
.Ds 0
.TA .5i
.ta .5i
typedef struct {
	char *res_name;
	char *res_class;
} XClassHint;
.De
.LP
.eM
The res_name member contains the application name, 
and the res_class member contains the application class. 
Note that the name set in this property may differ from the name set as WM_NAME.
That is, WM_NAME specifies what should be displayed in the title bar and,
therefore, can contain temporal information (for example, the name of
a file currently in an editor's buffer).
On the other hand, 
the name specified as part of WM_CLASS is the formal name of the application
that should be used when retrieving the application's resources from the 
resource database.
.LP
.sp
To set a window's WM_CLASS property, use
.PN XSetClassHint .
.IN "XSetClassHint" "" "@DEF@"
.sM
.FD 0
XSetClassHint\^(\^\fIdisplay\fP, \fIw\fP, \fIclass_hints\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XClassHint *\fIclass_hints\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIclass_hints\fP 1i
Specifies the
.PN XClassHint
structure that is to be used.
.LP
.eM
The
.PN XSetClassHint
function sets the class hint for the specified window.
If the strings are not in the Host Portable Character Encoding,
the result is implementation-dependent.
.LP
.PN XSetClassHint
can generate
.PN BadAlloc
and
.PN BadWindow
errors. 
.LP
.sp
To read a window's WM_CLASS property, use
.PN XGetClassHint .
.IN "XGetClassHint" "" "@DEF@"
.sM
.FD 0
Status XGetClassHint\^(\^\fIdisplay\fP, \fIw\fP, \fIclass_hints_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP;
.br
      XClassHint *\fIclass_hints_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIclass_hints_return\fP 1i
Returns the 
.PN XClassHint
structure.
.LP
.eM
The
.PN XGetClassHint
function returns the class hint of the specified window to the members
of the supplied structure.
If the data returned by the server is in the Latin Portable Character Encoding,
then the returned strings are in the Host Portable Character Encoding.
Otherwise, the result is implementation-dependent.
It returns a nonzero status on success;
otherwise, it returns a zero status.
To free res_name and res_class when finished with the strings,
use
.PN XFree
on each individually.
.LP
.PN XGetClassHint
can generate a
.PN BadWindow 
error.
.NH 3
Setting and Reading the WM_TRANSIENT_FOR Property
.XS
\*(SN Setting and Reading the WM_TRANSIENT_FOR Property
.XE
.LP
Xlib provides functions that you can use to set and read
the WM_TRANSIENT_FOR property for a given window.
.LP
.sp
To set a window's WM_TRANSIENT_FOR property, use
.PN XSetTransientForHint .
.IN "XSetTransientForHint" "" "@DEF@"
.sM
.FD 0
XSetTransientForHint\^(\^\fIdisplay\fP, \fIw\fP, \fIprop_window\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Window \fIprop_window\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIprop_window\fP 1i
Specifies the window that the WM_TRANSIENT_FOR property is to be set to.
.LP
.eM
The
.PN XSetTransientForHint
function sets the WM_TRANSIENT_FOR property of the specified window to the 
specified prop_window.
.LP
.PN XSetTransientForHint
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.LP
.sp
To read a window's WM_TRANSIENT_FOR property, use
.PN XGetTransientForHint .
.IN "XGetTransientForHint" "" "@DEF@"
.sM
.FD 0
Status XGetTransientForHint\^(\^\fIdisplay\fP, \fIw\fP, \fIprop_window_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Window *\fIprop_window_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIprop_window_return\fP 1i
Returns the WM_TRANSIENT_FOR property of the specified window.
.LP
.eM
The
.PN XGetTransientForHint
function returns the WM_TRANSIENT_FOR property for the specified window.
It returns a nonzero status on success;
otherwise, it returns a zero status.
.LP
.PN XGetTransientForHint
can generate a
.PN BadWindow 
error.
.NH 3
Setting and Reading the WM_PROTOCOLS Property
.XS
\*(SN Setting and Reading the WM_PROTOCOLS Property
.XE
.LP
Xlib provides functions that you can use to set and read
the WM_PROTOCOLS property for a given window.
.LP
.sp
To set a window's WM_PROTOCOLS property, use
.PN XSetWMProtocols .
.IN "XSetWMProtocols" "" "@DEF@"
.sM
.FD 0
Status XSetWMProtocols\^(\^\fIdisplay\fP, \fIw\fP, \fIprotocols\fP, \
\fIcount\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Atom *\fIprotocols\fP\^;
.br
      int \fIcount\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIprotocols\fP 1i
Specifies the list of protocols.
.ds Cn protocols in the list
.IP \fIcount\fP 1i
Specifies the number of \*(Cn.
.LP
.eM
The 
.PN XSetWMProtocols 
function replaces the WM_PROTOCOLS property on the specified window 
with the list of atoms specified by the protocols argument.
If the property does not already exist,
.PN XSetWMProtocols
sets the WM_PROTOCOLS property on the specified window
to the list of atoms specified by the protocols argument.
The property is stored with a type of ATOM and a format of 32.
If it cannot intern the WM_PROTOCOLS atom, 
.PN XSetWMProtocols
returns a zero status.
Otherwise, it returns a nonzero status.
.LP
.PN XSetWMProtocols
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.sp
.LP
To read a window's WM_PROTOCOLS property, use
.PN XGetWMProtocols .
.IN "XGetWMProtocols" "" "@DEF@"
.sM
.FD 0
Status XGetWMProtocols\^(\^\fIdisplay\fP, \fIw\fP, \fIprotocols_return\fP, \
\fIcount_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Atom **\fIprotocols_return\fP\^;
.br
      int *\fIcount_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIprotocols_return\fP 1i
Returns the list of protocols.
.ds Cn protocols in the list
.IP \fIcount_return\fP 1i
Returns the number of \*(Cn.
.LP
.eM
The 
.PN XGetWMProtocols 
function returns the list of atoms stored in the WM_PROTOCOLS property 
on the specified window.
These atoms describe window manager protocols in which the owner 
of this window is willing to participate.
If the property exists, is of type ATOM, is of format 32, 
and the atom WM_PROTOCOLS can be interned, 
.PN XGetWMProtocols
sets the protocols_return argument to a list of atoms, 
sets the count_return argument to the number of elements in the list, 
and returns a nonzero status.
Otherwise, it sets neither of the return arguments
and returns a zero status.
To release the list of atoms, use
.PN XFree .
.LP
.PN XGetWMProtocols
can generate a
.PN BadWindow
error.
.NH 3
Setting and Reading the WM_COLORMAP_WINDOWS Property
.XS
\*(SN Setting and Reading the WM_COLORMAP_WINDOWS Property
.XE
.LP
Xlib provides functions that you can use to set and read
the WM_COLORMAP_WINDOWS property for a given window.
.sp
.LP
To set a window's WM_COLORMAP_WINDOWS property, use
.PN XSetWMColormapWindows .
.IN "XSetWMColormapWindows" "" "@DEF@"
.sM
.FD 0
Status XSetWMColormapWindows\^(\^\fIdisplay\fP, \fIw\fP, \
\fIcolormap_windows\fP, \fIcount\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Window *\fIcolormap_windows\fP\^;
.br
      int \fIcount\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIcolormap_windows\fP 1i
Specifies the list of windows.
.ds Cn windows in the list
.IP \fIcount\fP 1i
Specifies the number of \*(Cn.
.LP
.eM
The 
.PN XSetWMColormapWindows 
function replaces the WM_COLORMAP_WINDOWS property on the specified
window with the list of windows specified by the colormap_windows argument.
If the property does not already exist,
.PN XSetWMColormapWindows
sets the WM_COLORMAP_WINDOWS property on the specified
window to the list of windows specified by the colormap_windows argument.
The property is stored with a type of WINDOW and a format of 32.
If it cannot intern the WM_COLORMAP_WINDOWS atom,
.PN XSetWMColormapWindows
returns a zero status.
Otherwise, it returns a nonzero status.
.LP
.PN XSetWMColormapWindows
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.sp
.LP
To read a window's WM_COLORMAP_WINDOWS property, use
.PN XGetWMColormapWindows .
.IN "XGetWMColormapWindows" "" "@DEF@"
.sM
.FD 0
Status XGetWMColormapWindows\^(\^\fIdisplay\fP, \fIw\fP, \
\fIcolormap_windows_return\fP, \fIcount_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Window **\fIcolormap_windows_return\fP\^;
.br
      int *\fIcount_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIcolormap_windows_return\fP 1i
Returns the list of windows.
.ds Cn windows in the list
.IP \fIcount_return\fP 1i
Returns the number of \*(Cn.
.LP
.eM
The 
.PN XGetWMColormapWindows 
function returns the list of window identifiers stored 
in the WM_COLORMAP_WINDOWS property on the specified window.
These identifiers indicate the colormaps that the window manager
may need to install for this window.
If the property exists, is of type WINDOW, is of format 32, 
and the atom WM_COLORMAP_WINDOWS can be interned, 
.PN XGetWMColormapWindows
sets the windows_return argument to a list of window identifiers, 
sets the count_return argument to the number of elements in the list, 
and returns a nonzero status.
Otherwise, it sets neither of the return arguments
and returns a zero status.
To release the list of window identifiers, use
.PN XFree . 
.LP
.PN XGetWMColormapWindows
can generate a
.PN BadWindow
error.
.NH 3
Setting and Reading the WM_ICON_SIZE Property
.XS
\*(SN Setting and Reading the WM_ICON_SIZE Property
.XE
.LP
Xlib provides functions that you can use to set and read 
the WM_ICON_SIZE property for a given window.
These functions use the 
.PN XIconSize 
.IN "XIconSize"
structure, which is defined in the
.hN X11/Xutil.h
header file.
.sp
.LP
To allocate an
.PN XIconSize
structure, use
.PN XAllocIconSize .
.IN "XAllocIconSize" "" "@DEF@"
.sM
.FD 0
XIconSize *XAllocIconSize\^(\|)
.FN
.LP
.eM
The
.PN XAllocIconSize 
function allocates and returns a pointer to an
.PN XIconSize 
structure.
Note that all fields in the
.PN XIconSize
structure are initially set to zero.
If insufficient memory is available, 
.PN XAllocIconSize
returns NULL.
To free the memory allocated to this structure,
use
.PN XFree .
.LP
The
.PN XIconSize
structure contains:
.LP
.sM
.IN "XIconSize" "" "@DEF@"
.Ds 0
.TA .5i 2.5i
.ta .5i 2.5i
typedef struct {
	int min_width, min_height;
	int max_width, max_height;
	int width_inc, height_inc;
} XIconSize;
.De
.LP
.eM
The width_inc and height_inc members define an arithmetic progression of
sizes (minimum to maximum) that represent the supported icon sizes.
.LP
.sp
To set a window's WM_ICON_SIZE property, use
.PN XSetIconSizes .
.IN "XSetIconSizes" "" "@DEF@"
.sM
.FD 0
XSetIconSizes\^(\^\fIdisplay\fP, \fIw\fP, \fIsize_list\fP, \fIcount\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XIconSize *\fIsize_list\fP\^;
.br
      int \fIcount\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIsize_list\fP 1i
Specifies the size list.
.IP \fIcount\fP 1i
Specifies the number of items in the size list.
.LP
.eM
The
.PN XSetIconSizes
function is used only by window managers to set the supported icon sizes.
.LP
.PN XSetIconSizes
can generate
.PN BadAlloc
and
.PN BadWindow 
errors.
.LP
.sp
To read a window's WM_ICON_SIZE property, use
.PN XGetIconSizes .
.IN "XGetIconSizes" "" "@DEF@"
.sM
.FD 0
Status XGetIconSizes\^(\^\fIdisplay\fP, \fIw\fP, \fIsize_list_return\fP, \fIcount_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XIconSize **\fIsize_list_return\fP\^;
.br
      int *\fIcount_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIsize_list_return\fP 1i
Returns the size list.
.IP \fIcount_return\fP 1i
Returns the number of items in the size list.
.LP
.eM
The
.PN XGetIconSizes
function returns zero if a window manager has not set icon sizes;
otherwise, it returns nonzero.
.PN XGetIconSizes
should be called by an application that
wants to find out what icon sizes would be most appreciated by the
window manager under which the application is running.
The application
should then use
.PN XSetWMHints
to supply the window manager with an icon pixmap or window in one of the
supported sizes.
To free the data allocated in size_list_return, use
.PN XFree .
.LP
.PN XGetIconSizes
can generate a
.PN BadWindow 
error.
.NH 3
Using Window Manager Convenience Functions
.XS
\*(SN Using Window Manager Convenience Functions
.XE
.LP
The 
.PN XmbSetWMProperties
function stores the standard set of window manager properties,
with text properties in standard encodings
for internationalized text communication.
The standard window manager properties for a given window are
WM_NAME, WM_ICON_NAME, WM_HINTS, WM_NORMAL_HINTS, WM_CLASS,
WM_COMMAND, WM_CLIENT_MACHINE, and WM_LOCALE_NAME.
.IN "XmbSetWMProperties" "" "@DEF@"
.sM
.FD 0
void XmbSetWMProperties\^(\^\fIdisplay\fP\^, \fIw\fP\^, \fIwindow_name\fP\^, \fIicon_name\fP\^, \fIargv\fP\^, \fIargc\fP\^,
.br
                      \fInormal_hints\fP\^, \fIwm_hints\fP\^, \fIclass_hints\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      char *\fIwindow_name\fP\^;
.br
      char *\fIicon_name\fP\^;
.br
      char *\fIargv\fP\^[];
.br
      int \fIargc\fP\^;
.br
      XSizeHints *\fInormal_hints\fP\^;
.br
      XWMHints *\fIwm_hints\fP\^;
.br
      XClassHint *\fIclass_hints\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIwindow_name\fP 1i
Specifies the window name,
which should be a null-terminated string.
.IP \fIicon_name\fP 1i
Specifies the icon name,
which should be a null-terminated string.
.IP \fIargv\fP 1i
Specifies the application's argument list.
.IP \fIargc\fP 1i
Specifies the number of arguments.
.IP \fIhints\fP 1i
Specifies the size hints for the window in its normal state.
.IP \fIwm_hints\fP 1i
Specifies the
.PN XWMHints
structure to be used.
.IP \fIclass_hints\fP 1i
Specifies the
.PN XClassHint
structure to be used.
.LP
.eM
The
.PN XmbSetWMProperties
convenience function provides a simple programming interface 
for setting those essential window properties that are used 
for communicating with other clients
(particularly window and session managers).
.LP
If the window_name argument is non-NULL,
.PN XmbSetWMProperties
sets the WM_NAME property.
If the icon_name argument is non-NULL,
.PN XmbSetWMProperties
sets the WM_ICON_NAME property.
The window_name and icon_name arguments are null-terminated strings
in the encoding of the current locale.
If the arguments can be fully converted to the STRING encoding,
the properties are created with type ``STRING''; 
otherwise, the arguments are converted to Compound Text, 
and the properties are created with type ``COMPOUND_TEXT''.
.LP
If the normal_hints argument is non-NULL,
.PN XmbSetWMProperties
calls
.PN XSetWMNormalHints ,
which sets the WM_NORMAL_HINTS property (see section 14.1.7).
If the wm_hints argument is non-NULL, 
.PN XmbSetWMProperties
calls
.PN XSetWMHints ,
which sets the WM_HINTS property (see section 14.1.6).
.LP
If the argv argument is non-NULL,
.PN XmbSetWMProperties
sets the WM_COMMAND property from argv and argc.
An argc of zero indicates a zero-length command.
.LP
The hostname of the machine is stored using 
.PN XSetWMClientMachine 
(see section 14.2.2).
.LP
If the class_hints argument is non-NULL,
.PN XmbSetWMProperties
sets the WM_CLASS property.
If the res_name member in the 
.PN XClassHint
structure is set to the NULL pointer and the RESOURCE_NAME
environment variable is set,
the value of the environment variable is substituted for res_name.
If the res_name member is NULL,
the environment variable is not set, and argv and argv[0] are set,
then the value of argv[0], stripped of any directory prefixes,
is substituted for res_name.
.LP
It is assumed that the supplied class_hints.res_name and argv,
the RESOURCE_NAME environment variable, and the hostname of the machine
are in the encoding of the locale announced for the LC_CTYPE category
(on POSIX-compliant systems, the LC_CTYPE, else LANG environment variable).
The corresponding WM_CLASS, WM_COMMAND, and WM_CLIENT_MACHINE properties
are typed according to the local host locale announcer.
No encoding conversion is performed prior to storage in the properties.
.LP
For clients that need to process the property text in a locale,
.PN XmbSetWMProperties
sets the WM_LOCALE_NAME property to be the name of the current locale.
The name is assumed to be in the Host Portable Character Encoding
and is converted to STRING for storage in the property.
.LP
.PN XmbSetWMProperties
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.sp
.LP
To set a window's standard window manager properties
with strings in client-specified encodings, use
.PN XSetWMProperties .
The standard window manager properties for a given window are
WM_NAME, WM_ICON_NAME, WM_HINTS, WM_NORMAL_HINTS, WM_CLASS,
WM_COMMAND, and WM_CLIENT_MACHINE.
.IN "XSetWMProperties" "" "@DEF@"
.sM
.FD 0
void XSetWMProperties\^(\^\fIdisplay\fP, \fIw\fP, \fIwindow_name\fP, \
\fIicon_name\fP, \fIargv\fP, \fIargc\fP, \fInormal_hints\fP, \fIwm_hints\fP, \
\fIclass_hints\fP\^)
.br
      Display *\fIdisplay\fP\^; 
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fIwindow_name\fP\^;
.br
      XTextProperty *\fIicon_name\fP\^;
.br
      char **\fIargv\fP\^;
.br
      int \fIargc\fP\^;
.br
      XSizeHints *\fInormal_hints\fP\^;
.br
      XWMHints *\fIwm_hints\fP\^;
.br
      XClassHint *\fIclass_hints\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIwindow_name\fP 1i
Specifies the window name,
which should be a null-terminated string.
.IP \fIicon_name\fP 1i
Specifies the icon name,
which should be a null-terminated string.
.IP \fIargv\fP 1i
Specifies the application's argument list.
.IP \fIargc\fP 1i
Specifies the number of arguments.
.IP \fInormal_hints\fP 1i
Specifies the size hints for the window in its normal state.
.IP \fIwm_hints\fP 1i
Specifies the
.PN XWMHints
structure to be used.
.IP \fIclass_hints\fP 1i
Specifies the
.PN XClassHint
structure to be used.
.LP
.eM
The 
.PN XSetWMProperties 
convenience function provides a single programming interface 
for setting those essential window properties that are used 
for communicating with other clients (particularly window and session
managers).
.LP
If the window_name argument is non-NULL, 
.PN XSetWMProperties
calls
.PN XSetWMName ,
which, in turn, sets the WM_NAME property (see section 14.1.4).
If the icon_name argument is non-NULL,
.PN XSetWMProperties
calls
.PN XSetWMIconName ,
which sets the WM_ICON_NAME property (see section 14.1.5).
If the argv argument is non-NULL, 
.PN XSetWMProperties
calls
.PN XSetCommand ,
which sets the WM_COMMAND property (see section 14.2.1).
Note that an argc of zero is allowed to indicate a zero-length command.
Note also that the hostname of this machine is stored using
.PN XSetWMClientMachine 
(see section 14.2.2).
.LP
If the normal_hints argument is non-NULL, 
.PN XSetWMProperties
calls
.PN XSetWMNormalHints ,
which sets the WM_NORMAL_HINTS property (see section 14.1.7).
If the wm_hints argument is non-NULL, 
.PN XSetWMProperties
calls
.PN XSetWMHints ,
which sets the WM_HINTS property (see section 14.1.6).
.LP
If the class_hints argument is non-NULL, 
.PN XSetWMProperties
calls
.PN XSetClassHint ,
which sets the WM_CLASS property (see section 14.1.8).
If the res_name member in the
.PN XClassHint
structure is set to the NULL pointer and the RESOURCE_NAME environment 
variable is set, 
then the value of the environment variable is substituted for res_name.
If the res_name member is NULL, 
the environment variable is not set, 
and argv and argv[0] are set, 
then the value of argv[0], stripped of
any directory prefixes, is substituted for res_name.
.LP
.PN XSetWMProperties
can generate
.PN BadAlloc
and
.PN BadWindow
errors.
.NH 2
Client to Session Manager Communication
.XS
\*(SN Client to Session Manager Communication
.XE
.LP
This section discusses how to:
.IP \(bu 5
Set and read the WM_COMMAND property
.IP \(bu 5
Set and read the WM_CLIENT_MACHINE property
.NH 3
Setting and Reading the WM_COMMAND Property
.XS
\*(SN Setting and Reading the WM_COMMAND Property
.XE
.LP
Xlib provides functions that you can use to set and read
the WM_COMMAND property for a given window.
.sp
.LP
To set a window's WM_COMMAND property, use
.PN XSetCommand .
.IN "XSetCommand" "" "@DEF@"
.sM
.FD 0
XSetCommand\^(\^\fIdisplay\fP, \fIw\fP, \fIargv\fP, \fIargc\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      char **\fIargv\fP\^;
.br
      int \fIargc\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIargv\fP 1i
Specifies the application's argument list.
.IP \fIargc\fP 1i
Specifies the number of arguments.
.LP
.eM
The
.PN XSetCommand
function sets the command and arguments used to invoke the
application.
(Typically, argv is the argv array of your main program.)
If the strings are not in the Host Portable Character Encoding,
the result is implementation-dependent.
.LP
.PN XSetCommand
can generate
.PN BadAlloc
and
.PN BadWindow 
errors.
.sp
.LP
To read a window's WM_COMMAND property, use
.PN XGetCommand .
.IN "XGetCommand" "" "@DEF@"
.sM
.FD 0
Status XGetCommand\^(\^\fIdisplay\fP, \fIw\fP, \fIargv_return\fP, \
\fIargc_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      char ***\fIargv_return\fP\^;
.br
      int *\fIargc_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIargv_return\fP 1i
Returns the application's argument list.
.IP \fIargc_return\fP 1i
Returns the number of arguments returned.
.LP
.eM
The 
.PN XGetCommand 
function reads the WM_COMMAND property from the specified window 
and returns a string list.
If the WM_COMMAND property exists, 
it is of type STRING and format 8.
If sufficient memory can be allocated to contain the string list, 
.PN XGetCommand
fills in the argv_return and argc_return arguments
and returns a nonzero status.
Otherwise, it returns a zero status.
If the data returned by the server is in the Latin Portable Character Encoding,
then the returned strings are in the Host Portable Character Encoding.
Otherwise, the result is implementation-dependent.
To free the memory allocated to the string list, use
.PN XFreeStringList .
.NH 3
Setting and Reading the WM_CLIENT_MACHINE Property
.XS
\*(SN Setting and Reading the WM_CLIENT_MACHINE Property
.XE
.LP
Xlib provides functions that you can use to set and read 
the WM_CLIENT_MACHINE property for a given window.
.sp
.LP
To set a window's WM_CLIENT_MACHINE property, use
.PN XSetWMClientMachine .
.IN "XSetWMClientMachine" "" "@DEF@"
.sM
.FD 0
void XSetWMClientMachine\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fItext_prop\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop\fP 1i
Specifies the
.PN XTextProperty
structure to be used.
.LP
.eM
The
.PN XSetWMClientMachine
convenience function calls
.PN XSetTextProperty
to set the WM_CLIENT_MACHINE property.
.sp
.LP
To read a window's WM_CLIENT_MACHINE property, use
.PN XGetWMClientMachine .
.IN "XGetWMClientMachine" "" "@DEF@"
.sM
.FD 0
Status XGetWMClientMachine\^(\^\fIdisplay\fP, \fIw\fP, \fItext_prop_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XTextProperty *\fItext_prop_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fItext_prop_return\fP 1i
Returns the
.PN XTextProperty
structure.
.LP
.eM
The
.PN XGetWMClientMachine
convenience function performs an 
.PN XGetTextProperty 
on the WM_CLIENT_MACHINE property.
It returns a nonzero status on success;
otherwise, it returns a zero status.
.NH 2
Standard Colormaps
.XS
\*(SN Standard Colormaps 
.XE
.LP
Applications with color palettes, smooth-shaded drawings, or digitized
images demand large numbers of colors.  
In addition, these applications often require an efficient mapping 
from color triples to pixel values that display the appropriate colors.
.LP
As an example, consider a three-dimensional display program that wants 
to draw a smoothly shaded sphere.  
At each pixel in the image of the sphere, 
the program computes the intensity and color of light
reflected back to the viewer.  
The result of each computation is a triple of red, green, and blue (RGB)
coefficients in the range 0.0 to 1.0.  
To draw the sphere, the program needs a colormap that provides a
large range of uniformly distributed colors.  
The colormap should be arranged so that the program can
convert its RGB triples into pixel values very quickly,
because drawing the entire sphere requires many such
conversions.
.LP
On many current workstations,
the display is limited to 256 or fewer colors.  
Applications must allocate colors carefully, 
not only to make sure they cover the entire range they need 
but also to make use of as many of the available colors as possible.
On a typical X display, 
many applications are active at once.
Most workstations have only one hardware look-up table for colors,
so only one application colormap can be installed at a given time.
The application using the installed colormap is displayed correctly, 
and the other applications go technicolor and are
displayed with false colors.
.LP
As another example, consider a user who is running an 
image processing program to display earth-resources data.  
The image processing program needs a colormap set up with 8 reds, 
8 greens, and 4 blues, for a total of 256 colors.
Because some colors are already in use in the default colormap, 
the image processing program allocates and installs a new colormap.
.LP
The user decides to alter some of the colors in the image
by invoking a color palette program to mix and choose colors.
The color palette program also needs a
colormap with eight reds, eight greens, and four blues, so just like
the image processing program, it must allocate and
install a new colormap.
.LP
Because only one colormap can be installed at a time,
the color palette may be displayed incorrectly
whenever the image processing program is active.
Conversely, whenever the palette program is active, 
the image may be displayed incorrectly.  
The user can never match or compare colors in the palette and image.
Contention for colormap resources can be reduced if applications
with similar color needs share colormaps.
.LP
The image processing program and the color palette program 
could share the same colormap if there existed a convention that described
how the colormap was set up.  
Whenever either program was active, 
both would be displayed correctly.
.LP
The standard colormap properties define a set of commonly used
colormaps.  
Applications that share these colormaps and conventions display 
true colors more often and provide a better interface to the user.
.LP
Standard colormaps allow applications to share commonly used color
resources.  
This allows many applications to be displayed in true colors
simultaneously, even when each application needs an entirely filled
colormap.
.LP
Several standard colormaps are described in this section.
Usually, a window manager creates these colormaps.
Applications should use the standard colormaps if they already exist.
.sp
.LP
To allocate an
.PN XStandardColormap
structure, use
.PN XAllocStandardColormap .
.IN "XAllocStandardColormap" "" "@DEF@"
.sM
.FD 0
XStandardColormap *XAllocStandardColormap\^(\|)
.FN
.LP
.eM
The
.PN XAllocStandardColormap
function allocates and returns a pointer to an
.PN XStandardColormap
structure.
Note that all fields in the
.PN XStandardColormap
structure are initially set to zero.
If insufficient memory is available, 
.PN XAllocStandardColormap
returns NULL.
To free the memory allocated to this structure,
use
.PN XFree .
.LP
The 
.PN XStandardColormap 
structure contains:
.LP
.sM
/* Hints */
.TS
lw(.5i) lw(2i) lw(1i).
T{
#define
T}	T{
.PN ReleaseByFreeingColormap
T}	T{
( (XID) 1L)
T}
.TE
/* Values */
.IN "XStandardColormap" "" "@DEF@"
.Ds 0
.TA .5i 2.5i
.ta .5i 2.5i
typedef struct {
	Colormap colormap;
	unsigned long red_max;
	unsigned long red_mult;
	unsigned long green_max;
	unsigned long green_mult;
	unsigned long blue_max;
	unsigned long blue_mult;
	unsigned long base_pixel;
	VisualID visualid;
	XID killid;
} XStandardColormap;
.De
.LP
.eM
The colormap member is the colormap created by the
.PN XCreateColormap
function.
The red_max, green_max, and blue_max members give the maximum
red, green, and blue values, respectively.  
Each color coefficient ranges from zero to its max, inclusive.  
For example,
a common colormap allocation is 3/3/2 (3 planes for red, 3
planes for green, and 2 planes for blue).  
This colormap would have red_max = 7, green_max = 7, 
and blue_max = 3.  
An alternate allocation that uses only 216 colors is red_max = 5, 
green_max = 5, and blue_max = 5.
.LP
The red_mult, green_mult, and blue_mult members give the
scale factors used to compose a full pixel value. 
(See the discussion of the base_pixel members for further information.)
For a 3/3/2 allocation, red_mult might be 32,
green_mult might be 4, and blue_mult might be 1.  
For a 6-colors-each allocation, red_mult might be 36, 
green_mult might be 6, and blue_mult might be 1.
.LP
The base_pixel member gives the base pixel value used to
compose a full pixel value.  
Usually, the base_pixel is obtained from a call to the 
.PN XAllocColorPlanes
function.  
Given integer red, green, and blue coefficients in their appropriate 
ranges, one then can compute a corresponding pixel value by
using the following expression:
.LP
.Ds
.TA .5i 1.5i
.ta .5i 1.5i
(r * red_mult + g * green_mult + b * blue_mult + base_pixel) & 0xFFFFFFFF
.De
.LP
For 
.PN GrayScale
colormaps, 
only the colormap, red_max, red_mult, 
and base_pixel members are defined. 
The other members are ignored.  
To compute a 
.PN GrayScale 
pixel value, use the following expression:
.LP
.Ds
.TA .5i 1.5i
.ta .5i 1.5i
(gray * red_mult + base_pixel) & 0xFFFFFFFF
.De
.LP
Negative multipliers can be represented by converting the 2's
complement representation of the multiplier into an unsigned long and
storing the result in the appropriate _mult field.
The step of masking by 0xFFFFFFFF effectively converts the resulting
positive multiplier into a negative one.
The masking step will take place automatically on many machine architectures,
depending on the size of the integer type used to do the computation.
.LP
The visualid member gives the ID number of the visual from which the
colormap was created.
The killid member gives a resource ID that indicates whether
the cells held by this standard colormap are to be released 
by freeing the colormap ID or by calling the
.PN XKillClient
function on the indicated resource.
(Note that this method is necessary for allocating out of an existing colormap.)
.LP
The properties containing the 
.PN XStandardColormap 
information have 
the type RGB_COLOR_MAP.
.LP
The remainder of this section discusses standard colormap properties and atoms
as well as how to manipulate standard colormaps.
.NH 3
Standard Colormap Properties and Atoms
.XS
\*(SN Standard Colormap Properties and Atoms 
.XE
.LP
.IN "Standard Colormaps"
.IN "Colormaps" "standard"
Several standard colormaps are available.  
Each standard colormap is defined by a property, 
and each such property is identified by an atom.  
The following list names the atoms and describes the colormap
associated with each one.
The
.hN X11/Xatom.h
header file contains the definitions for each of the following atoms,
which are prefixed with XA_.
.IP RGB_DEFAULT_MAP 5
This atom names a property.
The value of the property is an array of
.PN XStandardColormap
structures.
Each entry in the array describes an RGB subset of the default color
map for the Visual specified by visual_id.
.IP
Some applications only need a few RGB colors and
may be able to allocate them from the system default colormap.
This is the ideal situation because the fewer colormaps that are
active in the system the more applications are displayed
with correct colors at all times.
.IP
A typical allocation for the RGB_DEFAULT_MAP on 8-plane displays
is 6 reds, 6 greens, and 6 blues.  
This gives 216 uniformly distributed colors 
(6 intensities of 36 different hues) and still leaves 40 elements 
of a 256-element colormap available for special-purpose colors 
for text, borders, and so on.
.IP RGB_BEST_MAP 5
.br
This atom names a property.
The value of the property is an 
.PN XStandardColormap .
.IP 
The property defines the best RGB colormap available on
the screen.
(Of course, this is a subjective evaluation.)
Many image processing and three-dimensional applications need to
use all available colormap cells and to distribute as many
perceptually distinct colors as possible over those cells.
This implies that there may be more green values available than
red, as well as more green or red than blue.
.IP
For an 8-plane 
.PN PseudoColor 
visual, 
RGB_BEST_MAP is likely to be a 3/3/2 allocation.  
For a 24-plane 
.PN DirectColor 
visual, 
RGB_BEST_MAP is normally an 8/8/8 allocation.  
.IP RGB_RED_MAP 5
.br
.ns
.IP RGB_GREEN_MAP 5
.br
.ns
.IP RGB_BLUE_MAP 5
These atoms name properties.
The value of each property is an
.PN XStandardColormap . 
.IP
The properties define all-red, all-green, and all-blue
colormaps, respectively.  
These maps are used by applications that want to make color-separated 
images.  
For example, a user might generate a full-color image 
on an 8-plane display both by rendering an image three times 
(once with high color resolution in red, once with green, 
and once with blue) and by multiply exposing a single frame in a camera.
.IP RGB_GRAY_MAP 5
This atom names a property.
The value of the property is an 
.PN XStandardColormap .
.IP
The property describes the best 
.PN GrayScale 
colormap available on the screen.  
As previously mentioned, 
only the colormap, red_max, red_mult, and base_pixel members of the
.PN XStandardColormap 
structure are used for 
.PN GrayScale 
colormaps.
.NH 3
Setting and Obtaining Standard Colormaps
.XS
\*(SN Setting and Obtaining Standard Colormaps
.XE
.LP
Xlib provides functions that you can use to set and obtain an
.PN XStandardColormap
structure.
.sp
.LP
To set an
.PN XStandardColormap
structure, use
.PN XSetRGBColormaps .
.IN "XSetRGBColormaps" "" "@DEF@"
.sM
.FD 0
void XSetRGBColormaps\^(\^\fIdisplay\fP, \fIw\fP, \fIstd_colormap\fP, \
\fIcount\fP, \fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XStandardColormap *\fIstd_colormap\fP\^;
.br
      int \fIcount\fP\^;
.br
      Atom \fIproperty\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIstd_colormap\fP 1i
Specifies the
.PN XStandardColormap
structure to be used.
.ds Cn colormaps
.IP \fIcount\fP 1i
Specifies the number of \*(Cn.
.IP \fIproperty\fP 1i
Specifies the property name.
.LP
.eM
The 
.PN XSetRGBColormaps 
function replaces the RGB colormap definition in the specified property 
on the named window.
If the property does not already exist,
.PN XSetRGBColormaps
sets the RGB colormap definition in the specified property
on the named window.
The property is stored with a type of RGB_COLOR_MAP and a format of 32.
Note that it is the caller's responsibility to honor the ICCCM
restriction that only RGB_DEFAULT_MAP contain more than one definition.
.LP
The
.PN XSetRGBColormaps
function usually is only used by window or session managers.
To create a standard colormap, 
follow this procedure:
.IP 1. 5
Open a new connection to the same server.
.IP 2. 5
Grab the server.
.IP 3. 5
See if the property is on the property list of the root window for the screen.
.IP 4. 5
If the desired property is not present:
.RS
.IP \(bu 5
Create a colormap (unless you are using the default colormap of the screen).
.IP \(bu 5
Determine the color characteristics of the visual.
.IP \(bu 5
Allocate cells in the colormap (or create it with
.PN AllocAll ).
.IP \(bu 5
Call 
.PN XStoreColors
to store appropriate color values in the colormap.
.IP \(bu 5
Fill in the descriptive members in the 
.PN XStandardColormap
structure.
.IP \(bu 5
Attach the property to the root window.
.IP \(bu 5
Use
.PN XSetCloseDownMode
to make the resource permanent.
.RE
.IP 5. 5
Ungrab the server.
.LP
.PN XSetRGBColormaps
can generate
.PN BadAlloc ,
.PN BadAtom ,
and
.PN BadWindow
errors.
.sp
.LP
To obtain the 
.PN XStandardColormap 
structure associated with the specified property, use
.PN XGetRGBColormaps .
.IN "XGetRGBColormaps" "" "@DEF@"
.sM
.FD 0
Status XGetRGBColormaps\^(\^\fIdisplay\fP, \fIw\fP, \fIstd_colormap_return\fP, \
\fIcount_return\fP, \fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XStandardColormap **\fIstd_colormap_return\fP\^;
.br
      int *\fIcount_return\fP\^;
.br
      Atom \fIproperty\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIstd_colormap_return\fP 1i
Returns the
.PN XStandardColormap
structure.
.ds Cn colormaps
.IP \fIcount_return\fP 1i
Returns the number of \*(Cn.
.IP \fIproperty\fP 1i
Specifies the property name.
.LP
.eM
The 
.PN XGetRGBColormaps
function returns the RGB colormap definitions stored 
in the specified property on the named window.
If the property exists, is of type RGB_COLOR_MAP, is of format 32, 
and is long enough to contain a colormap definition,
.PN XGetRGBColormaps
allocates and fills in space for the returned colormaps
and returns a nonzero status.
If the visualid is not present, 
.PN XGetRGBColormaps 
assumes the default visual for the screen on which the window is located; 
if the killid is not present, 
.PN None
is assumed, which indicates that the resources cannot be released.
Otherwise, 
none of the fields are set, and 
.PN XGetRGBColormaps
returns a zero status.
Note that it is the caller's responsibility to honor the ICCCM
restriction that only RGB_DEFAULT_MAP contain more than one definition.
.LP
.PN XGetRGBColormaps
can generate
.PN BadAtom
and
.PN BadWindow
errors.
.bp