1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
|
\input texinfo @c -*-texinfo-*-
@c %**start of header
@documentencoding UTF-8
@include macros.texinfo
@copying
@c --------------------------------------------------------------------------------
Copyright @copyright{} 2014, 2015, 2016 @w{Mattias Andrée @e{maandree@@member.fsf.org}}
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version@tie{}1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being the ``GNU General Public License'', the ``GNU
Free Documentation License'', with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the section
entitled ``GNU Free Documentation License''.
@end quotation
@c THIS WAS LAST CHANGED 2016-JULY-10
@c --------------------------------------------------------------------------------
@end copying
@setfilename mds.info
@settitle mds -- The avant-garde micro-display server
@documentlanguage en_GB
@finalout
@iftex
@c @set USLETTER
@c @set AFOURPAPER
@c @set AFIVEPAPER
@c @set SMALLBOOK
@c @set HARDCOPY
@c @set CROPMARKS
@c @set SKIPCHAPTERNEWPAGE
@c @set SKIPFONTTEXTSIZE
@end iftex
@c @set LOGO
@c @set DOUBLE_HEADINGS
@c @set SINGLE_HEADINGS
@c @set AMERICANSPACING
@ignore
This document does not look too good on A5-paper. This
document looks best on A4-paper, but smallbook format and
US Letter is acceptable.
CROPMARKS has no effect unless HARDCOPY is set. CROPMARKS
and AFIVEPAPER (or actually @cropmarks and @afivepaper) does
not play well together.
You can configure how TeX output files should look by
uncommenting @set commands above. Do not uncomment more
than one of the paper sizes (USLETTER, AFOURPAPER, AFIVEPAPER
and SMALLBOOK); if none is uncomment AFOURPAPER will be set
unless HARDCOPY is set, in which case SMALLBOOK will be set.
However, if you do not want to modify this source file, you can
run `make` with for example `TEXIFLAGS='--texinfo="@set HARDCOPY"'`.
Finally, you can include, on the front page, the version of mds
that the manual is up to date with, by setting the value of VERSION
to the version of mds, as well as date of the last update by
setting DATE, and edition by setting EDITION. This is intended for
printed manuals. The date is recommended to not be more accurate,
or less accurate, than to the month. The edition should be formatted
as, for example, "1@sup{st}".
@end ignore
@ifset HARDCOPY
@ifclear USLETTER
@ifclear AFOURPAPER
@ifclear AFIVEPAPER
@ifclear SMALLBOOK
@set SMALLBOOK
@end ifclear
@end ifclear
@end ifclear
@end ifclear
@end ifset
@ifclear SINGLE_HEADINGS
@ifclear DOUBLE_HEADINGS
@ifclear HARDCOPY
@set SINGLE_HEADINGS
@end ifclear
@ifset HARDCOPY
@set DOUBLE_HEADINGS
@end ifset
@end ifclear
@end ifclear
@ifset AFIVEPAPER
@afivepaper
@end ifset
@ifset SMALLBOOK
@smallbook
@end ifset
@ifclear AFIVEPAPER
@ifclear SMALLBOOK
@ifclear USLETTER
@afourpaper
@set AFOURPAPER
@end ifclear
@end ifclear
@end ifclear
@ifset HARDCOPY
@ifset CROPMARKS
@cropmarks
@end ifset
@ifclear SKIPCHAPTERNEWPAGE
@setchapternewpage odd
@end ifclear
@end ifset
@ifclear SKIPFONTTEXTSIZE
@ifset SMALLBOOK
@set SMALLFONT
@end ifset
@ifset AFIVEPAPER
@set SMALLFONT
@end ifset
@end ifclear
@ifset SMALLFONT
@fonttextsize 10
@end ifset
@ifclear SMALLFONT
@fonttextsize 11
@end ifclear
@ifclear AMERICANSPACING
@frenchspacing on
@end ifclear
@c @paragraphindent asis
@c @firstparagraphindent none
@c @exampleindent asis
@c @kbdinputstyle distinct
@dircategory Graphics environment
@direntry
* mds: (mds). The avant-garde micro-display server.
@end direntry
@documentdescription
User and developer manual for mds, the avant-garde
micro-display server, and servers, protocols,
libraries and concepts.
@end documentdescription
@c %**end of header
@ifset AFIVEPAPER
@set AFIVEPAPER_OR_USLETTER
@set SMALLBOOK_OR_AFIVEPAPER
@set AFOURPAPER_OR_AFIVEPAPER
@end ifset
@ifset USLETTER
@set AFIVEPAPER_OR_USLETTER
@set AFOURPAPER_OR_USLETTER
@end ifset
@ifset AFOURPAPER
@set AFOURPAPER_OR_USLETTER
@set AFOURPAPER_OR_AFIVEPAPER
@end ifset
@ifset SMALLBOOK
@set SMALLBOOK_OR_AFIVEPAPER
@end ifset
@ifset SMALLFONT
@set AFOURPAPER_OR_USLETTER_OR_SMALLFONT
@ifset SMALLBOOK
@set SMALLBOOK_WITH_SMALLFONT
@set AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@set AFIVEPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@end ifset
@ifset AFIVEPAPER
@set AFIVEPAPER_WITH_SMALLFONT
@end ifset
@ifset AFOURPAPER
@set AFOURPAPER_WITH_SMALLFONT
@set AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@end ifset
@ifset USLETTER
@set USLETTER_WITH_SMALLFONT
@end ifset
@end ifset
@ifset AFOURPAPER_OR_USLETTER
@set AFOURPAPER_OR_USLETTER_OR_SMALLFONT
@set AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@end ifset
@ifset AFIVEPAPER_OR_USLETTER
@set AFIVEPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@set AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@end ifset
@defindex op
@defindex sg
@defindex ub
@defcodeindex pr
@ifset HARDCOPY
@include hardcopy-copying.texinfo
@end ifset
@ifnottex
@node Top
@top mds -- The avant-garde micro-display server
@insertcopying
@end ifnottex
@titlepage
@title The @code{mds} Reference Manual
@subtitle The avant-garde micro-display server
@ifset DATE
@ifset VERSION
@ifset EDITION
@subtitle @value{DATE}, mds version@tie{}@value{VERSION}, @value{EDITION} edition
@end ifset
@ifclear EDITION
@subtitle @value{DATE}, mds version@tie{}@value{VERSION}
@end ifclear
@end ifset
@ifclear VERSION
@ifset EDITION
@subtitle @value{DATE}, @value{EDITION} edition
@end ifset
@ifclear EDITION
@subtitle @value{DATE}
@end ifclear
@end ifclear
@end ifset
@ifclear DATE
@ifset VERSION
@ifset EDITION
@subtitle mds version@tie{}@value{VERSION}, @value{EDITION} edition
@end ifset
@ifclear EDITION
@subtitle mds version@tie{}@value{VERSION}
@end ifclear
@end ifset
@ifclear VERSION
@ifset EDITION
@subtitle @value{EDITION} edition
@end ifset
@end ifclear
@end ifclear
@ifset LOGO
@vskip 0pt plus 1filll
@comment this way, it is centered exactly in pdf and approximently in dvi and ps
@comment @center does not work for @image in dvi and ps
@multitable @columnfractions 0.15 0.7
@item @tab @center @image{../logo,250px}
@end multitable
@vskip 0pt plus 2filll
@end ifset
@author by Mattias Andrée (maandree)
@page
@ifset HARDCOPY
@vskip 0pt plus 1filll
@insertcopying
@page
@end ifset
@center `To me, writing a monolithic system in 1991 is a truly poor idea.'
@c Well, here we are 23 years later, and we are still
@c doing it, but where it is even easier not to.
@ifclear HARDCOPY
@vskip 0pt plus 1filll
@c If you prefer a dead tree edition, you can order one from
@c ...
@c @*
@insertcopying
@end ifclear
@end titlepage
@ifset DOUBLE_HEADINGS
@headings double
@end ifset
@ifset SINGLE_HEADINGS
@headings single
@end ifset
@shortcontents
@contents
@menu
* Overview:: Brief overview of @command{mds}.
* Features:: Reasons to install and use @command{mds}.
* Architecture:: Architectural overview of @command{mds}.
* Application Design:: Guildlines for your applications.
* Protocol:: The @command{mds} procotol.
* Utilities:: About @command{mds} utilities.
* Servers:: About @command{mds} servers.
* Protocols:: @command{mds} procotols.
* libmdsserver:: Overview of @command{libmdsserver}, the server library.
* mds-base.o:: Overview of @file{mds-base.o}, the common server base.
* libmdsclient:: Overview of @command{libmdsclient}, the client library.
* libmdslltk:: Overview of @command{libmdslltk}, the toolkit library.
* Keyboard Codes:: Scancodes and keycodes.
* Keyboard Layouts:: Writing and compiling keyboard layouts.
* Default Keyboard Layouts:: The keyboard layouts installed with @command{mds}.
* Accessibility:: Dealing with disabilities.
* Specifications:: Specifications.
* New Concepts:: Discussion of new display server concepts.
* Discussion:: Discussion on display server-architecture and decision.
* GNU General Public License:: Copying and sharing @command{mds}.
* GNU Free Documentation License:: Copying and sharing this manual.
* Concept index:: Index of concepts.
* Data type index:: Index of data types.
* Function index:: Index of functions.
* Option index:: Index of command line options.
* Program index:: Index of servers, clients and utilities.
* Protocol index:: Index of @command{mds} protocols.
* Signal index:: Index of signals.
* Unicode block index:: Index of Unicode block.
* Variable index:: Index of variables and environment variables.
@end menu
@c TODO @detailmenu (`C-c C-u m`)
@node Overview
@chapter Overview
@command{mds}@footnote{mds stands for micro-display
server.} is a display server protocol and an
implementation of said protocol. What makes
@command{mds} stand out is its core design choice:
it is designed just like a microkernel. Rather than
one, possibly modular, process --- a monolithic
process --- @command{mds} is comprised of many small
servers, each exchangable and responsible for one
thing.
@cpindex Goals of @command{mds}
@command{mds}'s goal is neither security, performance
nor a perfect graphical experience. @command{mds} is
all about flexibility and freedom 0@footnote{The
freedom to run the program as you wish, for any
purpose.}.
The reason for having a display server architectured
as a microkernel is so that components can be added,
removed, updated and replaced online. Additionally,
the message passing between the servers makes it easy
to design a system that lets you make clients that
can listen on messages between the servers and
perhaps modify them. This enables you to do so much
more with your display server. Moreover, if a single
part of the system crashes it does not bring down the
whole system, and the crashed server can be respawned
with minor side-effects. @command{mds} is
architectured in three layers: a microkernel, a
master server and a collection of servers. And
clients are actually located on the same layer as the
servers, because there is no actual difference, the
only thing that separates a server from a client is
for what purpose you run it. @command{mds}'s kernel
is a minimal program that do initialisation of the
display, such as giving it an index and create
runtime files and directories for servers and other
programs to use. Then the kernel creates a domain
socket for the master server and spawns the master
server and respawns it if it crashes. Because of
this, if the master server crashes it will not lose
its socket when it is respawned. The master server
then, on its initial spawn, starts the all servers
and other programs that the user have choosen and
then starts accepting connections to it and
coordinates messages between servers and clients.
Further, separating all components into separate
processes enables us to only give the servers the
privileges they actually need, rather than having
one program with root privileges that takes care of
everything even things that do not do require any
privileges.
All @command{mds}'s servers, that is all running
parts of @command{mds} except the kernel, are
designed so that they can re-execute themself so that
they can be updated online without any side-effects.
Servers serialises their state, saves it to RAM (in a
directory created by the kernel), re-execute themself
and loads their serialised state. The kernel cannot
do this because when it has spawned the master server
it has no reason to re-execute, its only mission is
to respawn the master server it if would happen to
crash. It would technically be possible to enable the
kernel to re-execute but it is not worth it as there
is no reason to re-execute, and doing so puts the
display server at risk of crashing.
@node Features
@chapter Features
@command{mds} is not the most shiny display server
known to the planet (yet), but it does have a number
of enticing features:
@table @asis
@item it is free software
Anybody can use, modify, and redistribute it under the
terms of the GNU General Public License version 3
(@pxref{GNU General Public License}). Unlike some
other display server that are license under the MIT
license, @command{mds} is licensed under a copyleft
license. Not only that, it is a strong copyleft license
too.
@item is is open source
As an unintended side-effect of @command{mds} being
licensed udner the GNU General Public License,
@command{mds} is also open source. The principal author
of @command{mds} do not value open source, however some
people do.
@item it will be compatible
@command{mds}'s design makes it easy to make it
compatile with any display server using a compatibility
server. When @command{mds} matures, compatibility
servers for X, Wayland and Mir will we written, both
for using those display server's client programs in
@command{mds} and @command{mds} client programs in those
display servers.
@item it is built to survive
Unlike other dispaly servers, @command{mds} has an
object-oriented structure that allows it to evolve
without compromising its design. This structure will
help the @command{mds} undergo major redesign and
modifications without having to be entirely rewritten.
@item it is scalable
@command{mds}'s design makes it inherently aggressively
multithreaded and easy to strip down on features, so
that it runs efficiently on any system. @command{mds}
can also be distributed on multiple computers in a
network, although the servers for this has not yet been
implemented.
@item it is extensible
@command{mds} is designed to modified and extended.
Every part of @command{mds} is separated into distinct
servers that can easily be modified or replaced, but it
is also easy to create servers to modifies or otherwise
uses the communication between other servers and clients.
@command{mds} is a perfect place for developing new
display server technology or just learn about display
server technology.
@item it is stable
It is possible to develop and test new @command{mds}
servers without restarting the display server. Servers
can be updated to newer versions of themself without
losing their state. This means to you never have to
restart your display server to update it. Additionally
servers that crash can be startared automatically and
their state can for the most part be restored.
@end table
@node Architecture
@chapter Architecture
@menu
* Layers:: The layers of the display server.
* Interprocess Communication:: How servers and clients communicate.
@end menu
@node Layers
@section Layers
@cpindex Layers, architecture
@cpindex Architectural layers
@cpindex Kernel
@cpindex Display server kernel
@pgindex @command{mds}
@cpindex Master server
@pgindex @command{mds-server}
The @command{mds} display server in architectured in
three layers. The first layer is called the kernel.
The kernel is responsible for acquiring a display
server index@footnote{As with any display server, the
system can have multiple instances of @command{mds}
running at the same time.}, set up environment
variables to indicate which display server and
display server instance is being used, create a
domain socket for the display server and start the
master server and restart it if it crashes, and then
clean up the system when the display server closes.
The kernel only responsible for creating the domain
socket for communication with the display server, it
is not responsible for using it, that mission falls
to the master server.
@cpindex Master server
@cpindex Message passing, coordination
@cpindex Communication, coordination
@cpindex Interprocess communication, coordination
@pgindex @command{mds-server}
The second layer is the master server. The master
server has two responsibilities: coordinating
message passing between other servers and clients
@footnote{In @command{mds} there is no functional
distinction between servers and clients, the
distinction is purely semantic.} and starting other
servers.
@cpindex Starting of servers
@cpindex Servers, starting
@pgindex @file{mdsinitrc}
The third layer is the other servers and clients.
protocolwise there is no specification on how they
are started. But in the reference implementation of
the master server, this is done by starting a shell
script with the pathname
@file{$@{XDG_CONFIG_HOME@}/mdsinitrc} and the user
is responsible for providing the logic in that shell
script.@footnote{Moonstruck users are allowed to
implement this in C or any other language of their
choosing.}
@c Which is better: cray-cray users, lunatic users,
@c moonstruck users, insane users, ballers, madmen,
@c loony tunes, systemd-lovers?
These servers implements the actual functionality
of the display server.
@node Interprocess Communication
@section Interprocess Communication
@cpindex Message passing, mechanism
@cpindex Communication, mechanism
@cpindex Interprocess communication, mechanism
@cpindex Master server
@pgindex @command{mds-server}
Intrinsic to @command{mds} is a powerful interprocess
communication mechanism. Servers and clients connect
to the display server by connecting to a domain
socket served by the master server. A server or
client that has connected to the display server can
do three things:
@itemize
@item
Request assignment of a unique ID@.
@item
Multicast a message.
@item
Join or leave a multicast group.
@end itemize
@cpindex Multicast groups
@cpindex Client ID assignment
@cpindex ID assignment
@cpindex Assignment of ID
@cpindex Disconnection
@cpindex Master server
@pgindex @command{mds-server}
Upon assignment of an ID the master server will
automatically place the client in a multicast group
for that specific client. This automatically
multicast group assignment is done by the master
server simply so you as a debugger do not forget to
do so. When a client is disconnected it will send
out a message to a specific multicast group that the
client, refered to by it's ID, have closed.
@cpindex Message passing, message structure
@cpindex Communication, message structure
@cpindex Interprocess communication, message structure
@cpindex Message structure, message passing
@cpindex Master server
@pgindex @command{mds-server}
A message in the @command{mds} protocol is comprised
of two parts: headers and a payload. When a client
joins a multicast group it is actually saying that
it is interested in receiving broadcasts containing
a specific header or a specific header--value pair,
or that it is interesting in all messages
@footnote{This could be used for logging, possibly
spying and networking.}. Thus a message is
automatically multicasted to groups indicated by its
headers.
@cpindex Interceptions, message passing
@cpindex Message passing, message modification
@cpindex Communication, message modification
@cpindex Interprocess communication, message modification
@cpindex Message modification, message passing
@cpindex Master server
@pgindex @command{mds-server}
@cpindex Multicast groups
The multicast groups and receiving of message is
called interceptions. The interesting property of
interceptions is that they may be modifying. When a
server registers for message interception it can say
that it wants to be able to modify messages. If this
is done and the server receives a message for which
it has said it want to be able to modify it, the
master server will wait for that server to respond
before it send the message to the next server in the
interception list. The server can choose to do three
things with a message that it has opted in for
modification of: leave the message as-is, modify the
message, or consume the message. A message
consumption is done by modify the message to make it
empty. A consumed message will not be send to any
further clients or servers in the interception list.
@cpindex Interception priority, message passing
@cpindex Priority, interception, message passing
@cpindex Message consumption, message passing
@cpindex Consumption, interception, message passing
To make this mechanism sensible, a server or client
can set a priority when it registers for interception
(does not need to be modifying.) When a message is
broadcasted it will be received by all servers in the
interception except the original sender, unless it
gets consumes. The order in which the master server
sends the message to the recipients is determined by
priority the servers registed with. The message first
sent to the recipients with highest priority and last
to the recipients with lowest priority, and ordered
by the priority between those priorities. Of two or
more servers have the same priority the order in
which they will receive the message, of those
recipients, is arbitrary.
@pgindex @command{mds-vt}
@cpindex Virtual terminal, switching
@cpindex Switching virtual terminal
@cpindex Dual-connection, message passing
@cpindex Message passing, dual-connection
@cpindex Communication, dual-connection
@cpindex Interprocess communication, dual-connection
@cpindex Reflexive connection, message passing
An interesting property of this mechanism is
demonstrated in the @command{mds-vt} server. Unlike
most servers @command{mds-vt} maintains two
concurrent connections to the display. Once
@command{mds-vt} receives a signal from the OS
kernel requesting to switch virtual terminal,
@command{mds-vt} will from one of its connections
send out a message and wait for it to be received
in its other connection and the let the OS kernel
switch virtual terminal. The secondary connection to
the display has registered interception with lower
priority of the message than the primary connection
broadcasts. This message will be received by other
servers that will let the message continue to the
next server in the interception list once that server
is ready for the OS kernel to switch virtual
terminal. All of these servers have registered
modifying interception of the message but none of
them will actually modify or consume the message; it
is only used a mechanism for letting @command{mds-vt}
know when all servers are ready for the switch
without having to know how many they are and wait
for a reply from all of them.
@node Application Design
@chapter Application Design
@cpindex Application design
@cpindex Client design
@cpindex Guildlines, applications
@cpindex Toolkit guildlines
When creating graphical @command{mds} applications,
there are some guildlines you should follow.
@itemize @bullet
@item
@cpindex Client-side decoration
@cpindex Server-side decoration
@cpindex Decoration, guildlines
@b{Do not create client-side decoration}. Some users
do not want decorations or wants minimal decorations.
Windows should look similar, server-side decoration
helps ensure this. Your client-side decorations may
not meet the requirements the users have. For
example, your client-side decoration may only support
minimise, maximise and close, whilst the user may
also want, as provided by her decoration server,
stick, shade and always on top. And it should be
sufficient to configure your decorations once rather
once for every toolkit. Additionally, because of
oversight from developers, client-side decoration
tends to work poorly with tiling window managers.
@item
@cpindex Memorisation of size and position
@cpindex Position, memorisation
@cpindex Size, memorisation
@pgindex @command{mds-posmem}
@b{Do not remember size and position}. Some users
do not want their programs to remember their size
and position. There is also a risk that your
mechanism for implementing this does not account for
the possibility that outputs may have been removed,
resized or relocated. @command{mds-posmem} can be
used if the user wants programs to start where they
were closed the last time they were closed.
@end itemize
@node Protocol
@chapter Protocol
@menu
* Environment Variables:: Identifying the active display server.
* Signals:: Signalling individual servers.
* Filesystem:: The display server's footprint on the filesystem.
* Message Passing:: Sending messages between servers and clients.
* Interception:: Implementing protocols and writing unanticipated clients.
* Responses:: How responses to queries and commands are structured.
* Portability:: Restrictions for portability on protocols.
@end menu
@node Environment Variables
@section Environment Variables
@cpindex Environment variables
@vrindex @env{DISPLAY}
@vrindex @env{MDS_DISPLAY}
@cpindex Display server identification
@cpindex Identification, display server
A crucial task of any display server is letting child
processes know which display server they should
connect to. @command{X.org} does this by setting the
environment variable @env{DISPLAY} to
@code{<host>:<display index>}, where @code{<host>}
is empty if the display is one the local machine.
In this tradition, @command{mds} does the same thing
with the environment variable @env{MDS_DISPLAY}@.
The display index is the TCP-port if the host is
non-empty.
@cpindex Networking
@pgindex @command{mds-remote}
Servers (and clients) that depend the display being
local, should reject any value on @env{MDS_DISPLAY}
that does not start with a colon. They should instead
utilise @command{mds-remote}.
@c TODO More on MDS_DISPLAY for remote access, see libmdsclient/address.c
@cpindex Environment variables
@vrindex @env{MDS_PGROUP}
@cpindex Display server process group
@cpindex Process group, display server
@command{mds} also creates a new process group and
export the new process group ID to the environment
variable @command{MDS_PGROUP}@. This process group
can be used to send signals to all @command{mds}
servers collectively.
@node Signals
@section Signals
@cpindex Signals
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
@command{mds} servers can re-execute into an updated
version of their binary. This can be used to update
display server online after a new version has been
installed. To do this send the signal @code{SIGUSR1}
to the server you want update. If a server does not
support online updating it will ignore this signal.
If the operating system defines a signal named
@code{SIGUPDATE}, this signal is used instead of
@code{SIGUSR1}.
@cpindex Signals
@cpindex Memory release, automatic
@cpindex Memory release, forced
@cpindex Automated memory release
@cpindex Forcing memory release
@cpindex Releasing memory
@sgindex @code{SIGDANGER}
@sgindex @code{SIGRTMIN + 1}
If you need servers to free up allocated memory that
they do not use, send the signal @code{SIGDANGER}, or
if not defined @code{SIGRTMIN + 1}. Unimportant
servers may choose to die on @code{SIGDANGER}@.
@sgindex @code{SIGINFO}
@sgindex @code{SIGRTMIN + 2}
@cpindex State dump
@cpindex Statistics dump
Server may also choose to support the signal
@code{SIGINFO}, or if not defined
@code{SIGRTMIN + 2}. It is not expected that server
do support this signal, but thay must not die when
received. @code{SIGINFO} is send by a user to the
server, if she wants the server to dump information
about the server's state or statistics to the TTY@.
@sgindex @code{SIGRTMIN}
@cpindex No-operation signal
All servers configured to be interrupted when the
signal @code{SIGRTMIN} is received. No further action
is taked. This may be used by the user to test that
the program supports being interrupted. It can also
be used by the server to interrupt itself from another
thread.
@pgindex @command{valgrind}
@sgindex @code{SIGRTMAX}
@command{valgrind} uses @code{SIGRTMAX} for its own
internal stuff. Therefore servers must not use
@code{SIGRTMAX} as it is hence unavailable when
running under @command{valgrind}.
@node Filesystem
@section Filesystem
@cpindex Interprocess communication, filesystem
@cpindex Filesystem
@cpindex Kernel
@cpindex Display server kernel
@pgindex @command{mds}
The @command{mds} kernel creates two directories for
the @command{mds} servers to use: one for runtime
data and one for temporary data. These directories
are named by @code{MDS_RUNTIME_ROOT_DIRECTORY} and
@code{MDS_STORAGE_ROOT_DIRECTORY}, respectively,
by the header file @file{<libmdsserver/config.h>}.
If the systems runtime data directory is @file{/run}
and transient temporary data directory is @file{/tmp},
and the package name of @command{mds} is
@command{mds}, these directories will be
@file{/run/mds} and
@file{/tmp/.@{system-directory@}.mds}, respectively.
In @file{/tmp/.@{system-directory@}.mds} the kernel
will create a directory for the display server
instance named @file{.data} prefixed by the display
server index. For example if the display server index
is zero, temporary data may be stored in
@file{/tmp/.@{system-directory@}.mds/0.data}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
As defined by @code{SHM_PATH_PATTERN} in
@file{<libmdsserver/config.h>}, when a server
re-executes itself it will marshal its state to
the POSIX shared memory unit named
@file{/.proc-pid-%ji}, where @file{%ji}
@footnote{@code{%ji} is the pattern in @code{*printf}
functions for the data type @code{intmax_t}.} is
replaced with the process ID of the server. This
file will be bound to the pathname
@file{/dev/shm/.proc-pid-%ji} if POSIX shared memory
is stored in @file{/dev/shm} by the operating system.
In @code{MDS_RUNTIME_ROOT_DIRECTORY} the kernel will
create two files. @file{.pid} and @file{.socket},
both prefixed with the display server index
@footnote{@file{0.pid} and @file{0.socket} if the
display server index is 0.}. The @file{.pid} file
contains the process ID of the display server and is
used by the kernel to figure out whether an display
server index is still in use or just not properly
cleaned up. Of course it can be used by any program
to find the process ID of the kernel process of a
display server instance. The @file{.socket} is the
domain socket used for communication with the display
server and its servers and clients.
@node Message Passing
@section Message Passing
@cpindex Message passing, display
@cpindex Communication, display
@cpindex Interprocess communication, display
@cpindex Kernel
@cpindex Display server kernel
@pgindex @command{mds}
Message passing over domain sockets is the
underlaying technique for communicating with the
display server. To communicate with the display
server in the local machine a process must connect
to the domain socket created by the display server
kernel as named in @ref{Filesystem}.
@cpindex Connecting to the display
@cpindex Client ID assignment
@cpindex ID assignment
@cpindex Assignment of ID
Clients should request a unique ID when it
connects to the display server.@footnote{There
is seldom a reason for servers to do this.}
To do this the client sends
@example
@group
Command: assign-id\n
Message ID: 0\n
\n
@end group
@end example
@cpindex Message ID
@cpindex Message corruption
@cpindex Corrupt messages
where @code{\n} is an LF-line break. The value on the
@code{Message ID}-line does not need to be 0, but
servers and clients often start with 0 and count
upwards. The value is however bound to an unsigned
32-bit integer. All message must contain this
@code{Message ID}-header, otherwise the message is
considered corrupt and is ignored.
@cpindex Message structure
@cpindex Message passing, message structure
@cpindex Communication, message structure
@cpindex Interprocess communication, message structure
The empty line signifies the end of the header list,
and in this case the end of the message. But a
message may contain payload beneath this empty line.
To include a payload, add the header @code{Length}
that says how many bytes the payload is comprised.
A header must contain a header name and header value
without any trailing or leading spaces, and @w{`: '}
(colon, one regular blank space) exactly delimits
the name and the value.
@cpindex Master server
@pgindex @command{mds-server}
@cpindex Client ID assignment
@cpindex ID assignment
@cpindex Assignment of ID
When the master server receives this
@code{Command: assign-id}-message it will assign the
client a unique ID and send it to the client.
@footnote{The master server is the only server than
can address the client uniquely before it has an ID,
so this part can only be implement in the master
server.} If the client already has an ID, it will
send back that ID to the client. This response
consists of two headers @code{ID assignment} and
@code{In response to}, containing the client's
new (or possibly already assigned) ID and the value
that was in the @code{Message ID}-header,
respectively. For example:
@example
@group
ID assignment: 0:1\n
In response to: 0\n
\n
@end group
@end example
@cpindex Message ID
Notice that the master server never includes
@code{Message ID} in message originating from it.
As seen in this example, the client ID consists of
two integers delimited by a colon@tie{}(`:'). Both of
these integers are unsigned 32-bit integers. This is
done this way because unsigned 64-bit integers are
forbidden because it is not supported natively be
some programming languages.
Before a client has gotten a unique client ID
assigned to it, it will be `0:0'.
@cpindex Disconnection
If a client gets disconnected from the master server,
the master server will sends out a signal header
message. This header will be @code{Client closed}
and contain ID of the client that closed. For example:
@example
@group
Client closed: 0:1\n
\n
@end group
@end example
Be aware that if a server or client closes and does
not have a unique client ID, this message will be:
@example
@group
Client closed: 0:0\n
\n
@end group
@end example
@cpindex Addressing message
@cpindex Message passing, addressing
@cpindex Communication, addressing
@cpindex Interprocess communication, addressing
Once a client has an unique client ID assigned to it,
it should always include the header @code{Client ID}
in its messages. The value of @code{Client ID} should
be the client's ID@. If a server wants to address
this client, it should include the header @code{To}
with the value set to the recipient's client ID@.
Be aware that such message may not be sent to that
recipient uniquely, any server or client is free to
sign up for receive of such message, any messages
or message contain any other header or header--value
pair that may also be included in the header.
@node Interception
@section Interception
@cpindex Interceptions, message passing
@cpindex Message passing, message modification
@cpindex Communication, message modification
@cpindex Interprocess communication, message modification
@cpindex Message modification, message passing
@cpindex Interceptions, eavesdropping
@cpindex Message passing, eavesdropping
@cpindex Communication, eavesdropping
@cpindex Interprocess communication, eavesdropping
@cpindex Eavesdropping, message passing
As discussed in @ref{Interprocess Communication},
interception in the primary feature of
@command{mds}'s message passing system. Not only does
it enable servers to select which message it wants to
receive in order to provide it's service. It also
enables clients to do anything, things that was never
anticipated. As an example of its power,
@command{mds} does not provide any protocol for
taking screenshots or recording a session. Instead,
a screenshot application signs up for messages passed
between the compositor and presentation servers, and
simply requests that the compositor resends the
screen, a feature intended for the presentation
servers. A screen recoding application would do the
same and just hang on and record all message passed
between the servers.
If you want your server or client to receive all
messages passed around in the display server, simply
sign up for all messages:
@example
@group
Command: intercept\n
Message ID: 0\n
\n
@end group
@end example
But if you only want messages contain the header
@code{Command}, include that header in the payload
of the message:
@example
Command: intercept\n
Message ID: 0\n
Length: 8\n
\n
Command\n
@end example
It is allowed to include multiple headers. You can
also be more strict, and require a specific value
for a header, for example:
@example
Command: intercept\n
Message ID: 0\n
Length: 16\n
\n
Command: get-vt\n
@end example
You may mix these two types of requirements freely.
Your client will receive any message that satisfies
at least one of the requirements, these requirements
may be split into multiple message or coalesced into
one message; but you cannot request to include
receive a message if multiple requirements are
satisfied.
Alternatively you can choose to stop receiving
message that satisfies requirements. For example:
@example
Command: intercept\n
Stop: yes\n
Message ID: 1\n
Length: 16\n
\n
Command: get-vt\n
@end example
Or stop receiving all messages:
@example
Command: intercept\n
Stop: yes\n
Message ID: 1\n
\n
@end example
Note that this will stop you from receiving messages
contain the @code{To}-header addressed to you until
you request to receiving such messages again.
When you sign up for message you may request to be
able to modify them before that are send to the next
client in the list of client that should receive
them. To do this include the header--value pair
@code{Modifying: yes}:
@example
Command: intercept\n
Modifying: yes\n
Message ID: 0\n
Length: 30\n
\n
Command: keyboard-enumeration\n
@end example
It is up to the client to keep track of which message
that it may modify. When you receive a message that
you can modify you must respond when you are done
with the message.
For example, if you have signed up for
@code{Command: keyboard-enumeration} with the ability
to modify such messages and the message
@example
Command: keyboard-enumeration\n
To: 0:1\n
In response to: 2\n
Message ID: 1\n
Length: 7\n
\n
kernel\n
@end example
is send from a server, you may receive it as
@example
Command: keyboard-enumeration\n
To: 0:1\n
In response to: 2\n
Message ID: 1\n
Length: 7\n
Modify ID: 4\n
\n
kernel\n
@end example
Be aware that the @code{Modify ID} may be included
even if you have not signed up to be able to modify
the message, it is enough that one client before you
has or it was originally included @footnote{You may
however not include this header when you send out an
orginal message.}.
If you receive the message as such and want to add
the line @code{on-screen-keyboard-20376} to the
payload should send out: @footnote{The first line
containing starting with @code{Message ID} is an
example, it should be whatever is appropriate for
your client.}
@example
Modify ID: 4\n
Message ID: 2\n
Modify: yes\n
Length: 127\n
\n
Command: keyboard-enumeration\n
To: 0:1\n
In response to: 2\n
Message ID: 1\n
Length: 32\n
Modify ID: 4\n
\n
kernel\n
on-screen-keyboard-20376\n
@end example
If you however decide not to modify the message send
out
@example
Modify ID: 4\n
Message ID: 2\n
Modify: no\n
\n
@end example
@cpindex Message consumption, message passing
@cpindex Consumption, interception, message passing
There is also a third option: to consume to the
message. This stops any further clients from
receiving the message. This is done by modifying the
message into an empty message:
@example
Modify ID: 4\n
Message ID: 2\n
Modify: yes\n
\n
@end example
You may choose to include the header--value pair
@code{Length: 0}, it is however redundant and
discouraged.
@cpindex Interception priority, message passing
@cpindex Priority, interception, message passing
This mechanism of being able to modify message does
not make much sense unless you can control in the
order the clients receive messages. This is done with
what is called priority. The higher priority you
have, the earlier you will receive the message. The
default priority is zero, and the priority is bound
to a signed 64-bit integer. If you want to be able to
list yourself in @code{Command: keyboard-enumeration}
message, you should sign up with a positive priority
since the final recipient or requested the
enumeration will receive it with priority zero.
Therefore you should sign up for such message with a
message like: @footnote{4611686018427387904 is
halfway to the maximium value.}
@example
Command: intercept\n
Modifying: yes\n
Priority: 4611686018427387904\n
Message ID: 0\n
Length: 30\n
\n
Command: keyboard-enumeration\n
@end example
@node Responses
@section Responses
@cpindex Responses
@cpindex Error management
Many commands are met with no response. The client,
can however sometimes infer when the commands has
been processed by listening for events that are
triggered when some commands have been process.
Other times, commands are responded to with an
error message either indicating success or failure.
@footnote{See @ref{error}}.
Queries are always met with a response unless
the an involved server failed or the queries was
malformated or included invalid parameters and
therefore silently@footnote{Although in these
cases most servers will print an error to their
stderr} ignored. The response will either be
an error message indicating failure (or success
in very special cases,) or an especially formatted
message that includes describes the requested data.
Responses will always include at least four headers:
@table @code
@item To
Will include the client's, who made the request,
client ID. This will be the value of the header
@code{Client ID} in the message that triggered
the response.
@item In response to
Will include the message ID of the message that
triggered the response. The value of the
@code{Message ID}-header of the received message.
@item Message ID
The ID of the response message. You will probably
not find any use of this. But it is required by
the message passing protocol.
@item Origin command
The value of this header will be the value of the
@code{Command}-header in the received message.
This can be used if you want to listen for
responses, and perhaps modify them, between
other servers and clients.
@end table
The message @code{Command: assign-id} is except from
this sections. In particular it will not include the
headers @code{To}, @code{Message ID} and
@code{Origin command}. See @ref{Message Passing}.
@node Portability
@section Portability
@cpindex Portability
For optimal portability, there are some restrictions
on protocols.
@itemize @bullet{}
@item
Integers that are not especially encoded must not be
larger than 64-bits if they use fixed bit-size. If,
for example, @code{size_t} is 128-bits on your
platform but you are using a language that only have
native integers up to 64-bits you must use arbitrary
size integers or otherwise make sure that the value
can be properly stored and used.
@item
@tpindex @code{uint64_t}
@cpindex Integers, unsigned, restriction
@cpindex Unsigned integer, restriction
@cpindex Restrictions on unsigned integers
Integer 64-bits that are not especially encoded must
not be unsigned if the bit-size is fixed. This is
because some programming languages primitive
integers are limited to 64-bits and are signed; a
large enough unsigned 64-bit integer would overflow.
@item
@cpindex Endianness, portability
Native endianness when a endianness is choosen. Do
not assume big endianness, but the same endianness
that appear on the same machine when using C@.
@item
@cpindex UTF-8, portability
@cpindex Strings, portibility
All strings musts be encoded in UTF-8 without any
NUL-character unless express permission is given.
NUL-character may be encoded either using a zero byte
or using Modified UTF-8, where it is encoded using
two bytes. Which is used is selected in the protocol,
however headers and their values must not include
NUL-characters. No character may be encoded with more
bytes than necessary. Encoding a character in extra
long form is a security issue, and is prune to bugs,
and is hence disallowed by newer specifications of
UTF-8.
@item
@cpindex New line, portability
@cpindex Strings, portibility
The new line-character is always LF@tie{}(@code{'\n'},
10, line feed) and never a combination of LF and any
other character, or multiple LF:s.
@end itemize
@node Utilities
@chapter Utilities
@menu
* mds-respawn:: The server immortality protocol.
* mds-reg:: The registry control command.
* mds-clip:: The clipboard control command.
* mds-screenshot:: The screenshot utility.
* mds-slay:: The process killing utility.
* mds-chvt:: Utility for switching virtual terminal.
* mds-kbdc:: The keyboard layout compiler.
* External Utilities:: Suggestion on utilities you can utilise.
@end menu
@node mds-respawn
@section @command{mds-respawn}
@pgindex @command{mds-respawn}
@cpindex Respawning servers, automatic
@cpindex Crash resilience
@cpindex Hyposerver
@command{mds-respawn} is a hyposerver, that is, a
utility beneath servers, and intended to be used in
@file{$@{XDG_CONFIG_HOME@}/mdsinitrc}. It will
spawn a selected set of servers. If a server it
spawns exits with a bad status, @command{mds-respawn}
will respawn it. @command{mds-respawn} supports two
options in the command line:
@table @option
@item --alarm=SECONDS
@opindex @option{--alarm}
Schedule @command{mds-respawn} to die in @var{SECONDS}
seconds. At most 1 minute.
@item --interval=SECONDS
@opindex @option{--interval}
@sgindex @code{SIGUSR2}
Spawned servers that die twice within @var{SECONDS}
seconds should stop respawning until the signal
@code{SIGUSR2} is send to @command{mds-respawn}.
At most 1 minute.
@end table
Commands for servers to spawn are specified within
curly braces. Each of the braces must be alone its
its own argument. For example:
@opindex @option{--initial-spawn}
@example
@group
mds-respawn --interval=5 \
@{ mds-foo --initial-spawn @} \
@{ mds-bar --initial-spawn @} &
@end group
@end example
@cpindex Server supervision
@cpindex Supervision of servers
@opindex @option{--initial-spawn}
@opindex @option{--respawn}
will spawn and supervise the servers @command{mds-foo}
and @command{mds-bar}. Both spawned with the argument
@option{--initial-spawn}. When a server is respawed
by @command{mds-respawn}, @option{--initial-spawn} in
its argument list will be replaced by
@option{--respawn} to let the server know it is being
respawned.
@sgindex @code{SIGTERM}
A server is considered to exit with a failure status
unless it exits with the return value 0 or is
terminated by the signal @code{SIGTERM}@.
@node mds-reg
@section @command{mds-reg}
@pgindex @command{mds-reg}
@cpindex List protocols
@cpindex Protocols, listing
@cpindex Protocol registry
@cpindex Registry of protocols
@opindex @option{--list}
@opindex @option{--wait}
@command{mds-reg} is a utility that can be used to
list available protocols provided by running servers.
It can also wait for a set of protocols to become
available. To list all available protocols run
@command{mds-reg --list}. And to wait for the
protocol @code{foo} run @command{mds-reg --wait=foo}.
To also wait for the protocol @code{bar} run
@command{mds-reg --wait=foo,bar} or
@command{mds-reg --wait=foo --wait=bar}. Both of
thesestyles can be mixed if you want to wait for
even more protocols.
@node mds-clip
@section @command{mds-clip}
@pgindex @command{mds-clip}
@cpindex Clipboard
@command{mds-clip} is a utility that can be used to
review the clipboards on the display and manipulate
them. @command{mds-clip} recognises the following
options:
@table @option
@item --push
@opindex @option{--push}
Push non-option arguments from the command line into
the clipboard.
@item --expire=SECONDS
@opindex @option{--expire}
@opindex @option{--push}
Can be used with @option{--push}. The clip will not
removed after @var{SECONDS} seconds.
@item --pop
@opindex @option{--pop}
Pop items from the clipboard whose indices are listed
in the command line as non-option arguments. The first
index is 1.
@item --clear
@opindex @option{--clear}
Pop all items in the clipboard.
@item --list
@opindex @option{--list}
List items in the clipboard whose indices are listed
in the command line as non-option arguments. The first
index is 1. If no indicies are specified, all clips
will be listed.
@item --size
@opindex @option{--size}
Print the size of the clipboard, the number of clips
in the clipboard.
@item --capacity
@opindex @option{--capacity}
Print the capacity of the clipboard, the number of
clips the clipboard can hold. If both @option{--size}
and @option{--capacity} is used, the size will be
printed on the first line and the capacity will be
printed on the second line.
@item --resize=CAPACITY
@opindex @option{--resize}
Change the capaciy of the clipboard to @var{CAPACITY}
clips.
@item --stdin
@opindex @option{--stdin}
@opindex @option{--push}
Can be used with @option{--push}. If used, the clip
that should be placed on the top of the clipboard
stack should be read from stdin.
@item --delimiter=DELIMITER
@opindex @option{--delimiter}
@opindex @option{--list}
@opindex @option{--stdin}
Can be used with @option{--stdin} or @option{--list}.
If used with @option{--stdin}, an line containing
only @var{DELIMITER} will delimit two values that
should be placed in the clipboard. If used with
@option{--list}, a line containing only
@var{DELIMITER} will delimit two values in the
output. The default delimiter for @option{--list}
is an empty line.
@item -1
@opindex @option{-1}
Use the primary clipboard, that is, the text copy
clipboard. This is the default clipboard.
@item -2
@opindex @option{-2}
Use the secondary clipboard, that is, the text
selection clipboard.
@item -3
@opindex @option{-3}
Use the tertiary clipboard, that is, the non-text
copy clipboard.
@end table
@node mds-screenshot
@section @command{mds-screenshot}
@pgindex @command{mds-screenshot}
@cpindex Screenshooting
@command{mds-screenshot} is a simple utility, and
reference implementation thereof, that can take a
screeenshot of either the display, a monitor, or a
window with or without its decorating window. It can
also include or exclude the rat cursor or gamma
ramps. @command{mds-screenshot} recognises the
following options:
@table @option
@item --monitor
@opindex @option{--monitor}
Take screenshot of the monitor. The rat will be used
to select monitor.
@item --monitor=WINDOW_ID
@opindex @option{--monitor}
Take screenshot of the monitor whose root window's
window ID is @var{WINDOW_ID} or has another window in
it whose window ID is @var{WINDOW_ID}@.
@item --embed
@opindex @option{--embed}
Take a screenshot of an embedded window. The rat will
be used to select window.
@item --embed=WINDOW_ID
@opindex @option{--monitor}
Take a screenshot of an embedded window whose window
ID is @var{WINDOW_ID}@.
@item --window
@opindex @option{--window}
Take a screenshot a window. The rat will be used to
select window.
@item --window=WINDOW_ID
@opindex @option{--window}
Take a screenshot of a window whose window ID is
@var{WINDOW_ID}@.
@item --decoration
@opindex @option{--decoration}
Include the window's decoration, if used together
with @option{--window}. Ignored if used without
@option{--window}.
@item --cursor
@opindex @option{--cursor}
Include the rat cursor in the screenshot.
@item --gamma
@opindex @option{--gamma}
Include the effects of gamma ramps in the screenshot.
@item --low-gamma=LOW_PRIORITY
@opindex @option{--low-gamma}
Include the effects of gamma ramps with a priority
above @var{LOW_PRIORITY} in the screenshot.
@item --high-gamma=HIGH_PRIORITY
@opindex @option{--high-gamma}
@opindex @option{--low-gamma}
Include the effects of gamma ramps with a priority
below @var{HIGH_PRIORITY} in the screenshot. If used
together with @option{--low-gamma=LOW_PRIORITY},
the range [@var{LOW_PRIORITY}, @var{HIGH_PRIORITY}]
will be used.
@end table
Optionally, you can add a non-option argument that
specifies the pathname of the saved file.
@opindex @option{--window}
@opindex @option{--monitor}
@opindex @option{--embed}
If neither @option{--monitor}, @option{--embed} or
@option{--window} is used, a screenshot will be taked
of the display. That is, all monitors.
@opindex @option{--gamma}
@opindex @option{--low-gamma}
@opindex @option{--high-gamma}
In case of mirrored outputs, one of the potential
outputs will be selected arbitrarily if
@option{--gamma}, @option{--low-gamma} or
@option{--high-gamma} is used. If neither is used,
the screenshot will be identical for all mirrored
outputs.
@node mds-slay
@section @command{mds-slay}
@pgindex @command{mds-slay}
@cpindex Process killing
@cpindex Killing processes
@command{mds-slay} a utility that can be used to
kill a process by it window or identify the window
ID of a window. @command{mds-slay} recognises the
following options:
@table @option
@item --embed
@opindex @option{--embed}
Kill an embedded window. The rat will be used to
select window.
@item --embed=WINDOW_ID
@opindex @option{--embed}
Kill an embedded window whose window ID is
@var{WINDOW_ID}@.
@item --window
@opindex @option{--window}
Kill a window. The rat will be used to select window.
@item --window=WINDOW_ID
@opindex @option{--window}
Kill a window whose window ID is @var{WINDOW_ID}@.
@item --signal=SIGNAL
@opindex @option{--signal}
Send the signal @var{SIGNAL} to the process owning
the selected window.
@item --no-signal
@opindex @option{--no-signal}
Do not send a signal; only identify the window.
@item --keep-cursor
@opindex @option{--keep-cursor}
Do not change the cursor to a kill cursor.
@item --print
@opindex @option{--print}
Print the ID of the selected window.
@end table
@node mds-chvt
@section @command{mds-chvt}
@pgindex @command{mds-chvt}
@pgindex @command{chvt}
@cpindex Virtual terminal, switching
@cpindex Switching virtual terminal
@command{mds-chvt} is a utility similar to the command
@command{chvt} from the @command{kbd} project.
However, @command{mds-chvt} has setuid and therefore
does not require root permissions, but it will only
request a virtual terminal switch if the display
server's virtual terminal is in the foreground.
@command{mds-chvt} recognises the following options:
@table @option
@item --switch=VT
@opindex @option{--switch}
Switch to the virtual terminal with the index
@var{VT}@.
@end table
@node mds-kbdc
@section @command{mds-kbdc}
@pgindex @command{mds-kbdc}
@cpindex Keyboard layouts, compile
@cpindex Compile keyboard layouts
@cpindex Compose tables, compile
@cpindex Compile compose tables
@command{mds-kbdc} is the program used to compile
keyboard layouts and compose tables.
TODO how to use mds-kbdc
@node External Utilities
@section External Utilities
@cpindex Background processes
@opindex @option{--on-init-fork}
@pgindex @file{mdsinitrc}
Servers let you use the option @option{--on-init-fork}
to put the process in the background when it has been
initialised. This can used to spawn that depend on
each other in linear order. For example, if
@command{mds-bar} requires that @command{mds-foo} is
initialised before it can be initialised, you can in
@file{$@{XDG_CONFIG_HOME@}/mdsinitrc} write:
@example
@group
mds-foo --on-init-fork
mds-bar &
@end group
@end example
@opindex @option{--on-init-fork}
@opindex @option{--on-init-sh}
@pgindex @command{mds-respawn}
@pgindex @command{cmdipc}
@pgindex @command{ipcmd}
This will start @command{mds-bar} when
@command{mds-foo} has been initialised. However if
one of them crashes, that server will not respawn; to
fix this @command{mds-respawn} can be used, but use
of @command{mds-respawn} hinders the use of
@option{--on-init-fork}. Instead you can use
@option{--on-init-sh} and global semaphores. The
packages, and commands, @command{cmdipc} and
@command{ipcmd} can be used for this purpose. We will
use @command{cmdipc} in an example:
@ifset AFOURPAPER
@example
S=$(cmdipc -Scx set 1 | cut -d ' ' -f 2)
# Create a System V semaphore with the value 1.
mds-respawn @{ mds-foo --on-init-sh="cmdipc -Sk $S p" @} &
# Spawn `mds-foo` and decrease the semaphore with 1 when initialised.
cmdipc -Sk $S z # Wait for the semaphore's value to become 0.
cmdipc -Srk $S # Remove the semaphore.
mds-respawn @{ mds-bar @} & # Spawn `mds-bar`.
@end example
@end ifset
@ifclear AFOURPAPER
@ifset USLETTER
@example
S=$(cmdipc -Scx set 1 | cut -d ' ' -f 2)
# Create a System V semaphore with the value 1.
mds-respawn @{ mds-foo --on-init-sh="cmdipc -Sk $S p" @} &
# Spawn `mds-foo` and decrease the semaphore with 1 when initialised.
cmdipc -Sk $S z # Wait for the semaphore's
# value to become 0.
cmdipc -Srk $S # Remove the semaphore.
mds-respawn @{ mds-bar @} & # Spawn `mds-bar`.
@end example
@end ifset
@ifclear USLETTER
@example
S=$(cmdipc -Scx set 1 | cut -d ' ' -f 2)
# Create a System V semaphore with the value 1.
mds-respawn @{ mds-foo --on-init-sh="cmdipc -Sk $S p" @} &
# Spawn `mds-foo` and decrease the semaphore with
# 1 when initialised.
cmdipc -Sk $S z # Wait for the semaphore's
# value to become 0.
cmdipc -Srk $S # Remove the semaphore.
mds-respawn @{ mds-bar @} & # Spawn `mds-bar`.
@end example
@end ifclear
@end ifclear
@pgindex @command{mds-reg}
This is however seldom necessary as @command{mds-reg}
can often be used instead, with more abstraction as
you would only need to specify what servers need to
wait for, not what they provide.
@pgindex @command{setpgrp}
@cpindex Display server process group
@cpindex Process group, display server
Another useful command (and package) is
@command{setpgrp}. @command{mds} puts itself an all
its children in a new process group. However you may
want to put processes that are not @command{mds}
servers or @command{mds} utilities in a separate
process group. @command{setpgrp} can be used to start
a process in a new process group.
@node Servers
@chapter Servers
@pgindex @command{mds}
@pgindex @command{mds-server}
@cpindex Kernel
@cpindex Display server kernel
@cpindex Master server
An @command{mds} display server instance is comprised
of multiple small servers that each implements a
small part of the display server's functionallity.
This chapter will include all servers but the master
server, @command{mds-server} and the kernel,
@command{mds}, the latter of which is not actually a
server.
@menu
* mds-echo:: The @command{mds-echo} server.
* mds-registry:: The @command{mds-registry} server.
* mds-vt:: The @command{mds-vt} server.
* mds-clipboard:: The @command{mds-clipboard} server.
* mds-drag:: The @command{mds-drag} server.
* mds-kkbd:: The @command{mds-kkbd} server.
* mds-kkbdrate:: The @command{mds-kkbdrate} server.
* mds-kbd:: The @command{mds-kbd} server.
* mds-keytrans:: The @command{mds-keytrans} server.
* mds-keystick:: The @command{mds-keystick} server.
* mds-keybounce:: The @command{mds-keybounce} server.
* mds-slowkey:: The @command{mds-slowkey} server.
* mds-keycue:: The @command{mds-keycue} server.
* mds-kbdbind:: The @command{mds-kbdbind} server.
* mds-multikey:: The @command{mds-multikey} server.
* mds-rat:: The @command{mds-rat} server.
* mds-ratbarrier:: The @command{mds-ratbarrier} server.
* mds-ratbind:: The @command{mds-ratbind} server.
* mds-gestures:: The @command{mds-gestures} server.
* mds-kbd2rat:: The @command{mds-kbd2rat} server.
* mds-hwcursor:: The @command{mds-hwcursor} server.
* mds-swcursor:: The @command{mds-swcursor} server.
* mds-cursorshadow:: The @command{mds-cursorshadow} server.
* mds-cursorgamma:: The @command{mds-cursorgamma} server.
* mds-hwgamma:: The @command{mds-hwgamma} server.
* mds-swgamma:: The @command{mds-swgamma} server.
* mds-coopgamma:: The @command{mds-coopgamma} server.
* mds-dcvs:: The @command{mds-dcvs} server.
* mds-colour:: The @command{mds-colour} server.
* mds-dither:: The @command{mds-dither} server.
* mds-retro-crt:: The @command{mds-retro-crt} server.
* mds-state:: The @command{mds-state} server.
* mds-focus:: The @command{mds-focus} server.
* mds-kill:: The @command{mds-kill} server.
* mds-screensaver:: The @command{mds-screensaver} server.
* mds-compositor:: The @command{mds-compositor} server.
* mds-crtc:: The @command{mds-crtc} server.
* mds-dri:: The @command{mds-dri} server.
* mds-fb:: The @command{mds-fb} server.
* mds-endomon:: The @command{mds-endomon} server.
* mds-mds:: The @command{mds-mds} server.
* mds-meta:: The @command{mds-meta} server.
* mds-seat:: The @command{mds-seat} server.
* mds-nest:: The @command{mds-nest} server.
* mds-host:: The @command{mds-host} server.
* mds-remote:: The @command{mds-remote} server.
* mds-xmds:: The @command{mds-xmds} server.
* mds-wmds:: The @command{mds-wmds} server.
* mds-mmds:: The @command{mds-mmds} server.
* mds-mdsx:: The @command{mds-mdsx} server.
* mds-mdsw:: The @command{mds-mdsw} server.
* mds-mdsm:: The @command{mds-mdsm} server.
* mds-posmem:: The @command{mds-posmem} server.
* mds-decorator:: The @command{mds-decorator} server.
* mds-tile:: The @command{mds-tile} server.
* mds-stack:: The @command{mds-stack} server.
* mds-desktop:: The @command{mds-desktop} server.
* mds-workspace:: The @command{mds-workspace} server.
* mds-tray:: The @command{mds-tray} server.
@end menu
@node mds-echo
@section @command{mds-echo}
@pgindex @command{mds-echo}
@cpindex Ping
@cpindex Debugging
@cpindex Heartbeat
@cpindex Network heartbeat
@command{mds-echo} is a server that echos message
that contain the header--value pair
@code{Command: echo}. This server can be used for
debugging and testing as well as to enable network
heartbeats.
@node mds-registry
@section @command{mds-registry}
@pgindex @command{mds-registry}
@cpindex List protocols
@cpindex Protocols, listing
@cpindex Protocol registry
@cpindex Registry of protocols
@command{mds-registry} is a server that keeps a
registry of all protocols that are supported they the
sum of all active servers. It can also be used by
other servers to wait until a protocol has become
available.
@node mds-vt
@section @command{mds-vt}
@pgindex @command{mds-vt}
@cpindex Virtual terminal, switching
@cpindex Virtual terminal, mode switching
@cpindex Switching virtual terminal
@cpindex Switching virtual terminal mode
@cpindex TTY
@cpindex Graphical mode
@cpindex Text mode
@cpindex Mode, virtual terminal, switching
@command{mds-vt} is the server that acquires a virtual
terminal for the display, manages virtual terminal
switches and enables other servers to get access to
the virtual terminal's TTY and informs them of which
virtual terminal the display is located on. It also
enables other servers to switch the virtual terminals
mode to graphical mode or text mode.
@vrindex @env{XDG_VTNR}
@pgindex @command{mds-vt}
@pgindex @file{mdsinitrc}
By default @command{mds-vt} will select the next
available virtual terminal for the display server.
You can override this behaviour by exporting a value
to the environment variable @env{XDG_VTNR}@. The value
must be a decimal integer of a valid virtual terminal
index@footnote{Which is the same thing as a valid TTY
index.}. To select the virtual terminal the display
was started from you can use the following code in
your @file{~/.mdsinitrc}:
@pgindex @command{fgconsole}
@example
export XDG_VTNR="$(fgconsole)"
@end example
@pgindex @command{kbd}
@command{fgconsole} is a part of the @command{kbd}
package.
@node mds-clipboard
@section @command{mds-clipboard}
@pgindex @command{mds-clipboard}
@cpindex Clipboard
@command{mds} has three clipboards, one for copied
text, one for selected text, and one for non-textual
data. Each of these clipboards are stacks, just like
in GNU Emacs. @command{mds-clipboard} implements
these clipboards and automatic removal of outdated
clips. Clips can be configured to expire based on
time or when its originator closes.
@node mds-drag
@section @command{mds-drag}
@pgindex @command{mds-drag}
@cpindex Drag-and-drop
@command{mds-drag} is the server that implements
drag-and-drop support.
@node mds-kkbd
@section @command{mds-kkbd}
@pgindex @command{mds-kkbd}
@cpindex Keyboard
@cpindex Keyboard, kernel-based
@cpindex Scancodes
@cpindex Keycodes
@cpindex Keycodes, remapping
@cpindex Keyboard, remapping
@cpindex Remapping keycodes
@cpindex Keys, swap
@cpindex Swap keys
@command{mds-kkbd} implements access to the
kernel-based keyboard. It does not however implement
delay and rate configurations for the kernel-based
keyboard as that requires root privileges. The
kernel-based keyboard is a keyboard that can be
accessed by reconfiguring stdin in a TTY using
@code{ioctl} and then read from stdin.
@command{mds-kkbd} does not implement any keyboard
layout, rather it broadcasts scancodes and keycodes.
However it can remap keycodes, but not scancodes.
@cpindex Keyboard LED:s
@cpindex LED:s, keyboard
@cpindex Keyboard LED:s, remap
@cpindex LED:s, keyboard, remap
@cpindex Remap keyboard LED:s
@cpindex Remap LED:s, keyboard
@opindex @option{--led}
@command{mds-kkbd} implements control over keyboard
LED:s, the indicators for locked keys. The user can
remap the LED:s both while the server is running, and
at launch via the command line arguments. The option
@option{--led} is used to remap the LED:s. The valid
LED names are @code{num}, @code{caps} and @code{scrl},
and also @code{compose} and SPARC machines. The swap,
for example @key{Caps Lock}'s LED and @key{Num Lock}'s
LED, start @command{mds-kkbd} with
@option{--led=caps=num} and @option{--led=num=caps}.
You can also use an index instead of a name, for
example @option{--led=caps=0}, but not
@option{--led=0=caps}. The index must be a
non-negative integer. The server's behaviour is
undefined if the used value does not map to a real
LED.
@node mds-kkbdrate
@section @command{mds-kkbdrate}
@pgindex @command{mds-kkbdrate}
@pgindex @command{mds-kkbd}
@cpindex Keyboard
@cpindex Keyboard, kernel-based
@cpindex Keyboard repeat rate
@cpindex Keyboard repeat delay
@command{mds-kkbdrate} is a complemental server to
@command{mds-kkbd}, it implements rate and delay
control for the kernel-based keyboard.
@node mds-kbd
@section @command{mds-kbd}
@pgindex @command{mds-kbd}
@cpindex Keyboard
@cpindex Keyboard repeat rate
@cpindex Keyboard repeat delay
@cpindex Scancodes
@cpindex Keycodes
@cpindex Keycodes, remapping
@cpindex Keyboard, remapping
@command{mds-kbd} is an alternative to
@command{mds-kkbd} and @command{mds-kkbdrate}.
In contrast to @command{mds-kkbd}, @command{mds-kbd}
implements control over individual keybroads rather
than utilising the kernels keyboard drivers to treats
all keyboards a one keyboard. This server is only
useful for multiseat sessions and if you otherwise
actually want to handle the keyboards individually.
@node mds-keytrans
@section @command{mds-keytrans}
@pgindex @command{mds-keytrans}
@pgindex @command{mds-kbd}
@pgindex @command{mds-kkbd}
@cpindex Keyboard layout
@cpindex Layout, keyboard
@cpindex Dead keys
@cpindex Compose key
@cpindex Modifier keys
@cpindex Keys, mapping, layout
@cpindex Keys, dead
@cpindex Keys, compose
@cpindex Keys, modifiers
@command{mds-keytrans} is the server than translates
keycodes from @command{mds-kkbd} and
@command{mds-kbd}, and third-party alternatives, to
characters and other attributes. It implements the
keyboard's layouts including modifiers, letters,
other symbols, dead keys and compose.
@node mds-keystick
@section @command{mds-keystick}
@pgindex @command{mds-keystick}
@cpindex Sticky keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
@command{mds-keystick} is a server that can be used
to enable sticky keys. See @ref{Sticky Keys} for more
information.
@node mds-keybounce
@section @command{mds-keybounce}
@pgindex @command{mds-keybounce}
@cpindex Bounce keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
@command{mds-keybounce} is a server that can be used
to enable bounce keys. See @ref{Bounce Keys} for more
information.
@node mds-slowkey
@section @command{mds-slowkey}
@pgindex @command{mds-slowkey}
@cpindex Slow keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
@command{mds-slowkey} is a server that can be used
to enable slow keys. See @ref{Slow Keys} for more
information.
@node mds-keycue
@section @command{mds-keycue}
@pgindex @command{mds-keycue}
@cpindex Loud keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
@command{mds-keycue} is a server that can be used
to enable loud keys. See @ref{Loud Keys} for more
information.
@node mds-kbdbind
@section @command{mds-kbdbind}
@pgindex @command{mds-kbdbind}
@pgindex @command{xbindkeys}
@pgindex @command{dmenu}
@cpindex Hotkeys
@cpindex Keyboard bindings
@cpindex Bindings, keyboard
@cpindex Layout, keyboard, switching
@cpindex Keyboard layout, switching
@cpindex Switching keyboard layout
@command{mds-kbdbind} is a server similar to
@command{xbindkeys}. It can be used to run commands
upon selected key combinations, for example starting
@command{dmenu} or change keyboard layout.
@command{mds-kbdbind} can distinguish keyboards
from each other.
@node mds-multikey
@section @command{mds-multikey}
@pgindex @command{mds-multikey}
@pgindex @command{mds-kbdbind}
@cpindex Keyboard bindings
@cpindex Bindings, keyboard
@command{mds-multikey} is a server that can bind a
key, key combination, or sequence their of to a
sequence of keys or key combinations. For example,
you could bind @kbd{<super>x, y} to simulate that a
key @key{Faux1} is pressed, a key that does not
exist, this key press could be picked up by
@command{mds-kbdbind} to enable @command{mds-kbdbind}
to respond to squences rather than single keys and
single key combinations. alternatively you could bind
@kbd{<super>x} to press @key{x} a selected number of
times with a short selectable delay between them; or
@kbd{<super>x, 5} to press @key{x} five times.
@node mds-rat
@section @command{mds-rat}
@pgindex @command{mds-rat}
@cpindex Rat device
@cpindex Mouse device
@cpindex Pointing device
@command{mds-rat} is a server that implements support
of rat (also known as mouse) devices.
@node mds-ratbarrier
@section @command{mds-ratbarrier}
@pgindex @command{mds-ratbarrier}
@cpindex Cursor barriers
@cpindex Rat pointer barriers
@cpindex Mouse pointer barriers
@cpindex Pointer barriers
@cpindex Screen edges, barriers
@cpindex Barriers, rat
@command{mds-ratbarrier} is a server that lets you
set up barriers for the rat pointer, for example at
the screen edges.
A barrier requires that the rat be moved a bit extra
move it can move on to the next pixel. A barrier can
be directional. A barrier can also be infinite, which
blocks the rat pointer fully and it cannot pass
through at all.
@node mds-ratbind
@section @command{mds-ratbind}
@pgindex @command{mds-ratbind}
@cpindex Bindings, rat
@cpindex Rat bindings
@cpindex Mouse bindings
@cpindex Pointer bindings
@cpindex Hotcorners
@command{mds-ratbind} is a server similar to
@command{mds-kbdbind}. However, @command{mds-ratbind}
respons to rat and rat cursor actions rather than
keyboard actions. It can for example be used to
implement hotcorners.
@node mds-gestures
@section @command{mds-gestures}
@pgindex @command{mds-gestures}
@cpindex Bindings, gestures
@cpindex Gestures bindings
@cpindex Rat gestures bindings
@cpindex Mouse gestures bindings
@cpindex Pointer gestures bindings
@command{mds-gestures} is a server similar to
@command{mds-ratbind}. However it is specialised to
respond to gestures.
@node mds-kbd2rat
@section @command{mds-kbd2rat}
@pgindex @command{mds-kbd2rat}
@cpindex Keyboard to rat bindings
@cpindex Rat keys
@cpindex Mouse keys
If you do not have a rat or rather use your keyboard,
the server @command{mds-kbd2rat} can be used to bind
keyboard actions to simulate rat actions. This server
is a specialisation of @code{mds-kbdbind}, rather
than spawning generic commands it broadcasts messages
within the display server to move the rat cursor and
click on rat buttons. @code{mds-kbdbind} could be
used to do this, but @command{mds-kbd2rat} will not
spawn a new process for each action. For more
information see @ref{Mouse Keys}.
@node mds-hwcursor
@section @command{mds-hwcursor}
@pgindex @command{mds-hwcursor}
@cpindex Cursor, hardware
@cpindex Rat cursor, hardware
@cpindex Mouse cursor, hardware
@cpindex Hardware cursor
@command{mds-hwcursor} is a server that draws the rat
cursor to the monitor on a plane separate from all
other content on the display. In less esoteric terms,
it implements a hardware cursor.
@node mds-swcursor
@section @command{mds-swcursor}
@pgindex @command{mds-swcursor}
@cpindex Cursor, software
@cpindex Rat cursor, software
@cpindex Mouse cursor, software
@cpindex Software cursor
@command{mds-swcursor} is a server that draws the rat
cursor to the monitor on the same plane as all other
content on the display. In less esoteric terms, it
implements a software cursor.
@node mds-cursorshadow
@section @command{mds-cursorshadow}
@pgindex @command{mds-cursorshadow}
@cpindex Cursor shadow
@cpindex Rat cursor shadow
@cpindex Mouse cursor shadow
@cpindex Shadow, cursor
@command{mds-cursorshadow} is a server that can be
used to decorate the rat cursor with a configurable
shadow.
@node mds-cursorgamma
@section @command{mds-cursorgamma}
@pgindex @command{mds-cursorgamma}
@pgindex @command{mds-hwcursor}
@cpindex Gamma correction, hardware cursor
@cpindex Cursor, hardware, gamma correction
@cpindex Rat cursor, hardware, gamma correction
@cpindex Mouse cursor, hardware, gamma correction
@cpindex Hardware cursor, gamma correction
@cpindex Graphics drivers
@command{mds-cursorgamma} is a server you can use if
you use @command{mds-hwcursor} to, if not done by the
graphics driver, correct the gamma correction on the
hardware cursor using software gamma ramps. This of
courses works whether you are using hardware or
software gamma ramps for your monitor's gamma
correction. If can even be used if you do not use
gamma correction, in such case, only the cursor will
have its gamma corrected.
@node mds-hwgamma
@section @command{mds-hwgamma}
@pgindex @command{mds-hwgamma}
@cpindex Gamma correction, hardware
@cpindex Hardware gamma correction
To enable gamma correction, use the server
@command{mds-hwgamma}. It implements hardware gamma
ramps, that is, gamma ramps assisted by hardware
acceleration.
@node mds-swgamma
@section @command{mds-swgamma}
@pgindex @command{mds-swgamma}
@cpindex Gamma correction, software
@cpindex Software gamma correction
@cpindex Graphics drivers
If your graphics driver does not support
@command{mds-hwgamma}, you can instead use
@command{mds-swgamma}. It implements software gamma
ramps, that is, it will modify each pixel according
to the selected gamma correction before it is send
to the presentation sever. To accelerate this process,
@command{mds-swgamma} can tell programs how to modify
its colours before sending it; the programs can then
tell @command{mds-swgamma} not to apply its
correction. Programs such as video players can also
use this to tell the server not to apply gamma
correction as that may cause the video to be played
back to slowly.
@node mds-coopgamma
@section @command{mds-coopgamma}
@pgindex @command{mds-coopgamma}
@cpindex Gamma correction, cooperative
@cpindex Gamma correction, chain
@cpindex Gamma correction, filters
@cpindex Cooperative gamma correction
@command{mds-coopgamma} is a server that
can be used to enable multiple clients to manipulate
the gamma ramps without stepping on each others toes.
It does this by letting clients tell which priority
their corrections has and use this data to chain
together there modifications. For example if one
program wants to apply a red filter to the display
and another program wants to correct the monitors'
gamma, the red filter program will send lookup tables
for the gamma with high priority and the correction
program will send its lookup tables with low priority.
@command{mds-coopgamma} will then apply the latter
lookup tables on top of the red filter. The clients
can tell @command{mds-coopgamma} whether it should
remove their changes when they close, or even keep
them and wait for the client to restart.
@node mds-dcvs
@section @command{mds-dcvs}
@pgindex @command{mds-dcvs}
@cpindex Defective colour vision, simulation
@cpindex Simulateion of defective colour vision
@cpindex Colour blindness, simulation
@cpindex Simulateion of colour blindnes
@command{mds-dcvs} is a server than can be used to
simulate defective colour vision. That is, it can for
example turn the display greyscale (colour blindness)
or add a filter the simulates deuteranopia or
deuteranomaly. This server is intended for testing
that interfaces are suitable for people with
defective colour vision.
@node mds-colour
@section @command{mds-colour}
@pgindex @command{mds-colour}
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@sgindex @code{SIGUSR2}
@command{mds-colour} is a server that implements
colour names, such as system colours and generic
names, for example `red', whose exact colour can be
configured by the user. A terminal written for
@command{mds} would look up colours such as `red'
and `light-red' and get the colours the terminal
should use by default. Nothing is to be assumed
for such colours, not even that `light-red' is in
fact lighter than `dark red', or that `red' is in
fact `red', only that it is the colour the user
wants to see when a colour is supposed to be `red'.
@command{mds-colour} will notify clients when a
colour has been reconfigured, added or removed.
@command{mds-colour} can be notified to reload its
settings by sending @code{SIGUSR2} to the server.
@node mds-dither
@section @command{mds-dither}
@pgindex @command{mds-dither}
@cpindex Colour dithering
@cpindex Dithering of colours
@command{mds-dither} is a server responsible for
informing clients on which two colours clients
should use and how to dither them (by percent, not
by pattern.) This is useful if only 16-bit colours
can be used, or if only 24-colour can used but
gradients between for example sRGB(255, 255, 255)
and sRGB(254, 254, 254) is to be drawn.
@cpindex Gamma correction, dithering
@command{mds-dither} is gamma ramp-aware. For
example, if for the red channel, 0 is mapped to 0, 1
is mapped to 3, 2 is mapped 2 and 3 is mapped to 1,
but 1 and 3 requires dithering, then if 3 is
requested, @command{mds-dither} will tell the client
to dither 0 and 2 with 50 %, which should generate 1,
but 1 and 3 has been swapped.
@command{mds-dither} holds a cache of the outputs
gamma ramps to optimise performance. It will also
inform clients when it is time to redither colours.
This happens the gamma ramps change substantially,
small changes should not trigger redithering, make
it a waste of CPU time if all clients using dithering
would spend time figuring out whether redithering
is required.
@node mds-retro-crt
@section @command{mds-retro-crt}
@pgindex @command{mds-retro-crt}
@pgindex @command{cool-retro-crt}
@command{mds-retro-crt} is a server that applies
filters used in the terminal emulator
@command{cool-retro-term} to the whole display.
@node mds-state
@section @command{mds-state}
@pgindex @command{mds-state}
@cpindex State, windows
@cpindex Windows states
@command{mds-state} is the server that keeps tracks
of the windows' state.
@node mds-focus
@section @command{mds-focus}
@pgindex @command{mds-focus}
@cpindex Window focus
@cpindex Focus of windows and components
@command{mds-focus} is the server focuses windows
and windows' components.
@node mds-kill
@section @command{mds-kill}
@pgindex @command{mds-kill}
@cpindex Signals, sending
@cpindex Process identification
@cpindex Identification of processes
@command{mds-kill} is a server that can be used to
send signals to processes by identifying them by
their windows. This server can also be used to simply
identify the process that owns a window.
@node mds-screensaver
@section @command{mds-screensaver}
@pgindex @command{mds-screensaver}
@cpindex Screensaver
@cpindex Monitor deactivation
@cpindex Deactive monitors
@command{mds-screensaver} is a server that can be
used to start a screensaver or deactive monitors when
the input devices has not be used for a period of
time provided that no client has disabled this. It is
capable of deactiving single monitors or start a
screensaver on single monitors rather than all
monitors.
@node mds-compositor
@section @command{mds-compositor}
@pgindex @command{mds-compositor}
@pgindex @command{mds-dri}
@pgindex @command{mds-fb}
@cpindex Compositor
@cpindex Presentation
@command{mds-compositor} is the server that composes
the output. It takes output of all windows and
arranges it to one image per monitor and sends it to
the presentation servers, such as @command{mds-dri}
and @command{mds-fb}.
@node mds-crtc
@section @command{mds-crtc}
@pgindex @command{mds-crtc}
@cpindex CRTC
@cpindex Cathode ray tube controller
@command{mds-crtc} is the server that identifies
CRTC:s and provide access to them.
@node mds-dri
@section @command{mds-dri}
@pgindex @command{mds-dri}
@cpindex Direct Rendering Infrastructure
@cpindex Presentation
@cpindex Display of content
@cpindex Content, display
@command{mds-dri} is a server that displays
content using the Direct Rendering Infrastructure.
@node mds-fb
@section @command{mds-fb}
@pgindex @command{mds-fb}
@cpindex Framebuffer
@cpindex Presentation
@cpindex Display of content
@cpindex Content, display
@command{mds-fb} is a server that displays content
using framebuffers.
@node mds-endomon
@section @command{mds-endomon}
@pgindex @command{mds-endomon}
@cpindex CRTC
@cpindex Cathode ray tube controller
@cpindex Presentation
@cpindex Display of content
@cpindex Content, display
@cpindex Endomonitor
@cpindex Monitor, endo-
@cpindex Cinerama
@pgindex @command{mds-cinerama}
@command{mds-endomon} is a server that provides a
logical monitor inside another monitor or cinerama, an
endomonitor. This lets you for example start a
single-monitor full screen game but keep a part, for
example the status bar with the clock, visible.
For more information, see @ref{Endomonitor}.
@node mds-mds
@section @command{mds-mds}
@pgindex @command{mds-mds}
@cpindex Monitor emulation
@cpindex Emulation, monitor
@command{mds-mds} is a server that displays
content using another @command{mds} window. It
creates a window that emulates a monitor.
@node mds-meta
@section @command{mds-meta}
@pgindex @command{mds-meta}
@cpindex Metadisplay server
@vrindex @env{MDS_DISPLAY}
@cpindex Server sharing
@cpindex Sharing, servers
@command{mds-meta} is a metadisplay server.
It creates or joins a named metadisplay server,
and creates an alternative value for
@env{MDS_DISPLAY}@. Any server connecting to this
alternative @env{MDS_DISPLAY} connects to this
metadisplay server. This can be used to make servers
shared between display server instances.
@command{mds-meta} uses the environment variable
@env{MDS_METADISPLAY} to acquire the name of the
metadisplay server instance it should join or create.
If @env{MDS_METADISPLAY} has not been set it is
treated as having an empty string for its value which
is a valid metadisplay server instance name.
@command{mds-meta} works by connecting to the running
display server instance, the display, and create a
new display server instance, the metadisplay.
Messages passed via the metadisplay's socket is
forward to the display, and messages passed to via
the display to @command{mds-meta} is send to the
appropriate server. @command{mds-meta} manages
interception in the same way as @command{mds-server}
and @command{mds-remote}.
@pgindex @file{mdsmetainitrc}
If @command{mds-meta} creates a new metadisplay,
rather than joining an existing metadisplay, it will
spawn @file{~/.mdsmetainitrc} to let you start the
shared servers.
@pgindex @command{mds-host}
@pgindex @command{mds-clipboard}
@pgindex @command{mds-remot}
@cpindex Networking
An interesting property of @command{mds-meta} is that
it can be used to share servers across display
servers on multiple computers. For example, if you
start @command{mds-host} and @command{mds-clipboard}
inside the metadisplay on your central computer,
displays started on other servers can run
@command{mds-remote} to connect to the metadisplay
so that all computers share the same clipboard.
However, this network will be centralised and not
distributed, so it is not perfect.
For more information, see @ref{Metadisplay Server}.
@node mds-seat
@section @command{mds-seat}
@pgindex @command{mds-seat}
@cpindex Sandboxing, seats
@cpindex Seats
@command{mds-seat} is a server that enables
seat-sandboxing. It can be used to place two users
on the same machine without them interfering with
each others monitors and input devices. Servers
started below @command{mds-seat} become shared and
servers started above @command{mds-seat} become
seat-private. @command{mds-seat} can filter messages
from shared servers so only the appropriate seat
receives them.
@node mds-nest
@section @command{mds-nest}
@pgindex @command{mds-nest}
@cpindex Display server, nesting
@cpindex Nested display server
@command{mds-nest} is a server that creates a new
@command{mds} instance inside another @command{mds}
instance. A display server inside another display
server.
@node mds-host
@section @command{mds-host}
@pgindex @command{mds-host}
@pgindex @command{mds-remote}
@cpindex Networking
@command{mds-host} is a server that enables servers
like @command{mds-remote} running on remote machines
to connect to the local machine and its display
server.
@node mds-remote
@section @command{mds-remote}
@pgindex @command{mds-remote}
@cpindex Networking
@command{mds-remote} is a server that enables you to
connect extend a remote @command{mds} with your local
machine. This can be used to make a display server
instance span multiple computers including its
monitors and input devices.
@node mds-xmds
@section @command{mds-xmds}
@pgindex @command{mds-xmds}
@cpindex Compatibility layer, X.org
@cpindex X.org compatibility layer
@command{mds-xmds} is a server that translates X.org
calls to @command{mds} calls. It can be used to run
X.org-only programs inside @command{mds}.
@node mds-wmds
@section @command{mds-wmds}
@pgindex @command{mds-wmds}
@cpindex Compatibility layer, Wayland
@cpindex Wayland compatibility layer
@command{mds-wmds} is a server that translates
Wayland calls to @command{mds} calls. It can be used
to run Wayland-only programs inside @command{mds}.
@node mds-mmds
@section @command{mds-mmds}
@pgindex @command{mds-mmds}
@cpindex Compatibility layer, Mir
@cpindex Mir compatibility layer
@command{mds-mmds} is a server that translates Mir
calls to @command{mds} calls. It can be used to run
Mir-only programs inside @command{mds}.
@node mds-mdsx
@section @command{mds-mdsx}
@pgindex @command{mds-mdsx}
@cpindex Reverse compatibility layer, X.org
@cpindex X.org reverse compatibility layer
@command{mds-mdsx} is a server that translates
@command{mds} calls to X.org calls. It can be used to
enable @command{mds} specific programs to run inside
the X.org display servers.
@node mds-mdsw
@section @command{mds-mdsw}
@pgindex @command{mds-mdsw}
@cpindex Reverse compatibility layer, Wayland
@cpindex Wayland reverse compatibility layer
@command{mds-mdsw} is a server that translates
@command{mds} calls to Wayland calls. It can be used
to enable @command{mds} specific programs to run
inside the Wayland display servers.
@node mds-mdsm
@section @command{mds-mdsm}
@pgindex @command{mds-mdsm}
@cpindex Reverse compatibility layer, Mir
@cpindex Mir reverse compatibility layer
@command{mds-mdsm} is a server that translates
@command{mds} calls to Mir calls. It can be used
to enable @command{mds} specific programs to run
inside the display server Mir.
@node mds-posmem
@section @command{mds-posmem}
@cpindex Memorisation of size and position
@cpindex Position, memorisation
@cpindex Size, memorisation
@pgindex @command{mds-posmem}
@command{mds-posmem} is a server that remembers where
window's were positioned and their size, and moves
and resizes them accordingly when they are created.
@node mds-decorator
@section @command{mds-decorator}
@pgindex @command{mds-decorator}
@cpindex Client-side decoration
@cpindex Decoration
@command{mds-decorator} is a server that provides a
simple, reference implementation of a, window
decorator. This window decorator should implement
snappy and sticky edges and stacking (the title bars
is split into tabs with different windows that have
been stacked togather.)
@node mds-tile
@section @command{mds-tile}
@pgindex @command{mds-tile}
@cpindex Tiling window manager
@cpindex Window manager, tiling
@command{mds-tile} is a server that provides a
simple, reference implementation of a, tiling window
manager.
@node mds-stack
@section @command{mds-stack}
@pgindex @command{mds-stack}
@cpindex Stacking window manager
@cpindex Window manager, stacking
@command{mds-stack} is a server that provides a
simple, reference implementation of a, stack window
manager.
@node mds-desktop
@section @command{mds-desktop}
@pgindex @command{mds-desktop}
@cpindex Desktop
@command{mds-desktop} is a server that provides a
simple, reference implementation of a, desktop.
@node mds-workspace
@section @command{mds-workspace}
@pgindex @command{mds-workspace}
@cpindex Workspaces
@command{mds-workspace} is a server that provides
simple, reference implementation of, workspaces.
@node mds-tray
@section @command{mds-tray}
@pgindex @command{mds-tray}
@cpindex Status icon tray
@cpindex System tray
@cpindex Tray, status icons
@cpindex Icon, status, tray
@command{mds-tray} is a server that provides a
simple, reference implementation of a, status icon
tray.
@node Protocols
@chapter Protocols
@menu
* Infrastructure Protocols:: Infrastructure protocols.
* Virtual Terminal Protocols:: Virtual terminal protocols.
* Keyboard Protocols:: Keyboard protocols.
* Clipboard Protocols:: Clipboard protocols.
* Status Icon Protocols:: Status icon protocols.
* Colour Protocols:: Colour protocols.
* Screensaver Protocols:: Screensaver protocols.
* Miscellaneous Protocols:: Miscellaneous protocols.
@end menu
@node Infrastructure Protocols
@section Infrastructure Protocols
@menu
* assign-id:: Assign new ID to client, or fetch current ID@.
* intercept:: Sign up for reception of message.
* register:: Register availability of a command for which you implement a service.
* reregister:: Request for reregistration for available commands.
* error:: Notify a client about a request failure.
@end menu
@node assign-id
@subsection @code{assign-id}
@prindex @code{assign-id}
@cpindex Client ID assignment
@cpindex ID assignment
@cpindex Assignment of ID
@cpindex Client ID fetching
@cpindex ID fetching
@cpindex Fetching of ID
@table @asis
@item Identifying header:
@code{Command: assign-id}
@item Action:
Assign new ID to client, or fetch current ID@.
@item Purpose:
Assigning ID to clients so server can respond to that
client.
@item Compulsivity:
Manditory, part of the core infrastructure.
@item Reference implementation:
@pgindex @command{mds-server}
@command{mds-server}
@end table
@node intercept
@subsection @code{intercept}
@prindex @code{intercept}
@cpindex Interceptions, message passing
@cpindex Message modification, message passing
@table @asis
@item Identifying header:
@code{Command: intercept}
@item Action:
Sign up for reception of message.
@item Optional header: @code{Stop}
Stop reception of messages if the value for the
header @code{Stop} is @code{yes}.
@item Optional header: @code{Priority}
Signed 64-bit integer of reception priority (reversed
of order.)
@item Optional header: @code{Modifying}
Send message asynchronously and await modification if
the value for the header @code{Modifying} is
@code{yes}.
@item Optional header: @code{Length}
Length of the message.
@item Message:
List of headers and header--value-pairs that
qualifies a message for reception, all messages
qualifies if this list is empty.
@item Purpose:
Filter received message for clients and servers.
@item Purpose:
Assigned interception order for modification of
messages.
@item Compulsivity:
Manditory, part of the core infrastructure.
@item Reference implementation:
@pgindex @command{mds-server}
@command{mds-server}
@end table
@node register
@subsection @code{register}
@prindex @code{register}
@cpindex Protocol registry
@cpindex Registry of protocols
@table @asis
@item Identifying header:
@code{Command: register}
@item Action:
Register availability of a command for which you
implement a service.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Conditionally required header: @code{Length}
Length of the message.
Required if @code{Action: list} is included in the
headers.
@item Optional header: @code{Action}
@table @code
@item remove
Remove availability from registry if the value of the
header @code{Action} is @code{remove}.
@item wait
Wait until listed commands are available if the value
of the header @code{Action} is @code{wait}. However
if a protocol becomes unavailable during this wait
period it will still be counted as available for this
wait action.
@item list
@cpindex List protocols
@cpindex Protocols, listing
Send a list of availability commands if the value of
the header @code{Action} is @code{list}.
@end table
@item Conditionally optional header: @code{Time to live}
The maximum number of seconds to wait. Available and
optional if @code{Action: wait} is included in the
headers.
@item Message:
List of values for the header @code{Command} that you
implement.
@item Purpose:
Identify supported display server operations.
@item Purpose:
@cpindex Initialisation synchronisation
Initialisation process synchronisation.
@item Compulsivity:
Highly recommended, programs may stall a bit from
time to time without it, or at initialisation
depending on the program's implementation.
@item Reference implementation:
@pgindex @command{mds-registry}
@command{mds-registry}
@end table
@node reregister
@subsection @code{reregister}
@prindex @code{reregister}
@cpindex Protocol registry
@cpindex Registry of protocols
@table @asis
@item Identifying header:
@code{Command: reregister}
@item Action:
@prindex @code{register}
Request that all servers resends
@code{Command: register} with either @code{Action: add}
or without the @code{Action}-header (does the same
thing.)
@item Purpose:
@prindex @code{register}
Rebuild registry created with @code{Command: register}
if the registry server crashes.
@item Compulsivity:
Highly recommended, programs may think a protocol is
not supported of the registry server crashes if you
do not implement this in your server.
@item Reference implementation:
@pgindex @command{mds-registry}
@command{mds-registry}
@end table
@node error
@subsection @code{error}
@prindex @code{error}
@cpindex Error management
@cpindex Responses
@table @asis
@item Identifying header:
@code{Command: error}
@item Action:
Notify a client about a request failure.
@item Required header: @code{To}
The ID of the client that send a request that failed.
@item Required header: @code{In response to}
The ID of the message whose request failed.
@item Required header: @code{Error}
The errno number of the error, 0 on success if the
message was not an information query. The string
``custom'' can be used if there is not errno number,
optionally followed by a blank space and a number
that identifies the error, this number must be
positive (not zero).
@item Conditionally optional header: @code{Length}
The length of the message.
Available and optional if ``custom'' is used in the
header @code{Error}.
@item Message:
Description of the error, single line, mid-sentence
case, no punctuation in the end, must not be a
question but rather it must be a statement. The
message shall end with a line feed.
@item Purpose:
Enable keyboard layout servers to automatically set
active locks when the server starts based on
currently active LED:s.
@item Compulsivity:
Optional.
@end table
@node Virtual Terminal Protocols
@section Virtual Terminal Protocols
@cpindex Virtual terminal
@menu
* get-vt:: Get the index of the virtual terminal the server is display on.
* configure-vt:: Reconfigure the virtual terminal the server is display on.
* switching-vt:: Notify servers about an ongoing virtual terminal switch.
@end menu
@node get-vt
@subsection @code{get-vt}
@prindex @code{get-vt}
@table @asis
@item Identifying header:
@code{Command: get-vt}
@item Action:
Get the index of the virtual terminal the server is
display on.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Response:
The server will response with the header
@code{VT index} and the index of the virtual terminal
the server is display on in decimal format.
Additionally the server will respond with the header
@code{Active} with the value @code{yes} if the VT is
in the foreground or the value @code{no} if the VT is
in the background.
@item Purpose:
Allow programs to be aware of whether the display is
in the foreground or the background.
@item Purpose:
Allow programs to be aware of which VT the server is
running on.
@item Purpose:
Allow programs to gain access of the TTY associated
with the VT such that they can use @code{ioctl} and
similar calls on that TTY@.
@item Compulsivity:
Required.
@item Reference implementation:
@pgindex @command{mds-vt}
@command{mds-vt}
@end table
@node configure-vt
@subsection @code{configure-vt}
@prindex @code{configure-vt}
@table @asis
@item Identifying header:
@code{configure-vt}
@item Action:
Reconfigure the virtual terminal the server is
display on.
@cpindex Virtual terminal, mode switching
@cpindex Switching virtual terminal mode
@cpindex Graphical mode
@cpindex Text mode
@cpindex Mode, virtual terminal, switching
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Optional header: @code{Graphical}
@table @code
@item yes
Set the TTY graphical mode if the value of the header
@code{Graphical} is @code{yes}.
@item no
Set the TTY text mode if the value of the header
@code{Graphical} is @code{no}.
@end table
The server implementing this protocol should not set
the TTY to text mode temporarily when switching TTY@.
It is up to the server that set the request for
graphical mode to temporarily switch to text mode
when switching TTY@.
@cpindex Virtual terminal, exclusive mode
@cpindex Exclusive mode, virtual terminal
@item Optional header: @code{Exclusive}
@table @code
@item yes
The server may block other process from opening the
TTY if the value of the header @code{Exclusive} is
@code{yes}.
@item no
The server may not block other process from opening
the TTY if the value of the header @code{Exclusive}
is @code{no}.
@end table
The server implementing this protocol should keep a
counter for how many servers have requested
non-exclusive mode and only switch back to exclusive
mode when that counter reaches zero
@item Response:
The server will response with a @code{Command: error}.
@item Purpose:
Allow presentation servers to enter and leave
graphical mode.
@item Purpose:
@cpindex TTY
Allow programs to gain access of the TTY associated
with the VT such that they can use @code{ioctl} and
similar calls on that TTY@.
@item Compulsivity:
Required.
@item Reference implementation:
@pgindex @command{mds-vt}
@command{mds-vt}
@end table
@node switching-vt
@subsection @code{switching-vt}
@prindex @code{switching-vt}
@cpindex Virtual terminal, switching
@cpindex Switching virtual terminal
@table @asis
@item Identifying header:
@code{Command: switching-vt}
@item Action:
Notify servers about an ongoing virtual terminal
switch.
@item Required header: @code{Status}
@table @code
@item deactivating
The kernel wants to place the display in the
background if the value of the header @code{Status}
is @code{deactivating}.
@item activating
The kernel wants to place the display in the
foreground if the value of the header @code{Status}
is @code{activating}.
@end table
@item Instructions:
When a virtual terminal switch is requested the
server implementing control VT switching involving
the display's virtual terminal will get signaled by
the kernel. Upon this signal the server should
broadcast this command. All servers that need to
release or acquire resouces should intercept this
message with the possibility of modifying it. Once a
server is ready for the VT to switch it should let
the message pass to the next server by telling the
master server that it is no modification to do. Once
all servers are read for the switch the server that
emitted this message should signal the kernel that it
may switch VT@. The server should detect this by
setting up secondary contection to the display that
intercepts this message. This connection should
intercept this message with priority @math{-2^{62}},
all servers that need to perform actions before the
switch takes place must have a priority higher than
@math{-2^{62}}, preferably 0.
@item Purpose:
Allow servers to release resources when the user
switch virtual terminal before the terminal actually
changes and to reacquire resources when the virtual
terminal become active again.
@item Compulsivity:
Required.
@item Reference implementation:
@pgindex @command{mds-vt}
@command{mds-vt}
@end table
@node Keyboard Protocols
@section Keyboard Protocols
@menu
* key-sent:: Announce a keyboard input event.
* enumerate-keyboards:: List available keyboards.
* keyboard-enumeration:: Response to @code{Command: enumerate-keyboards}.
* set-keyboard-leds:: Activate and deactivate LED:s on a keyboard.
* get-keyboard-leds:: List exisiting LED:s on a keyboard and their state.
* map-keyboard-leds:: Remap LED:s on a keyboard.
* set-keyboard-rate:: Set the repeat rate and repeat delay on a keyboard.
* get-keyboard-rate:: Get the repeat rate and repeat delay on a keyboard.
* keycode-map:: Remap keyboard keycodes and query current mapping.
* new-keyboard:: Announce the existance of a new keyboard.
* old-keyboard:: Announce the removal of an old keyboard.
@end menu
@node key-sent
@subsection @code{key-sent}
@prindex @code{key-sent}
@table @asis
@item Identifying header:
@code{Command: key-sent}
@item Action:
@cpindex Keyboard input events
@cpindex Input events, keyboard
Announce a keyboard input event.
@item Required header: @code{Keyboard}
@cpindex Keyboard ID
@cpindex ID of keyboard
Any string that uniquely identifies the keyboard.
@table @asis
@item Purpose:
Enable multi-keyboard aware programs and give at
least one keyboard per seat in a multi-seat
environment.
@item Note:
@pgindex @command{mds-kkbd}
@command{mds-kkbd} uses @code{kernel} to indicate that
it uses the kernel and thus lumps together all
keyboards.
@end table
@item Required header: @code{Released}
@table @code
@item yes
The value of the header @code{Released} will be
@code{yes} if the key was released.
@item no
The value of the header @code{Released} will be
@code{no} otherwise, that is, held down or pressed.
@end table
Note: @key{Pause}/@key{Break} is automatically
released directly after it has been pressed. This is
feature built into most keyboards and servers should
not try to circumvent this.
@item Required header: @code{Keycode}
@cpindex Keycodes
An unsigned 14-bit integer identifying the key, may
be remapped.
@item Optional header: @code{Scancode}
@cpindex Scancodes
Either an unsigned 7-bit integer or a single blank
space separated trio of unsigned 7-bit integers,
identifying the key. This is the scancode sent from
the keyboard and optionally unified by the keyboard
driver, however with the typed/released bit zeroed
out. This may not be remapped.
@item Optional header: @code{Modifiers}
@cpindex Modifier keys
@cpindex Keys, modifiers
Single blank space separated list of active modifiers:
@table @code
@item shift
@key{Shift} (level 2)
@item ctrl
@key{Control}
@item alt
@key{Alternative}/@key{Option}
@item altgr
@key{Alternative Graphic} (level 3)
@item lvl*
@code{*} may be any @math{2^n + 1} integer with
@math{1 < n < 20}.
@item super
@key{Super}
@item hyper
@key{Hyper}
@item ultra
@key{Ultra}
@item caps
@key{Caps} (usually a lock key)
@item num
@key{Num} (usually a lock key)
@item scrl
@key{Scroll} (usually a lock key)
@item top
@key{Top} (historical)
@item front
@key{Front} (historical)
@item greek
@key{Greek} (historical)
@item compose
@key{Compose} (rare, it is usually a dead key)
@end table
@cpindex Lock keys
@cpindex Keys, lock
Any key that has been locked should be prefix with
@code{+}, if the key has been locked by nullified
with non-lock modifier it should be prefixed with a
@code{-}. If no modifier is active or has been
nullified, @code{none} should be used.
@item Optional header: @code{Key}
A textual representation of the key that has been
typed or released, as mapped by the keyboard layout.
@table @code
@item esc
@key{Escape}
@item f*
@key{F*} where @code{*} is any integer.
@item sysrq
@key{System Request}/@key{Print Screen}
@item scrl
@key{Scroll} (lock)
@item break
@key{Break}/@key{Pause}
@item backspace
@key{Backspace}
@item tab
@key{Tab}
@item return
@key{Return}/@key{Enter}
@item space
@key{Blank Space}
@item menu
@key{Application Menu}
@item ins
@key{Insert}
@item home
@key{Home}
@item pgup
@key{Page Up}
@item del
@key{Delete}
@item end
@key{End}
@item pgdown
@key{Page Down}
@item up
@key{Up} arrow
@item left
@key{Left} arrow
@item down
@key{Down} arrow
@item right
@key{Right} arrow
@item shift
@key{Shift} (level 2)
@item begin
@key{Begin} (keypad @key{5} in nagivation mode)
@item ctrl
@key{Control}
@item alt
@key{Alternative}/@key{Option}
@item altgr
@key{Alternative Graphic} (level 3)
@item lvl*
@code{*} may be any @math{2^n + 1} integer with
@math{1 < n < 20}.
@item super
@key{Super}
@item hyper
@key{Hyper}
@item ultra
@key{Ultra}
@item caps
@key{Caps} (usually a lock key)
@item num
@key{Num} (usually a lock key)
@item scrl
@key{Scroll} (usually a lock key)
@item top
@key{Top} (historical)
@item front
@key{Front} (historical)
@item greek
@key{Greek} (historical)
@item compose
@key{Compose} (usually a dead key)
@item hexcompose
@key{Hex-Compose} (usually a dead key)
(Used to create aribitrary characters.)
@item longhexcompose
@key{Long Hex-Compose} (usually a dead key)
(Variant of @code{hexcompose} for longer codepoints.)
@item modelock
@key{Mode Lock}
@item letter *
@code{*} may be any UTF-8 encoded letter.
@end table
Keys that lock/unlock a modifer should be suffixed
with a blank space and a @code{lock}. If the key is a
dead key (even the @key{Compose} key) should use
@code{dead} instead. A position, either @code{left},
@code{right}, @code{keypad} or an index, followed by
a blank space, should prefix any key that occurs on
multiple position on the keyboard, unless it only
appears on the keypad once and once not on the
keypad. Keys without any meaning should be identified
as @code{unknown}. Modifiers and dead keys should not
affect the value.
@item Optional header: @code{Characters}
UTF-8 encoded string that has been written.
@item Purpose:
@cpindex On-screen keyboards
@cpindex Keyboards, on-screen
Enable the user to use a keyboard, physical or
on-screen.
@item Purpose:
Enable programs to send keys as part of a script or a
reply of a recorded session.
@item Compulsivity:
Highly-recommended, a computer is as good as useless
without a keyboard.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@pgindex @command{mds-keytrans}
@command{mds-kkbd}, @command{mds-kbd} and
@command{mds-keytrans}
@end table
@node enumerate-keyboards
@subsection @code{enumerate-keyboards}
@prindex @code{enumerate-keyboards}
@cpindex Keyboard listing
@cpindex List keyboards
@table @asis
@item Identifying header:
@code{Command: enumerate-keyboards}
@item Action:
List available keyboards.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Instructions:
@prindex @code{keyboard-enumeration}
@prindex @code{key-sent}
This message must be consumed by the first server that
receives it and implements support for it, and then
send out a @code{Command: keyboard-enumeration}
populated with the keyboard it provide as named in
the @code{Keyboard}-header for protocols such as
@code{Command: key-sent}.
@item Purpose:
Make it possible for clients to list all available
keyboards so that can be configured individually.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@command{mds-kkbd} and @command{mds-kbd}
@end table
@node keyboard-enumeration
@subsection @code{keyboard-enumeration}
@prindex @code{keyboard-enumeration}
@cpindex Keyboard listing
@cpindex List keyboards
@table @asis
@item Identifying header:
@code{Command: keyboard-enumeration}
@item Action:
@prindex @code{enumerate-keyboards}
Response to @code{Command: enumerate-keyboards}.
@item Required header: @code{To}
@prindex @code{enumerate-keyboards}
The ID received under @code{Client ID}-header in the
@code{Command: enumerate-keyboards}-message that
triggered this message to be broadcasted
@item Required header: @code{In response to}
@prindex @code{enumerate-keyboards}
The ID received under the @code{Message ID}-header in
the @code{Command: enumerate-keyboards}-message that
triggered this message to be broadcasted.
@item Required header: @code{Length}
Length of the message.
@item Message:
New line separated list of available keyboards.
@item Instructions:
All keyboard servers should listen for this message
and append all keyboards it implement to the message
once recieved.
@item Purpose:
Make it possible for clients to list all available
keyboards so that can be configured individually.
@item Compulsivity:
@prindex @code{enumerate-keyboards}
Required if you implement
@code{Command: enumerate-keyboards}.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@command{mds-kkbd} and @command{mds-kbd}
@end table
@node set-keyboard-leds
@subsection @code{set-keyboard-leds}
@prindex @code{set-keyboard-leds}
@cpindex Keyboard LED:s
@cpindex LED:s, keyboard
@table @asis
@item Identifying header:
@code{Command: set-keyboard-leds}
@item Action:
Activate and deactivate LED:s on a keyboard.
@item Required header: @code{Active}
LED:s that should be turned on. If a LED is listed
here but not in @code{Mask} that LED should be turned
on if it is off, and turned off if it is on.
The value is a single blank space separated list of
LED:s:
@table @code
@item num
@key{Num lock}
@item caps
@key{Caps lock}
@item scrl
@key{Scroll lock}
@item compose
@key{Compose}
@end table
Unsupported LED:s should be silently ignored.
@item Required header: @code{Mask}
LED:s listed here that do not appear in @code{Active}
should be turned off. The value of this header follows
the same rules as for @code{Active}.
@item Optional header: @code{Keyboard}
A string that identifies the keyboard that should be
affected. If omitted all keyboard are affected.
@item Purpose:
Enable keyboard layout servers to activate and
deactive LED:s on the keyboard to indicate active
locks.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@pgindex @command{mds-keytrans}
@command{mds-kkbd}, @command{mds-kbd} and
@command{mds-keytrans}
@end table
@node get-keyboard-leds
@subsection @code{get-keyboard-leds}
@prindex @code{get-keyboard-leds}
@cpindex Keyboard LED:s
@cpindex LED:s, keyboard
@table @asis
@item Identifying header:
@code{Command: get-keyboard-leds}
@item Action:
List exisiting LED:s on a keyboard and their state.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Keyboard}
A string that identifies the keyboard that should be
affected.
@item Response:
@prindex @code{set-keyboard-leds}
The server implementing support for
@code{Command: get-keyboard-leds} for the keyboard
indicated by @code{Keyboard} should send a message back
to the client indicated by the @code{Client ID}-header
(using the @code{To}-header) with the headers:
@table @code
@item Active
List of currently turned on LED:s.
@item Present
List of LED:s that the server believes to be present
on the keyboards.
@end table
Both of these headers follows the rules of the
@code{Active}-header under
@code{Command: set-keyboard-leds}.
@item Purpose:
Enable keyboard layout servers to automatically set
active locks when the server starts based on
currently active LED:s
@item Compulsivity:
@prindex @code{set-keyboard-leds}
Recommended. Required if you implement support for
@code{Command: set-keyboard-leds}. If you do not
support this protocol servers and clients and stall
when they try to get the active LED:s.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@pgindex @command{mds-keytrans}
@command{mds-kkbd}, @command{mds-kbd} and
@command{mds-keytrans}
@end table
@node map-keyboard-leds
@subsection @code{map-keyboard-leds}
@prindex @code{map-keyboard-leds}
@cpindex Keyboard LED:s, remap
@cpindex LED:s, keyboard, remap
@cpindex Remap keyboard LED:s
@cpindex Remap LED:s, keyboard
@table @asis
@item Identifying header:
@code{Command: map-keyboard-leds}
@item Action:
Remap LED:s on a keyboard.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Length}
The length of the message.
@item Optional header: @code{Keyboard}
A string that identifies the keyboard that should be
affected. If omitted all keyboard are affected.
@item Message:
Each line contains two single space delimited values,
the first value is the LED's name, the second value is
the LED's new position, either a zero-based index or
the name of the LED that was originally mapped to that
position. For example, @code{num num} sets the LED for
@key{Num Lock} to its original position. This is
equivalent to @code{num 0} on SPARC machines and
@code{num 1} on non-SPARC machines.
@example
@group
num caps
caps num
@end group
@end example
swaps the LED:s for @key{Num Lock} and
@key{Caps Lock}. Valid LED names are @code{num},
@code{caps} and @code{scrl}, and on SPARC machines
@code{compose}.
@item Instructions:
The server should remap the LED:s and update their
activity accordingly. The server should do this
atomically.
@item Purpose:
Allow the user to swap LED:s on the keyboard. Some
keyboards use a non-standard layout, which can be very
distracting or confusing.
@item Purpose:
Allow the user to correct invalid LED mappings.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@command{mds-kkbd} and @command{mds-kbd}
@end table
@node set-keyboard-rate
@subsection @code{set-keyboard-rate}
@prindex @code{set-keyboard-rate}
@table @asis
@item Identifying header:
@code{Command: set-keyboard-rate}
@item Action:
Set the repeat rate and repeat delay on a keyboard.
@item Optional header: @code{Rate}
@cpindex Keyboard repeat rate
A floating point value of the repeat rate, measured in
cycles per second (hertz). Zero means no repeat.
@item Optional header: @code{Delay}
@cpindex Keyboard repeat delay
An unsigned 16-bit integer of the number of
milliseconds to wait before the first time a key is
repeated. Zero means that the delay is matched with
the rate, that is the reciprocal of the rate.
@item Optional header: @code{Emulate}
@table @code
@item disallow
Always use the keyboard's built in repeat feature.
@item allow
Use the keyboard's built in repeat feature when
possible, otherwise emulate the feature. But if the
selected settings are close enough to what the
keyboard supports, use the closed settings the
keyboard supports.
@item if needed
Use the keyboard's built in repeat feature when
possible, otherwise emulate the feature.
@item force
Never use the keyboard's built in repeat feature,
always emulate the feature.
@end table
@item Optional header: @code{Keyboard}
A string that identifies the keyboard that should be
affected. If omitted all keyboard are affected.
@item Instructions:
If neither of @code{Rate}, @code{Delay} and
@code{Emulate} headers are used. The server should
reapply the settings.
@item Purpose:
Enable the user to configure the repeat rate and
repeat delay on keyboards.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@command{mds-kkbd} and @command{mds-kbd}
@end table
@node get-keyboard-rate
@subsection @code{get-keyboard-rate}
@prindex @code{get-keyboard-rate}
@cpindex Keyboard repeat rate
@cpindex Keyboard repeat delay
@table @asis
@item Identifying header:
@code{Command: get-keyboard-rate}
@item Action:
Get the repeat rate and repeat delay on a keyboard.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Keyboard}
A string that identifies the keyboard that should be
affected.
@item Response:
@prindex @code{set-keyboard-rate}
The server implementing support for
@code{Command: get-keyboard-rate} for the keyboard
indicated by @code{Keyboard} should send a message back
to the client indicated by the @code{Client ID}-header
(using the @code{To}-header) with the headers:
@table @code
@item Rate
The current repeat rate. Same syntax as in
@code{Command: set-keyboard-rate}. Set to
@code{unknown} if the server does not know what the
value is.
@item Delay
The current repeat delay. Same syntax as in
@code{Command: set-keyboard-rate}. Set to
@code{unknown} if the server does not know what the
value is.
@item Emulated
@table @code
@item yes
The server implements the key repeat in software.
@item no
The server has set the rate on the keyboard, and lets
the keyboard be responsible for the repeat. This
value should also be used if the server does not
support @code{Command: set-keyboard-rate} for the
enquired keyboard, but is the server that should be
responsible for it.
@end table
@end table
@item Purpose:
Enable the user to get the current repeat rate and
repeat delay on the keyboard.
@item Compulsivity:
Optional. Recommended if implement support for
@code{Command: set-keyboard-rate}. If you do not
support this protocol servers and clients and stall
when they try to get the current repeat rate and
repeat delay on the keyboard.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@command{mds-kkbd} and @command{mds-kbd}
@end table
@node keycode-map
@subsection @code{keycode-map}
@prindex @code{keycode-map}
@cpindex Keycodes, remapping
@cpindex Keyboard, remapping
@cpindex Remapping keycodes
@cpindex Keys, swap
@cpindex Swap keys
@table @asis
@item Identifying header:
@code{Command: keycode-map}
@item Action:
Remap keyboard keycodes and query current mapping.
@item Required header: @code{Action}
@table @code
@item remap
Remap keys if the value of the header @code{Action}
is @code{remap}.
@item reset
Reset all mappings to identity mapping if the value
of the header @code{Action} is @code{reset}.
@item query
Query mapping if the value of the header @code{Action}
is @code{query}.
@end table
Each affected server will send a message format like
that of @code{Action: remap} with current mapping
that are not identity mappings.
@item Optional header: @code{Keyboard}
A string that identifies the keyboard that should be
affected. If omitted all keyboard are affected.
@item Conditionally required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
Required if @code{Action: query} is included in the
headers.
@item Conditionally optional header: @code{Length}
The length of the message.
Available and optional if @code{Action: remap} is
included in the headers.
@item Message:
Each line contains two single space delimited numbers,
the first number is the keycode as determined by the
scancode, the second number is keycode that scancode
should generate. For example, @code{1 1} resets
@key{Escape} to be mapped to @key{Escape}, and
@code{1 59} remaps @key{Escape} to @key{F1}, while
@example
@group
1 59
59 1
@end group
@end example
swaps @key{Escape} and @key{F1}.
@item Purpose:
Enable the user to swap or replace keys on the
keyboard.
@item Purpose:
Enable the user manually correct an incorrectly
mapped keyboard.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-kbd}
@pgindex @command{mds-kkbd}
@command{mds-kbd} and @command{mds-kkbd}
@end table
@node new-keyboard
@subsection @code{new-keyboard}
@prindex @code{new-keyboard}
@cpindex Keyboard, devices
@cpindex Devices, keyboards
@table @asis
@item Identifying header:
@code{Command: new-keyboard}
@item Action:
Announce the existance of a new keyboard.
@item Required header: @code{Length}
The length of the message.
@item Message:
List of strings that identifies the keyboards that
have been added.
@item Purpose:
Enable servers and clients to detect new keyboards.
@item Compulsivity:
Recommended.
@item Reference implementation:
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@command{mds-kbd} and @command{mds-kkbd}
@end table
@node old-keyboard
@subsection @code{old-keyboard}
@prindex @code{old-keyboard}
@cpindex Keyboard, devices
@cpindex Devices, keyboards
@table @asis
@item Identifying header:
@code{Command: old-keyboard}
@item Action:
Announce the removal of an old keyboard.
@item Required header: @command{Length}
The length of the message.
@item Message:
List of strings that identifies the keyboards that
have been removed.
@item Purpose:
Enable servers and clients to detect removal of
keyboards.
@item Compulsivity:
Recommended.
@item Reference implementation:
@pgindex @command{mds-kbd}
@command{mds-kbd}
@end table
@node Clipboard Protocols
@section Clipboard Protocols
@menu
* clipboard:: Read or manipulate a clipboard.
* clipboard-info:: Clipboard event announcements.
@end menu
@node clipboard
@subsection @code{clipboard}
@prindex @code{clipboard}
@cpindex Clipboard
@cpindex Clipstack
@table @asis
@item Identifying header:
@code{Command: clipboard}
@item Action:
Read or manipulate a clipboard.
@item Required header: @code{Level}
The clipboard level, an [1, 3] integer:
@table @code
@item 1
Text copied/pasted using the keyboard or a menu item.
(This level is called `primary'.)
@item 2
Text copied/pasted using the rat.
(This level is called `secondary'.)
@item 3
Data to begin with a line describing the data type.
(This level is called `tertiary'.)
@end table
@item Required header: @code{Action}
What to do with the clipboard:
@table @code
@item add
Write the message to the clipboard if the value of
the header @code{Action} is @code{add}.
@item read
Read the clipboard if the value of the header
@code{Action} is @code{read}.
@item clear
Clear all entries on the selected level on the
clipboard if the value of the header @code{Action} is
@code{read}.
@item set-size
Shrink/grow the clipstack if the value of the header
@code{Action} is @code{set-size}.
@item get-size
Read the size of the clipstack if the value of the
header @code{Action} is @code{get-size}. In the
reply, the server will send a message containing the
headers:
@table @code
@item Size
The configured maximum size of the clipstack.
@item Used
The number of elements currently in the clipstack.
@end table
@end table
@item Conditionally required header: @code{Length}
Length of the message.
Required if @code{Action: add} is included in the
headers.
@item Conditionally required header: @code{Size}
The maximum number of elements in the clipstack.
Required if @code{Action: set-size} is included in
the headers.
@item Conditionally required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
Required if @code{Action: read} or @code{Action: read}
is included in the headers, or if @code{Action: add}
is included in the headers and if the header
@code{Time to live} is included and has a value
starting with @code{until-death}.
@item Conditionally optional header: @code{Index}
The index of the item in the clipstack, starting at 0.
Available and optional if the @code{Action: read} is
included in the headers.
@item Conditionally optional header: @code{Time to live}
The number of seconds the entry should be available
before it is removed by the server, or:
@table @code
@item until-death
Remove entry when the client closes.
@item until-death #
Remove entry when the client closes, or @code{#}
seconds have elapsed.
@item forever
Never remove it. (This is the default.)
@end table
The server will always remove the entry when either:
@enumerate 1
@item
it is at the bottom of the clipstack and a new entry
is added to the clipstack, or
@item
@code{Action: clear} is issued for the clipstack.
@end enumerate
The entry will also be removed, unless
@code{Time to live: forever} is used, if the server
crashes or is re-executed.
@sgindex @code{SIGALRM}
It is up to the implementation to choose when the
removal actually takes place. For example, the
reference implementation will pop entries that have
timed out when a new entry is added, the reading on
the clipstack is requested or the server is
reexecuted, but another implement may choose to pop
entries asynchronously using another thread or an
alarm an pop when @code{SIGALRM} is received.
Available and optional if the @code{Action: add} is
included in the headers.
@item Message:
The content to add to the clipboard.
@item Purpose:
Enable the user to duplicate content from one process
into another process without requiring those processes
to be aware of eathother to any extent.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-clipboard}
@command{mds-clipboard}
@end table
@node clipboard-info
@subsection @code{clipboard-info}
@prindex @code{clipboard-info}
@cpindex Clipboard
@cpindex Clipstack
@table @asis
@item Identifying header:
@code{Command: clipboard-info}
@item Action:
The clipboard server sends out some information about
what it is doing, such as automatically removing
entries.
@item Included header: @code{Event}
@table @code
@item pop
The value of the header @code{Event} is @code{pop}
when an item in the clipstack has been removed. If
the value header--value-pair is used the following
headers will also be included in the message:
@table @code
@item Level
The clipboard level that has been affected.
@item Popped
The index of the item in the clipstack that has been
removed.
@item Size
The configured maximum size of the clipstack.
@item Used
The number of elements currently in the clipstack.
@end table
@item crash
The value of the header @code{Event} is @code{crash}
when the clipboard has been reset because of a
software crash.
@end table
@item Purpose:
@prindex @code{clipboard}
Enable clients to get notification about changes to
the clipboard, that cannot trivially derived from
@code{Command: clipboard}
@item Compulsivity:
Optional add-on to the clipboard's functionallity.
@item Reference implementation:
@pgindex @command{mds-clipboard}
@command{mds-clipboard}
@end table
@node Status Icon Protocols
@section Status Icon Protocols
@menu
* add-tray-icon:: Add a status icons to the status icon tray.
* update-tray-icon:: Change the status of a status icon.
* tray-update:: Send updates about the status tray to the status icon.
* new-tray:: Announce the existence of a new status icon trays.
@end menu
@node add-tray-icon
@subsection @code{add-tray-icon}
@prindex @code{add-tray-icon}
@cpindex Status icon tray
@cpindex System tray
@cpindex Tray, status icons
@cpindex Icon, status, tray
@table @asis
@item Identifying header:
@code{Command: add-tray-icon}
@item Action:
Add a status icons to the status icon tray.
The client should keep in mind that there can be any
number of trays available on the system: zero, one,
two or three, …, and that it will get a response once
from every tray.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Package}
The name of the package to which the program
announced the icon belongs.
@item Required header: @code{Icon ID}
An ID of the icon that can be used to identify the
icon, icon ID:s are not unique, but the combination
of a package and a icon ID should be unique and can
be used to ignore already added icons and hide icons
that the user has been configured to be hidden.
@item Required header: @code{Title}
A title describing the icon for the user, used to
configured when icons should be hidden and shown
among other configuration.
@item Required header: @code{Icon}
The name or pathname of an icon to use together with
the title.
@item Response:
Recipients will respond with a message containing the
headers:
@table @code
@item To
Will contain the value of the @code{Client ID} from
the message that triggered this response.
@item In response to
Will contain the value of the @code{Message ID} from
the message that triggered this response.
@item Message ID
Will contain a value as described in
@ref{Message Passing}.
@item Socket
Will contain an ID to where the icon should be
embeded.
@item Will send update
@prindex @code{tray-update}
The value of this header will be @code{yes} if this
message will be followed by a
@code{Command: tray-update}-message. Otherwise the
value will be @code{no}.
@end table
@item Purpose:
Enable clients to add a small icon that displays the
status of programs, particularly minimised programs
and services.
@item Compulsivity:
Optional.
@end table
@node update-tray-icon
@subsection @code{update-tray-icon}
@prindex @code{update-tray-icon}
@cpindex Status icon tray
@cpindex System tray
@cpindex Tray, status icons
@cpindex Icon, status, tray
@table @asis
@item Identifying header:
@code{Command: update-tray-icon}
@item Action:
Change the status of a status icon.
@item Required header: @code{Status}
@table @code
@item hide
Hide the icon if the value of the
@code{Status}-header is @code{hide}.
@item show
Show the icon if the value of the
@code{Status}-header is @code{show}.
@item active
The icon is active if the value of the
@code{Status}-header is @code{active}.
@item inactive
The icon is inactive if the value of the
@code{Status}-header is @code{inactive}.
@end table
@item Purpose:
Enable status trays to automatically hide inactive
icons.
@item Purpose:
Hide icons without actually removing them.
@item Compulsivity:
@prindex @code{add-tray-icon}
Required if supporting @code{Command: add-tray-icon},
only @code{Status: hide} and @code{Status show} is
required.
@end table
@node tray-update
@subsection @code{tray-update}
@prindex @code{tray-update}
@cpindex Status icon tray
@cpindex System tray
@cpindex Tray, status icons
@cpindex Icon, status, tray
@table @asis
@item Identifying header:
@code{Command: tray-update}
@item Action:
Send updates about the status tray to the status icon.
@item Required header: @code{Socket}
Where the icon is embedded, used to identify the
affected tray.
@item Conditionally required header: @code{Max colour}
The maximum colour component value, for example, if
using 24-bit colour, which component will be 8-bit
and the maximum value will be 255, this also applies
to the alpha component. Required if either for the
@code{Colour}-, @code{Foreground}- or
@code{Alpha}-header are used.
@item Conditionally required header: @code{Size}
The width and height, in pixels, the icon should have.
Required if the @code{Length}-header is used,
otherwise this header is optional.
@item Conditionally required header: @code{Has alpha}
@table @code
@item yes
The message contains an alpha channel if the value of
the @code{Has alpha}-header is @code{yes}.
@item no
The message does not contain an alpha channel if the
value of the @code{Has alpha}-header is @code{no}.
@end table
Required if the @code{Length}-header is used.
@item Conditionally required header: @code{Bytes}
@cpindex Deep colour
@cpindex Colour, deep
@cpindex Endianness
The number of bytes the subpixels used, for example,
24-bit colours will have this set to 1 because each
subpixel has 8 bits, 48-bit colours will have this set
to 2 because each subpixel has 16 bits. Allowed values
are: 1, 2, 4 and 8. These values are used so that
CPU:s with any endianness can be trivially used as the
words sizes are guaranteed to be supported in C, and
mixed/middle-endianness gets complicated if we go
outside this. Required if the @code{Length}-header is
used.
@item Conditionally optional/required header: @code{Colour}
Single blank space-separated [0, @code{<Max colour>}]
sRGB 3-tuple.
Available and optional if the @code{Length}-header
is not used.
Required if the @code{Foreground}-header but not
@code{Length}-header is used.
@item Conditionally optional header: @code{Foreground}
Single blank space-separated [0, @code{<Max colour>}]
sRGB 3-tuple.
@item Optional header: @code{Alpha}
The opacity of the tray.
@item Optional header: @code{Length}
Length of the message.
@item Optional header: @code{Use urgency}
@cpindex Notification of urgency
@cpindex Urgency notification
@table @code
@item yes
The icon tray may blink if the value of the
@code{Use urgency}-header is @code{yes}.
@item no
The icon tray may not blink if the value of the
@code{Use urgency}-header is @code{no}.
@end table
@item Message:
Raw binary encoding of the background image, bytes
are orders: row, pixel, channel (alpha, red, green,
blue), subpixel value (native CPU encoding). The
Alpha channel should be included but ignored if
@code{Has alpha: no}, in such as it is best to set it
to full.
@ifset AFOURPAPER_OR_USLETTER
Example image with @code{Bytes: 2},
@code{Has alpha: no} and @code{Size: 3}:
@example
@group
sRGB(x0102, 0, 0), sRGB(0, x0304, 0), sRGB(0, 0, x0506)
sRGB(x0708, 0, 0), sRGB(0, x090A, 0), sRGB(0, 0, x0B0C)
sRGB(x0D0E, 0, 0), sRGB(0, x0F10, 0), sRGB(0, 0, x1112)
@end group
@end example
Encoding of example image in hexadecimal
representation:
@example
@group
FFFF 0102 0000 0000 FFFF 0000 0304 0000 FFFF 0000 0000 0506
FFFF 0708 0000 0000 FFFF 0000 090A 0000 FFFF 0000 0000 0B0C
FFFF 0D0E 0000 0000 FFFF 0000 0F10 0000 FFFF 0000 0000 1112
@end group
@end example
Note that on a big-endian system this would be:
@footnote{x86_64 computers are big-endian.}
@example
@group
FF FF 02 01 0 0 0 0 FF FF 0 0 04 03 0 0 FF FF 0 0 0 0 06 05
FF FF 08 07 0 0 0 0 FF FF 0 0 0A 09 0 0 FF FF 0 0 0 0 0C 0B
FF FF 0E 0D 0 0 0 0 FF FF 0 0 10 0F 0 0 FF FF 0 0 0 0 12 11
@end group
@end example
@end ifset
@ifclear AFOURPAPER_OR_USLETTER
Example image with @code{Bytes: 2},
@code{Has alpha: no} and @code{Size: 2}:
@example
@group
sRGB(x0102, 0, 0), sRGB(0, x0304, 0)
sRGB(x0708, 0, 0), sRGB(0, x090A, 0)
@end group
@end example
Encoding of example image in hexadecimal
representation:
@example
@group
FFFF 0102 0000 0000 FFFF 0000 0304 0000
FFFF 0708 0000 0000 FFFF 0000 090A 0000
@end group
@end example
Note that on a big-endian system this would be:
@footnote{x86_64 computers are big-endian.}
@example
@group
FF FF 02 01 0 0 0 0 FF FF 0 0 04 03 0 0
FF FF 08 07 0 0 0 0 FF FF 0 0 0A 09 0 0
@end group
@end example
@end ifclear
@cpindex Networking
@cpindex Endianness
It is up to the networking servers to translate the
encoding between machines.@footnote{The host
translates to big-endian unless they can confirm that
they have the same endianness.}
@item Purpose:
Enable clients to be aware of the appearance of the
tray, such as colours, transparency and background
image.
@item Purpose:
Enable clients to be aware of how the user wants
status icons to behave.
@item Compulsivity:
Optional.
@end table
@node new-tray
@subsection @code{new-tray}
@prindex @code{new-tray}
@cpindex Status icon tray
@cpindex System tray
@cpindex Tray, status icons
@cpindex Icon, status, tray
@table @asis
@item Identifying header:
@code{Command: new-tray}
@item Action:
Announce the existence of a new status icon trays.
@item Purpose:
Allow clients to add their status icons to status icon
trays that have been added to the display after those
programs have started and attempted to add their
icons.
@item Compulsivity:
@prindex @code{add-tray-icon}
Required if supporting @code{Command: add-tray-icon}.
@end table
@node Colour Protocols
@section Colour Protocols
@menu
* get-gamma-info:: Query gamma ramp information.
* get-gamma:: Query gamma ramps.
* set-gamma:: Modify gamma ramps.
* list-colours:: Retrieve colour table.
* get-colour:: Query colour table.
* set-colour:: Modify colour table.
* colour-added:: Announce new colours.
* colour-removed:: Announce removal of colours.
* colour-changed:: Announce modified colours.
* dither:: Dither colours.
* dither-stop:: Inform the dither server that a colour is no longer being dithered.
* redither:: Announce that redithering is required.
@end menu
@node get-gamma-info
@subsection @code{get-gamma-info}
@prindex @code{get-gamma-info}
@cpindex Gamma correction
@table @asis
@item Identifying header:
@code{Command: get-gamma-info}
@item Action:
Query gamma ramp information.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{CRTC}
The output name for the CRTC of interest.
@item Response:
The server will response with a @code{Command: error}
on error, on success the server will respond with a
message contain the headers:
@table @code
@item To
Will contain the value of the header @code{Client ID}
in the message that was received by the server.
@item In response to
Will contain the value of the header @code{Message ID}
in the message that was received by the server.
@item Cooperative
Whether a server like @command{mds-coopgamma} is
running. That is, if priorities and classes are
respected. The value with be either @code{yes}, for
cooperative, or @code{no}, for non-cooperative.
@item Depth
The bit-depth of the gamma ramps. Possible values
are: 8, 16, 32 och 64.
@item Red size
The number of stops in the red gamma ramp.
@item Green size
The number of stops in the green gamma ramp.
@item Blue size
The number of stops in the blue gamma ramp.
@item Gamma support
Will have one of the following values:
@table @code
@item yes
It is known that gamma ramps are supported.
@item no
It is known that gamma ramps are not supported.
@item maybe
It is not known whether gamma ramps are supported.
@end table
@end table
If @code{Gamma support: no} is send in the response,
the headers @code{Depth}, @code{Red size},
@code{Green size} and @code{Blue size} may be omitted.
@item Purpose:
Enable performance optimisation when manipulating
gamma ramps.
@item Compulsivity:
@prindex @code{get-gamma}
@prindex @code{set-gamma}
Optional. Required if your implement support for
@code{Command: get-gamma} or @code{Command: set-gamma}.
@item Reference implementation:
@pgindex @command{mds-hwgamma}
@pgindex @command{mds-swgamma}
@pgindex @command{mds-coopgamma}
@pgindex @command{mds-cursorgamma}
@command{mds-hwgamma}, @command{mds-swgamma},
@command{mds-coopgamma} and @command{mds-cursorgamma}
@end table
@node get-gamma
@subsection @code{get-gamma}
@prindex @code{get-gamma}
@cpindex Gamma correction
@cpindex Gamma correction, cooperative
@cpindex Gamma correction, chain
@cpindex Gamma correction, filters
@cpindex Cooperative gamma correction
@table @asis
@item Identifying header:
@code{Command: get-gamma}
@item Action:
Query gamma ramps.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{CRTC}
The output name for the CRTC of interest.
@item Required header: @code{Coalesce}
Whether the received the full gamma ramp filter list,
if the value is @code{yes}, rather than the result of
them, if the value is @code{no}.
@item Required header: @code{High priority}
The upper bound of the priority range of the gamma
ramps to received. This is a signed 64-bit integer.
@item Required header: @code{Low priority}
The lower bound of the priority range of the gamma
ramps to received. This is a signed 64-bit integer.
@item Response:
@prindex @code{error}
The server will response with a @code{Command: error}
on error, on success the server will respond with a
message contain the headers:
@table @code
@item Depth
The bit-depth of the gamma ramps. Possible values
are: 8, 16, 32 och 64.
@item Red size
The number of stops in the red gamma ramp.
@item Green size
The number of stops in the green gamma ramp.
@item Blue size
The number of stops in the blue gamma ramp.
@item Tables
The number of gamma ramp lookup tables that is
included in the respone's message. This header will
not necessarily be included if @code{Coalesce: yes}
was used in the query, rather reference
implementations will exclude it.
@end table
These headers are included so you can make sure the
no metadata for gamma ramps have changed, which could
happen if the user switches between hardware and
software gamma ramps. The response will also contain
a @code{Length}-header and a message formatted in the
same manner as for @code{Command: set-gamma}-messages.
That is, assuming as an example that the gamma ramp
depth is 16 bits, @code{Coalesce: yes} was used in the
query, the red ramp is (1, 2, 3, 4, 5, 6), the green
ramp is (17, 18, 19, 20, 21, 22, 23) and the blue ramp
is (33, 34, 35, 36, 37, 38, 39, 40) then the message
will be (hexadecimal representation):
@example
@group
0001 0002 0003 0004 0005 0006
0011 0012 0013 0014 0015 0016 0017
0021 0022 0023 0024 0025 0026 0027 0028
@end group
@end example
On a big-endian system this would be:
@example
@group
01 00 02 00 03 00 04 00 05 00 06 00
11 00 12 00 13 00 14 00 15 00 16 00 17 00
21 00 22 00 23 00 24 00 25 00 26 00 27 00 28 00
@end group
@end example
However if @code{Coalesce: no} was used in the query,
the message will include multiple gamma ramps lookup
tables. These will be in the order they are applied,
that is, highest priority first. The tables will be
encoded in the same way as for @code{Coalesce: yes}
and they with be included without any delimiter.
However, each table will be prefixed with the priority
and the class. The priority will be encoded in native
binary format as an @code{int64_t} and the class will
be encoded as a NUL-terminated UTF-8 string
@item Purpose:
Enable analysis and readings of the current gamma
ramps.
@item Compulsivity:
@prindex @code{get-gamma-info}
@prindex @code{set-gamma}
Optional. Required if your implement support for
@code{Command: get-gamma-info} or
@code{Command: set-gamma}.
@item Reference implementation:
@pgindex @command{mds-hwgamma}
@pgindex @command{mds-swgamma}
@pgindex @command{mds-coopgamma}
@pgindex @command{mds-cursorgamma}
@command{mds-hwgamma}, @command{mds-swgamma},
@command{mds-coopgamma} and @command{mds-cursorgamma}
@end table
@node set-gamma
@subsection @code{set-gamma}
@prindex @code{set-gamma}
@cpindex Gamma correction
@cpindex Gamma correction, cooperative
@cpindex Gamma correction, chain
@cpindex Gamma correction, filters
@cpindex Cooperative gamma correction
@table @asis
@item Identifying header:
@code{Command: set-gamma}
@item Action:
Modify gamma ramps.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{CRTC}
The output name for the CRTC of interest.
@item Required header: @code{Priority}
A signed 64-bit integer of the priority for the
filter. Gamma correction should use zero priority. It
is preferable that search logical adjustment is sent
with different priorities so other programs can insert
filters between them.
@item Required header: @code{Class}
A UTF-8 string that identifies the filter. It should
be formatted as @code{pkg::cmd::role}. @code{pkg}
should be the package name the package was installed
with on the system. @code{cmd} should be the basename
of the command for the program.
@item Required header: @code{Lifespan}
The value may be one of the following:
@table @code
@item until-removal
Remove the filter when @command{Lifespan: remove} is
sent.
@item until-death
Remove the filter when the client dies.
@item remove
Remove the filter now.
@end table
@item Conditionally required header: @code{Length}
The length of the message.
Available and required if @code{Lifespan: remove} is
not included in the message.
@item Message:
The gamma ramps in binary encoding. As an example,
assume the gamma ramp depth is 16 bits, the red ramp
is (1, 2, 3, 4, 5, 6), the green ramp is (17, 18, 19,
20, 21, 22, 23) and the blue ramp is (33, 34, 35, 36,
37, 38, 39, 40) then the message will be (hexadecimal
representation):
@example
@group
0001 0002 0003 0004 0005 0006
0011 0012 0013 0014 0015 0016 0017
0021 0022 0023 0024 0025 0026 0027 0028
@end group
@end example
Note that on a big-endian system this would be:
@footnote{x86_64 computers are big-endian.}
@example
@group
01 00 02 00 03 00 04 00 05 00 06 00
11 00 12 00 13 00 14 00 15 00 16 00 17 00
21 00 22 00 23 00 24 00 25 00 26 00 27 00 28 00
@end group
@end example
It is up to the networking servers to translate the
encoding between machines.@footnote{The host
translates to big-endian unless they can confirm that
they have the same endianness.}
The use of binary rather than text here is chosen to
increase performance for programs that try the change
the adjustments fluently. For programs similar to
@command{xgamma} that sets the ramps once this is
however unnessary. However it does simplify the
program code as one would only need to write the
ramps to the message without creating a string with
all stops converted and then measure the length of
that string.
@item Response:
@prindex @code{error}
The server will response with a @code{Command: error}.
@item Instructions:
@prindex @code{set-gamma}
For optimal flexibility a system may run a server such
as @command{mds-hwgamma} that applies the gamma ramps,
and a server such as @command{mds-coopgamma} to let
multiple programs adjust the output with their open
filters that stack up. In a configuration like this,
@command{mds-coopgamma} will keep track of all filters
and when a modification is made it sends the grand
result to @command{mds-hwgamma}, that is, what the
filters together produce. To do this,
@command{mds-coopgamma} listens for
@code{Command: set-gamma} with priority @math{2^{62}}
and modifies the message so the payload is filled with
the result rather than to single filter. This modified
message is then received by @command{mds-hwgamma} that
listens with priority zero and applies the gamma ramps.
@command{mds-hwgamma} will ignore the @code{Priority}
and the @code{Class}-header, but it will respect the
@code{Lifespan}-header, therefore
@command{mds-coopgamma} will always modify the value
of the @code{Lifespan}-header to @code{until-removal}.
@item Purpose:
Enable colour output correction such as gamma
correction.
@item Purpose:
Enable colour output filters such colour temperature
adjustments, colour invertion and dimming.
@item Compulsivity:
@prindex @code{get-gamma-info}
@prindex @code{get-gamma}
Optional. Required if your implement support for
@code{Command: get-gamma-info} or
@code{Command: get-gamma}.
@item Reference implementation:
@pgindex @command{mds-hwgamma}
@pgindex @command{mds-swgamma}
@pgindex @command{mds-coopgamma}
@pgindex @command{mds-cursorgamma}
@command{mds-hwgamma}, @command{mds-swgamma},
@command{mds-coopgamma} and @command{mds-cursorgamma}
@end table
@node list-colours
@subsection @code{list-colours}
@prindex @code{list-colours}
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@table @asis
@item Identifying header:
@code{Command: list-colours}
@item Action:
Retrieve an exhaustive list of defined colours.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Optional header: @code{Include values}
@table @code
@item yes
Include the values of the colours in addition to the
name of the colours.
@item no
Include only the names of the colours.
@end table
@code{no} is used if omitted.
@item Response:
The server will response with a @code{Command: error}
on error, on success the server will respond with a
message whose payload is a list all defined colours.
Each line in the payload represents a colour. If values
where not requested, each line contain, exactly, the
name of the colour it lists. If however values are
requested, each name will be prefixed with the number
of bytes with which each channel is encoded, the red value,
the green value and the blue value of the colour,
each of these values will be suffixed with a single
regular blank space making the format
@code{bytes red green blue name}. Note that the name may
contain any whitespace@footnote{Tab space is discouraged.}
except a line feed. Allowed values for the byte count
are 1, 2, 4 and 8.
The payload will end with a line break unless it is
empty. No empty lines will otherwise be included
(unless a colours name happend to be nothing
@footnote{You should not define colours whose name
is of zero length or containing non-ASCII or
non-printable characters.}.)
@item Purpose:
Enable programs to list named colours, system colours
or otherwise.
@item Compulsivity:
@prindex @code{get-colour}
@prindex @code{set-colour}
Optional. Required if your implement support for
@code{Command: get-colour} or
@code{Command: set-colour}.
@item Reference implementation:
@pgindex @command{mds-colour}
@command{mds-colour}
@end table
@node get-colour
@subsection @code{get-colour}
@prindex @code{get-colour}
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@table @asis
@item Identifying header:
@code{Command: get-colour}
@item Action:
Query the values of a defined colour.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Name}
The name of the colour whose values you want to
retrieve.
@item Response:
The server will response with a @code{Command: error}
on error, on success the server will respond with a
message contain the headers:
@table @code
@item Bytes
The number of bytes with which each channel is encoded.
Allowed values are 1, 2, 4 and 8.
@item Red
The value of the red channel.
@item Green
The value of the green channel.
@item Blue
The value of the blue channel.
@end table
If the colour is not defined, the @code{Command: error}
message will return a custom error, with the message
``not defined''.
@item Purpose:
@cpindex Toolkits, colours
@cpindex Colours, toolkits
Provide a central place for retrieving system colours,
such as text field background, for toolkits.
@item Purpose:
Provide a central place for retrieving themeable colours.
@item Compulsivity:
@prindex @code{list-colours}
@prindex @code{set-colour}
Optional. Required if your implement support for
@code{Command: list-colours} or
@code{Command: set-colour}.
@item Reference implementation:
@pgindex @command{mds-colour}
@command{mds-colour}
@end table
@node set-colour
@subsection @code{set-colour}
@prindex @code{set-colour}
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@table @asis
@item Identifying header:
@code{Command: set-colour}
@item Action:
Change the value of a defined colour, or
remove it.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Name}
The name of the colour you want to define, modify or undefine.
@item Optional header: @code{Remove}
@table @code
@item yes
Remove the colour definition.
@item no
Add or modify colour definition.
@end table
@code{no} is used if omitted.
@item Conditionally required header: @code{Bytes}
The number of bytes with which each channel is encoded.
Allowed values are 1, 2, 4 and 8.
Required unless @code{Remove: yes} is included in the headers.
@item Conditionally required header: @code{Red}
The value of the red channel.
Required unless @code{Remove: yes} is included in the headers.
@item Conditionally required header: @code{Green}
The value of the green channel.
Required unless @code{Remove: yes} is included in the headers.
@item Conditionally required header: @code{Blue}
The value of the blue channel.
Required unless @code{Remove: yes} is included in the headers.
@item Purpose:
@cpindex Toolkits, colours
@cpindex Colours, toolkits
Provide a central place for defining system colours,
such as text field background, for toolkits to use.
@item Purpose:
Provide a central place for defining themeable colours.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-colour}
@command{mds-colour}
@end table
@node colour-added
@subsection @code{colour-added}
@prindex @code{colour-added}
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@table @asis
@item Identifying header:
@code{Command: colour-added}
@item Action:
Announce that a new colour has been defined.
@item Included header: @code{Name}
The name of the new colour.
@item Included header: @code{Bytes}
The number of bytes with which each channel is encoded.
@item Included header: @code{Red}
The value of the colour's red channel.
@item Included header: @code{Green}
The value of the colour's green channel.
@item Included header: @code{Blue}
The value of the colour's blue channel.
@item Included header: @code{Last update}
@table @code
@item yes
No more updates are queued.
@item changes
No more additions or deletions are queued,
but modifications are queued.
@item no
More additions or deletions are queued.
@end table
@item Purpose:
@prindex @code{colour}
Supplement @code{Command: list-colours} with
automatic updating.
@item Compulsivity:
@prindex @code{list-colours}
Optional. Recommended if your implement support for
@code{Command: list-colours}.
@item Reference implementation:
@pgindex @command{mds-colour}
@command{mds-colour}
@end table
@node colour-removed
@subsection @code{colour-removed}
@prindex @code{colour-removed}
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@table @asis
@item Identifying header:
@code{Command: colour-removed}
@item Action:
Announce when colour definition is removed.
@item Included header: @code{Name}
The name of the removed colour.
@item Included header: @code{Last update}
@table @code
@item yes
No more updates are queued.
@item changes
No more additions or deletions are queued,
but modifications are queued.
@item no
More additions or deletions are queued.
@end table
@item Purpose:
@prindex @code{colour}
Supplement @code{Command: list-colours} with
automatic updating.
@item Compulsivity:
@prindex @code{list-colours}
Optional. Recommended if your implement support for
@code{Command: list-colours}.
@item Reference implementation:
@pgindex @command{mds-colour}
@command{mds-colour}
@end table
@node colour-changed
@subsection @code{colour-changed}
@prindex @code{colour-changed}
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@table @asis
@item Identifying header:
@code{Command: colour-changed}
@item Action:
Announce when a defined colour changes value.
@item Included header: @code{Name}
The name of the modified colour.
@item Included header: @code{Bytes}
The number of bytes with which each channel is encoded.
@item Included header: @code{Red}
The new value of the colour's red channel.
@item Included header: @code{Green}
The new value of the colour's green channel.
@item Included header: @code{Blue}
The new value of the colour's blue channel.
@item Included header: @code{Last update}
@table @code
@item yes
No more updates are queued.
@item no
More changes are queued.
@end table
@item Instructions:
The server must always send additions and deletions
of colour definitions before modifitions, when sending
multiple update.
@item Purpose:
Provide a way to detect when a themeable colour, or
system colour, has changed, and the program needs to
be redrawn with new colours.
@item Compulsivity:
@prindex @code{list-colours}
@prindex @code{get-colour}
Optional. Recommended if your implement support for
@code{Command: list-colours} or
@code{Command: get-colour}.
@item Reference implementation:
@pgindex @command{mds-colour}
@command{mds-colour}
@end table
@node dither
@subsection @code{dither}
@prindex @code{dither}
@cpindex Colour dithering
@cpindex Dithering of colours
@table @asis
@item Identifying header:
@code{Command: dither}
@item Action:
Request output device dependent colour dithering,
and inform the dither server that the colour is
being dithered.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Bytes}
The number of bytes with which each channel is encoded.
@item Required header: @code{Red}
The value of the colour's red channel.
@item Required header: @code{Green}
The value of the colour's green channel.
@item Required header: @code{Blue}
The value of the colour's blue channel.
@item Response:
The server will response with a @code{Command: error}
on error, on success the server will respond with a
message contain a payload describing how the colour
should be dithered on each output. Each line on the
payload will decribed be dithering on an output.
No empty lines will required, however the payload
will end with a line feed unless it is
empty@footnote{It can only be empty if there are
no outputs.}. Each line will contain line single
blank space-delimited values. These values are:
@itemize @bullet{}
@item
The number of bytes with which each channel is
encoded.
@item
The value of the primary colour's red channel.
@item
The value of the primary colour's green channel.
@item
The value of the primary colour's blue channel.
@item
A floating point value describing the predominance
of the primary colour. A period is used as
decimal comma. This value is between 0 and 1, but
cannot be zero. If the value is @code{1}, the
secondary colour is identical to the primary and
no dithering is required. As an example,
@code{0.75} means that there should be 75% of the
primary colour and 25% of the secondary colour.
@item
The value of the secondary colour's red channel.
@item
The value of the secondary colour's green channel.
@item
The value of the secondary colour's blue channel.
@item
The name of the CRTC for which the line describes
the colour's dithering. Note that thes value may
contain whitespace.
@end itemize
Note that the pattern to use of dithering is not
included in the response. It is up to the client
to select a pattern.
@item Instructions:
@prindex @code{dither-stop}
The dither server should count how many times
the colour's dithering has be queried, per client.
It should be decremented by one request each time
@code{Command: dither-stop} is received for
the colour and client. When the counter reaches
zero for a client, the server knows that the client
is no longer displaying the dithered colour.
@item Purpose:
Provide dithering for low colour-depth-output,
that is gamma correction- and output filter-aware.
@item Purpose:
Provide gamma correction- and output filter-aware
dither for low-delta colour gradients.
@item Compulsivity:
@prindex @code{redither}
@prindex @code{dither-stop}
Optional. Required if your implement support for
@code{Command: redither} or
@code{Command: dither-stop}.
@item Reference implementation:
@pgindex @command{mds-dither}
@command{mds-dither}
@end table
@node dither-stop
@subsection @code{dither-stop}
@prindex @code{dither-stop}
@cpindex Colour dithering
@cpindex Dithering of colours
@table @asis
@item Identifying header:
@code{Command: dither-stop}
@item Action:
Inform the dither server that a colour is no
longer being dithered.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
@item Required header: @code{Bytes}
The number of bytes with which each channel is encoded.
@item Required header: @code{Red}
The value of the colour's red channel.
@item Required header: @code{Green}
The value of the colour's green channel.
@item Required header: @code{Blue}
The value of the colour's blue channel.
in response to a @code{Command: assign-id}-header.
@item Purpose:
Allow dithering server to know when a client is not
longer dithering colours, or a specific colour.
@item Compulsivity:
@prindex @code{dither}
@prindex @code{redither}
Optional. Required if your implement support for
@code{Command: dither} or
@code{Command: redither}.
@item Reference implementation:
@pgindex @command{mds-dither}
@command{mds-dither}
@end table
@node redither
@subsection @code{redither}
@prindex @code{redither}
@cpindex Colour dithering
@cpindex Dithering of colours
@table @asis
@item Identifying header:
@code{Command: redither}
@item Action:
Announce that the client needs to redither
its dithered colours.
@item Included header: @code{Length}
The length of the message.
@item Message:
A line feed-terminated, line feed-separated list
of colours that need to be dithered on the client.
Each line will be formatted @code{Bytes Red Green Blue},
where each these words are replaced by the values
associated with the same headers of the same name
in the @code{Command: dither} message that let
the dither server know that the colour is being
dithered.
@item Purpose:
@prindex @code{dither}
Supplement @code{Command: dither} with automatic
detection of when colours need to be redithered,
without all clients needing to determine when,
thus saving CPU time.
@item Compulsivity:
@prindex @code{dither}
@prindex @code{dither-stop}
Optional. Required if your implement support for
@code{Command: dither} or
@code{Command: dither-stop}.
@item Reference implementation:
@pgindex @command{mds-dither}
@command{mds-dither}
@end table
@node Screensaver Protocols
@section Screensaver Protocols
@menu
* configure-screensaver:: Configure screensaver settings.
* start-screensaver:: Start the screensaver.
* screensaver-start-test:: Test whether the screensaver may start.
@end menu
@node configure-screensaver
@subsection @code{configure-screensaver}
@prindex @code{configure-screensaver}
@cpindex Screensaver
@table @asis
@item Identifying header:
@code{Command: configure-screensaver}
@item Action:
Reconfigure screensaver settings, or tell the
screensaver server that the screensaver may not start
whilst a program is active.
@item Optional header: @code{Screensaver}
The command, in POSIX shell syntax, for the command
to run to start the screensaver. The screensaver
server will be inactive as long as the spawn command
has not exited. To disable screensaving, the value
for this header should be @command{true}. This
command always starts without fail, and does nothing.
Which means that the a screensaver will not start,
and the panic action cannot start is it would if the
values as set to @command{false}. The screensaver
server may choose recognise the command
@command{true} as meaning that does not need to start
a screensaver. It is also possible to disable
screensaving via the @code{Activate delay}-header.
@item Optional header: @code{Activate delay}
The number of seconds the display should be inactive
before the screensaver should start. Floating points
are allowed. The value @code{0} is discouraged, but
has the same meaning as @code{disable}, which means
that the screensaver should never start.
@item Optional header: @code{Lock delay}
@cpindex Screen locking
@cpindex Locking, screen
@vrindex @env{MDS_SCREENSAVER_LOCK}
The number of seconds to wait after the screensaver
starts before authentication via login passphrase is
required to deactivate the screensaver. Floating
points are allowed. If properly formatted, the
environment variable @env{MDS_SCREENSAVER_LOCK} is
set to have this value. If the value is
@code{disable}, the environment variable
@env{MDS_SCREENSAVER_LOCK} will be cleared, which
should be interpreted by the screensaver as that it
should not start the lock mechanism.
@item Optional header: @code{Panic on error}
@cpindex Security, screen locking
The command, in POSIX shell syntax, to run if the
screensaver exits without another value than 0. If
you do no want anything to happen, choose either of
the values @command{true} or @command{false}. This is
intended as a security measure, in case the
screensaver fails to start the lock mechanism.
@item Optional header: @code{DPMS}
@cpindex DPMS
@cpindex Display Power Management Signaling @c [sic!]
@cpindex VESA Display Power Management Signaling @c [sic!]
@cpindex Power management, Display Power Management Signaling @c [sic!]
TODO
@item Optional header: @code{Inhibit}
@table @code
@item yes
The screensaver may not start whilst the client is
connected to the server.
@item no
Undo the action set by @code{Inhibit: yes} and the
same client.
@end table
@item Conditionally required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
Required if @code{Inhibit} is included in the headers.
@item Purpose:
Allow the user to change screensaver settings.
@item Purpose:
Allow programs to stop the screensaver from starting.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-screensaver}
@command{mds-screensaver}
@end table
@cpindex Screensaver
@node start-screensaver
@subsection @code{start-screensaver}
@prindex @code{start-screensaver}
@table @asis
@item Identifying header:
@code{Command: start-screensaver}
@item Action:
Start the screensaver, either timed or forced.
@item Instructions:
The screensaver server should broadcast this command
when the display has been active for long enough for
the screensaver to start. It should then intercept
the message, including messages with this command
that is not send from the screensaver server itself,
with priority @math{-2^{63}}. The screensaver should
be started when this message is intercepted by the
screensaver server. All servers that need to perform
actions before the switch takes place must have a
priority higher than @math{-2^{63}}, preferably 0.
Server that can perform their actions asynchronously
should intercept the message without modifying
capabilities.
@item Purpose:
Allow users to force the screensaver to start.
@item Purpose:
Allow the screensaver daemon to notify servers when
the screensaver starts.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-screensaver}
@command{mds-screensaver}
@end table
@node screensaver-start-test
@subsection @code{screensaver-start-test}
@prindex @code{screensaver-start-test}
@cpindex Screensaver
@table @asis
@item Identifying header:
@code{Command: screensaver-start-test}
@item Action:
Ask servers when they last were active.
@item Required header: @code{Last active}
The message broadcaster should set the value of this
header to 0. Any server intercepting this message
should set value to the last time (monotonic time,
preferably raw) the server observed actions that
means that the display is active, such as usage of
the keyboard or rat. The servers should however not
modify the value if the value they would set it to
is lower than the already set value. Floating points
are allowed.
@item Instructions:
The screensaver server should broadcast this message
when it thinks it can start the screensaver. It
should intercept this message with priority
@math{-2^{63}}. When intercepted it should read the
@code{Last active}-header to determine the next time
the screensaver is allowed to start, which means that
it should add the activate delay to this value. If
the calculate time is in the past, the screensaver
server should broadcast the
@command{start-screensaver}-message to start the
screensaver.
@item Purpose:
Allow the screensaver to as servers like the input
device servers whether it is the for the screensaver
to start, instead of needing to listening on all
input devices.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-screensaver}
@pgindex @command{mds-kkbd}
@pgindex @command{mds-kbd}
@pgindex @command{mds-rat}
@command{mds-screensaver}, @command{mds-kkbd},
@command{mds-kbd} and @command{mds-rat}
@end table
@node Miscellaneous Protocols
@section Miscellaneous Protocols
@menu
* echo:: Echo back a message.
* kill:: The window killing protocol.
@end menu
@node echo
@subsection @code{echo}
@prindex @code{echo}
@cpindex Ping
@cpindex Debugging
@cpindex Heartbeat
@cpindex Network heartbeat
@table @asis
@item Identifying header:
@code{Command: echo}
@item Action:
Echo back a message.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Optional header: @code{Length}
Length of the message.
@item Message:
Message to echo.
@item Purpose:
Debugging and testing.
@item Purpose:
Network heartbeat.
@item Compulsivity:
Recommended for network enabled servers.
@item Reference implementation:
@pgindex @command{mds-echo}
@command{mds-echo}
@end table
@node kill
@subsection @code{kill}
@prindex @code{kill}
@cpindex Process killing
@cpindex Killing processes
@table @asis
@item Identifying header:
@code{Command: kill}
@item Action:
Kill and identify processes based on the their
windows.
@item Required header: @code{Client ID}
Your ID, provided by the @code{ID assignment}-header
in response to a @code{Command: assign-id}-header.
@item Required header: @code{Window ID}
The ID of the window whose owning process should
be identified or signaled.
@item Required header: @code{Signal}
A numerical value of the signal to send to the
process. It is up to networking protocols to
translate these numbers of the display spans
multiple operating systems. The signal zero can
usually be used if no signal is to be sent, this is
however dependent on the operating system.
@item Response:
@prindex @code{error}
The server will respond with a
@code{Command: error}-message. In this message the
server all include an ad-hoc header:
@code{Process ID}@. Its value will be the ID of the
process that owns the window.
@item Purpose:
Identify and send signal to processes by refering to
them by one of their windows.
@item Compulsivity:
Optional.
@item Reference implementation:
@pgindex @command{mds-kill}
@pgindex @command{mds-slay}
@command{mds-kill} and @command{mds-slay}
@end table
@node libmdsserver
@chapter libmdsserver
@cpindex Servers, library
@cpindex Library, Servers
libmdsserver is a library written for the reference
implementation of the @command{mds} servers.
llibmdsserver does not contain support for any
protocols, rather it contains auxiliary functions,
macros, data structures such as linked lists and hash
tables, and support the basics of the message passing
protocol: receiving message and decode it into
headers and payloads.
@menu
* Macros:: Writing macroscopic systems.
* Auxiliary Functions:: Auxiliary functions for servers.
* Data Structures:: Data structures available in libmdsserver.
@end menu
@node Macros
@section Macros
The header file @file{<libmdsserver/macros.h>}
contains macros for readability and code reduction,
it also contains macros and definitions for
portability; they may either provide portability by
nature, or provide one place to do modifications to
port the system.
@table @asis
@item @code{xasprintf} [(@code{char* buffer, ...}) @arrow{} @code{int}]
@fnindex @code{xasprintf}
@cpindex Functions, printing
@cpindex Printing fuction
This is a wrapper for @code{asprintf} that has two
important properties, the buffer is guaranteed to be
@code{NULL} on failure, and it will return zero on
and only on success. Unlike @code{asprintf},
@code{xasprintf} takes the buffer's variable as its
first argument rather than the address of that
variable.
@item @code{xsnprintf} [(@code{char buffer[], ...}) @arrow{} @code{int}]
@fnindex @code{xsnprintf}
@cpindex Functions, printing
@cpindex Printing fuction
This is a wrapper for @code{snprintf} that allows you
to forget about the buffer size. When you know how
long a string can be, you should use @code{sprintf}.
But when you cannot know for sure you should use
@code{xsnprintf}. @code{xsnprintf} works exactly as
@code{sprintf}, but it will require that the first
argument is defined using @code{[]} rather than
@code{*} because it will use this to find out how
large the buffer is so it can call @code{snprintf}
with that size.
@item @code{eprint} [(@code{const char* format}) @arrow{} @code{int}]
@fnindex @code{eprint}
@cpindex Functions, printing, errors
@cpindex Printing fuction, errors
@cpindex Error printing function
A wrapper for @code{fprintf} that prints a string
prefixed with the value of @code{*argv} to
@code{stderr}. This wrapper also as a line feed to
the end of the text. Because @code{eprintf} naïvely
wraps @code{fprintf}, all `%':s in the string must be
duplicated.
@item @code{eprintf} [(@code{const char* format, ...}) @arrow{} @code{int}]
@fnindex @code{eprintf}
@cpindex Functions, printing, errors
@cpindex Printing fuction, errors
@cpindex Error printing function
@code{eprint} extends @code{eprint} with variadic
arguments that can be used to insert values into the
format string just like you can do in @code{fprintf}.
@item @code{iprint} [(@code{const char* format}) @arrow{} @code{int}]
@fnindex @code{iprint}
@cpindex Functions, printing, state
@cpindex Printing fuction, state
@cpindex State printing function
@sgindex @code{SIGINFO}
@cpindex State dump
@cpindex Statistics dump
A wrapper for @code{fprintf} that prints a string
prefixed with the value of @code{*argv}, as well a
label telling the user that the output is part of a
state and statistics dump, to @code{stderr}. This
wrapper also as a line feed to the end of the text.
Because @code{eprintf} naïvely wraps @code{fprintf},
all `%':s in the string must be duplicated.
@item @code{iprintf} [(@code{const char* format, ...}) @arrow{} @code{int}]
@fnindex @code{iprintf}
@cpindex Functions, printing, state
@cpindex Printing fuction, state
@cpindex State printing function
@sgindex @code{SIGINFO}
@cpindex State dump
@cpindex Statistics dump
@code{eprint} extends @code{iprint} with variadic
arguments that can be used to insert values into the
format string just like you can do in @code{fprintf}.
@item @code{with_mutex} [(@code{pthread_mutex_t mutex, instructions})]
@fnindex @code{with_mutex}
@cpindex Threading, synchronisation
@cpindex Multi-threading, synchronisation
@cpindex Synchronisation, threading
@cpindex Mutex
Wraps @code{instructions} with
@code{errno = pthread_mutex_lock(mutex);} and
@code{errno = pthread_mutex_unlock(mutex);}, so a set
of instructions can be invoked inside mutex
protection.
@item @code{with_mutex_if} [(@code{pthread_mutex_t mutex, condition, instructions})]
@fnindex @code{with_mutex_if}
@cpindex Threading, synchronisation
@cpindex Multi-threading, synchronisation
@cpindex Synchronisation, threading
@cpindex Mutex
An alternative to @code{with_mutex} where
@code{instructions} is wrapped around
@code{if (condition)} which in turn is wrapped inside
the mutex protection.
@item @code{max} [(@code{a, b})]
@fnindex @code{max}
@cpindex Value comparision macro
Returns the higher value of @code{a} and @code{b}.
@item @code{min} [(@code{a, b})]
@fnindex @code{min}
@cpindex Value comparision macro
Returns the lower value of @code{a} and @code{b}.
@item @code{buf_cast} [(@code{char* buffer, type, size_t index})]
@fnindex @code{buf_cast}
@cpindex Re-executing servers, macros
@cpindex Updating, online, macros
@cpindex Online updating, macros
@cpindex Version update, macros
@cpindex Serialisation macros
@cpindex Marshalling macros
@sgindex @code{SIGUPDATE}
Casts @code{buffer} to a @code{type} buffer and
subscripts to the @code{index}:th element. You can
either use this function as a getter or a setter.
@item @code{buf_set} [(@code{char* buffer, type, size_t index, type variable}) @arrow{} @code{type}]
@fnindex @code{buf_set}
@cpindex Re-executing servers, macros
@cpindex Updating, online, macros
@cpindex Online updating, macros
@cpindex Version update, macros
@cpindex Serialisation macros
@cpindex Marshalling macros
@sgindex @code{SIGUPDATE}
Wrapper for @code{buf_cast} that sets the addressed
element to the value of @code{variable}.
@item @code{buf_get} [(@code{const char* buffer, type, size_t index, type variable}) @arrow{} @code{type}]
@fnindex @code{buf_get}
@cpindex Re-executing servers, macros
@cpindex Updating, online, macros
@cpindex Online updating, macros
@cpindex Version update, macros
@cpindex Serialisation macros
@cpindex Marshalling macros
@sgindex @code{SIGUPDATE}
Wrapper for @code{buf_cast} that sets the value of
@code{variable} to the value of the addressed element.
@item @code{buf_next} [(@code{char* buffer, type, size_t count}) @arrow{} @code{char*}]
@fnindex @code{buf_next}
@cpindex Re-executing servers, macros
@cpindex Updating, online, macros
@cpindex Online updating, macros
@cpindex Version update, macros
@cpindex Serialisation macros
@cpindex Marshalling macros
@sgindex @code{SIGUPDATE}
Increases the pointer @code{buffer} by the size of
@code{type} @code{count} types.
@item @code{buf_prev} [(@code{char* buffer, type, size_t count}) @arrow{} @code{char*}]
@fnindex @code{buf_prev}
@cpindex Re-executing servers, macros
@cpindex Updating, online, macros
@cpindex Online updating, macros
@cpindex Version update, macros
@cpindex Serialisation macros
@cpindex Marshalling macros
@sgindex @code{SIGUPDATE}
Decreases the pointer @code{buffer} by the size of
@code{type} @code{count} types.
@item @code{buf_set_next} [(@code{char* buffer, type, type variable}) @arrow{} @code{type}]
@fnindex @code{buf_set_next}
@cpindex Re-executing servers, macros
@cpindex Updating, online, macros
@cpindex Online updating, macros
@cpindex Version update, macros
@cpindex Serialisation macros
@cpindex Marshalling macros
@sgindex @code{SIGUPDATE}
@example
@group
buf_set(buffer, type, 0, variable),
buf_next(buffer, type, 1);
@end group
@end example
@item @code{buf_get_next} [(@code{char* buffer, type, type variable}) @arrow{} @code{type}]
@fnindex @code{buf_get_next}
@cpindex Re-executing servers, macros
@cpindex Updating, online, macros
@cpindex Online updating, macros
@cpindex Version update, macros
@cpindex Serialisation macros
@cpindex Marshalling macros
@sgindex @code{SIGUPDATE}
@example
@group
buf_get(buffer, type, 0, variable),
buf_next(buffer, type, 1);
@end group
@end example
@item @code{strequals} [(@code{const char* a, const char* b}) @arrow{} @code{int}]
@fnindex @code{strequals}
@cpindex String comparison
Evaluates whether the strings @code{a} and @code{b}
are equals, neither may be @code{NULL}@.
@item @code{startswith} [(@code{const char* haystack, const char* needle}) @arrow{} @code{int}]
@fnindex @code{startswith}
@cpindex String comparison
Evaluates whether the string @code{haystack}
starts with the string @code{needle}, neither
may be @code{NULL}@.
@item @code{drop_privileges} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{drop_privileges}
@cpindex Previleges
@cpindex Security, previleges
Sets the effective user to the real user and the
effective group to the real group. This is used by
most servers and ensure that they are not running
with unnecessary privileges. Returns zero on and only
on success.
@item @code{monotone} [(@code{struct timespec* time_slot}) @arrow{} @code{int}]
@fnindex @code{monotone}
@cpindex Time, monotonic
@cpindex Monotonic time
Stores the time of an unspecified monotonic clock
into @code{time_slot}. Returns zero on and only on
success.
@item @code{xclose} [(@code{int fd}) @arrow{} @code{void}]
@fnindex @code{xclose}
@cpindex Clean up
Wrapper for the @code{close} function. This wrapper
will retry if the call is interrupted by a signal.
It will however not return value, but you can detect
if an error have occured by inspecting @code{errno},
it is guaranteed to be zero on success and otherwise
indicate the error that occurred.
@item @code{xfclose} [(@code{FILE* f}) @arrow{} @code{void}]
@fnindex @code{xfclose}
@cpindex Clean up
Wrapper for the @code{fclose} function. This wrapper
will retry if the call is interrupted by a signal.
It will however not return value, but you can detect
if an error have occured by inspecting @code{errno},
it is guaranteed to be zero on success and otherwise
indicate the error that occurred.
@item @code{close_files} [(@code{condition}) @arrow{} @code{void}]
@fnindex @code{close_files}
@cpindex File descriptions, close all
@cpindex Close all file descriptions
Closes all file descriptors named by a variable
@code{fd} for which @code{condition} evalutes to
non-zero.
@item @code{xfree} [(@code{void** array, size_t elements}) @arrow{} @code{void}]
@fnindex @code{xfree}
@cpindex Memory management
Calls @code{free} on the first @code{elements}
elements in @code{array}, and than calls @code{free}
on @code{array}. This macro requires @code{size_t i}
is declared.
@item @code{xmalloc} [(@code{type* var, size_t elements, type}) @arrow{} @code{int}]
@fnindex @code{xmalloc}
@cpindex Memory management
Allocates a @code{type*} with @code{elements}
elements and stores the allocated pointer to
@code{var}. Returns zero on and only on success.
@item @code{xbmalloc} [(@code{type* var, size_t bytes}) @arrow{} @code{int}]
@fnindex @code{xbmalloc}
@cpindex Memory management
Allocates @code{bytes} bytes and stores the allocated
pointer to @code{var}. Returns zero on and only on
success.
@item @code{xcalloc} [(@code{type* var, size_t elements, type}) @arrow{} @code{int}]
@fnindex @code{xcalloc}
@cpindex Memory management
Allocates a zero-initialised @code{type*} with
@code{elements} elements and stores the allocated
pointer to @code{var}. Returns zero on and only on
success.
@item @code{xbcalloc} [(@code{type* var, size_t bytes}) @arrow{} @code{int}]
@fnindex @code{xbcalloc}
@cpindex Memory management
Allocates and zero-initialises @code{bytes} bytes and
stores the allocated pointer to @code{var}. Returns
zero on and only on success.
@item @code{xrealloc} [(@code{type* var, size_t elements, type}) @arrow{} @code{int}]
@fnindex @code{xrealloc}
@cpindex Memory management
Reallocates @code{var} and updates the variable
@code{var} accordingly. @code{var} will be allocated
to have @code{elements} elements of the type
@code{type}. If @code{var} is @code{NULL} a new
allocation is created. If @code{elements} is zero,
@code{var} will be deallocated. Returns zero on and
only on success. On failure, @code{var} will be
@code{NULL}, so you must store the @code{var} into
another variable in case this macro fails.
@item @code{xxrealloc} [(@code{type* old, type* var, size_t elements, type}) @arrow{} @code{int}]
@fnindex @code{xxrealloc}
@cpindex Memory management
Variant of @code{xrealloc} that will return with
@code{old} set to @code{NULL} on success, and
@code{old} set to @code{var} on error. Like
@code{xrealloc}, @code{xxrealloc} returns zero on and
only on success.
@item @code{yrealloc} [(@code{type* tmp, type* var, size_t elements, type}) @arrow{} @code{int}]
@fnindex @code{yrealloc}
@cpindex Memory management
Variant of @code{xrealloc} that will store @code{var}
to @code{tmp} before reallocating @code{var} and then
restore @code{var} if the reallocation failed. Like
@code{xrealloc}, @code{yrealloc} returns zero on and
only on success.
@item @code{growalloc} [(@code{type* old, type* var, size_t elements, type}) @arrow{} @code{int}]
@fnindex @code{growalloc}
@cpindex Memory management
When using this macro @code{var} should be a
@code{type*} pointer allocated for @code{elements}
elements of the type @code{type}. This macro will
reallocate @code{var} to contain twice as many
elements and update @code{elements} accordingly. On
failure nothing changes. You must specify a
auxiliary @code{type*} variable and specify it in as
the @code{old} parameter. Returns zero on and only on
success.
@item @code{xstrdup} [(@code{char* var, const char* original}) @arrow{} @code{int}]
@fnindex @code{xstrdup}
@cpindex Memory management
Wrapper for @code{strdup} that returns zero on and
only on success. @code{original} is duplicate and the
duplicate is stored in the variable @code{var}. If
@code{original} is @code{NULL}, @code{var} is set to
@code{NULL} and zero is returned.
@item @code{xstrdup_nn} [(@code{char* var, const char* original}) @arrow{} @code{int}]
@fnindex @code{xstrdup}
@cpindex Memory management
Wrapper for @code{strdup} that returns zero on and
only on success. @code{original} is duplicate and the
duplicate is stored in the variable @code{var}.
@code{original} must not be @code{NULL}. This macro
was added because GCC 6.1.1 warns if @code{xstrdup}
is used and @code{original} is known not to be @code{NULL}.
@item @code{xmemdup} [(@code{void* var, const void* original, size_t elements, type}) @arrow{} @code{int}]
@fnindex @code{xmemdup}
@cpindex Memory management
Allocates a pointer of the type @code{type*} with
room for @code{elements} elements and stores the
pointer to @code{var}. If successful, the content of
@code{original} (@code{elements} elements of size
@code{sizeof(type*)}) is copied to @code{var}, and
zero is returned. On failure, a non-zero value is
returned.
@item @code{xperror} [(@code{const char* str}) @arrow{} @code{void}]
@fnindex @code{xperror}
@cpindex Error management
Invokes @code{perror(str)} if and only if @code{errno}
is non-zero and then sets @code{errno} to zero.
@code{str} should unless you have a specific reason
be @code{*argv}.
@item @code{fail_if} [(@code{condition}) @arrow{} @code{void}]
@fnindex @code{fail_if}
@cpindex Error management
If @code{condition} is satisfied, a jump is made to
the label @code{fail}. Additionally the location of
failure will be printed to standard error.
@item @code{exit_if} [(@code{condition, instructions}) @arrow{} @code{void}]
@fnindex @code{exit_if}
@cpindex Error management
@cpindex Terminating
If @code{condition} is satisfied, @code{instructions}
is invoked and @code{1} is @code{return}:ed.
@item @code{STREND} [(@code{const char* str}) @arrow{} @code{char*}]
@fnindex @code{STREND}
@cpindex Optimisations
Expands to @code{(strchr(str, '\0'))}. It is here to
remain us that @code{str = strchr(str, '\0')} is faster
than @code{str += strlen(str)}.
@end table
@cpindex Signals
@sgindex @code{SIGDANGER}
@sgindex @code{SIGUPDATE}
@sgindex @code{SIGINFO}
Additionally, @file{<libmdsserver/macros.h>} defines
any missing signal name: currently @code{SIGDANGER},
@code{SIGINFO} and @code{SIGUPDATE}, and by inclusion
of @file{<libmdsserver/macro-bits.h>}, variants of
@code{atoi} for portability and convenience:
@cpindex Integer parsing macros
@table @code
@item atoz
@fnindex @code{atoz}
@tpindex @code{size_t}
Parse a human readable @code{const char*} 10-radix
integer to a @code{size_t}.
@item atosz
@fnindex @code{atosz}
@tpindex @code{ssize_t}
Parse a human readable @code{const char*} 10-radix
integer to a @code{ssize_t}.
@item atoh
@fnindex @code{atoh}
@tpindex @code{short int}
@tpindex @code{signed short int}
Parse a human readable @code{const char*} 10-radix
integer to a @code{short int}.
@item atouh
@fnindex @code{atouh}
@tpindex @code{unsigned short int}
Parse a human readable @code{const char*} 10-radix
integer to an @code{unsigned short int}.
@item atou
@fnindex @code{atou}
@tpindex @code{unsigned int}
Parse a human readable @code{const char*} 10-radix
integer to an @code{unsigned int}.
@item atoul
@fnindex @code{atoul}
@tpindex @code{unsigned long int}
Parse a human readable @code{const char*} 10-radix
integer to an @code{unsigned long int}.
@item atoull
@fnindex @code{atoull}
@tpindex @code{unsigned long long int}
Parse a human readable @code{const char*} 10-radix
integer to an @code{unsigned long long int}.
@item ato8
@fnindex @code{ato8}
@tpindex @code{int8_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{int8_t}.
@item atou8
@fnindex @code{atou8}
@tpindex @code{uint8_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{uint8_t}.
@item ato16
@fnindex @code{ato16}
@tpindex @code{int16_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{int16_t}.
@item atou16
@fnindex @code{atou16}
@tpindex @code{uint16_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{uint16_t}.
@item ato32
@fnindex @code{ato32}
@tpindex @code{int32_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{int32_t}.
@item atou32
@fnindex @code{atou32}
@tpindex @code{uint32_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{uint32_t}.
@item ato64
@fnindex @code{ato64}
@tpindex @code{int64_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{int64_t}.
@item atou64
@fnindex @code{atou64}
@tpindex @code{uint64_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{uint64_t}.
@item atoj
@fnindex @code{atoj}
@tpindex @code{intmax_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{intmax_t}.
@item atouj
@fnindex @code{atouj}
@tpindex @code{uintmax_t}
Parse a human readable @code{const char*} 10-radix
integer to an @code{uintmax_t}.
@end table
The header file @file{<libmdsserver/macros.h>}, also
define the macro @code{TEMP_FAILURE_RETRY} if missing,
however without a return value but will clear @code{errno}
if no error occurs@footnote{@code{glibc} will not clear
@code{errno} on success, however this behaviour is defined
@code{MDS_LIBMDSSERVER_MACROS_DEFINED_TEMP_FAILURE_RETRY}
will be defined.}, and creates the alias
@code{CLOCK_MONOTONIC_RAW} for @code{CLOCK_MONOTONIC}
unless @code{CLOCK_MONOTONIC_RAW} is already defined.
The header file also ensure that all aliases for socket
protocol families and address families, for all definied
protocol families and address families.
The header file @file{<libmdsserver/macros.h>}, also
provides to macros to help write signal handlers.
@table @code
@item SIGHANDLER_START
Normal signal handlers should place this macro
at the top of the function. It will save the value
of @code{errno}.
@item SIGHANDLER_END
Normal signal handlers should place this macro
at the bottom of the function, or just before
any @code{return}. It will restore the value of
@code{errno} saved by @code{SIGHANDLER_START}.
@end table
These macros should be used, because signal handlers
should not modify @code{errno}. The one occasion where
exiting a signal handler with a modified @code{errno}
is acceptable, is when the signal handler exits the
program without returning.
@node Auxiliary Functions
@section Auxiliary Functions
In the header file @file{<libmdsserver/util.h>},
libmdsserver defines common functions to help write
servers more concisely.
@table @asis
@item @code{parse_client_id} [(@code{const char* str}) @arrow{} @code{uint64_t}]
@fnindex @code{parse_client_id}
@cpindex Client ID, parsing
@cpindex Parsing client ID
Convert a client ID string into a client ID integer.
@item @code{getenv_nonempty} [(@code{const char* var}) @arrow{} @code{char*}]
@fnindex @code{getenv_nonempty}
@cpindex Environment variables, reading
@cpindex Reading environment variables
@cpindex Fetching environment variables
Read an environment variable, return @code{NULL} if
the variable's value is an empty string.
@item @code{prepare_reexec} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{prepare_reexec}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Prepare the server so that it can re-execute into a
newer version of the executed file.
This is required for two reasons:
@enumerate 1
@item
We cannot use @code{argv[0]} as @env{PATH}-resolution
may cause it to reexec into another pathname, and
maybe to wrong program. Additionally @code{argv[0]}
may not even refer to the program, and @code{chdir}
could also hinter its use.
@item
The kernel appends @samp{ (deleted)} to
@file{/proc/self/exe} once it has been removed, so it
cannot be replaced.
@end enumerate
Returns zero on success and @code{-1} on error.
@item @code{reexec_server} [(@code{int argc, char** argv, int reexeced}) @arrow{} @code{void}]
@fnindex @code{reexec_server}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Re-execute the server. If @code{prepare_reexec}
failed or has not been called, @code{argv[0]} will be
used as a fallback. This functions has three input
parameters:
@table @code
@item argc
The number of elements in @code{argv}.
@item argv
The command line arguments.
@item reexeced
Whether the server has previously been re-executed.
@end table
This function only returns on failure.
@item @code{xsigaction} [(@code{int signo, void (*function)(int signo)}) @arrow{} @code{int}]
@fnindex @code{xsigaction}
@fnindex @code{sigaction}
@fnindex @code{signal}
@cpindex Signals
@code{sigaction} with the same parameters as
@code{signal}. This function should only be used for
common @command{mds} signals and signals that does
not require any special settings. This function may
choose to add additional behaviour depending on the
signal, such as blocking other signals. Returns zero
on success and @code{-1} on error.
@item @code{send_message} [(@code{int socket, const char* message, size_t length}) @arrow{} @code{size_t}]
@fnindex @code{send_message}
@cpindex Communication over sockets
@cpindex Socket communication
Send the message @code{messsage}, of length
@code{length} over the socket that is access with the
file descriptor @code{socket}. Returns the number of
bytes that have been sent, even on error.
@item @code{strict_atoi} [(@code{const char* str, int* value, int min, int max}) @arrow{} @code{int}]
@fnindex @code{strict_atoi}
@fnindex @code{atoi}
@cpindex Integer parsing
@cpindex Error management
A version of @code{atoi} that is strict about the
syntax and bounds. Parses the string @code{str} into
an @code{int} and stores it in @code{*value}. If the
string is not a 10-radix integer or has a value
outside [@code{min}, @code{max}], @code{-1} is
returned, otherwise zero is returned.
@item @code{strict_atou}
@fnindex @code{strict_atou}
@fnindex @code{atou}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{unsigned int} instead
of @code{int} on its parameters.
@item @code{strict_atoh}
@fnindex @code{strict_atoh}
@fnindex @code{atoh}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{short int} instead
of @code{int} on its parameters. Note however that @code{min} and
@code{max} is in @code{int}, because smaller types should not be
passed as arguments.
@item @code{strict_atouh}
@fnindex @code{strict_atouh}
@fnindex @code{atouh}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{unsigned short int} instead
of @code{int} on its parameters. Note however that @code{min} and
@code{max} is in @code{unsigned int}, because smaller types should
not be passed as arguments.
@item @code{strict_atol}
@fnindex @code{strict_atol}
@fnindex @code{atol}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{long int} instead
of @code{int} on its parameters.
@item @code{strict_atoul}
@fnindex @code{strict_atoul}
@fnindex @code{atoul}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{unsigned long int} instead
of @code{int} on its parameters.
@item @code{strict_atoll}
@fnindex @code{strict_atoll}
@fnindex @code{atoll}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{long long int} instead
of @code{int} on its parameters.
@item @code{strict_atoull}
@fnindex @code{strict_atoull}
@fnindex @code{atoull}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{unsigned long long int} instead
of @code{int} on its parameters.
@item @code{strict_atoj}
@fnindex @code{strict_atoj}
@fnindex @code{atoj}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{intmax_t} instead
of @code{int} on its parameters.
@item @code{strict_atouj}
@fnindex @code{strict_atouj}
@fnindex @code{atouj}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{uintmax_t} instead
of @code{int} on its parameters.
@item @code{strict_atoz}
@fnindex @code{strict_atoz}
@fnindex @code{atoz}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{size_t} instead
of @code{int} on its parameters.
@item @code{strict_atosz}
@fnindex @code{strict_atosz}
@fnindex @code{atosz}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{ssize_t} instead
of @code{int} on its parameters.
@item @code{strict_ato8}
@fnindex @code{strict_ato8}
@fnindex @code{ato8}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{int8_t} instead
of @code{int} on its parameters. Note however that @code{min} and
@code{max} is in @code{int}, because smaller types should not be
passed as arguments.
@item @code{strict_atou8}
@fnindex @code{strict_atou8}
@fnindex @code{atou8}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{uint8_t} instead
of @code{int} on its parameters. Note however that @code{min} and
@code{max} is in @code{int}, because smaller types should not be
passed as arguments.
@item @code{strict_ato16}
@fnindex @code{strict_ato16}
@fnindex @code{ato16}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{int16_t} instead
of @code{int} on its parameters. Note however that @code{min} and
@code{max} is in @code{int}, because smaller types should not be
passed as arguments.
@item @code{strict_atou16}
@fnindex @code{strict_atou16}
@fnindex @code{atou16}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{uint16_t} instead
of @code{int} on its parameters. Note however that @code{min} and
@code{max} is in @code{unsigned int}, because smaller types should
not be passed as arguments.
@item @code{strict_ato32}
@fnindex @code{strict_ato32}
@fnindex @code{ato32}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{int32_t} instead
of @code{int} on its parameters.
@item @code{strict_atou32}
@fnindex @code{strict_atou32}
@fnindex @code{atou32}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{uint32_t} instead
of @code{int} on its parameters.
@item @code{strict_ato64}
@fnindex @code{strict_ato64}
@fnindex @code{ato64}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{int64_t} instead
of @code{int} on its parameters.
@item @code{strict_atou64}
@fnindex @code{strict_atou64}
@fnindex @code{atou64}
@cpindex Integer parsing
@cpindex Error management
A variant of @code{strict_atoi} that uses @code{uint64_t} instead
of @code{int} on its parameters.
@item @code{full_write} [(@code{int fd, const char* buffer, size_t length}) @arrow{} @code{int}]
@fnindex @code{full_write}
@cpindex File writing
Send the buffer @code{buffer}, with the length
@code{length}, into the file whose file descriptor is
@code{fd} and ignores interruptions. Returns zero on
success and @code{-1} on error.
@item @code{full_read} [(@code{int fd, size_t* length}) @arrow{} @code{char*}]
@fnindex @code{full_read}
@cpindex File reading
Read the file whose file descriptor is @code{fd}
completely and ignore interruptions. If @code{length}
if not @code{NULL}, the length of the read file is
stored in @code{*length}. On success, the read
content is retured, on error @code{NULL} is returned.
@item @code{full_send} [(@code{int socket, const char* message, size_t length}) @arrow{} @code{int}]
@fnindex @code{full_send}
@cpindex Message passing
Send the message @code{message}, with the length
@code{length}, to the socket whose file descriptor is
@code{socket} and ignores interruptions. Returns zero on
success and @code{-1} on error.
@item @code{startswith_n} [(@code{const char*, const char*, size_t, size_t}) @arrow{} @code{int}]
@fnindex @code{startswith_n}
@cpindex String comparison
Check whether a string begins with a specific string,
where neither of the strings are necessarily
NUL-terminated. The parameters are:
@table @code
@item const char* haystack
The string that should start with the other string.
@item const char* needle
The string the first string should start with.
@item size_t haystack_n
The length of @code{haystack}.
@item size_t needle_n
The length of @code{needle}.
@end table
Returns 1 if @code{haystack} beings with
@code{needle}, otherwise zero is returned.
@item @code{uninterruptable_waitpid} [(@code{pid_t pid, int* restrict status, int options}) @arrow{} @code{pid_t}]
@fnindex @code{uninterruptable_waitpid}
@fnindex @code{waitpid}
@cpindex Process management
Wrapper around @code{waitpid} that never returns on an
interruption unless it is interrupted one hundred
times within the same clock second. The parameters
and return value are exactly those of @code{waitpid}.
@item @code{verify_utf8} [(@code{const char* string, int allow_modified_nul}) @arrow{} @code{int}]
@fnindex @code{verify_utf8}
@cpindex Security, encoding, UTF-8
@cpindex UTF-8, security
@cpindex Encoding, UTF-8, security
Checks whether a NUL-terminated string's encoding
matches UTF-8. This function will reject the string
if it does not use the shorted possible
byte-combination for each character. However, if
@code{allow_modified_nul} is set, it will allow
@code{192 128} in place of @code{0} for a
NUL-character.@footnote{Remember @code{0} is used
to terminated the string, but @code{192 128} is not.}
This function returns zero if the @code{string} is
properly formatted, and @code{-1} otherwise.
@item @code{construct_error_message} [(@code{const char* restrict recv_client_id, const char* restrict recv_message_id, const char* restrict recv_command, int custom, int errnum, const char* restrict message, char** restrict send_buffer, size_t* restrict send_buffer_size, uint32_t message_id}) @arrow{} @code{size_t}]
@cpindex @code{construct_error_message}
@cpindex Error management
This function constructs an error message to be sent to
a client. It implements the @code{error} protocol with
with identifying header @code{Command: error}.
The parameters are:
@table @code
@item recv_client_id
The client ID attached on the message that was
received in the message that caused the error,
that is, the value of the header @code{Client ID}
on the received message and the header @code{To}
in the message to construct. Must not be @code{NULL}.
@item recv_message_id
The message ID attached on the message that was
received in the message that caused the error,
that is, the value of the header @code{Message ID}
on the received message and the header
@code{In response to} in the message to construct.
Must not be @code{NULL}.
@item recv_command
The value of the @code{Command}-header on the
message that was received. Must not be @code{NULL}.
@item custom
If and only if set to zero, value of @code{errnum}
is a value for @code{errno}.
@item errnum
A numeric value describing the error. A negative
value, such as @code{-1} should be used if the
error does not have a numeric value. Zero is
reserved to indicate success.
@item message
The description of the error, the line feed at the end
is added automatically and thus should not be included.
The description should be a statement in mid-sentence
case and without punctuation at the end.
@code{NULL} if no description should be included.
@item send_buffer
Pointer to the buffer where the message should be stored,
it should contain the current send buffer. Must not be
@code{NULL}
@item send_buffer_size
Pointer to the allocation size of @code{*send_buffer},
it should contain the current size of @code{*send_buffer}
and will be updated with the new size. Must not be
@code{NULL}
@item message_id
The message ID of the message that is being constructed.
@end table
It is not allowed to have a negative value on
@code{errnum} and a zero value on @code{custom}
at the same time.
This function returns the length of the constructed
message on success, and zero on failure. On failure
@code{errno} will be set accordingly.
@item @code{send_error} [(@code{..., int socket_fd}) @arrow{} @code{int}]
@fnindex @code{send_error}
@cpindex Error management
This function is a wrapper for @code{construct_error_message} that also
sends constructed message to the socket whose file descriptor is @code{socket_fd}.
This function has the same parameters as @code{construct_error_message},
but with one additional parameter as its last parameter: @code{socket_fd}.
Also, instead of returning the length of the message, it returns zero
on success and @code{-1} on error.
@end table
@fnindex @code{rawmemchr}.
@file{<libmdsserver/util.h>} also defines @code{rawmemchr}
if not already defined.
@node Data Structures
@section Data Structures
@cpindex Data structures
@cpindex Marshalling
@cpindex Serialisation
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
libmdsserver provides a small set of data structures
that are used by the @command{mds} servers. All of
these are written with marshal-functionallity.
@table @asis
@item @code{client_list_t} @{also known as @code{struct client_list}@}
@tpindex @code{client_list_t}
@tpindex @code{struct client_list}
@cpindex Client ID, lists
@cpindex Lists of client ID:s
In the header file
@file{<libmdsserver/client-list.h>}, libmdsserver
defines a dynamic list for storing client ID:s.
@item @code{linked_list_t} @{also known as @code{struct linked_list}@}
@tpindex @code{linked_list_t}
@tpindex @code{struct linked_list}
@cpindex Lists, linked
@cpindex Linked lists
In the header file
@file{<libmdsserver/linked-list.h>}, libmdsserver
defines a linear array sentinel doubly linked list.
@item @code{hash_table_t} @{also known as @code{struct hash_table}@}
@tpindex @code{hash_table_t}
@tpindex @code{struct hash_table}
@cpindex Tables, hash
@cpindex Maps, hash
@cpindex Dictionary, hash
@cpindex Hash table
In the header file @file{<libmdsserver/hash-table.h>},
libmdsserver defines a hash table.
@item @code{fd_table_t} @{also known as @code{struct fd_table}@}
@tpindex @code{fd_table_t}
@tpindex @code{struct fd_table}
@cpindex Tables, file descriptor
@cpindex Maps, file descriptor
@cpindex Dictionary, file descriptor
@cpindex File descriptor table
In the header file @file{<libmdsserver/fd-table.h>},
libmdsserver defines a lookup table for small
positive integer keys, intended as an alternative to
hash tables for file descriptors as keys.
@item @code{mds_message_t} @{also known as @code{struct mds_message}@}
@tpindex @code{mds_message_t}
@tpindex @code{struct mds_message}
@cpindex Message passing, data structure
In the header file
@file{<libmdsserver/mds-message.h>}, libmdsserver
defines a data structure for message between the
server or client and the master server, with the
capability of reading for a socket.
@item @code{hash_list} @{abstract@}
@tpindex @code{hash_list}
@cpindex Lists, hash
@cpindex Hash lists
@cpindex Tables, hash
@cpindex Maps, hash
@cpindex Dictionary, hash
@cpindex Hash table
In the header file @file{<libmdsserver/hash-list.h>},
libmdsserver defines an abstract class known as hash list.
It is intended as an alternative to hash tables, where
the number of stored elements is low.
@end table
These data structures share a common set of associated
methods. However, they do not use the same methods;
they are identical except they are are named with the
associated data structure. We will use @code{X_t} as
an example.
@table @asis
@item @code{X_destroy} [(@code{X_t* restrict this}) @arrow{} @code{void}]
@fnindex @code{client_list_destroy}
@fnindex @code{linked_list_destroy}
@fnindex @code{hash_table_destroy}
@fnindex @code{fd_table_destroy}
@fnindex @code{mds_message_destroy}
@cpindex Memory management
Releases all resouces in @code{*this}, @code{this}
itself is however not @code{free}:d.
However, @code{hash_table_destory} and
@code{fd_table_destory} have another signature.
@item @code{X_clone} [(@code{const X_t* restrict this, X_t* restrict out}) @arrow{} @code{int}]
@fnindex @code{client_list_clone}
@fnindex @code{linked_list_clone}
@fnindex @code{hash_table_clone}
@fnindex @code{fd_table_clone}
@fnindex @code{mds_message_clone}
@cpindex Memory management
Create a deep duplicate of @code{*this} and store it
in @code{*out}.
@item @code{X_marshal_size} [(@code{const X_t* restrict this}) @arrow{} @code{size_t}]
@fnindex @code{client_list_marshal_size}
@fnindex @code{linked_list_marshal_size}
@fnindex @code{hash_table_marshal_size}
@fnindex @code{fd_table_marshal_size}
@fnindex @code{mds_message_marshal_size}
@cpindex Marshalling
@cpindex Serialisation
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Calculates the exact allocate size needed for the
parameter @code{data} in the method @code{X_marshal}
if called with the same @code{this} parameter.
@item @code{X_marshal} [(@code{const X_t* restrict this, char* restrict data}) @arrow{} @code{void}]
@fnindex @code{client_list_marshal}
@fnindex @code{linked_list_marshal}
@fnindex @code{hash_table_marshal}
@fnindex @code{fd_table_marshal}
@fnindex @code{mds_message_marshal}
@cpindex Marshalling
@cpindex Serialisation
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Marshal the state of @code{*this} into @code{data}.
The number of bytes that will be stored (contiguously)
in @code{data} can be calculated with
@code{X_marshal_size}.
@item @code{X_unmarshal} [(@code{X_t* restrict this, char* restrict data)}) @arrow{} @code{int}]
@fnindex @code{client_list_unmarshal}
@fnindex @code{linked_list_unmarshal}
@fnindex @code{hash_table_unmarshal}
@fnindex @code{fd_table_unmarshal}
@fnindex @code{mds_message_unmarshal}
@cpindex Marshalling
@cpindex Serialisation
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Unmarshal a @code{X_t} from @code{data} into
@code{*this}. Returns zero on success and @code{-1}
on error. The number of bytes read from @code{data}
should, if required, have been precalculated with
@code{X_marshal_size} and stored in an earlier
location of @code{data}.
However, @code{hash_table_unmarshal} and
@code{fd_table_unmarshal} have another signature.
@end table
@menu
* Client List:: The @code{client_list_t} data structure.
* Linked List:: The @code{linked_list_t} data structure.
* Tables:: The @code{fd_table_t} and @code{hash_table_t} data structures.
* Hash List:: The @code{hash_list} abstract data structure.
* Message Structure:: The @code{mds_message_t} data structure.
@end menu
@node Client List
@subsection Client List
@tpindex @code{client_list_t}
@tpindex @code{struct client_list}
@cpindex Client ID, lists
@cpindex Lists of client ID:s
@fnindex @code{client_list_create}
To create a client list, allocate a
@code{client_list_t*} or otherwise obtain a
@code{client_list_t*}, and call
@code{client_list_create} with that pointer as the
first argument, and the @code{0} as the second
argument, unless you want to tune the initialisation.
@code{client_list_create} will return zero on and
only on successful initialisation.
@code{client_list_create}'s second parameter ---
@code{size_t capacity} --- can be used to specify how
many element the list should initially fit. It will
grow when needed, but it is a good idea to tell it
how many elements you are planning to populate it
with.
@code{client_list_t} has two associated methods for
manipulating its content:
@table @asis
@item @code{client_list_add} [(@code{client_list_t* restrict this, uint64_t client}) @arrow{} @code{int}]
@fnindex @code{client_list_add}
This method will add the element @code{client} to
the list @code{*this}, and return zero on and only on
success.
@item @code{client_list_remove} [(@code{client_list_t* restrict this, uint64_t client}) @arrow{} @code{void}]
@fnindex @code{client_list_remove}
This method will remove exactly one occurrence,
provided that there is at least one occurrence, of the
element @code{client} for the list @code{*this}.
@end table
To retrieve the number elements stored in a list,
reads its variable @code{size_t size}. The variable
@code{uint64_t* clients} is used to retrieve stored
elements.
@ifset AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@example
void print_elements(client_list_t* this)
@{
size_t i;
for (i = 0; i < this->size; i++)
printf("Element #%zu: %" PRIu64 "\n", i, this->elements[i]);
@}
@end example
@end ifset
@ifclear AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@example
void print_elements(client_list_t* this)
@{
size_t i;
for (i = 0; i < this->size; i++)
printf("Element #%zu: %" PRIu64 "\n",
i, this->elements[i]);
@}
@end example
@end ifclear
@node Linked List
@subsection Linked List
@tpindex @code{linked_list_t}
@tpindex @code{struct linked_list}
@cpindex Lists, linked
@cpindex Linked lists
@code{linked_list_t} is a linear array sentinel
doubly linked list. This means that is implemented
using arrays rather than node references. More
specifically, since it is doubly linked@footnote{And
not using XOR-linking.}, it is implemented using
three arrays:
@table @asis
@item @code{values} [@code{size_t*}]
The value stored in each node.
@item @code{next} [@code{ssize_t*}]
The next node for each node, @code{edge} if the
current node is the last node, and
@code{LINKED_LIST_UNUSED} if there is no node on this
position.
@item @code{previous} [@code{ssize_t*}]
The previous node for each node, @code{edge} if the
current node is the first node, and
@code{LINKED_LIST_UNUSED} if there is no node on this
position.
@end table
The linked list has a sentinel node that joins boths
ends of the list. The index of this node is stored in
the variable @code{edge}.
@cpindex Memory management
@fnindex @code{linked_list_pack}
Because the list is implemented using arrays, if the
number of elements in it shinks considerably, it will
not be able to automatically free unused space.
Instead you must call @code{linked_list_pack}:
@table @asis
@item @code{linked_list_pack} [(@code{linked_list_t* restrict this}) @arrow{} @code{int}]
Pack the list so that there are no reusable positions,
and reduce the capacity to the smallest capacity that
can be used. Note that values (nodes) returned by the
list's methods will become invalid. Additionally (to
reduce the complexity) the list will be defragment so
that the nodes' indices are continuous. This method
has linear time complexity and linear memory
complexity.
@end table
@fnindex @code{linked_list_create}
To create a linked list list, allocate a
@code{linked_list_t*} or otherwise obtain a
@code{linked_list_t*}, and call
@code{linked_list_create} with that pointer as the
first argument, and the @code{0} as the second
argument, unless you want to tune the initialisation.
@code{linked_list_create} will return zero on and
only on successful initialisation.
@code{linked_list_create}'s second parameter ---
@code{size_t capacity} --- can be used to specify how
many element the list should initially fit. It will
grow when needed, but it is a good idea to tell it
how many elements you are planning to populate it
with.
There are five methods adding and removing items to
and from a linked list:
@table @asis
@item @code{linked_list_insert_after} [(@code{this, size_t value, ssize_t predecessor}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_insert_after}
Create a new node with the value @code{value} and add
it to the list @code{*this} after the node
@code{predecessor}. On success, the new node is
returned, on failure @code{LINKED_LIST_UNUSED} is
returned.
@item @code{linked_list_insert_before} [(@code{this, size_t value, ssize_t successor}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_insert_before}
Create a new node with the value @code{value} and add
it to the list @code{*this} before the node
@code{successor}. On success, the new node is
returned, on failure @code{LINKED_LIST_UNUSED} is
returned.
@item @code{linked_list_remove_after} [(@code{this, ssize_t predecessor}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_remove_after}
Remove and return the node in the list @code{*this}
directly after the node @code{predecessor}.
@item @code{linked_list_remove_before} [(@code{this, ssize_t successor}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_remove_before}
Remove and return the node in the list @code{*this}
directly before the node @code{predecessor}.
@item @code{linked_list_remove} [(@code{this, ssize_t node}) @arrow{} @code{void}]
@fnindex @code{linked_list_remove}
Remove the node @code{node} from the list
@code{*this}.
@end table
The data type for @code{this} is @code{linked_list_t*}
with the @code{restrict} modifier for these and all
other @code{linked_list_t} methods.
Note that if the node @code{this->edge} is removed,
the list become circularly linked and the sentinel
will become missing which renders invokation of all
macros undefined in behaviour. Further note that
removing the sentinel while it is the only node in
the list invokes undefined behaviour. Also note that
addressing non-existing nodes invokes undefined
behaviour.
@file{<libmdsserver/linked_list.h>} defines two
macros for inserting nodes at the edges of a linked
list and two macros for removing nodes from the edges
of a linked list:
@table @asis
@item @code{linked_list_insert_beginning} [(@code{linked_list_t* this, size_t value}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_insert_beginning}
Create a new node with the value @code{value} in
insert it to the beginning of the list @code{*this}.
On success, the new node is returned, on failure
@code{LINKED_LIST_UNUSED} is returned.
@item @code{linked_list_insert_end} [(@code{linked_list_t* this, size_t value}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_insert_end}
Create a new node with the value @code{value} in
insert it to the end of the list @code{*this}. On
success, the new node is returned, on failure
@code{LINKED_LIST_UNUSED} is returned.
@item @code{linked_list_remove_beginning} [(@code{linked_list_t* this}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_remove_beginning}
Remove and return the first node in the list
@code{*this}.
@item @code{linked_list_remove_end} [(@code{linked_list_t* this}) @arrow{} @code{ssize_t}]
@fnindex @code{linked_list_remove_end}
Remove and return the node node in the list
@code{*this}.
@end table
Additionally the library defines a macro that wrappes
the @code{for}-keyword to iterate over all nodes
(except the sentinel node) the a linked list:
@table @asis
@item @code{foreach_linked_list_node} [(@code{linked_list_t this, ssize_t node})]
@fnindex @code{foreach_linked_list_node}
Wrapper for @code{for}-keyword that iterates over each
element in the list @code{this}, and store the
current node to the variable named by the parameter
@code{node} for each iterations.
@example
void print_linked_list_values(linked_list_t* list)
@{
ssize_t node;
foreach_linked_list_node (*list, node)
printf("%zi\n", list->values[node]);
@}
@end example
Note that the data type for @code{this} in the macro
is not a pointer.
@end table
There is also a method intended for debugging:
@table @asis
@item @code{linked_list_dump} [(@code{linked_list_t* restrict this, FILE* restrict output}) @arrow{} @code{void}]
@fnindex @code{linked_list_dump}
The all internal data of the list @code{*this} into
the stream @code{output}.
@end table
@node Tables
@subsection Tables
@tpindex @code{fd_table_t}
@tpindex @code{struct fd_table}
@cpindex Tables, file descriptor
@cpindex Maps, file descriptor
@cpindex Dictionary, file descriptor
@cpindex File descriptor table
@tpindex @code{hash_table_t}
@tpindex @code{struct hash_table}
@cpindex Tables, hash
@cpindex Maps, hash
@cpindex Dictionary, hash
@cpindex Hash table
libmdsserver defines two similar data structures:
@code{fd_table_t} and @code{hash_table_t}. Whenever a
method exists for both data structures we will
write @code{X_table} instead of @code{fd_table} and
@code{hash_table}. Additionally, unless otherwise
stated, a method's parameter named @code{this} will
be of the type @code{hash_table_t*} if the method's
name start with @code{hash_table} and
@code{fd_table_t*} if the method's name start with
@code{fd_table}, with the @code{restrict} modifier.
@table @asis
@item @code{X_table_create} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{hash_table_create}
@fnindex @code{fd_table_create}
Initialises @code{*this} so it can be used as a
table. Returns zero on and only on success.
These methods are defined as macros.
@item @code{X_table_create_tuned} [(@code{this, size_t initial_capacity}) @arrow{} @code{int}]
@fnindex @code{hash_table_create_tuned}
@fnindex @code{fd_table_create_tuned}
Initialises @code{*this} so it can be used as a
table, and makes its initial capacity at least
@code{initial_capacity}. Returns zero on and only on
success.
@code{hash_table_create_tuned} is defined as a macro.
@item @code{hash_table_create_fine_tuned} [(@code{this, size_t initial_capacity, float load_factor}) @arrow{} @code{int}]
@fnindex @code{hash_table_create_fine_tuned}
Initialises @code{*this} so it can be used as a
table, and makes its initial capacity at least
@code{initial_capacity} and its load factor
@code{load_factor}. Returns zero on and only on
success.
@item @code{X_table_destroy} [(@code{this, free_func* key_freer, free_func* value_freer}) @arrow{} @code{void}]
@fnindex @code{hash_table_destroy}
@fnindex @code{fd_table_destroy}
Release all resources in the table @code{*this}, but
do not @code{free} @code{this} itself. Should be
called even if construction fails. If
@code{keys_freer} is not @code{NULL}, this method
will be called for each key. If @code{values_freer}
is not @code{NULL}, this method will be called for
each value.
@item @code{X_table_contains_value} [(@code{const this, size_t value}) @arrow{} @code{int}]
@fnindex @code{hash_table_contains_value}
@fnindex @code{fd_table_contains_value}
Check whether the value @code{value} is stored in the
table @code{*this}.
@item @code{X_table_contains_key} [(@code{const this, key}) @arrow{} @code{int}]
@fnindex @code{hash_table_contains_key}
@fnindex @code{fd_table_contains_key}
Check whether the key @code{code} is used in the
table @code{*this}.
The data type for the parameter @code{key} is
@code{size_t} for @code{hash_table} and @code{int}
for @code{fd_table}.
@item @code{X_table_get} [(@code{const this, key}) @arrow{} @code{size_t}]
@fnindex @code{hash_table_get}
@fnindex @code{fd_table_get}
Look up a value by its key @code{key} in the table
@code{*this}. Zero will be returned if the key was
not used.
@item @code{hash_table_get_entry} [(@code{const this, size_t key}) @arrow{} @code{hash_entry_t*}]
@fnindex @code{hash_table_get_entry}
Look up an entry by its key @code{key} in the table
@code{*this}. @code{NULL} will be returned if the key
was not used.
@item @code{X_table_put} [(@code{this, key, size_t value}) @arrow{} @code{size_t}]
@fnindex @code{hash_table_put}
@fnindex @code{fd_table_put}
Map the value @code{value} to the key @code{key} in
the talbe @code{*this}. If a value was already mapped
to the key, that value will be returned, otherwise
zero will be returned. Zero will also be returned on
error. @code{errno} will be set to zero on and only
on success.
The data type for the parameter @code{key} is
@code{size_t} for @code{hash_table} and @code{int}
for @code{fd_table}.
@item @code{X_table_remove} [(@code{this, key}) @arrow{} @code{size_t}]
@fnindex @code{hash_table_remove}
@fnindex @code{fd_table_remove}
Unmaps the key @code{key} for the table @code{*this}.
If a value was mapped to the key, that value will be
returned, otherwise zero will be returned.
The data type for the parameter @code{key} is
@code{size_t} for @code{hash_table} and @code{int}
for @code{fd_table}.
@item @code{X_table_clear} [(@code{this}) @arrow{} @code{void}]
@fnindex @code{hash_table_clear}
@fnindex @code{fd_table_clear}
Unmaps all keys in the table @code{*this}.
@item @code{X_table_unmarshal} [(@code{this, char* restrict data, remap_func* remapper}) @arrow{} @code{int}]
@fnindex @code{hash_table_unmarshal}
@fnindex @code{fd_table_unmarshal}
As described in @ref{Data Structures} but with one
additional parameter: @code{remapper}. If this
parameter is not @code{NULL} this method is used to
edit values. It will be called once for each value
and the output of the method will be used inplace
of the input value.
@end table
@file{<libmdsserver/hash-table.h>} also defines as
wrapper macro for the @code{for}-keyword:
@table @asis
@item @code{foreach_hash_table_entry} [(@code{hash_table_t this, size_t i, hash_entry_t* entry})]
@fnindex @code{foreach_hash_table_entry}
Iterates over entry element in the hash table
@code{this}. On each iteration, the entry will be
stored to the variable @code{entry} and the bucket
index will be stored to the variable @code{i}.
@ifset AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@example
void print_hash_table(hash_table_t* table)
@{
hash_entry_t* entry;
size_t i;
foreach_hash_table_entry (*table, i, entry)
printf("%zu --> %zu\n", entry->key, entry->value);
@}
@end example
@end ifset
@ifclear AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@example
void print_hash_table(hash_table_t* table)
@{
hash_entry_t* entry;
size_t i;
foreach_hash_table_entry (*table, i, entry)
printf("%zu --> %zu\n", entry->key,
entry->value);
@}
@end example
@end ifclear
Note that the data type for the parameter @code{this}
is not a pointer.
@end table
@vrindex @code{value_comparator}, @code{hash_table_t}
@vrindex @code{value_comparator}, @code{hash_table_t}
@vrindex @code{hash_table_t.value_comparator}
@vrindex @code{fd_table_t.value_comparator}
The structures @code{hash_table_t} and
@code{fd_table_t} contain the variable
@code{value_comparator} which by default is
@code{NULL}@. If this variable is set to @code{NULL},
two values will be considered equal if and only if
they are numerically identical; otherwise two values
will be considered equal if and only if
@code{value_comparator} returned a non-zero value if
those two values are used for the method's
arguments. The data type for @code{value_comparator}
is @code{compare_func*}.
@code{hash_table_t} also contains two other variables:
@table @asis
@item @code{key_comparator} [@code{compare_func*}]
@vrindex @code{key_comparator}, @code{hash_table_t}
@vrindex @code{hash_table_t.key_comparator}
Identical to @code{value_comparator}, except it is
used for keys rather the values.
@item @code{hasher} [@code{hash_func*}]
@vrindex @code{hasher}, @code{hash_table_t}
@vrindex @code{hash_table_t.hasher}
By default, the hash value for key is identical to
the key itself. However, if this variable is not
@code{NULL}, it will be used to calculate the hash
value for keys.
@end table
@tpindex @code{hash_entry_t}
@tpindex @code{struct hash_entry}
There is a secondary data structure defined for hash
tables: @code{hash_entry_t} @{also known as
@code{struct hash_entry}@}. It is the data structure
used for entries in a hash table. @code{hash_entry_t}
contains three variables you may be interested in:
@table @asis
@item @code{key} [@code{size_t}]
@tpindex @code{key}, @code{hash_entry_t}
@tpindex @code{hash_entry_t.key}
The key.
@item @code{value} [@code{size_t}]
@tpindex @code{value}, @code{hash_entry_t}
@tpindex @code{hash_entry_t.value}
The value associated with the key.
@item @code{hash} [@code{size_t}]
@tpindex @code{hash}, @code{hash_entry_t}
@tpindex @code{hash_entry_t.hash}
The hash value of the key.
@end table
By inclusion of @file{<libmdsserver/table-common.h>},
@file{<libmdsserver/hash-table.h>} and
@file{<libmdsserver/fd-table.h>} defines four
@code{typedef}:s for method signatures:
@table @asis
@item @code{compare_func} [(@code{size_t a, size_t b}) @arrow{} @code{int}]
@tpindex @code{compare_func}
A method that performs a comparison of two objects.
Should return non-zero if and only if @code{a} and
@code{b} are to be considered equal in the given
context.
@item @code{hash_func} [(@code{size_t value}) @arrow{} @code{size_t}]
@tpindex @code{hash_func}
A method that hashes an object or a value. Should
return the hash value for @code{value}.
@item @code{free_func} [(@code{size_t obj}) @arrow{} @code{void}]
@tpindex @code{free_func}
A method that, to the extent that is appropriate,
releases the object @code{obj}'s resources and
@code{free}:s it.
@item @code{remap_func} [(@code{size_t obj}) @arrow{} @code{size_t}]
@tpindex @code{remap_func}
A method that translates a object into a new object.
The method should return new object that should
replace the object @code{obj}.
@end table
If you are working with strings, you may consider
including the header file
@file{<libmdsserver/hash-help.h>}. It defines to
useful methods:
@table @asis
@item @code{string_hash} [(@code{const char* str}) @arrow{} @code{size_t}]
@fnindex @code{string_hash}
Calculate and returns the hash value of the string
@code{str}.
@item @code{string_comparator} [(@code{char* str_a, char* str_b}) @arrow{} @code{int}]
@fnindex @code{string_comparator}
@cpindex String comparison
Returns non-zero if either both @code{str_a} and
@code{str_b} are @code{NULL} or neither are
@code{NULL} but are identical strings by content upto
their first NUL characters (or by address.)
@end table
These methods are defined as pure and
@code{static inline}.
@node Hash List
@subsection Hash List
@tpindex @code{hash_list}
@cpindex List, hash
@cpindex Hash list
@cpindex Tables, hash
@cpindex Maps, hash
@cpindex Dictionary, hash
@cpindex Hash table
@code{hash_list} is an abstract data structure,
provided as an alternative to hash tables with
a low number of elements. @code{hash_list} is a
associated dynamic list, with hash keys, that
keeps removed slot free for reuse until they
are as many as the occupied slots.
@fnindex @code{CREATE_HASH_LIST_SUBCLASS}
To use @code{hash_list}, a concrete subclass of
it must be created. To do this, call the macro
@code{CREATE_HASH_LIST_SUBCLASS}. It takes four
parameters:
@enumerate 1
@item
The name of the subclass, this must not be a string,
but rather formated as an identifier. This text
will replace the @code{hash_list} in all that the
macro defines.
@item
@tpindex @code{KEY_T}
The data type of the keys. We will hence refer to
this as @code{KEY_T}.
@item
A @code{const} version of the data type of the keys.
We will hence refer to this as @code{const KEY_T}.
@item
@tpindex @code{VALUE_T}
The data type of the values. We will hence refer to
this as @code{VALUE_T}. It is however internally
type-defined as @code{hash_list_value_t}, but this
is not guaranteed to be true in the future.
@end enumerate
@code{CREATE_HASH_LIST_SUBCLASS} will define two
structures, two method type definitions, four
@code{static inline} methods for the creator
of the subclass to implement, and a set of methods,
as well as one auxiliary type definition@footnote{This
type definition would be @code{hash_list_value_t} as
specified above.}.
@tpindex @code{hash_list_entry_t}
@tpindex @code{struct hash_list_entry}
The first structure is called @code{hash_list_entry_t}
@{also known as @code{struct hash_list_entry}@}. Keep in
mind that @code{hash_list} is replaced by the first
argument in the call to @code{CREATE_HASH_LIST_SUBCLASS}.
This structure represents a entry, or slot, the hash list,
it contains three elements:
@table @asis
@item @code{key} [@code{KEY_T}]
@vrindex @code{key}, @code{hash_list_entry_t}
@vrindex @code{hash_list_entry_t.key}
The key of the entry. Will be @code{NULL} if the slot
is unused; a @code{NULL} on a key is disallowed.
Note that @code{NULL} is equivalent to zero if the
data type is numeral primitively.
@item @code{key_hash} [@code{size_t}]
@vrindex @code{key_hash}, @code{hash_list_entry_t}
@vrindex @code{hash_list_entry_t.key_hash}
The hash of the key. This element is transparent to the
user of the class.
@item @code{value} [@code{VALUE_T}]
@vrindex @code{value}, @code{hash_list_entry_t}
@vrindex @code{hash_list_entry_t.value}
The value.
@end table
@tpindex @code{hash_list_t}
@tpindex @code{struct hash_list}
The other structure is called @code{hash_list_t}
@{also known as @code{struct hash_list}@}. This
structure represents the entire hash list. It contains
six elements:
@table @asis
@item @code{allocated} [@code{size_t}]
@vrindex @code{allocated}, @code{hash_list_t}
@vrindex @code{hash_list_t.allocated}
The number of allocated slots. This element is
transparent to the user of the class.
@item @code{unused} [@code{size_t}]
@vrindex @code{unused}, @code{hash_list_t}
@vrindex @code{hash_list_t.unused}
The number of unused slot that has previously be used.
This element is transparent to the user of the class.
@item @code{used} [@code{size_t}]
@vrindex @code{used}, @code{hash_list_t}
@vrindex @code{hash_list_t.used}
The number of slots that have been used, even if
no longer used. This element is transparent to the
user of the class.
@item @code{last} [@code{size_t}]
@vrindex @code{last}, @code{hash_list_t}
@vrindex @code{hash_list_t.last}
@fnindex @code{hash_list_get}
@fnindex @code{hash_list_put}
@fnindex @code{hash_list_remove}
This variable is used for optimisation, any
time @code{hash_list_get} finds an element, its
will be stored, and it will be the first
inspected element by @code{hash_list_put} and
@code{hash_list_remove}. This element is
transparent to the user of the class.
@item @code{slots} [@code{hash_list_entry_t*}]
@vrindex @code{slots}, @code{hash_list_t}
@vrindex @code{hash_list_t.slots}
The allocation for the slots. This element is
transparent to the user of the class.
@item @code{freer} [@code{hash_list_entry_free_func*}]
@vrindex @code{freer}, @code{hash_list_t}
@vrindex @code{hash_list_t.freer}
@tpindex @code{hash_list_entry_free_func}
Method used to free keys and values of entries.
If left @code{NULL}, no keys or values are freed.
This value must be set after @code{hash_list_create}
or @code{hash_list_unmarshal} is called, not before.
@item @code{hasher} [@code{hash_list_key_hash_func*}]
@vrindex @code{hasher}, @code{hash_list_t}
@vrindex @code{hash_list_t.hasher}
@tpindex @code{hash_list_key_hash_func}
method used to calculate the hash of a key.
If left @code{NULL}, the identity hash is used, that
is, the address of the key, or if it is numeral, it
is casted to @code{size_t}.
This value must be set after @code{hash_list_create}
or @code{hash_list_unmarshal} is called, not before.
@end table
The two method-type definitions are:
@table @asis
@item @code{hash_list_entry_free_func} [(@code{hash_list_entry_t* entry}) @arrow{} @code{void}]
@tpindex @code{hash_list_entry_free_func}
The method shall free the key and value, if defined
in such a way that they can be freed. It is guaranteed
that neither @code{entry} or @code{entry->key} are
@code{NULL}.
@item @code{hash_list_key_hash_func} [(@code{const KEY_T key}) @arrow{} @code{size_t}]
@tpindex @code{hash_list_key_hash_func}
The method shall return the hash of the @code{key}.
It is guaranteed that @code{key} is not @code{NULL}.
@end table
There are five methods specific to @code{hash_list_t}.
The @code{this}-parameter's data type for this methods
are @code{hash_list_t*} with the @code{restrict} modifier.
@table @asis
@item @code{hash_list_create} [(@code{this, size_t capacity}) @arrow{} @code{int}]
@fnindex @code{hash_list_create}
Create a hash list, and store it in @code{this}.
The hash list's initial capacity will be at least the value @code{capacity}.
If, however, @code{capacity} is zero, a default capacity will be used.
Zero is returned on success, @code{-1} is returned on error.
@item @code{hash_list_pack} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{hash_list_pack}
Pack the list so that there are no reusable positions, and
reduce the capacity to the smallest capacity that can be used.
This method has linear time complexity and constant memory
complexity. Zero is returned on success, @code{-1} is returned
on error. Errors are however non-fatal and can be ignored,
it only means that the capacity could not be reduces, because
a called to @code{realloc} failed.
@item @code{hash_list_get} [(@code{this, const KEY_T key, VALUE_T* restrict value}) @arrow{} @code{int}]
@fnindex @code{hash_list_get}
Look up a value, with the key @code{key}, in the hash list
@code{this}. The found value will be stored in @code{*value}.
This method cannot fail, therefore it cannot return a value
indicating that it failed. Instead it returns one if the
entry was found and nought if it was not found.
Note that @code{this} is not specified with @code{const};
this is because internal caching is done.
@item @code{hash_list_put} [(@code{this, KEY_T key, const VALUE_T* restrict value}) @arrow{} @code{int}]
@fnindex @code{hash_list_put}
Store the value stored in @code{*value} to the hash list
@code{this}. The value will be stored with the key @code{key}.
If a value with this key already exists, that entry will
be freed and replaced. @code{key} will be stored in the
hash list, and the caller is not longer responsble for freeing
it unless the call to this function fails. Zero is returned
on success, @code{-1} is returned on error.
If however @code{value} is @code{NULL}, the entry with the
key @code{key} will be removed if it exists. And zero is
always returned. The caller will be responsible for freeing
@code{key} in this case.
@item @code{hash_list_remove} [(@code{this, const KEY_T key}) @arrow{} @code{void}]
@fnindex @code{hash_list_remove}
Calling this function is equivalent to calling
@code{hash_list_put} with the last argument being @code{NULL}.
However, it allows the key to be stored with @code{const} and
it does not have a return value.
@end table
Keep in mind that the methods
@itemize @bullet{}
@item @code{hash_list_destroy}
@item @code{hash_list_clone}
@item @code{hash_list_marshal_size}
@item @code{hash_list_marshal}
@item @code{hash_list_unmarshal}
@end itemize
also have @code{hash_list} exchanged with whatever
is in the first argument of the on the call to
@code{CREATE_HASH_LIST_SUBCLASS}.
Additionally @code{hash_list_clone} cannot clone
keys or values that are pointers. So if freeing
method is set, you need to manually clone keys
and values after calling @code{hash_list_clone}.
@code{CREATE_HASH_LIST_SUBCLASS} also defines the
prototypes for four functions the user of the class
is required to implement. This four functions are
defined with @code{static inline}. The @code{entry}
parameter is defined with the type
@code{hash_list_entry_t*}@footnote{Keep in mind
that @code{hash_list} is replaced with the value
of the first argument in @code{CREATE_HASH_LIST_SUBCLASS}}.
@table @asis
@item @code{hash_list_key_comparer} [(@code{const KEY_T key_a, const KEY_T key_b}) @arrow{} @code{int}]
@fnindex @code{hash_list_key_comparer}
Compare two keys, @code{key_a} and @code{key_b}. The
function shall return zero on inequality and non-zero
on equality.
@item @code{hash_list_submarshal_size} [(@code{const entry}) @arrow{} @code{size_t}]
@fnindex @code{hash_list_submarshal_size}
The function shall return the number of bytes required
to marshal @code{entry->key} and @code{entry->value}.
@item @code{hash_list_submarshal} [(@code{const entry, char* restrict data}) @arrow{} @code{size_t}]
@fnindex @code{hash_list_submarshal}
The function shall marshal @code{entry->key} and
@code{entry->value} into the buffer @code{data}.
The function shall then return the number of
written bytes, that is, the value returned by
@code{hash_list_submarshal_size}.
@item @code{hash_list_subunmarshal} [(@code{entry, char* restrict data}) @arrow{} @code{size_t}]
@fnindex @code{hash_list_subunmarshal}
The function shall unmarshal the key and value
of an entry stored in the beginning of @code{data}.
The unmarshaled key and value should be stored
to @code{entry->key} and @code{entry->value},
respectively. The function shall then return the
number of read bytes, that is, the value
@code{hash_list_submarshal_size} returned when
the marshal took place, or equivalently, the
will it would return after the unmarshalling.
The function shall return zero on error.
@end table
@file{<libmdsserver/hash-list.h>} also defines two
macros that is uneffected by @code{CREATE_HASH_LIST_SUBCLASS}.
@table @asis
@item @code{foreach_hash_list_entry} [(@code{hash_list_t this, size_t i, hash_list_entry_t* entry})]
This marcro is a warpper for the @code{for}-keyword.
It iterates over entry element in the hash list @code{this}.
On each iteration, the entry (used slots) will be stored
to the variable @code{entry}. The variable @code{i} defined
as a @code{size_t} must be available for the macro to use
freely.
@ifset AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@example
void print_hash_list(hash_list_t* table)
@{
hash_list_entry_t* entry;
size_t i;
foreach_hash_table_entry (*table, i, entry)
printf("%zu --> %zu\n", entry->key, entry->value);
@}
@end example
@end ifset
@ifclear AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@example
void print_hash_list(hash_list_t* table)
@{
hash_list_entry_t* entry;
size_t i;
foreach_hash_lsit_entry (*table, i, entry)
printf("%zu --> %zu\n", entry->key,
entry->value);
@}
@end example
@end ifclear
Note thay the data type for the parameter @code{this}
is not a pointer.
@item @code{HASH_LIST_EXPECTED} [(@code{...})]
This macro is defined as @code{__builtin_expect(__VA_ARGS__, 1)}.
This means that the input value is evaluated, and may
contain the sequence-operator (comma-operator), and the
the value is expected to evaluate to @code{1}.
It is encourage to run @code{hash_list_get} before
@code{hash_list_put} and @code{hash_list_remove}.
This way, you know exactly what is happening.
There is an optimisation in place to let
@code{hash_list_put} and @code{hash_list_remove}
skip the search for the item (unless it is the first
element) if @code{hash_list_get} was used directly
prior to @code{hash_list_put} or @code{hash_list_remove}
to find the element. This macro used to tell the
compiler that position of the element is most likely
already known but is not zero.
If you however choose to not call @code{hash_list_get}
before @code{hash_list_put} and @code{hash_list_remove}
you should define this macro before including the header
file, but with the @code{1} changed to a @code{0}. If
you on the other hand do not know if you are going to
call @code{hash_list_get} before @code{hash_list_put}
and @code{hash_list_remove} you should define it to
expand to the input verbatim, that is, have the value
@code{__VA_ARGS__}.
@end table
@node Message Structure
@subsection Message Structure
@tpindex @code{mds_message_t}
@tpindex @code{struct mds_message}
@cpindex Message passing, data structure
Apart from internal data @code{mds_message_t}
contains four variables:
@table @asis
@item @code{headers} [@code{char**}]
@vrindex @code{headers}, @code{mds_message_t}
@vrindex @code{mds_message_t.headers}
The headers in the message, each element in this list
as an unparsed header, it consists of both the header
name and its associated value, joined by @w{`: '}. A
header cannot be @code{NULL} (unless its memory
allocation failed,) but @code{headers} itself is
@code{NULL} if there are no headers. The
@code{Length}-header should be included in this list.
@item @code{header_count} [@code{size_t}]
@vrindex @code{header_count}, @code{mds_message_t}
@vrindex @code{mds_message_t.header_count}
The number of headers in the message.
@item @code{payload} [@code{char*}]
@vrindex @code{payload}, @code{mds_message_t}
@vrindex @code{mds_message_t.payload}
The payload of the message, @code{NULL} if none (of
zero-length).
@item @code{payload_size} [@code{size_t}]
@vrindex @code{payload_size}, @code{mds_message_t}
@vrindex @code{mds_message_t.payload_size}
The length of the message's payload. This value will
be the same as the value of the @code{Length}-header.
@end table
There are six methods specific to
@code{mds_message_t}. The @code{this}-parameter's
data type for this methods are @code{mds_message_t*}
with the @code{restrict} modifier.
@table @asis
@item @code{mds_message_initialise} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{mds_message_initialise}
Initialises @code{*this} so that it can be used by
@code{mds_message_read}. Returns zero on and only on
success. On failure you should destroy @code{*this}
using @code{mds_message_destroy}.
@item @code{mds_message_zero_initialise} [(@code{this}) @arrow{} @code{void}]
@fnindex @code{mds_message_zero_initialise}
This method is similar to
@code{mds_message_initialise}, however it cannot fail
and thus have no return value. The difference it is
action is that it will not allocate an internal
buffer.
@item @code{mds_message_extend_headers} [(@code{this, size_t extent}) @arrow{} @code{int}]
@fnindex @code{mds_message_extend_headers}
Ensures that @code{extent} additional headers can be
stored in the @code{*this}. Returns zero on and only
on success.
@item @code{mds_message_read} [(@code{this, int fd}) @arrow{} @code{int}]
@fnindex @code{mds_message_read}
Reads the next message from the socket file descriptor
@code{fd} and stores it in @code{*this}. Returns zero
on success and non-zero on error or interruption.
@code{*this} should be destroyed using
@code{mds_message_destroy} on error but not on
interruption. If @code{-2} is returned @code{errno}
will not have been set; @code{-2} indicates that the
message is malformated, which is a state that cannot
be recovered from.
@item @code{mds_message_compose_size} [(@code{const this}) @arrow{} @code{size_t}]
@fnindex @code{mds_message_compose_size}
This method is to @code{mds_message_compose} as
@code{mds_message_marshal_size} is to
@code{mds_message_marshal}.
@item @code{mds_message_compose} [(@code{const this, char* restrict data}) @arrow{} @code{void}]
@fnindex @code{mds_message_compose}
This method is similar to
@code{mds_message_marshal}. The only difference is
that it will not store internal data and instead
create a message that can be broadcasted in the
display server message passing system.
@end table
@node mds-base.o
@chapter @file{mds-base.o}
@cpindex Servers, library
@cpindex Library, Servers
@cpindex @file{mds-base}
@file{mds-base.c} and @file{mds-base.h} as an object
filepair whose purpose is similar to libmdsserver.
@file{mds-base} is compiled into all @command{mds}
servers and implements common procedures including
@code{main}. It also complements procedures that are
weakly defined, that is, if the server implementation
also defines them, the server implementations
procedure replaces @file{mds-base}'s implementation at
compile-time.
@file{mds-base} defines one function that you can
call from threads you create and functions that should
be implement depending on specified conditions:
@table @asis
@item @code{trap_signals} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{trap_signals}
@cpindex Signals
Set up signal traps for all especially handled
signals. Returns zero on and only on success.
@end table
@file{mds-base} weakly defines functions that you can
replace if they do not suit your needs:
@table @asis
@item @code{parse_cmdline} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{parse_cmdline}
@cpindex Parse command line
@cpindex Command line, parse
Parses command line arguments. Returns zero on and
only on success.
This function will parse the following options:
@table @option
@item --initial-spawn
@opindex @option{--initial-spawn}
It is the first time the server is spawn by its
spawner process.
@item --respawn
@opindex @option{--respawn}
The server was respawned.
@item --re-exec
@opindex @option{--re-exec}
The server is re-executing.
@item --alarm=SECONDS
@opindex @option{--alarm}
@sgindex @code{SIGALRM}
Kill the process after @var{SECONDS} seconds. At most
one minute.
@item --on-init-fork
@opindex @option{--on-init-fork}
Fork the process to detach it from its parent when
the server has been initialised.
@item --on-init-sh=COMMAND
@opindex @option{--on-init-sh}
When the server has been initialised, run the command
@var{COMMAND}@.
@item --immortal
@opindex @option{--immortal}
The server should do its best not to die. For example
do not die if @code{SIGDANGER} is received even if
that is the server's default action.
@end table
@item @code{connect_to_display} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{connect_to_display}
@cpindex Connecting to the display
Connects to the display. Returns zero on and only on
success.
@item @code{server_initialised} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{server_initialised}
@cpindex Initialisation
This function should be called when the server has
been properly initialised but before initialisation
of anything that is removed at forking is initialised.
Returns zero on and only on success.
@item @code{signal_all} [(@code{int signo}) @arrow{} @code{void}]
@fnindex @code{signal_all}
@cpindex Signals, multi-threading
@cpindex Multi-threading, signals
@cpindex Treading, signals
This function should be implemented by the actual
server implementation if the server is multi-threaded.
It sends the singal @code{signo} to all threads
except the current thread.
@item @code{received_danger} [(@code{int signo}) @arrow{} @code{void}]
@fnindex @code{received_danger}
@sgindex @code{SIGDANGER}
@vrindex @code{server_characteristics.danger_is_deadly}
@vrindex @code{danger_is_deadly}, @code{server_characteristics}
@cpindex Memory release, automatic
@cpindex Memory release, forced
@cpindex Automated memory release
@cpindex Forcing memory release
@cpindex Releasing memory
@vrindex @code{danger}
This function is called when a signal that signals the
system is running out of memory has been received.
The exact received signal is specified by the
parameter @code{signo}. When this function is
invoked, the server should free up all memory it can
spare. When this function is invoked, it should set
the variable @code{danger} to a non-zero value. If
@code{server_characteristics.danger_is_deadly} is set,
this function will never be called.
@item @code{received_reexec} [(@code{int signo}) @arrow{} @code{void}]
@fnindex @code{received_reexec}
@vrindex @code{reexecing}
@vrindex @code{terminating}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
This function is called when a signal that signals the
server to re-execute has been received. The exact
received signal is specified by the parameter
@code{signo}. When this function is invoked, it
should set the variables @code{reexecing} and
@code{terminating} to a non-zero value.
@item @code{received_terminate} [(@code{int signo}) @arrow{} @code{void}]
@fnindex @code{received_terminate}
@vrindex @code{terminating}
@cpindex Terminating
@sgindex @code{SIGTERM}
@sgindex @code{SIGINT}
This function is called when a signal that signals the
server to terminate has been received. The exact
received signal is specified by the parameter
@code{signo}. When this function is invoked, it
should set the variable @code{terminating} to a
non-zero value.
@item @code{received_info} [(@code{int signo}) @arrow{} @code{void}]
@fnindex @code{received_info}
@sgindex @code{SIGINFO}
@cpindex State dump
@cpindex Statistics dump
This function is called when a signal that signals the
server to dump state information and statistics has
been received. The exact received signal is specified
by the parameter @code{signo}.
@item @code{fork_cleanup} [(@code{int status}) @arrow{} @code{void}]
@fnindex @code{fork_cleanup}
@vrindex @code{server_characteristics.fork_for_safety}
@vrindex @code{fork_for_safety}, @code{server_characteristics}
@cpindex Initialisation
This function should be implemented by the actual
server implementation if the server has set
@code{server_characteristics.fork_for_safety} to be a
non-zero value. This function is called by the parent
server process when the child server process exits,
if the server has completed its initialisation. The
parameter @code{status} specifies the child process
exit status as returned by @code{waitpid}.
@end table
Additionally, @file{mds-base} expects the server
implementation to define and implement a set of
functions:
@table @asis
@item @code{preinitialise_server} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{preinitialise_server}
@fnindex @code{initialise_server}
@fnindex @code{unmarshal_server}
@cpindex Initialisation
This function will be invoked before
@code{initialise_server} (if not re-executing) or
before @code{unmarshal_server} (if not re-executing).
Returns zero on and only on success.
@item @code{initialise_server} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{initialise_server}
@cpindex Initialisation
This function should initialise the server. It not
invoked after a re-execution. Returns zero on and
only on success.
@item @code{postinitialise_server} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{postinitialise_server}
@fnindex @code{initialise_server}
@fnindex @code{unmarshal_server}
@cpindex Initialisation
This function will be invoked after
@code{initialise_server} (if not re-executing) or
after @code{unmarshal_server} (if re-executing).
Returns zero on and only on success.
@item @code{marshal_server_size} [(@code{void}) @arrow{} @code{size_t}, pure]
@fnindex @code{marshal_server_size}
@fnindex @code{marshal_server}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Calculate and returns the number of bytes that will
be stored by @code{marshal_server}. On failure the
server should call @code{abort} or exit with failure
status by other means. However it should not be
possible for this function to fail.
@code{marshal_server_size} must be pure@footnote{That
is, define with and conforming to
@code{__attribute__((pure))}.}.
@item @code{marshal_server} [(@code{char* state_buf}) @arrow{} @code{int}]
@fnindex @code{marshal_server}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Marshal server implementation specific data into the
buffer @code{state_buf}. Returns zero on and only on
success.
@item @code{unmarshal_server} [(@code{char* state_buf}) @arrow{} @code{int}]
@fnindex @code{unmarshal_server}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Unmarshal server implementation specific data from the
buffer @code{state_buf} and update the servers state
accordingly. Returns zero on and only on success.
@fnindex @code{reexec_failure_recover}
On critical failure the program should call
@code{abort} or exit with failure status by other
means. That is, do not let
@code{reexec_failure_recover} run successfully, if it
unrecoverable error has occurred or one severe enough
that it is better to simply respawn.
@item @code{reexec_failure_recover} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{reexec_failure_recover}
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Attempt to recover from a re-execution failure that
has been detected after the server successfully
updated it execution image. Returns zero on and only
on success.
@item @code{master_loop} [(@code{void}) @arrow{} @code{int}]
@fnindex @code{master_loop}
@cpindex Initialisation
Perform the server's mission. Returns zero on and
only on success.
@end table
@file{mds-base} also defines a number of global
variables.
@table @asis
@item @code{argc} [@code{int}]
@vrindex @code{argc}
@cpindex Command line
Number of elements in @code{argv}.
@item @code{argv} [@code{char**}]
@vrindex @code{argv}
@cpindex Command line
Command line arguments.
@item @code{is_respawn} [@code{int}]
@vrindex @code{is_respawn}
@cpindex Initialisation
@vrindex @code{is_reexec}
Whether the server has been respawn rather than this
being the initial spawn. This will be at least as true
as @code{is_reexec}.
@item @code{is_reexec} [@code{int}]
@vrindex @code{is_reexec}
@cpindex Initialisation
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
Whether the server is continuing from a
self-reexecution.
@item @code{is_immortal} [@code{int}]
@vrindex @code{is_immortal}
@opindex @option{--immortal}
Whether the server should do its best to resist event
triggered death.
@item @code{on_init_fork} [@code{int}]
@vrindex @code{on_init_fork}
@cpindex Initialisation
Whether to fork the process when the server has been
properly initialised.
@item @code{on_init_sh} [@code{char*}]
@vrindex @code{on_init_sh}
@cpindex Initialisation
Command the run (@code{NULL} for none) when the server
has been properly initialised.
@item @code{master_thread} [@code{pthread_t}]
@vrindex @code{master_thread}
@cpindex Threading
@cpindex Multi-threading
The thread that runs the master loop.
@item @code{terminating} [@code{volatile sig_atomic_t}]
@vrindex @code{terminating}
@cpindex Terminating
Whether the server has been signaled to terminate.
@item @code{reexecing} [@code{volatile sig_atomic_t}]
@vrindex @code{reexecing}
@cpindex Initialisation
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
Whether the server has been signaled to re-execute.
@item @code{danger} [@code{volatile sig_atomic_t}]
@vrindex @code{danger}
@sgindex @code{SIGDANGER}
@cpindex Memory release, automatic
@cpindex Memory release, forced
@cpindex Automated memory release
@cpindex Forcing memory release
@cpindex Releasing memory
Whether the server has been signaled to free unneeded
memory.
@item @code{socket_fd} [@code{int}]
@vrindex @code{socket_fd}
@cpindex Connecting to the display
The file descriptor of the socket that is connected
to the server.
@end table
@cpindex Server characteristics
@file{mds-base} expects the server implementation to
define a variable that specifies how @file{mds-base}
should behave:
@table @asis
@item @code{server_characteristics} [@code{server_characteristics_t}]
@vrindex @code{server_characteristics}
This variable should declared by the actual server
implementation. It must be configured before
@code{main} is invoked. That is, it should be
configured by a constructor. If it is configured at
its definition, it is configured by a constructor;
that is normally how you want to configured it.
@end table
@tpindex @code{server_characteristics_t}
@tpindex @code{struct server_characteristics}
@code{server_characteristics_t} @{also known as
@code{struct server_characteristics}@} is a packed
@footnote{That is, define with @code{__attribute__((packed))}.} with the following fields:
@table @asis
@item @code{require_privileges} [@code{unsigned : 1}]
@vrindex @code{require_privileges}
@cpindex Previleges
@cpindex Security, previleges
Setting this to zero will cause the server to drop
privileges as a security precaution.
@item @code{require_display} [@code{unsigned : 1}]
@vrindex @code{require_display}
@cpindex Connecting to the display
Setting this to non-zero will cause the server to
connect to the display.
@item @code{require_respawn_info} [@code{unsigned : 1}]
@vrindex @code{require_respawn_info}
@opindex @option{--initial-spawn}
@opindex @option{--respawn}
@cpindex Initialisation
Setting this to non-zero will cause the server to
refuse to start unless either @option{--initial-spawn}
or @option{--respawn} is used.
@item @code{sanity_check_argc} [@code{unsigned : 1}]
@vrindex @code{sanity_check_argc}
@cpindex Command line, security
@cpindex Security, command line
Setting this to non-zero will cause the server to
refuse to start if there are too many command line
arguments.
@item @code{fork_for_safety} [@code{unsigned : 1}]
@vrindex @code{fork_for_safety}
@cpindex Initialisation
@fnindex @code{fork_cleanup}
Setting this to non-zero will cause the server to
place itself in a fork of itself when initialised.
This can be used to let the server clean up fatal
stuff after itself if it crashes. When the child
exits, no matter how it exits, the parent will call
@code{fork_cleanup} and then die in the same manner
as the child.
@item @code{danger_is_deadly} [@code{unsigned : 1}]
@vrindex @code{danger_is_deadly}
@sgindex @code{SIGDANGER}
@vrindex @code{fork_for_safety}
@fnindex @code{server_initialised}
@cpindex Memory release, automatic
@cpindex Memory release, forced
@cpindex Automated memory release
@cpindex Forcing memory release
@cpindex Releasing memory
Setting this to non-zero without setting a signal
action for @code{SIGDANGER} will cause the server to
die if @code{SIGDANGER} is received. It is safe to
set both @code{danger_is_deadly} and
@code{fork_for_safety} to non-zero, during the call
of @code{server_initialised} the signal handler for
@code{SIGDANGER} in the parent process will be set to
@code{SIG_IGN} independently of the value of
@code{danger_is_deadly} if @code{fork_for_safety} is
set to non-zero.
@opindex @option{--immortal}
This setting will be treated as set to zero if
@option{--immortal} is used.
@end table
@node libmdsclient
@chapter libmdsclient
@cpindex Clients, library
@cpindex Library, clients
libmdsclient is a library written for @code{mds}
clients. But can also be used for @code{mds} servers.
However, reference servers use libmdsserver
(@pxref{libmdsserver}.)
@cpindex @command{pkg-config}
@pgindex @command{pkg-config}
To use libmdsclient, include @file{<libmdsclient.h>}
in your source files. @file{<libmdsclient.h>} includes
all libmdsclient headers; you may cherrypick them if
you so choose. When compiling and linking your programs,
use the @command{pkg-config} package @code{libmdsclient}.
Definitions@footnote{Structures, unions, enumerations,
type-definitions, functions, macros and variables.} in
libmdsclients use the prefixes @code{libmds_} and
@code{LIBMDS_}@footnote{@code{LIBMDS_} is reserved for
macros, but function-like macros and lvalue-macros use
@code{libmds_}.}, rather than @code{libmdsclient_} and
@code{LIBMDSCLIENT_}. This is to make the identifiers
shorter. Inclusion-guards are formatted
@code{MDS_LIBMDSCLIENT_*_H}.
libmdsclient is not yet capable of state marshalling
which is required for online updating to newer versions
of the client.
@menu
* Protocol Utilties:: Low-level functions for implementing protocols.
* Communication Utilities:: Low-level communication functions.
* Receiving Messages:: Low-level functions for receiving messages.
@end menu
@node Protocol Utilties
@section Protocol Utilties
@cpindex Implementing protocols
@cpindex Protocols, implementing
The header file @file{<libmdsclient/proto-util.h>}
provides functions that can be used in implementing
protocols. Using these functions will make it easy
to implement the protocol, the implementing may
however be more efficient if you implement everything
by hand. In particular, protocols that are expected
to be used very often with similar data may be faster
if implemented using caching techniques.
The header file provides a function for retrieving
header files of interest:
@table @asis
@item @code{libmds_headers_cherrypick} [(@code{char** restrict headers, size_t header_count, size_t* restrict found, libmds_cherrypick_optimisation_t optimisation, ...}) @arrow{} @code{int}]
@fnindex @code{libmds_headers_cherrypick}
@cpindex Headers, cherrypicking
@cpindex Cherrypicking headers
@cpindex Headers, reading
@cpindex Reading headers
This function takes an list of headers as input. The
headers are provided by the parameter @code{headers},
and the number of headers is specified by the parameter
@code{header_count}. These headers must include both
the names and values. For example:
@example
headers = (char[][]) @{
"Client ID: 0:1",
"Message ID: 12",
@};
@end example
The function will store the number headers it found
to @code{*found}, unless @code{found} is @code{NULL}.
Only requested headers are counted.
The function can use optimisations based on the input
The parameter @code{optimisation} is used to provide
hints required for optimal optimisation.
@tpindex @code{libmds_cherrypick_optimisation_t}
@tpindex @code{enum libmds_cherrypick_optimisation}
@code{optimisation} is defined with the type
@code{libmds_cherrypick_optimisation_t} @{also known as
@code{enum libmds_cherrypick_optimisation}@}. Values of
@code{optimisation} should combine, using bit-wise OR,
two values defined in @code{libmds_cherrypick_optimisation_t}.
One of the values should be from the header input
optimisation group:
@table @code
@item DO_NOT_SORT = 0
@code{headers} is neither sorted nor may it its
elements be reordered. However, the function may
choose to create a copy of @code{headers} and
sort that copy, if it sees it as beneficial.
@item SORT
@code{headers} is not sorted, but the function
may sort it without copying it, if it sees it as
beneficial.
@item SORTED
@code{headers} is already sorted in ascending
order. This means that the function will not
reorder its elements.
@end table
The other value should be from the header request
optimisation group:
@table @code
@item ARGS_UNSORTED = 0
The header request list is not sorted.
@item ARGS_SORTED
The header request list is sorted in ascending order.
@end table
Note that @code{DO_NOT_SORT} and @code{ARGS_UNSORTED}
are both guaranteed to have the value 0. The other
definitions do not have a guaranteed value, but they
are guaranteed to be unique and only consist of one
set bit.
The variadic arguments are used for the header request
list. The first argument in the variadic argument list
should be a @code{const char*} that names a requested
header. It should only contain the name of the header.
The follow argument should be of the type @code{char**}.
The first element in this argument will be set the
the value of the header named by the previous argument,
or @code{NULL} if not found. This, pair of arguments,
is repeated once for every requested header. The end
of the variadic argument list must be marked with a
@code{NULL}. For example:
@example
char* recv_client_id;
char* recv_message_id;
char* recv_command_id;
r = libmds_headers_cherrypick(headers, n, NULL, 0,
/* Header request starts here */
"Client ID", &recv_client_id,
"Message ID", &recv_message_id,
"Command", &recv_command,
NULL);
@end example
The function's behaviour is undefined for if a header
is requested more than once, or in an order contrary
to the specifications provided by @code{optimisation}.
The function's behaviour is also undefined if the input
headers are in an order contrary to the specifications
provided by @code{optimisation}.
Upon successful completion, even if no requested headers
are found, this function returned zero. On error, @code{-1}
is returned and @code{errno} is set to indicate the error.
This function can fail with errno set to @code{ENOMEM},
if the process cannot allocate required memory.
The call must not free returned header values. They are
freed automatically when corresponding element in the
header input list is freed. The input headers are returned
with an offset. This also means that the returned values
will be modified if the value part of the input headers are
modified.
@end table
The header file also provides four pre-optimised version
of @code{libmds_headers_cherrypick}. These functionf behaves
like @code{libmds_headers_cherrypick}, except they does not
have the optimisation parameter, and return the number of
found headers rather than storing it using a pointer.
Additionally these function cannot fail.
@table @asis
@item @code{libmds_headers_cherrypick_linear_unsorted} [(@code{char** restrict headers, size_t header_count, ...}) @arrow{} @code{size_t}]
@fnindex @code{libmds_headers_cherrypick_linear_unsorted}
This function is not optimised. Because of its low overhead
it can still be the fastest choice.
@item @code{libmds_headers_cherrypick_linear_sorted} [(@code{char** restrict headers, size_t header_count, ...}) @arrow{} @code{size_t}]
@fnindex @code{libmds_headers_cherrypick_linear_sorted}
This function uses linear search, but uses an optimised based
on the assumption that both the input header list and the
header request list are sorted in ascending order. Because of
its low overhead it can still be faster than
@code{libmds_headers_cherrypick_binary_sorted}.
@item @code{libmds_headers_cherrypick_binary_unsorted} [(@code{char** restrict headers, size_t header_count, ...}) @arrow{} @code{size_t}]
@fnindex @code{libmds_headers_cherrypick_binary_unsorted}
This function uses binary search. It assumes that the
header input list sorted in ascending order, header request
list is unsorted.
@item @code{libmds_headers_cherrypick_binary_sorted} [(@code{char** restrict headers, size_t header_count, ...}) @arrow{} @code{size_t}]
@fnindex @code{libmds_headers_cherrypick_binary_sorted}
This function uses binary search. It assumes that the
both the header input list and header request list are
sorted in ascending order. It seeks for the headers in
the order the are provided in the header request list,
and adjusts the lower bound on the binary search each
time it founds a header.
@end table
Currently it is assumed that these are the only useful
optimisations. This may however change in the future,
and some optimisations may even be removed. Therefore
the user of the library can check at compile time whether
the functions are still available. This is done by checking
that a macro with exactly the same name as the function
is defined.
@cpindex Sorting headers
@cpindex Headers, sorting
If you want to sort a list of headers. You need to be
aware that the header should treated as ending at the
first occurrence of a colon followed by a blank space.
Because of this, @file{<libmdsclient/proto-util.h>}
provides a function for sorting a list of headers.
@table @asis
@item @code{libmds_headers_sort} [(@code{char** restrict headers, size_t header_count}) @arrow{} @code{void}]
@fnindex @code{libmds_headers_sort}
This function takes the list of headers in the parameter
@code{headers} and the number of headers in the parameter
@code{header_count}. It cannot fail, and thus does not
return a value.
This function sorts the headers in ascending order,
and is used internally by @code{libmds_headers_cherrypick}
if it chooses to sort headers.
@end table
@file{<libmdsclient/proto-util.h>} also provides a function
for composing messages:
@table @asis
@item @code{libmds_compose} [(@code{char** restrict buffer, size_t* restrict buffer_size, size_t* restrict length, const char* restrict payload, const size_t* restrict payload_length, ...}) @arrow{} @code{int}]
@fnindex @code{libmds_compose}
@cpindex Messages, composing
@cpindex Composing messages
@cpindex Messages, writting
@cpindex Writting messages
This function provides a simple way for writting message
that can be send to the display server. The function writes
the message on a buffer provides by the caller. This buffer
is reallocationed by the function if necessary.
The buffer is provided by a pointer, @code{buffer} to the
buffer. @code{*buffer} is changed to the new buffer pointer
if it is reallocated. The current size of @code{*buffer}
should be stored @code{*buffer_size}. @code{*buffer_size}
will be updated with the new allocation size if the buffer
is reallocated. Neither if these pointers may be @code{NULL}.
However, @code{*buffer} should be @code{NULL} if
@code{*buffer_size} is zero, and vice versa.
The length of the written message will be saved to
@code{length}. @code{length} must not be @code{NULL}.
If the message should include a payload. It should be
provided using the parameter @code{payload}. If the message
should not have a payload @code{payload} should be @code{NULL}.
The argument @code{payload_length} should point to a value
with the length of the message, or be @code{NULL} if the
function should measure the @code{payload} by searching for
a NUL bytes which must exists in such a cass. If
@code{payload_length} is not @code{NULL}, there is not
requirement for a NUL byte. If @code{payload} is @code{NULL},
@code{payload_length} is unused and may have any value.
The function uses variadic arguments for header input.
The first argument in the variadic argument list should
be an @code{printf}-formatted format-string that describes
a header line (header name, colon, blank space, header value.)
The following arguments are the formatting-arguments for that
format string. At the end of the list of formatting-arguments,
this is begin anew for the next header, and so on. After the
last header, a @code{NULL} should be used to mark the end of
the list. The header formatting string, may include any
extensions provided by your C library. Nut is has one additional
extension: if the formatting-string begins with a question mark,
the first formatting-argument is if type @code{int} and the
header is only included if that argument is non-zero.
This is no way to escape a question mark at the beginning of
the formatting-string, because headers should never begin
with a question mark.
Upon successful completion, this function returns zero.
On error, this function returns @code{-1} and sets @code{errno}
to indicate the error.
This function may fail with @code{errno} set to @code{ENOMEM}
if the process cannot allocate more memory.
The function's behaviour is undefined if a header is longer than
@iftex
2@sup{15}
@end iftex
@ifnottex
2 to the power of 15
@end ifnottex
bytes.
This function shall not be used if there must be a guarantee
that the written data can be securely erased.
@end table
The header file also provides a function for finding the
next unused message ID:
@table @asis
@item @code{libmds_next_message_id} [(@code{uint32_t* restrict message_id, int (*test)(uint32_t message_id, void* data), void* data}) @arrow{} @code{int}]
The parameter @code{message_id} is a pointer to the message
ID counter. It should contain the ID of the previous
message,@footnote{For the first message, it is preferred
that this value is @code{UINT32_MAX}, so the first message
is the ID 0, but it is not a requirement, it should however
be initialised.} it will be updated with the message ID
for the new message upon successful completion.
@code{message_id} must not be @code{NULL}.
The parameter @code{test} can either point to a function
that is used to test if a message ID is unused, or be
@code{NULL} if no testing should be done. @code{*test}
tests whether the message ID provided as the first
argument is free to be used. The second argument in
@code{*test} will be the value of the parameter @code{data}
in the call to the function @code{libmds_next_message_id}.
@code{data} can e used to deal with threading or any other issues.
@code{data} may be @code{NULL}. @code{data} is unused if
@code{test} is @code{NULL}.
Upon successful completion zero is returned. On error
@code{-1} is returned and @code{errno} is set to indicate
the error.
This function can fail with errno set to any error thrown
by @code{*test}, as well as @code{EAGAIN}. @code{EAGAIN}
is thrown if the function cannot find any free message ID
to use. It is advisable to make @code{*test} throw this
immediately if there are no free message ID:s.
The function cannot fail if @code{test} is @code{NULL}.
@end table
@fnindex @code{libmds_headers_cherrypick_v}
@fnindex @code{libmds_headers_cherrypick_linear_unsorted_v}
@fnindex @code{libmds_headers_cherrypick_linear_sorted_v}
@fnindex @code{libmds_headers_cherrypick_binary_unsorted_v}
@fnindex @code{libmds_headers_cherrypick_binary_sorted_v}
@fnindex @code{libmds_compose_v}
All functions that uses variadic arguments, have a variant
that uses @code{va_list} instead. These functions are suffixed
@code{_v}.
@node Communication Utilities
@section Communication Utilities
@cpindex Communication foundation
The header file @file{<libmdsclient/comm.h>} provides
functions for connecting to the display server and
performing thread-safe communication.
@cpindex Descriptor, connection
@cpindex Connection descriptor
@tpindex @code{libmds_connection_t}
@tpindex @code{struct libmds_connection}
These functions use the structured @code{libmds_connection_t}.
@{also known as @code{struct libmds_connection}@}. Instances
of this structure are referred to as connection descriptors.
This structure should be considered opaque.
For these functions, the @code{this} parameter has the
type @code{libmds_connection_initialise* restrict}.
@table @asis
@item @code{libmds_connection_initialise} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{libmds_connection_initialise}
Initialises a connection descriptor, but does not connect
it to the display server.
Upon successful completion, zero is returned. On error,
@code{-1} is returned and @code{errno} is set to indicate
the error.
This function may fail with @code{errno} set to
@code{EAGAIN}, @code{ENOMEM} or @code{EPERM}, as
specified for @code{pthread_mutex_init(3)}.
@item @code{libmds_connection_create} [(@code{void}) @arrow{} @code{libmds_connection_t*}]
@fnindex @code{libmds_connection_create}
Wrapper for @code{libmds_connection_initialise} that
also allocates the connection descriptor.
Upon successful completion, the descriptor is returned.
On error, @code{NULL} is returned and @code{errno} is
set to indicate the error.
This function may fail for any reason, with @code{errno}
is to the same value, as @code{libmds_connection_initialise}.
It may also fail with @code{errno} set to @code{ENOMEM} if
the descriptor cannot be allocated. This is, on memory
exhaustion.
@item @code{libmds_connection_destroy} [(@code{this}) @arrow{} @code{void}]
@fnindex @code{libmds_connection_destroy}
Release all resources held by a connection descriptor.
This also means that the connection to the display
server will close. Nothing will happen if @code{this}
is @code{NULL}.
@item @code{libmds_connection_free} [(@code{this}) @arrow{} @code{void}]
@fnindex @code{libmds_connection_free}
Wrapper for @code{libmds_connection_destroy} that also
calls @code{free} on the descriptor to deallocate the
descriptor itself.
@item @code{libmds_connection_establish} [(@code{this, const char** restrict display}) @arrow{} @code{int}]
@fnindex @code{libmds_connection_establish}
Establishes a connection to the display server.
It is preferred to use @code{libmds_connection_establish_address},
over using @code{libmds_connection_establish}.
@code{display} must either be a pointer to a string,
or a pointer to @code{NULL}. It pointer @code{display}
itself must not be @code{NULL}. If @code{display} points
to @code{NULL}, it will be update with the value of
the environment variable @env{MDS_DISPLAY}, or left
@code{NULL} if not set.
This function will parse value @code{display} points
to (after it has been updated if it points to @code{NULL},)
and attempt to connect to the display server it addresses.
Upon successful completetion, zero is returned. On error,
@code{-1} is returned and @code{errno} is set to indicate
the error.
This function may fail with @code{errno} set to @code{EFAULT}
if @env{MDS_DISPLAY} is not set (if @code{display} pointed
to, and will in such case still point to, @code{NULL}, or
if the display server's address is not properly formatted,
or specifies an unsupported protocol. It may also fail with
@code{errno} set to @code{ENAMETOOLONG} if the pathname of
the display server's socket is too long. The function may
also fail with any value on @code{errno} specified for
@code{socket(2)} or @code{connect(2)}, except @code{EINTR}.
@item @code{libmds_connection_establish_address} [(@code{this, const libmds_display_address_t* restrict address}) @arrow{} @code{int}]
@fnindex @code{libmds_connection_establish_address}
This function is an alternative to @code{libmds_connection_establish},
which is preferred because it is easier to find out
why it potentially failed. And it can be done reliably.
Instead of a pointer to a string formated as @env{MDS_DISPLAY},
or a pointer to @code{NULL}. This function takes a, by
@code{libmds_parse_display_address}, preparsed address.
Upon successful completetion, zero is returned. On error,
@code{-1} is returned and @code{errno} is set to indicate
the error.
This function may fail with @code{errno} set to @code{EFAULT}
if the address is not full set, this can happen even if
@code{libmds_parse_display_address} returns successfully;
it means that the display server address is not properly
formatted or specifies an unsupported protocol. This function
may also fail with any value on @code{errno} specified for
@code{socket(2)} or @code{connect(2)}, except @code{EINTR}.
@item @code{libmds_connection_send} [(@code{this, const char* restrict message, size_t length}) @arrow{} @code{size_t}]
@fnindex @code{libmds_connection_send}
This function locks a connection descriptor and --- when
it is entered the lock --- it will send a message to the
display server over the connection, and ignores all
interrupts.
The message is specified by the parameter @code{message},
and this length is specified by the parameter @code{length}.
Note that this function treats @code{message} as a raw
memory segment rather than as a NUL-terminated string.
Undefined behaviour is invoked if @code{message} is
@code{NULL} or if @code{length} is zero.
Upon successful completeion, the number of sent bytes
are returned. On error, zero is returned and @code{errno}
is set to indicate the error.
This function may fail with errno set to any error
specified for @code{pthread_mutex_lock(3)}, or any
of the errors @code{EACCES}, @code{EWOULDBLOCK} (but
only if the socket has been modified to be nonblocking,)
@code{EBADF}, @code{ECONNRESET} --- if connection to
the display server is lost, --- @code{EDESTADDRREQ},
@code{EFAULT}, @code{EINVAL}, @code{ENOBUFS}, @code{ENOMEM},
@code{ENOTCONN}, @code{ENOTSOCK} or @code{EPIPE}, as
specified for @code{send(2)}.
@item @code{libmds_connection_send_unlocked} [(@code{this, const char* restrict message, size_t length, int continue_on_interrupt}) @arrow{} @code{size_t}]
@fnindex @code{libmds_connection_send_unlocked}
Variant of @code{libmds_connection_send} that does
not perform a lock on the connection descriptor.
This is not intended for single-threaded programs,
rather, it is intended to be used instead of
@code{libmds_connection_send} if the thread already
holds a lock on the connection descriptor.
This function is otherwise identical to
@code{libmds_connection_send}, except it has one
additional parameter: @code{continue_on_interrupt},
and cannot fail because of failure to call
@code{pthread_mutex_lock}. It can however also fail
with @code{errno} set to @code{EINTR} if
@code{continue_on_interrupt} is zero.
The function will continue sending the message
if it gets interrupted by a signal only if
@code{continue_on_interrupt} is non-zero.
@end table
@file{<libmdsclient/comm.h>} also provides a few
macros for use with connection descriptors.
For these macros, the @code{this} parameter has the
type @code{libmds_connection_initialise* restrict}.
@table @asis
@item @code{libmds_connection_lock} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{libmds_connection_lock}
Wrapper for @code{pthread_mutex_lock} that locks
@code{this}'s mutex. One difference from the wrapped
function, is that rather than returning a value for
@code{errno}, it sets @code{errno} and returns zero
on success and @code{-1} on failure.@footnote{POSIX
threading and reenterant functions has a weird
property of returning an error code rather than
setting it on @code{errno}, despite that all other
C functions sets @code{errno} (provided that they
have error codes specified in @file{<errno.h>}.)}
@item @code{libmds_connection_trylock} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{libmds_connection_trylock}
Wrapper for @code{pthread_mutex_trylock} that locks
@code{this}'s mutex. One difference from the wrapped
function, is that rather than returning a value for
@code{errno}, it sets @code{errno} and returns zero
on success and @code{-1} on failure.
@item @code{libmds_connection_timedlock} [(@code{this, const struct timespec *restrict deadline}) @arrow{} @code{int}]
@fnindex @code{libmds_connection_timedlock}
Wrapper for @code{pthread_mutex_timedlock} that locks
@code{this}'s mutex. One difference from the wrapped
function, is that rather than returning a value for
@code{errno}, it sets @code{errno} and returns zero
on success and @code{-1} on failure.
Neither parameter may be @code{NULL}.
@item @code{libmds_connection_unlock} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{libmds_connection_unlock}
Wrapper for @code{pthread_mutex_unlock} that unlocks
@code{this}'s mutex. One difference from the wrapped
function, is that rather than returning a value for
@code{errno}, it sets @code{errno} and returns zero
on success and @code{-1} on failure.
@item @code{LIBMDS_HEADER_CLIENT_ID} [(@code{this})]
@fnindex @code{LIBMDS_HEADER_CLIENT_ID}
@fnindex @code{libmds_compose}
Macro to be used with @code{libmds_compose}, to
add the connection's client ID to a message.
@item @code{LIBMDS_HEADER_MESSAGE_ID} [(@code{this})]
@fnindex @code{LIBMDS_HEADER_MESSAGE_ID}
@fnindex @code{libmds_next_message_id}
Macro to be used with @code{libmds_compose}, to
add the connection's next message ID to a message.
@code{libmds_next_message_id} shall have been called
prior to using this macro.
@item @code{LIBMDS_HEADERS_STANDARD} [(@code{this})]
@fnindex @code{LIBMDS_HEADERS_STANDARD}
Macro that can be used in place of using both
@code{LIBMDS_HEADER_CLIENT_ID} and
@code{LIBMDS_HEADER_MESSAGE_ID}.
@end table
@file{<libmdsclient/comm.h>} includes @file{<libmdsclient/address.h>},
with defines the structure @code{libmds_display_address_t}
@{also known as @code{struct libmds_display_address}@},
and the function @code{libmds_parse_display_address}.
@tpindex @code{libmds_display_address_t}
@tpindex @code{struct libmds_display_address}
@code{libmds_display_address_t} holds parsing results
from @code{libmds_parse_display_address}. Its members
are:
@table @asis
@item @code{domain} [@code{int}]
@vrindex @code{domain}, @code{libmds_display_address_t}
@vrindex @code{libmds_display_address_t.domain}
The domain (protocol family), that is the first
argument for @code{socket(2)}. This is a value
whose constant is prefixed @code{PF_}.@footnote{It
is common to use @code{AF_}-constants instead,
however this practice is not portable.}
@code{-1} if not detected.
@item @code{type} [@code{int}]
@vrindex @code{type}, @code{libmds_display_address_t}
@vrindex @code{libmds_display_address_t.type}
The socket type, that is the second argument
for @code{socket(2)}. This is a value
whose constant is prefixed @code{SOCK_}.
@code{-1} if not detected.
@item @code{protocol} [@code{int}]
@vrindex @code{protocol}, @code{libmds_display_address_t}
@vrindex @code{libmds_display_address_t.protocol}
The protocol, that is the third argument
for @code{socket(2)}. This is a value
whose constant is affixed @code{PROTO_}.
Zero can be used for the default protocol.
For example, for stream IP sockets, the protocol
can only be TCP, thus zero would indicate
@code{IPPROTO_TCP}.
@code{-1} if not detected.
@item @code{address} [@code{struct sockaddr*}]
@vrindex @code{address}, @code{libmds_display_address_t}
@vrindex @code{libmds_display_address_t.address}
The address. @code{NULL} if not detected.
You are responsible for freeing this.
@item @code{address_len} [@code{socklen_t}]
@vrindex @code{address_len}, @code{libmds_display_address_t}
@vrindex @code{libmds_display_address_t.address_len}
The allocation size of @code{.address}.
This value may be set even if @code{address}
is @code{NULL}.
@item @code{gai_error} [@code{int}]
@vrindex @code{gai_error}, @code{libmds_display_address_t}
@vrindex @code{libmds_display_address_t.gai_error}
Code for an error that has occured when parsing
the address, whose description can be retrieved
using @code{gia_strerror}, zero if none.
@end table
@fnindex @code{libmds_parse_display_address}
The function @code{libmds_parse_display_address}
is used to parse the a display address string:
@table @asis
@item @code{libmds_parse_display_address} [(@code{const char* restrict display, libmds_display_address_t* restrict address}) @arrow{} @code{int}]
@code{display} should be the address of the display
server, formatted as a value for @env{MDS_DISPLAY}.
The address of the display will be stored in @code{*address}.
Neither parameter may be @code{NULL}.
Upon successful completion, zero is returned. On error,
@code{-1} is returned and errno is set to indicate the
error. Parsing-failure is not considered an error,
instead data that could not retrieved from the address
string will be set to @code{-1} or @code{NULL}.
This function may fail with @code{errno} set to
@code{ENOMEM} on memory exhaustion, or @code{ENAMETOOLONG}
if the addressed socket's filename is too long.
@end table
@node Receiving Messages
@section Receiving Messages
@cpindex Communication foundation
@cpindex Messages, receiving
@cpindex Messages, inbound
@cpindex Receiving messages
@cpindex Inbound messages
libmdsclient's low-level facilities for receiving
messages are found in the header file
@file{<libmdsclient/inbound.h>}. These facilites
are thread-safe.
The header file defines three structures:
@table @asis
@item @code{libmds_message_t} @{also known as @code{struct libmds_message}@}
@tpindex @code{libmds_message_t}
@tpindex @code{struct libmds_message}
Messages sent between clients@footnote{Including
servers.}, are stored in this format when received.
It holds information pointers to the headers and
the payload in a message.
@item @code{libmds_mspool_t} @{also known as @code{struct libmds_mspool}@}
@tpindex @code{libmds_mspool_t}
@tpindex @code{struct libmds_mspool}
@cpindex Message spools
@cpindex Spools, messages
@cpindex Communication, multithreaded
@cpindex Multithreaded communication
@cpindex Threaded communication
A queue structured spool of received messages, to
be parsed and acted upon by other threads. Although
a stack structure would be more efficient, this
must be a queue. The reason for this is that it
sometimes is important the mesages are parsed in
the order they were sent.
@item @code{libmds_mpool_t} @{also known as @code{struct libmds_mpool}@}
@tpindex @code{libmds_mpool_t}
@tpindex @code{struct libmds_mpool}
@cpindex Message allocation pools
@cpindex Pools, message allocations
@cpindex Memory allocation resue
@cpindex Reuse of allocations
This structures provides an efficient way to
reuse allocations of messages, so that the
process does not need to perform the costly
procedure of allocating memory. This is
referred to as an allocation pool. This
structures implements a specialision for
messages: a message allocation pool, or
message pool for short. The pool is stack-based.
@end table
@tpindex @code{libmds_message_t}
@tpindex @code{struct libmds_message}
The members of the structure @code{libmds_message_t} are:
@table @asis
@item @code{headers} [@code{char**}]
@vrindex @code{headers}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.headers}
Array of all headers in the messages, include
the @code{Length}-header. The headers are never
@code{NULL}, and are unparsed. Unparsed means
that the name of the header and its value is
stored as one string: the header's name, a colon,
a blank space, the header's value, and a NUL
byte that terminates the header.
This member is @code{NULL} if there are no
headers. This member's elements must not be
freed, they are subpointers of @code{.buffer}.
@item @code{header_count} [@code{size_t}]
@vrindex @code{header_count}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.header_count}
The number of headers, that is, the number
of elements in @code{.headers}.
@item @code{payload} [@code{char*}]
@vrindex @code{payload}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.payload}
The payload in the message. This member is
@code{NULL} if there is no payload in the message.
This is a raw memory segment, it is not terminated
by a NUL byte. This member must not be freed,
it is a subpointer of @code{.buffer}.
@item @code{payload_size} [@code{size_t}]
@vrindex @code{payload_size}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.payload_size}
The length of @code{payload}. Zero if there
is no payload. This value holds the value
of the @code{Length}-header.
@item @code{buffer} [@code{char*}]
@vrindex @code{buffer}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.buffer}
Read buffer, for the message. The entire
message is stored in this buffer. The member
is intended for internal use only.
@item @code{buffer_size} [@code{size_t}]
@vrindex @code{buffer_size}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.buffer_size}
The allocation size of @code{.buffer}.
The member is intended for internal use only.
@item @code{buffer_ptr} [@code{size_t}]
@vrindex @code{buffer_ptr}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.buffer_ptr}
The number of bytes written to @code{.buffer}.
The member is intended for internal use only.
@item @code{buffer_off} [@code{size_t}]
@vrindex @code{buffer_off}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.buffer_off}
The number of parsed by from @code{.buffer}.
The member is intended for internal use only.
@item @code{flattened} [@code{size_t}]
@vrindex @code{flattened}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.flattened}
If zero, @code{.headers} and @code{.buffer}
pointers that can be freed. Otherwise,
@code{.headers} and @code{.buffer} are
subpointers of the instance of the structure
itself, which means the the object is actually
larger than @code{sizeof(libmds_message_t)},
which arrays of such objects must@footnote{Lest
you want to make really ugly code.} be arrays
of pointer. If this member is non-zero, it
specifies the allocation size of the message
object. The member is intended for internal
use only.
@item @code{stage} [@code{int}]
@vrindex @code{stage}, @code{libmds_message_t}
@vrindex @code{libmds_message_t.stage}
Specifies the state of the message parsing.
The member is intended for internal use only.
@end table
@tpindex @code{libmds_mspool_t}
@tpindex @code{struct libmds_mspool}
The members of the structure @code{libmds_mspool_t} are:
@table @asis
@item @code{message} [@code{libmds_message_t**}]
@vrindex @code{message}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.message}
Array of spooled message. The member is intended
for internal use only.
@item @code{size} [@code{size_t}]
@vrindex @code{size}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.size}
The number of elements @code{.message} is allocated
to hold. The member is intended for internal use only.
@item @code{head} [@code{size_t}]
@vrindex @code{head}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.head}
The index of the next message to be pushed to
the queue. The member is intended for internal
use only.
@item @code{tail} [@code{size_t}]
@vrindex @code{tail}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.tail}
The index of the next message to be polled from
the queue. The member is intended for internal
use only.
@item @code{spooled_bytes} [@code{size_t}]
@vrindex @code{spooled_bytes}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.spooled_bytes}
The sum of the sizes of all spooled messages.
The member is intended for internal use only.
@item @code{spool_limit_bytes} [@code{size_t}]
@vrindex @code{spooled_limit_bytes}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.spooled_limit_bytes}
The spooler may only spool message when this
value is larger than @code{.spooled_bytes}.
It is a restriction on the amount of memory
can be spooled in form of messages.
The spooling function blocks until this
limit is not longer reached. It should be
noted that the limit can be exceeded by one
message, but only if the limit has not already
been reached, this is because it would otherwise
not be possible to spool messages larger than
the limit, causing a deadlock.
@item @code{spool_limit_messages} [@code{size_t}]
@vrindex @code{spooled_limit_messages}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.spooled_limit_messages}
This is similar to @code{.spool_limit_bytes},
but it measures the number of message rather
than their size.
@item @code{please_post} [@code{int}]
@vrindex @code{please_post}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.please_post}
The spooling function increases this number
by one, if enters an blocked state, and the
pooler decreases it when it has signaled the
spooler to stop waiting and try again. It
counts the number of blocked spoolers.
The member is intended for internal use only.
@item @code{lock} [@code{sem_t}]
@vrindex @code{lock}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.lock}
This is a binary semaphore, with 1 as its
initial value, that is used to lock the spool
when it is being used. It is a non-reenterant
mutex. The member is intended for internal use
only.
@item @code{semaphore} [@code{sem_t}]
@vrindex @code{semaphore}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.semaphore}
Semaphore used to signal addition of messages.
Each time a message is spooled, this semaphore
is increased, the polling thread decreases the
semaphore before despooling a message,
causing it to block when the spool is empty
The member is intended for internal use only.
@item @code{wait_semaphore} [@code{sem_t}]
@vrindex @code{wait_semaphore}, @code{libmds_mspool_t}
@vrindex @code{libmds_mspool_t.wait_semaphore}
The spooling function acquires this semaphore
when the spool is full. When it does so it
also increases @code{.please_post}. The poller
will post this semaphore if @code{.please_post}
is non-zero, causing one blocked spooler to
continue when the poller unlocks @code{.lock},
and the decrease it. The member is intended for
internal use only.
@end table
These semaphores, and the one in @code{libmds_mpool_t},
a process-private@footnote{Thread-shared, rather
than process-shared, meaning child processes
cannot use them.} POSIX semaphores. POSIX semaphores
are not as functional as XSI (System V) semaphore
arrays, they are however much lighter weight can
offers the few functions needed by the library.
@tpindex @code{libmds_mpool_t}
@tpindex @code{struct libmds_mpool}
The members of the structure @code{libmds_mpool_t} are:
@table @asis
@item @code{messages} [@code{libmds_message_t**}]
@vrindex @code{messages}, @code{libmds_mpool_t}
@vrindex @code{libmds_mpool_t.messages}
Array of allocations stored in the pool
The member is intended for internal use only.
@item @code{size} [@code{size_t size}]
@vrindex @code{size}, @code{libmds_mpool_t}
@vrindex @code{libmds_mpool_t.size}
The number of allocations the pool can contain.
The member is intended for internal use only.
@item @code{tip} [@code{volatile size_t}]
@vrindex @code{tip}, @code{libmds_mpool_t}
@vrindex @code{libmds_mpool_t.tip}
The number of available allocations. The member
is intended for internal use only.
@item @code{lock} [@code{sem_t}]
@vrindex @code{lock}, @code{libmds_mpool_t}
@vrindex @code{libmds_mpool_t.lock}
This is a binary semaphore, with 1 as its
initial value, that is used to lock the pool
when it is being used. It is a non-reenterant
mutex. The member is intended for internal use
only.
@end table
The idea behind these structures is to, per
connection, have one thread that reads messages
as fast as possible and then delegate the
handling of the message, minimising congestion.
The feature optimise the performance of the
receiving thread a pool use used for allocation
of messages to minimise the time the thread
spends performing memory allocations, which
is costly.
@tpindex @code{libmds_message_t}
@tpindex @code{struct libmds_message}
@code{libmds_message_t} have four associated
functions. The parameters @code{this} have
the type @code{libmds_message_t* restrict}.
@table @asis
@item @code{libmds_message_initialise} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{libmds_message_initialise}
Initialise a @code{libmds_message_t} so it can
be used to read messages from a socket.
Upon successful completion, zero is returned.
On error, @code{-1} is returned and @code{errno}
is set to describe the error.
This function may fail with @code{errno} set
to @code{ENOMEM} if the process cannot allocate
enough memory.
@item @code{libmds_message_destroy} [(@code{this}) @arrow{} @code{void}]
@fnindex @code{libmds_message_destroy}
Release all resource in a @code{libmds_message_t}.
This is only required if the object was
initialised by @code{libmds_message_initialise}.
Objects returned by @code{libmds_message_duplicate}
or polled from a spool or pool does not need
to be destroy with this function.
@item @code{libmds_message_duplicate} [(@code{this, libmds_mpool_t* restrict pool}) @arrow{} @code{libmds_message_t*}]
@fnindex @code{libmds_message_duplicate}
Creates duplicate of a message, and returns it.
On error @code{NULL} is returned and @code{errno}
is set to describe the error.
This function may fail with @code{errno} set
to @code{ENOMEM} if the process cannot allocate
enough memory.
If @code{pool} is not @code{NULL}, the function
will try to reuse an allocation from @code{pool}
before it creates a new allocation.
@item @code{libmds_message_read} [(@code{this, int fd}) @arrow{} @code{int}]
@fnindex @code{libmds_message_read}
Read the next message from the socket with the
file descriptor @code{fd}.
Upon successful completion, zero is returned.
On error, either @code{-1} or @code{-2} is
returned. If @code{-1} is returned, @code{errno}
is set to indicate the error. If @code{-2}
is returned, a corrupt message has been received
and you have no other choice than resetting
the connection or exit.
This function may fail with @code{errno} set
to: @code{ENOMEM} if the process cannot allocate
the resources required to store the message;
@code{EINTR} if the process was interrupted by
a signal, in which case it is safe to simply
call the funtion again with the sama arguments;
@code{ECONNRESET} if the connection was closed;
or any other error specified for @code{recv(3)}.
Both @code{this} and @code{fd} must be unique
for all threads that uses this function concurrently.
Additionally, @code{this} to @code{fd} must be
a bijective mapping.
@end table
@tpindex @code{libmds_mspool_t}
@tpindex @code{struct libmds_mspool}
@code{libmds_mspool_t} have five associated
functions. The parameters @code{this} have
the type @code{libmds_mspool_t* restrict}.
@table @asis
@item @code{libmds_mspool_initialise} [(@code{this}) @arrow{} @code{int}]
@fnindex @code{libmds_mspool_initialise}
Initialises a message spool. Upon successful
completion, zero is returned. On error
@code{-1} is returned and @code{errno} is
set to describe the error.
This function may fail with @code{errno} set
to @code{ENOMEM} if the process cannot allocate
enough memory.
@item @code{libmds_mspool_destroy} [(@code{this}) @arrow{} @code{void}]
@fnindex @code{libmds_mspool_destroy}
Release all resources stored in a
message spool.
@item @code{libmds_mspool_spool} [(@code{this, libmds_message_t* restrict message}) @arrow{} @code{int}]
@fnindex @code{libmds_mspool_spool}
Spool a message. The message must have been
returned from @code{libmds_message_duplicate}.
Upon successful completion, zero is returned.
On error, @code{-1} is returned and @code{errno}
is set to describe the error.
This function may fail with @code{errno} set
to @code{ENOMEM} if the process cannot allocate
enough memory, @code{EINTR} if the call was
interrupted by a signal, in which case it is
safe to simply recall the function with the
same arguments.
@item @code{libmds_mspool_poll} [(@code{this}) @arrow{} @code{libmds_message_t*}]
@fnindex @code{libmds_mspool_poll}
Fetch the next message from a message spool.
Upon successful completion a message is returned,
on error @code{NULL} is returned and @code{errno}
is set to describe the errror. If the spool
is empty, the function will wait until a message
is added.
This function may fail with @code{errno} set to
@code{EINTR} if the call was interrupted by a
signal, in which case it is safe to simply recall
the function with the same argument.
@item @code{libmds_mspool_poll_try} [(@code{this, const struct timespec* restrict deadline}) @arrow{} @code{libmds_message_t*}]
@fnindex @code{libmds_mspool_poll_try}
This function is similar to @code{libmds_mspool_poll}.
However, if @code{deadline} is @code{NULL} the
funtion will return immediately if the spool
is empty, and set @code{errno} to @code{EAGAIN}.
If the spool is empty, but @code{deadline} is not
@code{NULL}, the function will wait until a
message is added, but if the timepoint specified
by @code{deadline} is passed without a message
being added, the function will return and set
@code{errno} to @code{ETIMEDOUT}. The function
may also fail with @code{errno} to @code{EINTR}
as described for @code{libmds_mspool_poll},
and with @code{errno} to @code{EINVAL} if
@code{deadline->tv_necs} is less than zero or is
equal to or greater than a milliard.
@code{deadline} shall be specified in an absolute
time measured with the @code{CLOCK_REALTIME} clock.
@end table
@tpindex @code{libmds_mpool_t}
@tpindex @code{struct libmds_mpool}
@code{libmds_mpool_t} have four associated
functions. The parameters @code{this} have
the type @code{libmds_mpool_t* restrict}.
@table @asis
@item @code{libmds_mpool_initialise} [(@code{this, size_t size}) @arrow{} @code{int}]
Initialise a pool of reusable message allocations.
The pool will be able to hold @code{size} allocations.
Upon successful completion, zero is returned.
On error, @code{-1} is returned and @code{errno}
is set to describe the error.
This function may fail with @code{errno} set
to @code{ENOMEM} if the process cannot allocate
enough memory.
@item @code{libmds_mpool_destroy} [(@code{this}) @arrow{} @code{void}]
Release all resources stored in a
message allocation pool.
@item @code{libmds_mpool_offer} [(@code{this, libmds_message_t* restrict message}) @arrow{} @code{int}]
Adds a message allocation to a pool. The message
must have been returned from @code{libmds_message_duplicate},
@code{libmds_mspool_poll} or @code{libmds_mspool_poll_try}.
If the pool is full, the function will free the
allocation, and return with a success status.
Upon successful completion, zero is returned.
On error @code{-1} is returned and @code{errno}
is set to describe the error.
@item @code{libmds_mpool_poll} [(@code{this}) @arrow{} @code{libmds_message_t*}]
Fetches a message allocation from a pool.
If the pool is empty, @code{NULL} is returned
and @code{errno} is set to zero. On error
@code{NULL} is returned and @code{errno} is set
describe teh error, the value of @code{errno}
will not be zero in this case.
@end table
@node libmdslltk
@chapter libmdslltk
@cpindex Toolkits, library
@cpindex Library, toolkits
libmdslltk is a planned library. It provides low-level
toolkit functionallity to facilitate development of
@code{mds} toolkits.
@node Keyboard Codes
@chapter Keyboard Codes
@cpindex Scancodes
Keyboard servers receive scancodes from keyboard
drivers. A scancode can either be comprised of one
byte or three bytes. In each byte, the most
significant bit (assuming unsigned bytes) is ignore,
however for it first byte in the scancode it
signifies whether the key was released: it is set of
the key is released, and not set if the key was
pressed or is being held down.
A scancode is comprised of three bytes if the lower
7-bits of the first byte is are all cleared, and the
highest bit in the two following bytes are set.
@cpindex Keycodes
Ignoring the most significant bit in all bytes, the
keycode is the value of the byte if the scancode is a
single byte scancode. If the scancode is comprised of
three bytes, the first byte is ignored and the
keycode is @math{a \cdot 128 + b} where @math{a} is
the value of the second byte and @math{b} is the value
of the third byte.
@menu
* 105-keys Keycodes:: List of keycodes for 105-keys keyboards.
@end menu
@node 105-keys Keycodes
@section 105-keys Keycodes
This is a list of keyboards for the 105-keys
keyboards, using QWERTY-layout for reference.
@table @asis
@item @code{1}
@key{Escape} key
@item @code{2}--@code{11}
Keys: @key{1}, @key{2}, @key{3}, @key{4}, @key{5},
@key{6}, @key{7}, @key{8}, @key{9}, @key{0}
@item @code{12}
Key right of @key{0}.
@item @code{13}
Key left of @key{Backspace}
@item @code{14}
@key{Backspace} key
@item @code{15}
@key{Tab} key
@item @code{16}--@code{25}
Keys: @key{q}, @key{w}, @key{e}, @key{r}, @key{t},
@key{y}, @key{u}, @key{i}, @key{o}, @key{p}
@item @code{26}
Key right of @key{p}, once removed
@item @code{27}
Key right of @key{p}, twice removed
@item @code{28}
@key{Return} key
@item @code{29}
Left @key{Control} key
@item @code{30}--@code{38}
Keys: @key{a}, @key{s}, @key{d}, @key{f}, @key{g},
@key{h}, @key{j}, @key{k}, @key{l}
@item @code{39}
Key right of @key{l}, once removed
@item @code{40}
Key right of @key{l}, twice removed
@item @code{41}
Key left of @key{1}
@item @code{42}
Left @key{Shift} key
@item @code{43}
Key right of @key{l}, three times removed
@item @code{44}--@code{50}
Keys: @key{z}, @key{x}, @key{c}, @key{v}, @key{b},
@key{n}, @key{m}
@item @code{51}
Key right of @key{m}, once removed
@item @code{52}
Key right of @key{m}, twice removed
@item @code{53}
Key right of @key{m}, three times removed
@item @code{54}
Right @key{Shift} key
@item @code{55}
@key{Multiply} key on the keypad
@item @code{56}
@key{Alternative} key
@item @code{57}
@key{Space} key
@item @code{58}
@key{Caps Lock} key
@item @code{59}--@code{68}
Keys: @key{F1} through @key{F10}
@item @code{69}
@key{Num Lock} key
@item @code{70}
@key{Scroll Lock} key
@item @code{71}--@code{73}
@key{7}, @key{8}, @key{9} keys on the keypad
@item @code{74}
@key{Minus} key on the keypad
@item @code{75}--@code{77}
@key{4}, @key{5}, @key{6} keys on the keypad
@item @code{78}
@key{Plus} key on the keypad
@item @code{79}--@code{82}
@key{1}, @key{2}, @key{3}, @key{0} keys on the keypad
@item @code{83}
@key{Comma} key on the keypad
@item @code{86}
Key left of @key{z}
@item @code{87}
@key{F11} key
@item @code{88}
@key{F12} key
@item @code{96}
@key{Return} key on the keypad
@item @code{97}
Right @key{control} key
@item @code{98}
@key{Divide} key on the keypad
@item @code{99}
@key{System Request}/@key{Print Screen} key
@item @code{100}
@key{Alternative Graphic} key
@item @code{102}
@key{Home} key
@item @code{103}
@key{Up} arrow key
@item @code{104}
@key{Page up} key
@item @code{105}
@key{Left} arrow key
@item @code{106}
@key{Right} arrow key
@item @code{107}
@key{End} key
@item @code{108}
@key{Down} arrow key
@item @code{109}
@key{Page down} down
@item @code{110}
@key{Insert} key
@item @code{111}
@key{Delete} key
@item @code{119}
@key{Pause}/@key{Break} key
@item @code{125}
Left @key{Super} key
@item @code{126}
Right @key{Super} key
@item @code{127}
@key{Application Menu} key
@end table
@node Keyboard Layouts
@chapter Keyboard Layouts
@cpindex Keyboard layouts, files
@cpindex Keyboard layouts, compile
@cpindex Compiling keyboard layouts
@fnindex @command{mds-kbdc}
Keyboard layouts are compiled from one or more files.
When compiling a layout from multiple files, it is
important that the files are specified in the correct
order. The general rule is that the layout file, for
example the Swedish QWERTY-keyboard, is specified
first and is followed by add-ons such as the compose
table and layout modifiers. @command{mds-kbdc} is
used to compile layouts.
Installed keyboard layout files are located in
@file{/usr/share/mds/keyboard}.@footnote{If you are
hacking in the source tree, you will find this under
@file{res/keyboard}.} Layouts are located in the
subdirectory @file{layout}, modifiers are located in
the subdirectory @file{mods} and compose tables are
located in the subdirectory @file{compose}.
@command{mds-kbdc} prefixes
@file{/usr/share/mds/keyboard} unless the specifed
files starts with @file{/}, @file{./} or @file{../}.
Dead keys are implemented by compose tables and not
in the layouts.
@menu
* Keyboard Layout Syntax:: How to write your how layouts.
* Builtin Functions:: Functions provided by the compiler.
@end menu
@node Keyboard Layout Syntax
@section Keyboard Layout Syntax
@cpindex Keyboard layout, files, syntax
@cpindex Syntax of keyboard layout file
Similar to the C programming language, keyboard layout
files are parsed from the top down. This means that
any function or macro can only be used from lines
below the definition of said callable. However, the
order of the mapping statements themself, in respect
to each other, does not matter. Additionally, the
layout files are parsed line by line, and leading
whitespace is ignored. Comment can be started with a
#-character and end at the end of the line. It is
important to know that modifiers like @key{Shift} and
@key{Control} needs to be mapped from a keycode, this
and similar that many keyboards have in common,
except dead key composition and compose sequences, is
already available in the @file{layout/common}
directory and can be included from the layout file.
Compositions are implement in the @file{compose}
directory and should be selected by the user at
compile-time. Keyboard layout files must be written
in UTF-8 (without UTF-8 BOM) and with line feeds for
new lines.
@menu
* Mapping Statements:: Mapping keycodes to logical keys and text.
* Sequence Mapping:: Implementing dead keys and compositions.
* Keyboard Layout Identification:: Specifing the layout language, country and variant.
* Layout Assumptions:: Making assumption about the keyboard layout.
* Include Statement:: Including base files.
* Layout Macros and Functions:: Reducing repetition.
* Escaping:: Backslashes have so many uses.
@end menu
@node Mapping Statements
@subsection Mapping Statements
The most fundamental part of the layout files are
mapping statements. These specify which keycode the
keys have and what happens when certain keys pressed,
combined or pressed and a sequence. If we want to map
keycode 57 to the space key we write
@example
<keycode 57> : <space>
@end example
but then we also want the space key to product a blank
space when we are writting so we add
@example
<space> : " "
@end example
giving us
@example
@group
<keycode 57> : <space>
<space> : " "
@end group
@end example
Because the order of the mapping statements does not
matter we can just as well write
@example
@group
<space> : " "
<keycode 57> : <space>
@end group
@end example
@code{" "} represents a text string with one blank
space, but it is possible to have multiple characters.
If we want to extend this to @kbd{altgr+space}
producing a no-break space, we can add either of the
lines
@example
@group
<altgr space> : "\u00A0" # no-break space (# comment)
<altgr keycode 57> : "\u00A0" # no-break space
@end group
@end example
However, we also need a mapping to @kbd{altgr}:
@example
<keycode 100> : <altgr>
@end example
If we want to add a mapping to @kbd{ultra} from
@kbd{altgr+menu} we can write
@example
@group
<keycode 127> : <menu>
<altgr menu> : <-altgr ultra>
@end group
@end example
@code{-altgr} means that @kbd{altgr} should not be
reported as held down.
@cpindex Lock keys
@cpindex Keys, lock
As can be seen in these examples it is not possible
to distinguish between modifiers and keys. It is up
to the keyboard layout server and keyboard layout
compiler to know this. However, it is defined in the
keyboard layout files whether modifiers keys are lock
keys or not. To map the keycode 58 to @kbd{caps lock},
write
@example
<keycode 58> : <caps lock>
@end example
But if you do not want it be a lock key, but instead
be required to be held down, similar to how is normal
for @key{Shift}, instead write
@example
<keycode 58> : <caps>
@end example
Any modifier may be a lock key.
Another, just as important, use of mappings to is map
letter keys. Unlike @key{Control} keys like
@key{Space} and @key{Shift}, there are no predefined
letters@footnote{With letters with mean any character
other than space.}. Therefore the letter is prefixed
with the word `letter'. For example:
@ifset AFOURPAPER_OR_USLETTER
@example
<keycode 16> : <letter q> # The Q-key has keycode 16 (on QWERTY)
<letter q> : "q" # The Q-key should produce a `q'
<shift letter q> : "Q" # but `Q' when shift is used
<caps q> : "Q" # or when caps is used
<shift caps letter q> : "q" # but not when both are used
@end example
@end ifset
@ifclear AFOURPAPER_OR_USLETTER
@example
# The Q-key has keycode 16 (on QWERTY)
<keycode 16> : <letter q>
# The Q-key should produce a `q'
<letter q> : "q"
# but `Q' when shift is used
<shift letter q> : "Q"
# or when caps is used
<caps q> : "Q"
# but not when both are used
<shift caps letter q> : "q"
@end example
@end ifclear
Special characters like simple double quotes,
backspace and, in @code{<>}-notation, greater than
sign must be escaped with a prepending backslash.
@cpindex Dead keys
@cpindex Compose key
@cpindex Modifier keys
@cpindex Keys, dead
@cpindex Keys, compose
@cpindex Keys, modifiers
Many keyboard layouts also have dead keys. Dead keys
are keys that affect the next key-press. For example,
`´' followed by `e' may product `é'. @kbd{compose}
may be a dead key, just like it is in X.org, but it
can also be a modifer.
To define @kbd{´}, with keycode 13, @kbd{compose},
with keycode 125, as a dead keys write
@example
@group
<keycode 13> : <dead letter ´>
<keycode 125> : <dead compose>
@end group
@end example
@cpindex Duplicate keys
@cpindex Keys, duplicates
Some may appear on multiple locations on the keyboard,
for example, there may be a left and a right
@key{Shift} key, and a normal @key{Return} key and
one on the keypad:
@example
<keycode 42> : <left shift>
<keycode 54> : <right shift>
<keycode 28> : <return>
<keycode 96> : <keypad return>
@end example
@cpindex Arrow keys
@cpindex Keys, arrows
Because @code{<left>} and @code{<right>} are valid
keys --- they are arrow keys --- it is important to
place them directly before the key, and not after.
For instance @code{<left shift>} denotes the left
@key{Shift} key, whilst @code{<shift left>} denotes
the @key{Left} arrow key with a @key{Shift} key held
down. Modifiers goes first.
@cpindex Void mapping, keys
@cpindex Mapping, void, keys
@cpindex Key mapping, void
@cpindex Inferred key mapping
@cpindex Inferred mapping, keys
@cpindex Key mapping, inferred
@cpindex Mapping, inferred, keys
Mapping to @code{<void>} can be used to suppress an
inferred mapping. For example,
@example
<num keycode 28> : <void>
@end example
removes all actions from the normal @key{Return} key
when @key{Num} is active. Note well, this cannot be
used to remove an explicit mapping. Explicit mappings
may not conflict.
@node Sequence Mapping
@subsection Sequence Mapping
@cpindex Dead keys
@cpindex Compose key
@cpindex Keys, dead
@cpindex Keys, compose
@cpindex Compose tables
@cpindex Key sequences
@cpindex Sequence, keys
Compose tables use mapping statements to map key
sequences. For example the compose key followed by
two `s':es makes an `ß':
@example
<dead compose> "s" "s" : "ß"
@end example
It is also possible to map a sequence to another
sequence:
@example
<dead compose> <tab> : <tab> <tab> <tab> <tab>
@end example
Of course, the input does not need to be
a sequence:
@example
<super tab> : <tab> <tab> <tab> <tab>
@end example
An alternative to @key{Compose} as a dead key, is
@key{Compose} as a modifier. If you use this, the
compose table need to be written for just that. There
two ways do this this. Either you can write for
example
@example
<compose "s"> <compose "s"> : "ß"
@end example
This maps two `s':es to a `ß', but requires that
@key{Compose} is held down during both key-presses.
The other way is to write
@example
<compose "s", "s"> : "ß" # Note the `,'
@end example
This also requires that @kbd{compose} is not
released between the key-presses.
The compose table is filled with compositions where
it does not matter in which order you press some of
the keys. For example, instead of
@example
@group
<dead compose> "S" "|" : "$"
<dead compose> "|" "S" : "$"
@end group
@end example
you can write
@example
<dead compose> ("S" "|") : "$"
@end example
@cpindex Key subsequences, unordered
@cpindex Subsequence, unordered, keys
@cpindex Unordered subsequence, keys
@cpindex Alternation, keys
@cpindex Key alternations
@code{( )} denotes an unordered subsequence. You can
also use @code{[ ]} for alternation. For example,
instead of
@example
@group
<dead compose> ("S" "|") : "$"
<dead compose> ("s" "|") : "$"
@end group
@end example
you can write
@example
<dead compose> (["S" "s"] "|") : "$"
@end example
Inside an alternation you can use a dot for specify
that no key press is needed. For example, instead of
@example
@group
<dead compose> "|" "S" : "$"
<dead compose> "|" "|" "S" : "$"
@end group
@end example
you can write
@example
<dead compose> "|" ["|" .] "S" : "$"
@end example
It is undefined in which order alternations and
unordered subsequences are expanded; neither
sequencewise or levelwise. Thus, there should not be
side-effects where either one is used, nor does it
make since to nest the two constructs in any other
way than alternation or unordered subsequence inside
unordered subsequence. The compiler may however
choose to discourage unordered subsequence inside
unordered subsequence because of readability issues.
Unordered subsequences longer than 5 elements cannot
compile under normal circumstances. Eliminiation of
unordered subsequences grows superexponentially, and
thus is probably an error than can cause memory
exhaustion and unrealistic compilation-time.
Therefore, if an unordered subsequences longer than 5
elements is used the compiler required that the
@option{--force} flag is used and that the unordered
subsequences uses double brackets:
@ifset AFOURPAPER_OR_USLETTER
@example
<dead compose> ("1" "2" "3" "4" "5") : "120"
<dead compose> (("1" "2" "3" "4" "5" "6")) : "720"
<dead compose> (("1" "2" "3" "4" "5" "6" "7")) : "5040"
<dead compose> (("1" "2" "3" "4" "5" "6" "7" "8")) : "40320"
<dead compose> (("1" "2" "3" "4" "5" "6" "7" "8" "9")) : "362880"
@end example
@end ifset
@ifclear AFOURPAPER_OR_USLETTER
@ifset SMALLBOOK_WITH_SMALLFONT
@example
<dead compose> ("1" "2" "3" "4" "5") : "120"
<dead compose> (("1" "2" "3" "4" "5" "6")) : "720"
<dead compose> (("1" "2" "3" "4" "5" "6" "7")) : "5040"
<dead compose> (("1" "2" "3" "4" "5" "6" "7" "8")) : "40320"
@end example
@end ifset
@ifclear SMALLBOOK_WITH_SMALLFONT
@example
@group
<dead compose> ("1" "2" "3" "4" "5") : "120"
<dead compose> (("1" "2" "3" "4" "5" "6")) : "720"
<dead compose> (("1" "2" "3" "4" "5" "6" "7")) : "5040"
@end group
@end example
@end ifclear
@end ifclear
@node Keyboard Layout Identification
@subsection Keyboard Layout Identification
@cpindex Keyboard layout identification
@cpindex Identification of keyboard layouts
Whilst it is possible to write a comment that states
what keyboard layout a file implements, there is a
standardise way to do this in code. The intention with
this is to make it possible for graphical tools to
easily list the layouts and easy to understand
descriptions.
There are three things a keyboard layout file should
specify: the language, the country where it is used,
and the variant.
For example the Swedish QWERTY layout used in Sweden
would have the code.
@example
information
language "Swedish"
country "Sweden"
variant "QWERTY"
end information
@end example
@cpindex Keyboard layout country
@cpindex Keyboard layout language
@cpindex Keyboard layout variant
@cpindex Country, keyboard layout
@cpindex Language, keyboard layout
@cpindex Variant, keyboard layout
If the layout is used multiple countries, or even for
multiple lanuages, @code{country} and @code{language}
may be specified on multiple lines. For example:
@example
information
language "Spanish"
country "Argentina"
country "Bolivia, Plurinational State of"
country "Chile"
country "Colombia"
country "Costa Rica"
country "Cuba"
country "Dominican Republic"
country "Ecuador"
country "El Salvador"
country "Guatemala"
country "Haiti"
country "Honduras"
country "Mexico"
country "Nicaragua"
country "Panama"
country "Paraguay"
country "Peru"
country "Puerto Rico"
country "Uruguay"
country "Venezuela, Bolivarian Republic of"
variant "Latin American, QWERTY"
end information
@end example
or
@example
information
language "Norwegian"
language "Bokmål"
language "Nynorsk"
country "Norway"
variant "QWERTY"
end information
@end example
@node Layout Assumptions
@subsection Layout Assumptions
@cpindex Keyboard layout, file inclusion
@cpindex File inclusion, keyboard layout
@cpindex Inclusion of file, keyboard layout
When writing generic compose tables it can be helpful
to let the compiler assume that a certain set of keys
will be provided by the layout file and not making
other assumptions. This is helpful because if you want
to make an compose table that can compose all
characters given only the ASCII letters, modifiers
and a compose key, rather than written a phony layout
file and select it each time you compile to compose
table you can state in the compose table file that
the compiler should as that those keys are provided
when the compose table file is compile by itself. If
this is done, the compiler can warn when one of the
compositions cannot be reached from those basic keys.
If we want to make the compiler assume that
@key{compose} is available as a dead key, that
@key{shift}, @key{altgr} and @key{space} are
available and that the ASCII letters, digits and some
basic special characters are available we can write.
@example
assumption
have <dead compose>
have <shift>
have <altgr>
have <space>
have_range "0" "9"
have_range "a" "z"
have_range "A" "Z"
have_chars "!\"@@#$%&/@{([)]=@}?\\^~*'<>|,;.:-_"
end assumption
@end example
@node Include Statement
@subsection Include Statement
@cpindex Keyboard layout, file inclusion
@cpindex File inclusion, keyboard layout
@cpindex Inclusion of file, keyboard layout
Writing layout files from scratch is probably
something you want to avoid. For instance you would
we need to create mappings for `A' to `Z' and `0' to
`9' (assuming its a latin-based language), and map up
all specific key, like modifiers, space, arrow keys,
and the keypad. And you would have to make sure do
only that the keys are mapped but that they are
mapped to the text the should product and that they
word correcly with the modifiers. These are things
most keyboards have in common with many other layouts.
For instance @file{layout/sv/qwerty} has two include
statements to implement its basics:
@example
@group
include "../common/qwerty"
include "../common/base"
@end group
@end example
@node Layout Macros and Functions
@subsection Layout Macros and Functions
@cpindex Keyboard layout, macros
@cpindex Macros, keyboard layout
There is a lot of repetitive work in layouts, for
instance all letters need mapping for any combination
of use of @key{shift} and @key{compose}. To reduce
this, you can define macros.
For example instead of writing
@example
<letter a> : "a"
<shift letter a> : "A"
<caps letter a> : "A"
<shift caps letter a> : "a"
<letter b> : "b"
<shift letter b> : "B"
<caps letter b> : "B"
<shift caps letter b> : "b"
# and so on ...
@end example
you can use a macro and write
@example
macro letter/2
<letter \1> : "\1"
<shift letter \1> : "\2"
<caps letter \1> : "\2"
<shift caps letter \1> : "\1"
end macro
letter("a" "A")
letter("b" "B")
# and so on ...
@end example
The name of this macro is @code{letter/2}, but it is
called with the name @code{letter} and two arguments.
The @code{/2}-suffix means that it is invoked with
exactly two arguments. You can use this do define
multiple version of the same macro, with the same
invocation name but with different number of
arguments. For example:
@example
macro letter/2
<letter \1> : "\1"
<shift letter \1> : "\2"
<caps letter \1> : "\2"
<shift caps letter \1> : "\1"
end macro
macro letter/1
letter(\1 \add(\sub(\1 "a") "A"))
end macro
letter("a")
letter("b")
# and so on ...
letter("å" "Å")
letter("ä" "Ä")
letter("ö" "Ö")
@end example
@code{\add( )} and @code{\sub( )} are calls to two
built-in functions named @code{add/2} and
@code{sub/2}.
@cpindex Alternation, keys
@cpindex Key alternations
Alternation can be used to invoke a macro:
@ifset AFOURPAPER_OR_USLETTER_OR_SMALLFONT
@example
@group
letter(["a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m"])
letter(["n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"])
@end group
@end example
@end ifset
@ifclear AFOURPAPER_OR_USLETTER_OR_SMALLFONT
@example
@group
letter(["a" "b" "c" "d" "e" "f" "g" "h" "i" "j"])
letter(["k" "l" "m" "n" "o" "p" "q" "r" "s" "t"])
letter(["u" "v" "w" "x" "y" "z"])
@end group
@end example
@end ifclear
@cpindex Alternation, keys
@cpindex Key alternations
You may use @code{.} in an alternation, in that case
macro is called once with the argument, causing it to
invoke for example @code{letter/0} instead of
@code{letter/1}.
A related issue are for-loops. If we for example want
to call the macro @code{letter/1} for all letters
between and including `a' and `z' we can just write
@example
@group
for "a" to "z" as \1
letter(\1)
end for
@end group
@end example
instead of using the alternation-trick.
You call also use if-statments. For example
@example
for "à" to "þ" as \1
# times sign is not upper case of division sign
if \not(\equals(\1 "\u00F7"))
letter(\1 \add(\sub(\1 "à") "À"))
end if
end for
@end example
or equivalently
@example
for "à" to "þ" as \1
if \equals(\1 "\u00F7")
continue # times sign is not upper case of division sign
end if
letter(\1 \add(\sub(\1 "à") "À"))
end for
@end example
@code{continue} can be used to stop the iteration of
the innermost for-loop and skip to the next iteration.
You can also use @code{break}, but it also has the
effect to stop the entire loop. Similarly,
@code{return} can be used to break an entire macro
call, or function call.
You can also use @code{if} for more example things,
and use @code{else if} and @code{else if}:
@example
macro latter/1
if \not(\greater(\1 "z"))
letter(\1 \add(\sub(\1 "a") "A"))
else if \not(\greater(\1 "þ"))
letter(\1 \add(\sub(\1 "à") "À"))
else
letter(\1 \sub(\1 1))
end if
end macro
@end example
Note that there is no quotes around the `a' in
@code{letter(\1 \sub(\1 1))}. This means that the
argument will be than value 1 rather than the code
point of the character `1'. Note however that values
lower than zero or equals to or greater than 2 to the
power of 31 not allowed and can either cause
compile-time error or erroneous compiled files.
@cpindex Keyboard layout, macros
@cpindex Macros, keyboard layout
Functions are similar to function macros, the
difference is that a function is called inline and is
prefixed with slash, and rather than inline the code
inside it, the evalutes to the last value it evaluted
before it returned.
For example instead of @code{\not(\greater(\1 "z"))}
you can write @code{\less_eq(\1 "z")} after you have
defined the function @code{less_eq/2} with the
following code:
@example
@group
function less_eq/2
\not(\greater(\1 \2))
end function
@end group
@end example
A final construct to make layout code less repetitive
is @code{let}-statements. This can be used to assign
values to variables.
The code
@example
macro latter/1
if \not(\greater(\1 "z"))
letter(\1 \add(\sub(\1 "a") "A"))
else if \not(\greater(\1 "þ"))
letter(\1 \add(\sub(\1 "à") "À"))
else
letter(\1 \sub(\1 1))
end if
end macro
@end example
can equivalently be written using @code{let} as
@example
macro latter/1
if \not(\greater(\1 "z"))
let \2 : \sub("a" "A")
else if \not(\greater(\1 "þ"))
let \2 : \sub("à" "À")
else
let \2 : 1
end if
letter(\1 \sub(\1 \2))
end macro
@end example
It is also possible to declare arrays:
@example
let \1 : @{ "å" "ä" "ö" "à" "é" "ü" @}
@end example
Arrays may however not have arrays for values.
Because arrays can be very large, they, but only
them, may span multiple lines. For example you may
write
@example
@group
let \1 : @{
"å" "ä" "ö" "à" "é" "ü"
@}
@end group
@end example
but not
@example
@group
let \1 :
@{ "å" "ä" "ö" "à" "é" "ü" @}
@end group
@end example
See @ref{Builtin Functions} for how they are used.
Variable names can only be numerical and most not
start with a zero. `0' is not valid variable name,
and thus @code{\0} does not address a variable. Macro
and function names, may only include `0'--`9',
`a'--`z', `A'--`Z' and `_', but must and not start
with `0'--`9'. Additionally, when declared macro and
function names must be suffixed with `/' follwed by
the exact number of arguments the macro or function
takes.
Variable indices are constrained to the 31:th power
of 2, exclusively. Attempts to use higher variable
indices invoke undefined behaviour. Additionally
there is no guarantee that the compiler allocates
indexwise spares variables efficiently.
Like variables, the size of arrays are also
restricted to the 31:th power of 2.
@node Escaping
@subsection Escaping
@cpindex Keyboard layout, escaping special character
@cpindex Keyboard layout, special character, escaping
@cpindex Escaping special character, keyboard layout
@cpindex Special character, escaping, keyboard layout
Similar to most, if not all, programming language, a
backslash inside quotes can be used to parse the next
character with special meaning. For instance, `\"' is
parsed as a literal `"', and `\\' is parsed as a
literal `\'. `\>' is too parsed as a literal `>', for
example you may need to write @code{<letter \>>}. The
characters `(', `)', `[', `]', `@{', `@}', `<' and
`,' also follow this rule to make those character
accesible inside a @code{< >}. But `\' can also be
used to specify characters by their code point, for
example if you want an `æ' you can write
@code{"\u00E6"} or @code{"\uE6"}, instead of
@code{"æ"}. You can also write @code{"\0346"}, the
difference between @code{\0} and @code{\u} is that
@code{\0} uses octal whereas @code{\u} uses
hexadecimal. A noteworthy side-effect of this is that
function names cannot start with a lower case `u'.
`\' can also be used to access variables and
parameters. For example @code{\1} in
@example
macro letter/2
<letter \1> : "\1"
<shift letter \1> : "\2"
<caps letter \1> : "\2"
<shift caps letter \1> : "\1"
end macro
letter("å" "Å")
@end example
is expanded to an `å', where as @code{\2} is expanded
to an `Å'.
`\' is also used to call functions, for example if
you want to call the function @code{f/0} you write
@code{\f()}.
Because numerical (possibly prefixed with an `u') are
of variable length, it is possible to specify the
escape's termination point with a dot. For instance,
if you want the value of the first variable
(@code{\1}) followed by two zeroes, you do not write
@code{\100} as that would expand to the value of the
hundredth variable. Instead you write @code{\1.00}.
Use of function calls and variables inside
@code{include}-statments invokes undefined behaviour.
Escaped numerals greater than or equal to the 31th
power of 2 also invoke undefined behaviour.
@node Builtin Functions
@section Builtin Functions
@cpindex Keyboard layout, functions, builtin
@cpindex Keyboard layout, builtin functions
@cpindex Functions, builtin, keyboard layout
@cpindex Builtin functions, keyboard layout
To help you write meaningful functions in your
keyboard layout files, the compiler defines an almost
minimal set of basic functions:
@table @code
@item add/2
@fnindex @code{add/2}
The code points in @code{\1} plus the code points
of the corresponding characters in @code{\2}. If
@code{\1} and @code{\2} are not of the same length,
the returned string will be of the length of the
longer of the parameters, and modulo is used to map
to the corresponing character.
@item sub/2
@fnindex @code{sub/2}
Like @code{add/2} but subtraction.
@item mul/2
@fnindex @code{mul/2}
Like @code{add/2} but multiplication.
@item div/2
@fnindex @code{div/2}
Like @code{add/2} but division.
@item mod/2
@fnindex @code{mod/2}
Like @code{add/2} but modulo.
@item rsh/2
@fnindex @code{rsh/2}
Like @code{add/2} but rightward bitwise shift. If a
character in @code{\2} is has a code point greater
than 30, undefined behaviour is invoked.
@item lsh/2
@fnindex @code{lsh/2}
Like @code{add/2} but leftward bitwise shift. If a
character in @code{\2} is has a code point greater
than 30, undefined behaviour is invoked.
@item or/2
@fnindex @code{or/2}
Like @code{add/2} but bitwise OR@.
@item and/2
@fnindex @code{and/2}
Like @code{add/2} but bitwise AND@.
@item xor/2
@fnindex @code{xor/2}
Like @code{add/2} but bitwise XOR@.
@item not/1
@fnindex @code{not/1}
For each character in @code{\1}, evaluate to zero if
the character is not zero, and one if the character
is zero.
@item equals/2
@fnindex @code{equals/2}
For each character, evalute to one if the characters
in @code{\1} and @code{\2} are equal and zero
otherwise.
@item greater/2
@fnindex @code{greater/2}
Like @code{equals/2} but @code{\1} greater than
@code{\2} rather than @code{\1} equals
@code{\2}.
@item less/2
@fnindex @code{less/2}
Like @code{equals/2} but @code{\1} less than
@code{\2} rather than @code{\1} equals @code{\2}.
@item set/3
@fnindex @code{set/3}
Set the element with index @code{\2}, in the array
with variable index @code{\1}, to @code{\3}, and
return @code{\3}. For example @code{\set(1 0 4)} sets
the first element in @code{\1} to 4.
@item get/2
@fnindex @code{get/2}
Return the element with index @code{\2} in the array
with variable index @code{\1}. For example after
@code{\set(1 0 4)} or @code{let \1 : @{ 4 3 2 1 0 @}}
has been used, @code{\get(1 0)} evaluates to 4.
@end table
@node Default Keyboard Layouts
@chapter Default Keyboard Layouts
@cpindex Compose tables
The chapter is about the special keyboard layouts
and compose tables included with @command{mds}.
@menu
* Dead Compose Table:: The compose table for the dead compose key.
@end menu
@node Dead Compose Table
@section Dead Compose Table
@cpindex Dead keys
@cpindex Compose key
@cpindex Keys, dead
@cpindex Keys, compose
This section describes the structure for the mappings
used in the compose table for the dead key version of
the compose key.
@menu
@c * Aegean Numbers:: Aegean Numbers.
@c * Alchemical Symbols:: Alchemical Symbols.
@c * Alphabetic Presentation Forms:: Alphabetic Presentation Forms.
@c * Ancient Greek Musical Notation:: Ancient Greek Musical Notation.
@c * Ancient Greek Numbers:: Ancient Greek Numbers.
@c * Ancient Symbols:: Ancient Symbols.
@c * Arabic:: Arabic.
@c * Arabic Extended-A:: Arabic Extended-A@.
@c * Arabic Mathematical Alphabetic Symbols:: Arabic Mathematical Alphabetic Symbols.
@c * Arabic Presentation Forms-A:: Arabic Presentation Forms-A@.
@c * Arabic Presentation Forms-B:: Arabic Presentation Forms-B@.
@c * Arabic Supplement:: Arabic Supplement.
@c * Armenian:: Armenian.
* Arrows:: Arrows.
@c * Avestan:: Avestan.
@c * Balinese:: Balinese.
@c * Bamum:: Bamum.
@c * Bamum Supplement:: Bamum Supplement.
* Basic Latin:: Basic Latin.
@c * Bassa Vah:: Bassa Vah.
@c * Batak:: Batak.
@c * Bengali:: Bengali.
* Block Elements:: Block Elements.
@c * Bopomofo:: Bopomofo.
@c * Bopomofo Extended:: Bopomofo Extended.
* Box Drawing:: Box Drawing.
* Braille Patterns:: Braille Patterns.
@c * Brahmi:: Brahmi.
@c * Buginese:: Buginese.
@c * Buhid:: Buhid.
@c * Byzantine Musical Symbols:: Byzantine Musical Symbols.
@c * C0 Controls:: C0 Controls.
@c * C1 Controls:: C1 Controls.
@c * Carian:: Carian.
@c * Caucasian Albanian:: Caucasian Albanian.
@c * Chakma:: Chakma.
@c * Cham:: Cham.
@c * Cherokee:: Cherokee.
@c * CJK Compatibility:: CJK Compatibility.
@c * CJK Compatibility Forms:: CJK Compatibility Forms.
@c * CJK Compatibility Ideographs:: CJK Compatibility Ideographs.
@c * CJK Compatibility Ideographs Supplement:: CJK Compatibility Ideographs Supplement.
@c * CJK Radicals Supplement:: CJK Radicals Supplement.
@c * CJK Strokes:: CJK Strokes.
@c * CJK Symbols and Punctuation:: CJK Symbols and Punctuation.
@c * CJK Unified Ideographs:: CJK Unified Ideographs.
@c * CJK Unified Ideographs Extension A:: CJK Unified Ideographs Extension A@.
@c * CJK Unified Ideographs Extension B:: CJK Unified Ideographs Extension B@.
@c * CJK Unified Ideographs Extension C:: CJK Unified Ideographs Extension C@.
@c * CJK Unified Ideographs Extension D:: CJK Unified Ideographs Extension D@.
@c * Combining Diacritical Marks:: Combining Diacritical Marks.
@c * Combining Diacritical Marks Extended:: Combining Diacritical Marks Extended.
@c * Combining Diacritical Marks for Symbols:: Combining Diacritical Marks for Symbols.
@c * Combining Diacritical Marks Supplement:: Combining Diacritical Marks Supplement.
@c * Combining Half Marks:: Combining Half Marks.
@c * Common Indic Number Forms:: Common Indic Number Forms.
@c * Control Pictures:: Control Pictures.
@c * Coptic:: Coptic.
@c * Coptic Epact Numbers:: Coptic Epact Numbers.
@c * Counting Rod Numerals:: Counting Rod Numerals.
@c * Cuneiform:: Cuneiform.
@c * Cuneiform Numbers and Punctuation:: Cuneiform Numbers and Punctuation.
@c * Currency Symbols:: Currency Symbols.
@c * Cypriot Syllabary:: Cypriot Syllabary.
@c * Cyrillic:: Cyrillic.
@c * Cyrillic Extended-A:: Cyrillic Extended-A@.
@c * Cyrillic Extended-B:: Cyrillic Extended-B@.
@c * Cyrillic Supplement:: Cyrillic Supplement.
@c * Deseret:: Deseret.
@c * Devanagari:: Devanagari.
@c * Devanagari Extended:: Devanagari Extended.
@c * Dingbats:: Dingbats.
* Domino Tiles:: Domino Tiles.
@c * Duployan:: Duployan.
@c * Egyptian Hieroglyphs:: Egyptian Hieroglyphs.
@c * Elbasan:: Elbasan.
@c * Emoticons:: Emoticons.
* Enclosed Alphanumeric Supplement:: Enclosed Alphanumeric Supplement.
@c * Enclosed Ideographic Supplement:: Enclosed Ideographic Supplement.
* Enclosed Alphanumerics:: Enclosed Alphanumerics.
@c * Enclosed CJK Letters and Months:: Enclosed CJK Letters and Months.
@c * Ethiopic:: Ethiopic.
@c * Ethiopic Extended:: Ethiopic Extended.
@c * Ethiopic Extended-A:: Ethiopic Extended-A@.
@c * Ethiopic Supplement:: Ethiopic Supplement.
* General Punctuation:: General Punctuation.
* Geometric Shapes:: Geometric Shapes.
* Geometric Shapes Extended:: Geometric Shapes Extended.
@c * Georgian:: Georgian.
@c * Georgian Supplement:: Georgian Supplement.
@c * Glagolitic:: Glagolitic.
@c * Gothic:: Gothic.
@c * Grantha:: Grantha.
@c * Greek and Coptic:: Greek and Coptic.
@c * Greek Extended:: Greek Extended.
@c * Gujarati:: Gujarati.
@c * Gurmukhi:: Gurmukhi.
@c * Halfwidth and Fullwidth Forms:: Halfwidth and Fullwidth Forms.
@c * Hangul Compatibility Jamo:: Hangul Compatibility Jamo.
@c * Hangul Jamo:: Hangul Jamo.
@c * Hangul Jamo Extended-A:: Hangul Jamo Extended-A@.
@c * Hangul Jamo Extended-B:: Hangul Jamo Extended-B@.
@c * Hangul Syllables:: Hangul Syllables.
@c * Hanunoo:: Hanunoo.
@c * Hebrew:: Hebrew.
@c * Hiragana:: Hiragana.
@c * Ideographic Description Characters:: Ideographic Description Characters.
@c * Imperial Aramaic:: Imperial Aramaic.
@c * Inscriptional Parthian:: Inscriptional Parthian.
@c * Inscriptional Pahlavi:: Inscriptional Pahlavi.
* IPA Extensions:: IPA Extensions.
@c * Javanese:: Javanese.
@c * Kaithi:: Kaithi.
@c * Kana Supplement:: Kana Supplement.
@c * Kangxi Radicals:: Kangxi Radicals.
@c * Kannada:: Kannada.
@c * Katakana:: Katakana.
@c * Katakana Phonetic Extensions:: Katakana Phonetic Extensions.
@c * Kanbun:: Kanbun.
@c * Kayah Li:: Kayah Li.
@c * Kharoshthi:: Kharoshthi.
@c * Khmer:: Khmer.
@c * Khmer Symbols:: Khmer Symbols.
@c * Khojki:: Khojki.
@c * Khudawadi:: Khudawadi.
@c * Lao:: Lao.
@c * Latin Extended Additional:: Latin Extended Additional.
* Latin Extended-A:: Latin Extended-A@.
* Latin Extended-B:: Latin Extended-B@.
* Latin Extended-C:: Latin Extended-C@.
@c * Latin Extended-D:: Latin Extended-D@.
@c * Latin Extended-E:: Latin Extended-E@.
* Latin-1 Supplement:: Latin-1 Supplement.
@c * Lepcha:: Lepcha.
@c * Letterlike Symbols:: Letterlike Symbols.
@c * Limbu:: Limbu.
@c * Linear A:: Linear A@.
@c * Linear B Ideograms:: Linear B Ideograms.
@c * Linear B Syllabary:: Linear B Syllabary.
@c * Lisu:: Lisu.
@c * Lycian:: Lycian.
@c * Lydian:: Lydian.
@c * Mahajani:: Mahajani.
* Mahjong Tiles:: Mahjong Tiles.
@c * Malayalam:: Malayalam.
@c * Mandaic:: Mandaic.
@c * Manichaean:: Manichaean.
@c * Mathematical Alphanumeric Symbols:: Mathematical Alphanumeric Symbols.
* Mathematical Operators:: Mathematical Operators.
@c * Meetei Mayek:: Meetei Mayek.
@c * Meetei Mayek Extensions:: Meetei Mayek Extensions.
@c * Mende Kikakui:: Mende Kikakui.
@c * Meroitic Cursive:: Meroitic Cursive.
@c * Meroitic Hieroglyphs:: Meroitic Hieroglyphs.
@c * Miao:: Miao.
* Miscellaneous Mathematical Symbols-A:: Miscellaneous Mathematical Symbols-A@.
* Miscellaneous Mathematical Symbols-B:: Miscellaneous Mathematical Symbols-B@.
@c * Miscellaneous Symbols:: Miscellaneous Symbols.
* Miscellaneous Symbols and Arrows:: Miscellaneous Symbols and Arrows.
@c * Miscellaneous Symbols and Pictographs:: Miscellaneous Symbols and Pictographs.
@c * Miscellaneous Technical:: Miscellaneous Technical.
@c * Modi:: Modi.
@c * Modifier Tone Letters:: Modifier Tone Letters.
@c * Mongolian:: Mongolian.
@c * Mro:: Mro.
@c * Musical Symbols:: Musical Symbols.
@c * Myanmar:: Myanmar.
@c * Myanmar Extended-A:: Myanmar Extended-A@.
@c * Myanmar Extended-B:: Myanmar Extended-B@.
@c * Nabataean:: Nabataean.
@c * New Tai Lue:: New Tai Lue.
@c * NKo:: NKo.
* Number Forms:: Number Forms.
@c * Ogham:: Ogham.
@c * Ol Chiki:: Ol Chiki.
@c * Old North Arabian:: Old North Arabian.
@c * Old Italic:: Old Italic.
@c * Old Permic:: Old Permic.
@c * Old Persian:: Old Persian.
@c * Old South Arabian:: Old South Arabian.
@c * Old Turkic:: Old Turkic.
@c * Optical Character Recognition:: Optical Character Recognition.
@c * Osmanya:: Osmanya.
@c * Ornamental Dingbats:: Ornamental Dingbats.
@c * Oriya:: Oriya.
@c * Palmyrene:: Palmyrene.
@c * Pahawh Hmong:: Pahawh Hmong.
@c * Pau Cin Hau:: Pau Cin Hau.
@c * Phaistos Disc:: Phaistos Disc.
@c * Phags-pa:: Phags-pa.
@c * Phoenician:: Phoenician.
@c * Phonetic Extensions:: Phonetic Extensions.
@c * Phonetic Extensions Supplement:: Phonetic Extensions Supplement.
* Playing Cards:: Playing Cards.
@c * Psalter Pahlavi:: Psalter Pahlavi.
@c * Rejang:: Rejang.
@c * Rumi Numeral Symbols:: Rumi Numeral Symbols.
@c * Runic:: Runic.
@c * Samaritan:: Samaritan.
@c * Saurashtra:: Saurashtra.
@c * Sharada:: Sharada.
@c * Shavian:: Shavian.
@c * Shorthand Format Controls:: Shorthand Format Controls.
@c * Siddham:: Siddham.
@c * Sinhala:: Sinhala.
@c * Sinhala Archaic Numbers:: Sinhala Archaic Numbers.
@c * Small Form Variants:: Small Form Variants.
@c * Sora Sompeng:: Sora Sompeng.
@c * Spacing Modifier Letters:: Spacing Modifier Letters.
@c * Specials:: Specials.
@c * Sundanese:: Sundanese.
@c * Sundanese Supplement:: Sundanese Supplement.
* Superscripts and Subscripts:: Superscripts and Subscripts.
* Supplemental Arrows-A:: Supplemental Arrows-A@.
* Supplemental Arrows-B:: Supplemental Arrows-B@.
* Supplemental Arrows-C:: Supplemental Arrows-C@.
* Supplemental Mathematical Operators:: Supplemental Mathematical Operators.
@c * Syloti Nagri:: Syloti Nagri.
@c * Syriac:: Syriac.
* Tags:: Tags.
@c * Tagalog:: Tagalog.
@c * Tagbanwa:: Tagbanwa.
@c * Tamil:: Tamil.
@c * Tai Le:: Tai Le.
@c * Tai Tham:: Tai Tham.
@c * Tai Viet:: Tai Viet.
@c * Tai Xuan Jing Symbols:: Tai Xuan Jing Symbols.
@c * Takri:: Takri.
@c * Telugu:: Telugu.
@c * Thaana:: Thaana.
@c * Thai:: Thai.
@c * Tibetan:: Tibetan.
@c * Tifinagh:: Tifinagh.
@c * Tirhuta:: Tirhuta.
@c * Transport and Map Symbols:: Transport and Map Symbols.
@c * Unified Canadian Aboriginal Syllabics:: Unified Canadian Aboriginal Syllabics.
@c * Unified Canadian Aboriginal Syllabics Extended:: Unified Canadian Aboriginal Syllabics Extended.
@c * Ugaritic:: Ugaritic.
@c * Vai:: Vai.
* Variation Selectors:: Variation Selectors and Variation Selectors Supplement.
@c * Vertical Forms:: Vertical Forms.
@c * Vedic Extensions:: Vedic Extensions.
@c * Warang Citi:: Warang Citi.
@c * Yi Radicals:: Yi Radicals.
@c * Yi Syllables:: Yi Syllables.
@c * Yijing Hexagram Symbols:: Yijing Hexagram Symbols.
@end menu
@node Arrows
@subsection Arrows
@ubindex Arrows
970
@node Basic Latin
@subsection Basic Latin
@ubindex Basic Latin
@ubindex Latin, Basic
125
@node Block Elements
@subsection Block Elements
@ubindex Block Elements
1648
@node Box Drawing
@subsection Box Drawing
@ubindex Box Drawing
Most of the box drawing glyphs can be composed by
typing @kbd{<dead compose>} followed by two glyphs
that should be combined to form the desired glyphs.
If the two glyphs are identical the glyph becomes
heavy. More general, common parts of the glyphs
become heavy.
Glyphs that contain a heavy part be transformed so
that the heavy parts become double stroked. Glyphs
that do not contain heavy parts be transformed so the
entire glyphs becomes double stroked. This is done by
typing @kbd{<dead compose>} followed by, in any
order, @kbd{"+"} and the glyph to modify. Note that
this is not possible for all glyphs, as not all
glyphs have a double stroked variant, but all double
stroked glyphs can be composed this way.
The horizontal and the vertical light glyphs, as well
as the combination of the two, can be made double
stroked by typing @kbd{<dead compose>} followed by,
in any order, @kbd{"="} and the glyph.
The light corners can be made rounded by by typing
@kbd{<dead compose>} followed by, in any order,
@kbd{"o"} and the glyph or @kbd{"O"} and the glyph.
The sequences @kbd{<dead compose> "-" "|"} and
@kbd{<dead compose> "|" "-"} can be used to create
a light horizontal line crossed with a light vertical
line.
Basic box drawing glyphs are created with sequences
starting either with @kbd{<shift dead compose> "b"}
or @kbd{<shift dead compose> "B"}. The former creates
light glyphs, and the latter creates heavy glyphs.
Note that glyphs with diagonal lines do not have an
heavy variants. The base sequences are followed by a
sequence describing the glyphs to compose.
@table @kbd
@item "-"
Horizontal line.
@item "|"
Vertical line.
@item "+"
Horizontal line combined with vertical line.
@item "/"
Diagonal upper right to lower left.
@item "\"
Diagonal upper left to lower right.
@item "X"
Diagonal cross.
@item "<"
Left part of a horizontal line.
@item "^"
Upper part of a vertical line.
@item ">"
Right part of a horizontal line.
@item "v"
Lower part of a vertical line.
@end table
Simple arrows can be used instead of @kbd{"<"},
@kbd{"^"}, @kbd{">"} and @kbd{"v"}.
@kbd{"-"}, @kbd{"|"} can be prefixed with a key to
modify the lines.
@table @kbd
@item "="
Double stroke. This modifier is also available for
@kbd{"+"}.
@item "."
Triple dash.
@item ":"
Quadruple dash.
@end table
Double dashed horizonal line is composed with
@kbd{<shift dead compose> "b" "." "."} for the light
variant and @kbd{<shift dead compose> "B" "." "."}
for the heavy. variant. @kbd{"." ":"}, or a broken
pipe, instead of @kbd{"." "."} can be used to create
a double dashed vertical line.
@node Braille Patterns
@subsection Braille Patterns
@ubindex Braille Patterns
The sequence @kbd{<shift dead compose> "b" <space>}
can be used to create a blank braille pattern.
A single-dot braille pattern can be composed with
@kbd{<shift dead compose> "b"} followed by a digit
key between @kbd{"1"} and @kbd{"8"}, representing
the index of the dot.
A dual-dot braille pattern can be composed with
@kbd{<shift dead compose> "B"} followed by two digit
keys between @kbd{"1"} and @kbd{"8"}, representing
the indices of the dots.
More complex braille patterns are composed by
overlaying two braille patterns. This is done by
typing @kbd{<dead compose>} followed by the two
braille patterns to overlay. If the two braille
patterns are identical, the braille pattern will be
overlays with its mirror pattern.
@node Domino Tiles
@subsection Domino Tiles
@ubindex Domino Tiles
@c TODO compose tiles together
There are two types of domino tile glyphs:
horizontal and vertical. Each tile has two halfs with
0 to 6 dots. Additonally there is one horizontal
tile, and one vertical tile, with the back facing the
user.
Horizontal tiles are composed with
@kbd{<shift dead compose> "d" "t" "-"} followed by
the number of dots on the left side and the number of
dots on the right side. Horizontal tile with the back
facing the user is composed with either @kbd{"-"} or
@kbd{<space>} instead of the two digits.
Vertical tiles are composed with
@kbd{<shift dead compose> "d" "t" "|"} followed by
the number of dots on the top and the number of dots
on the bottom. Vertical tile with the back facing
the user is composed with either @kbd{"|"} or
@kbd{<space>} instead of the two digits.
@node Enclosed Alphanumeric Supplement
@subsection Enclosed Alphanumeric Supplement
@ubindex Enclosed Alphanumeric Supplement
1476
@node Enclosed Alphanumerics
@subsection Enclosed Alphanumerics
@ubindex Enclosed Alphanumerics
3133
@node General Punctuation
@subsection General Punctuation
@ubindex General Punctuation
@ubindex Punctuation, General
730
@node Geometric Shapes
@subsection Geometric Shapes
@ubindex Geometric Shapes
1687
@node Geometric Shapes Extended
@subsection Geometric Shapes Extended
@ubindex Geometric Shapes Extended
3194
@node IPA Extensions
@subsection IPA Extensions
@ubindex IPA Extensions
568
@node Latin Extended-A
@subsection Latin Extended-A
@ubindex Latin Extended-A
236
@node Latin Extended-B
@subsection Latin Extended-B
@ubindex Latin Extended-B
364
@node Latin Extended-C
@subsection Latin Extended-C
@ubindex Latin Extended-C
2834
@node Latin-1 Supplement
@subsection Latin-1 Supplement
@ubindex Latin-1 Supplement
136
@node Mahjong Tiles
@subsection Mahjong Tiles
@ubindex Mahjong Tiles
Unnumbered mahjong tiles are composed with
@kbd{<shift dead compose> "m" "t"} followed by one
additional key:
@table @kbd
@item <
West tile
@item v
South tile
@item >
East tile
@item ^
North tile
@item r
Red dragon tile
@item g
Green dragon tile
@item w
White dragon tile
@item m
Plum (mei) tile
@item l
Orchid (lan) tile
@item z
Bamboo (zhu) tile
@item j
Chrysanthemum (ju) tile
@item 1
Spring tile
@item 2
Summer tile
@item 3
Autumn tile
@item 4
Winter tile
@item *
Joker tile
@item /
The back of a mahjong tile
@end table
The numbered tiles are composed with
@kbd{<shift dead compose> "m" "t"} followed by with
additional keys: one for the suit, and one for the
value. The value is is encoded with either @kbd{"1"}
to @kbd{"9"}. The suits is encoded
@table @kbd
@item W
Characters (wan)
@item T
Bamboos (tiao)
@item B
Circles (bing)
@end table
@node Mathematical Operators
@subsection Mathematical Operators
@ubindex Mathematical Operators
1118
@node Miscellaneous Mathematical Symbols-A
@subsection Miscellaneous Mathematical Symbols-A
@ubindex Miscellaneous Mathematical Symbols-A
@ubindex Mathematical Symbols-A, Miscellaneous
1824
@node Miscellaneous Mathematical Symbols-B
@subsection Miscellaneous Mathematical Symbols-B
@ubindex Miscellaneous Mathematical Symbols-B
@ubindex Mathematical Symbols-B, Miscellaneous
2119
@node Miscellaneous Symbols and Arrows
@subsection Miscellaneous Symbols and Arrows
@ubindex Miscellaneous Symbols and Arrows
@ubindex Symbols and Arrows, Miscellaneous
@ubindex Arrows, Miscellaneous Symbols and
2594
@node Number Forms
@subsection Number Forms
@ubindex Number Forms
889
@node Playing Cards
@subsection Playing Cards
@ubindex Playing Cards
@kbd{<shift dead compose> "p" "c"} composes the
character presenting the back of a playing card.
Jokers and trumps are composed using the playing card
back and two additional characters.
@table @asis
@item joker, red
@kbd{<dead compose> <playing card back> "j" "r"}
@item joker, white
@kbd{<dead compose> <playing card back> "j" "w"}
@item joker, black
@kbd{<dead compose> <playing card back> "j" "b"}
@end table
The red joker can be composed with the sequence
@kbd{<dead compose> <shift dead compose> "p" "c" "j" "r"},
becuase @kbd{<playing card back>} can be composed with
the sequence @kbd{<shift dead compose> "p" "c"}.
The trumps are number 1 through 21, and are composed
with @kbd{<dead compose> <playing card back> "1" <space>}
through @kbd{<dead compose> <playing card back> "2" "1"}.
Additionally, the fool card is composed with through
@kbd{<dead compose> <playing card back> "0" <space>}.
The Playing Cards block in Unicode also contains ace,
2--10, jack, knight, queen och king for the suits
spades/swords, hearts/cups, diamonds/pentacles and
clubs/wands. These are composed with the
@kbd{<dead compose>} followed by, in any order, the
suit and value. The values are encoded
@table @asis
@item Ace
@kbd{"A"}, @kbd{"a"} or @kbd{"1"}
@item 2--9
@kbd{"2"} through @kbd{"9"}
@item 10
@kbd{"0"}
@item Jack
@kbd{"J"} or @kbd{"j"}
@item Knight
@kbd{"C"} or @kbd{"c"}
@item Queen
@kbd{"Q"} or @kbd{"q"}
@item King
@kbd{"K"} or @kbd{"k"}
@end table
and the suits are encoded
@table @asis
@item Spades or Swords
Black or white spades symbol
@item Hearts or Cups
Black or white hearts symbol
@item Diamonds or Pentacles
Black or white diamonds symbol
@item Clubs or Wands
Black or white clubs symbol
@end table
@node Superscripts and Subscripts
@subsection Superscripts and Subscripts
@ubindex Superscripts and Subscripts
@ubindex Subscripts, Superscripts and
840
@node Supplemental Arrows-A
@subsection Supplemental Arrows-A
@ubindex Supplemental Arrows-A
@ubindex Arrows-A, Supplemental
1900
@node Supplemental Arrows-B
@subsection Supplemental Arrows-B
@ubindex Supplemental Arrows-B
@ubindex Arrows-B, Supplemental
1973
@node Supplemental Arrows-C
@subsection Supplemental Arrows-C
@ubindex Supplemental Arrows-C
@ubindex Arrows-C, Supplemental
3284
@node Supplemental Mathematical Operators
@subsection Supplemental Mathematical Operators
@ubindex Supplemental Mathematical Operators
@ubindex Mathematical Operators, Supplemental
2286
@node Tags
@subsection Tags
@ubindex Tags
The ``Tags'' block in Unicode has been deprecated.
Characters in this block is therefore not mapped in
the compose table.
@node Variation Selectors
@subsection Variation Selectors
@ubindex Variation Selectors
@ubindex Variation Selectors Supplement
@c TODO Variation Selectors, Variation Selectors Supplement
There are 256 variation selectors, numbered 1 through
256. These can be composed with the sequence
@kbd{<shift dead compose> "v" "s"} followed by
exactly three digits. These digits should form the
index of the variation selector. Indices lower than
100, require leading @kbd{"0"}:s. Alternatively,
variation selectors with an index lower than 100,
can be composed with a trailing @kbd{<space>} instead
of leading @kbd{"0"}:s.
@node Accessibility
@chapter Accessibility
@menu
* Sticky Keys:: Ephemeral key-locking.
* Bounce Keys:: Key repetition-elimination.
* Slow Keys:: Key press-acceptance delay.
* Loud Keys:: Keyboard tiggered sound cues.
* Mouse Keys:: Controlling the mouse with the keyboard.
@end menu
@c TODO vector grapics compatible magnifier
@node Sticky Keys
@section Sticky Keys
@pgindex @command{mds-keystick}
@cpindex Sticky keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
Sticky keys is an accessibility feature that lets the
user process modifier keys instead of holding them
down. Sticky keys is implemented by the
@command{mds-keystick} server.
When @command{mds-keystick} is active, any key that
is mapped in @command{mds-keystick} to be a modifier
is held down once press and not released until an
non-modifier is released. It is possible for map any
key to have this feature, that do not have to be
actual modifiers, that is, modifiers according to
@command{mds-keytrans}.
If a key is press three times without any intermediate
keys, and is a modifier, that key released until it is
pressed again.
Note that @command{mds-keystick} is not aware of which
keys are considered modifiers by
@command{mds-keytrans}, but it is affected of
remappings in @command{mds-kbd} and
@command{mds-kkbd}, therefore it is better to swap,
for example, @kbd{control} and @kbd{caps lock} in the
keyboard servers than in @command{mds-keytrans}. Doing
so means that you do not have to configure
@command{mds-keystick} to know the original
@kbd{caps lock} is a modifier but the original
@kbd{control} is not.
@cpindex Mode lock key
@cpindex Keys, mode lock
For greater accessibility you can, in
@command{mds-keytrans}, replace a key with the
@kbd{mode lock}-key. If this is done, pressing a
sequence of modifiers and then the @kbd{mode lock}-key
will caused those modifiers to be locked until the
next time you press @kbd{mode lock}. Any modifier
pressed directly before, optionally with intermediate
modifiers, the second @kbd{mode lock} will stay
locked. The action of @kbd{mode lock} is to release
all modifiers it is locked and the lock those that
are currently held down; active stickly keys are
artificially held down and thus included.
@node Bounce Keys
@section Bounce Keys
@pgindex @command{mds-keybounce}
@cpindex Bounce keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
Bounce keys is an accessibility feature that filters
out rapidly repeated key strokes. Bounce keys is
implemented by the @command{mds-keybounce} server.
@node Slow Keys
@section Slow Keys
@pgindex @command{mds-slowkey}
@cpindex Slow keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
Slow keys is an accessibility feature that filters out
brief key strokes. Slow keys is implemented by the
@command{mds-slowkey} server.
@node Loud Keys
@section Loud Keys
@pgindex @command{mds-keycue}
@cpindex Loud keys
@cpindex Keyboard, accessibility
@cpindex Accessibility, keyboard
Loud keys is an accessibility feature that can emulate
key clicking sounds when a key is pressed or generate
tones when certain keys are pressed. For example if
@kbd{caps lock} is actived by a key stroke a
high-pitched tone can be generated when when it is
deactived by a key stroke a low-pitched tone can be
generated. Loud keys is implemented by the
@command{mds-keycue} server.
@node Mouse Keys
@section Mouse Keys
@pgindex @command{mds-kbd2rat}
@cpindex Keyboard to rat bindings
@cpindex Rat keys
@cpindex Mouse keys
Rat keys (also known as mouse keys) is an
accessibility and usability feature that lets the
user use the keyboard as a pointing device. This
feature is implemented by the @command{mds-kbd2rat}
server, and this section covers the details of that
server.
If @command{mds-kbd2rat} is used, the keypad acts as a
pointing device when @kbd{num lock} is not active. It
is also possible to configure @command{mds-kbd2rat} to
disregard @kbd{num lock} and always be active, until
it receives a signal to toggle its state. For example,
if @command{mds-kbd2rat} is configured to disregard
@kbd{num lock}, @command{mds-kbdtrans} can be
configured to send to fauxkey @kbd{rat} when
@kbd{alt+shift+num} is pressed, and this key can be
caught by @command{mds-keybind} that sends a signal to
@command{mds-kbd2rat} to toggle.
When @command{mds-kbd2rat} is active, it maps the
keypad to the rat according to the following table:
@table @kbd
@item division
Right-hand left (primary) rat button.
@item multiplication
Middle (modifier) rat button.
@item subtraction
Right-hand (alternate) right rat button.
@item addition
Scroll up.
@item return
Scroll down.
@item comma
Cancel actions waiting by @kbd{0} and
@kbd{5}.
@item 0
Hold down the next selected rat button until that rat
button is selected again. This is a dead key, that is,
you do not have to hold it down.
@item 1
Cursor left down.
@item 2
Cursor down.
@item 3
Cursor right down.
@item 4
Cursor left.
@item 5
Double click with the next selected rat button. This
is a dead key, that is, you do not have to hold it
down. If pressed twice, a triple click triggered
instead, and so on. If this key is prefixed by
@kbd{0}, the last click will be replaced by hold down
action.
@item 6
Cursor right.
@item 7
Cursor left up.
@item 8
Cursor up.
@item 9
Cursor right up.
@end table
This table is not affected by mappings in
@command{mds-keytrans}, but it is affected by
remappings in @command{mds-kbd} and
@command{mds-kkbd}.
@command{mds-kbd2rat} can be configured to permute
the rat button keys. It is independent of
permutations in @command{mds-rat}.
If multiple direction keys@footnote{@kbd{1}, @kbd{2},
@kbd{3}, @kbd{3}, @kbd{4}, @kbd{6}, @kbd{7}, @kbd{8}
and @kbd{9}} are used, the average direction is used.
@command{mds-kbd2rat} is five parameters that control
with which speed it moves the cursor:
@table @asis
@item delay
The delay it takes before the first time a mouse
event is repeated when a key is held down. The
default is for the server to wait for the keyboard to
send another key press.
@item interval
The time it takes before a mouse event is repeated
since its previous repear when a key is held down.
The default is for the server to wait for the
keyboard to send another key press.
@item max speed
The maximum speed with which the cursor can move.
@item time to max speed
The time a key has to be held down before the maximum
speed is reached. The cursor accelerate with each
mouse event repeat.
@item curve
Ramp used to reach pointer speed.
@end table
The pointer's speed, not taking caps into
consideration, is calculated by
@iftex
@math{max~speed \left ( hold~down~time ~-~ delay \over time~to~max~speed \right)^{1 ~+~ curve}}
@end iftex
@ifnottex
max speed ((hold down time - delay) / time to max
speed)^(1 + curve)
@end ifnottex
@node Specifications
@chapter Specifications
@menu
* Rat Cursors:: Rat cursor specifications.
* Colour Names:: Recommended colour names.
* Nesting Applications:: Specifications for nesting applications.
* The Real Display Server:: Identifying the real display server.
@end menu
@node Rat Cursors
@section Rat Cursors
@cpindex Cursor, specifications
@cpindex Rat cursor, specifications
@cpindex Mouse cursor, specifications
@pgindex @command{mds-cursorshadow}
@cpindex Cursor shadow
@cpindex Rat cursor shadow
@cpindex Mouse cursor shadow
@cpindex Shadow, cursor
Rat cursor themes should not add shadows to the
cursors. Shadows are added by the
@command{mds-cursorshadow} server according to the
user's specifications.
@command{mds}'s rat cursors specifications are based on
@url{http://www.freedesktop.org/wiki/Specifications/cursor-spec}.
All rat cursor themes should include the cursors
listed below. The icons are conceptual examples of
how they can look.
@cpindex Cursor animation
@cpindex Rat cursor animation
@cpindex Mouse cursor animation
@cpindex Animation, cursors
In addition to the cursors below, each of the may be
accompanied with @code{X-press}, @code{X-hold} and
@code{X-release}, where @code{X} is the name of the
master icon. @code{X-press} is an animation from
@code{X} to @code{X-hold} and is used when the cursor
should transition from @code{X} to @code{X-hold}.
@code{X-hold} is the version of @code{X} that should
be used if any rat button is held down. @code{X-release}
is an animation from @code{X-hold} to @code{X} and is
used when the cursor should transition from
@code{X-hold} to @code{X}@. Clients should not set
the cursor to either of them, it is up to the server
to do this based on events from the rat device.
@ifset AFIVEPAPER
@page
@end ifset
@table @code
@item default
This is the default cursor. It is used as a fallback
if no more fitting cursor is found; for example if a
programs wants the cursor to be @command{pointer},
but the server is unable to find it, it will fallback
to @command{default}. The server should provide its
own fallback in case the theme is missing this cursor
too.
This cursor indicates that the interface is idle and
prepared to accept commands from the user.
This cursor is usually a north-west- or
north-north-west-pointing arrow. For left-handed
themes this cursor is usually a north-east- or
north-north-east-pointing arrow.
@example
@group
##
####
######
########
##########
############
##############
################
##################
############
###### ####
#### ######
## ####
######
####
####
@end group
@end example
@page
@item context-menu
@cpindex Menus, context menus
@cpindex Context menus
This cursor indicates the same state as
@command{default} with he addition that the object
beneath it can be right-clicked (left-clicked if
left-handed) to open a context menu.
This cursor is typically @command{default} combined
with a small menu.
@example
@group
## ############
#### ############
###### ## ##
######## ############
########## ## ##
############ ############
############## ## ##
################ ############
##################
############
###### ####
#### ######
## ####
######
####
####
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER
@page
@end ifset
@item text
@cpindex Text, horizontal
@cpindex Horizontal text
This cursor should be used when the rat pointers is
above an horizontal text that can be selected and
possibly edited.
This cursor is usually a vertical I-beam.
@example
@group
##############
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##############
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@item vertical-text
@cpindex Text, vertical
@cpindex Vertical text
@cpindex Text, rotated
@cpindex Rotated text
This cursor should be used when the rat pointers is
above an vertical text that can be selected and
possibly edited.
If this cursor is missing, @code{text} should be used
as the first fallback.
This cursor is usually a horizontal I-beam.
@example
@group
## ##
## ##
## ##
################################
## ##
## ##
## ##
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item progress
@cpindex Wait cursor
@cpindex Progress cursor
This cursor indicates that the interface can be used
as when @command{default} is used. But that the
program is working in the background with command the
user previously issued.
This cursor is usually rendered as a combination of
@command{default} and @command{wait}.
@example
@group
## ############
#### ############
###### ########
######## ####
########## ####
############ ########
############## ############
################ ############
##################
############
###### ####
#### ######
## ####
######
####
####
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@item wait
@cpindex Wait cursor
@cpindex Progress cursor
This cursor indicates that the interface cannot be
used because it is working or is blocked by an
external resource.
This cursor is typically rendered as a hourglass,
watch, sundial or some sort of animated ring.
@example
@group
####################
####################
################
############
########
####
####
####
####
####
####
########
############
################
####################
####################
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item pointer
@cpindex Clickable
@cpindex Links
This cursor indicates that the object beneath it is
clickable. Typically a link in a Web browser.
However, it should not be used for pushbuttons and
other user interface elements where it is apparent by
design that the object is clickable.
This cursor is usually a right hand (left hand if
left-handed) pointing with the index-finger.
@example
@group
####
####
####
####
#### ####
#### #### ####
## #### #### #### ####
###### ################ ####
##############################
############################
##########################
##########################
########################
########################
####################
################
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@item help
@cpindex Help mode
This cursor indicates that the interface is in
context help mode. This is usually activated by
clicking an help button --- which usally has a
question mark on it --- on the titlebar.
This cursor is typically renderas as @code{default}
with a question mark next to it.
@example
@group
## ######
#### ##########
###### #### ####
######## ####
########## ####
############ ####
############## ####
################ ####
##################
############ ####
###### #### ####
#### ######
## ####
######
####
####
@end group
@end example
@vskip 0pt plus 1filll
@item drag
@cpindex Drag-and-drop
This cursor indicates that an object is being dragged.
This cursor is usually a closed right hand, or closed
left hand if left-handed.
@example
@group
#### #### ####
################ ####
############################
############################
############################
##########################
########################
########################
####################
################
@end group
@end example
@vskip 0pt plus 1filll
@page
@item copy
@cpindex Drag-and-drop, copy
@cpindex Copy, drag-and-drop
This cursor indicates that the dragged object will be
copied or listed upon release.
If this cursor is missing, @code{drag} should be used
as the first fallback.
This cursor is usually rendered as @code{drag} with a
plus-sign next to it.
@example
@group
##
##
##########
##
##
#### #### ####
################ ####
############################
############################
############################
##########################
########################
########################
####################
################
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER
@page
@end ifset
@item move
@cpindex Drag-and-drop, move
@cpindex Move, drag-and-drop
This cursor indicates that the dragged object will be
moved upon release, or otherwise acted upon.
If this cursor is missing, @code{drag} should be used
as the first fallback.
This cursor is usually rendered as @code{drag} with
an arrow next to it. The arrow is usually point
north-east, or north-west if left-handed.
@example
@group
######
####
## ##
##
##
#### #### ####
################ ####
############################
############################
############################
##########################
########################
########################
####################
################
@end group
@end example
@vskip 0pt plus 1filll
@page
@item alias
@cpindex Drag-and-drop, link
@cpindex Link, drag-and-drop
@cpindex Drag-and-drop, alias
@cpindex Alias, drag-and-drop
This cursor indicates that the dragged object will be
aliased upon release, or otherwise acted upon. This
may entail creating a symlink.
If this cursor is missing, @code{drag} should be used
as the first fallback.
This cursor is usually rendered as @code{drag} with
an two or three linked links next to it, or an arced
arrow.
@example
@group
#### ####
## ##
## ######## ##
## ##
#### ####
#### #### ####
################ ####
############################
############################
############################
##########################
########################
########################
####################
################
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFOURPAPER
@ifclear SMALLBOOK_WITH_SMALLFONT
@ifclear USLETTER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@end ifclear
@item no-drop
@cpindex Drag-and-drop
This cursor indicates that the dragged object cannot
be release where the rat pointer is located, but that
the object beneath it usually allow drops of objects
with similar class to the dragged object.
If this cursor is missing, @code{not-allowed} should
be used as the first fallback, and @code{drag} should
be used as the second fallback.
This cursor is typically rendered as a combination of
@code{drag} and @code{not-allowed}.
@example
@group
########
## ####
## ## ##
## ## ##
#### ##
########
#### #### ####
################ ####
############################
############################
############################
##########################
########################
########################
####################
################
@end group
@end example
@vskip 0pt plus 1filll
@page
@item not-allowed
@cpindex Invalid
@cpindex Not allowed
This cursor indicates that the region beneath the rat
pointer is invalid for the current operation.
This cursor is often rendered as a circle with a
diagonal line through it.
@example
@group
########
#### ####
## ##
## ####
## ## ##
## ## ##
## ## ##
## ## ##
## ## ##
## ## ##
## ## ##
## ## ##
#### ##
## ##
#### ####
########
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER
@page
@end ifset
@item all-scroll
@cpindex Scrolling
This cursor is used to indicate that moving the rat
will also move the object beneath below the cursor
This cursor is often rendered as a combined vertical
and horizontal twin-headed arrow.
@example
@group
##
######
##########
##
##
## ## ##
#### ## ####
##############################
#### ## ####
## ## ##
##
##
##########
######
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@item up-arrow
@cpindex Insertion point
This cursor is typically used to identify an
insertion point.
It is often rendered an upwards-pointing arrow.
@example
@group
##
######
##########
##############
######
######
######
######
######
######
######
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item cell
@cpindex Spread-sheets
@cpindex Cell selection
@cpindex Tables, selection
This cursor is often used in spread-sheet applications
when selecting cells.
It is typically rendered as a thick plus-sign.
@example
@group
######
######
######
######
######
##########################
##########################
##########################
######
######
######
######
######
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@item col-resize
@cpindex Tables, resize
@cpindex Columns, resize
@cpindex Resize table columns
This cursor is used to indicate that the cursor is
within a region that allows it rat to be used to
resize a column.
If this cursor is missing, @code{ew-resize} should
be used as the first fallback, and @code{ew-select}
should be used as the second fallback.
This cursor is typically rendered as a vertical bar
with an arrow from the left side pointing horizontally
towards it and an arrow from the right side pointing
horizontally towards it.
@example
@group
##
##
##
##
##
## ## ##
#### ## ####
############ ## ############
#### ## ####
## ## ##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFOURPAPER
@ifclear USLETTER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@ifset AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item row-resize
@cpindex Tables, resize
@cpindex Rows, resize
@cpindex Resize table rows
This cursor is used to indicate that the cursor is
within a region that allows it rat to be used to
resize a column.
If this cursor is missing, @code{ns-resize} should be
used as the first fallback, and @code{ns-select}
should be used as the second fallback.
This cursor is typically rendered as a horizontal bar
with an arrow from the left side pointing vertically
towards it and an arrow from the right side pointing
vertically towards it.
@example
@group
##
##
##
##########
######
##
##############################
##
######
##########
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear USLETTER
@ifclear SMALLBOOK_WITH_SMALLFONT
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@end ifclear
@ifset USLETTER_WITH_SMALLFONT
@page
@end ifset
@item crosshair
@cpindex Drawing
@cpindex Precision drawing
@cpindex Crosshair cursor
This cursor is used for precision drawing or
precision manipulation of an area.
This cursor typically a thin crosshair.
@example
@group
##
##
##
##
##
##
##
##############################
##
##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@item w-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{w-select} should be
used as the first fallback, @code{ew-resize} should
be used as the second fallback, @code{ew-select}
should be used as the third fallback, and
@code{col-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a west-pointing
arrow, optionally with a wall at the arrowhead.
@example
@group
## ##
## ##
## ##
## ############################
## ##
## ##
## ##
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item w-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{w-resize} should be
used as the first fallback, @code{ew-select} should
be used as the second fallback, @code{ew-resize}
should be used as the third fallback, and
@code{col-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a west-pointing
arrow.
@example
@group
##
##
##
############################
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFIVEPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@ifset USLETTER_WITH_SMALLFONT
@page
@end ifset
@item e-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{e-select} should be
used as the first fallback, @code{ew-resize} should
be used as the second fallback, @code{ew-select}
should be used as the third fallback, and
@code{col-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a east-pointing
arrow, optionally with a wall at the arrowhead.
@example
@group
## ##
## ##
## ##
############################ ##
## ##
## ##
## ##
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@ifclear USLETTER_WITH_SMALLFONT
@page
@end ifclear
@end ifset
@item e-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{e-resize} should be
used as the first fallback, @code{ew-select} should
be used as the second fallback, @code{ew-resize}
should be used as the third fallback, and
@code{col-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a east-pointing
arrow.
@example
@group
##
##
##
############################
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifset SMALLBOOK
@ifclear SMALLFONT
@page
@end ifclear
@end ifset
@ifset AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item n-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{n-select} should be
used as the first fallback, @code{ns-resize} should
be used as the second fallback, @code{ns-select}
should be used as the third fallback, and
@code{row-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a north-pointing
arrow, optionally with a wall at the arrowhead.
@example
@group
##############
##
######
## ## ##
## ## ##
##
##
##
##
##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear SMALLBOOK
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@ifset SMALLBOOK_WITH_SMALLFONT
@page
@end ifset
@item n-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{n-resize} should be
used as the first fallback, @code{ns-select} should
be used as the second fallback, @code{ns-resize}
should be used as the third fallback, and
@code{row-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a north-pointing
arrow.
@example
@group
##
######
## ## ##
## ## ##
##
##
##
##
##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFOURPAPER_OR_USLETTER_OR_SMALLBOOK_WITH_SMALLFONT
@page
@end ifclear
@ifset AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item s-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{s-select} should be
used as the first fallback, @code{ns-resize} should
be used as the second fallback, @code{ns-select}
should be used as the third fallback, and
@code{row-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a south-pointing
arrow, optionally with a wall at the arrowhead.
@example
@group
##
##
##
##
##
##
##
##
##
##
## ## ##
## ## ##
######
##
##############
@end group
@end example
@vskip 0pt plus 1filll
@ifclear SMALLBOOK
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@item s-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{s-resize} should be
used as the first fallback, @code{ns-select} should
be used as the second fallback, @code{ns-resize}
should be used as the third fallback, and
@code{row-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a south-pointing
arrow.
@example
@group
##
##
##
##
##
##
##
##
##
##
## ## ##
## ## ##
######
##
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item nw-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{nw-select}
should be used as the first fallback,
@code{nwse-resize} should be used as the second
fallback, @code{nwse-select} should be used as the
third fallback, and @code{all-resize}. should be used
as the fourth fallback.
This cursor is typically rendered as a
north-west-pointing arrow, optionally with a corner
at the arrowhead.
@example
@group
##################
##
##
## ############
## ####
## ## ##
## ## ##
## ## ##
## ## ##
##
##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear SMALLBOOK
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@item nw-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{nw-resize} should be
used as the first fallback, @code{nwse-select} should
be used as the second fallback, @code{nwse-resize}
should be used as the third fallback, and
@code{all-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a
north-west-pointing arrow.
@example
@group
############
####
## ##
## ##
## ##
## ##
##
##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item se-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{se-select} should be
used as the first fallback, @code{nwse-resize} should
be used as the second fallback, @code{nwse-select}
should be used as the third fallback, and
@code{all-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a
south-east-pointing arrow, optionally with a corner
at the arrowhead.
@example
@group
##
##
##
##
##
##
##
## ## ##
## ## ##
## ## ##
## ## ##
#### ##
############ ##
##
##
##################
@end group
@end example
@vskip 0pt plus 1filll
@ifclear SMALLBOOK
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@item se-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{se-resize} should be
used as the first fallback, @code{nwse-select} should
be used as the second fallback, @code{nwse-resize}
should be used as the third fallback, and
@code{all-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a
south-east-pointing arrow.
@example
@group
##
##
##
##
##
##
##
## ##
## ##
## ##
## ##
####
############
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item ne-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{ne-select} should be
used as the first fallback, @code{nesw-resize} should
be used as the second fallback, @code{nesw-select}
should be used as the third fallback, and
@code{all-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a
north-east-pointing arrow, optionally with a corner
at the arrowhead.
@example
@group
##################
##
##
############ ##
#### ##
## ## ##
## ## ##
## ## ##
## ## ##
##
##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear SMALLBOOK
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@item ne-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{ne-resize} should be
used as the first fallback, @code{nesw-select} should
be used as the second fallback, @code{nesw-resize}
should be used as the third fallback, and
@code{all-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a
north-east-pointing arrow.
@example
@group
############
####
## ##
## ##
## ##
## ##
##
##
##
##
##
##
##
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item sw-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{sw-select} should be
used as the first fallback, @code{nesw-resize} should
be used as the second fallback, @code{nesw-select}
should be used as the third fallback, and
@code{all-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a
south-west-pointing arrow, optionally with a corner
at the arrowhead.
@example
@group
##
##
##
##
##
##
##
## ## ##
## ## ##
## ## ##
## ## ##
## ####
## ############
##
##
##################
@end group
@end example
@vskip 0pt plus 1filll
@ifclear SMALLBOOK
@ifclear AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@end ifclear
@item sw-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{sw-resize} should be
used as the first fallback, @code{nesw-select} should
be used as the second fallback, @code{nesw-resize}
should be used as the third fallback, and
@code{all-resize}. should be used as the fourth
fallback.
This cursor is typically rendered as a
south-west-pointing arrow.
@example
@group
##
##
##
##
##
##
##
## ##
## ##
## ##
## ##
####
############
@end group
@end example
@vskip 0pt plus 1filll
@item ew-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{ew-select} should be
used as the first fallback, and @code{col-resize}.
should be used as the second fallback.
This cursor is typically rendered as an east- and
west-pointing twin-arrow, optionally with a wall at
the arrowheads.
@example
@group
## ## ## ##
## ## ## ##
## ## ## ##
## ######################## ##
## ## ## ##
## ## ## ##
## ## ## ##
@end group
@end example
@vskip 0pt plus 1filll
@ifset SMALLFONT
@ifset AFOURPAPER_OR_AFIVEPAPER
@page
@end ifset
@end ifset
@item ew-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{ew-resize} should be
used as the first fallback, and @code{col-resize}.
should be used as the second fallback.
This cursor is typically rendered as an east- and
west-pointing twin-arrow.
@example
@group
## ##
## ##
## ##
########################
## ##
## ##
## ##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear AFIVEPAPER_OR_AFOURPAPER_WITH_SMALLFONT
@page
@end ifclear
@item ns-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{ns-select} should be
used as the first fallback, and @code{row-resize}.
should be used as the second fallback.
This cursor is typically rendered as a north- and
south-pointing twin-arrow, optionally with a wall at
the arrowheads.
@example
@group
##############
##
######
## ## ##
## ## ##
##
##
##
##
## ## ##
## ## ##
######
##
##############
@end group
@end example
@vskip 0pt plus 1filll
@item ns-select
@cpindex Cell selection
@cpindex Tables, selection
If this cursor is missing, @code{ns-resize} should be
used as the first fallback, and @code{row-resize}.
should be used as the second fallback.
This cursor is typically rendered as a north- and
south-pointing twin-arrow.
@example
@group
##
######
## ## ##
## ## ##
##
##
##
##
## ## ##
## ## ##
######
##
@end group
@end example
@vskip 0pt plus 1filll
@ifclear SMALLFONT
@ifclear AFIVEPAPER
@page
@end ifclear
@end ifclear
@ifset USLETTER_WITH_SMALLFONT
@page
@end ifset
@ifset AFOURPAPER_WITH_SMALLFONT
@page
@end ifset
@item nwse-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{all-resize} should
be used as the first fallback.
This cursor is typically rendered as a north-west- and
south-east-pointing twin-arrow, optionally with a
corner at the arrowheads.
@example
@group
##################
##
##
## ############
## ####
## ## ##
## ## ##
## ## ## ## ##
## ## ## ## ##
## ## ##
## ## ##
#### ##
############ ##
##
##
##################
@end group
@end example
@vskip 0pt plus 1filll
@ifset AFIVEPAPER
@page
@end ifset
@item nesw-resize
@cpindex Resizing
@cpindex Window resizing
If this cursor is missing, @code{all-resize} should
be used as the first fallback.
This cursor is typically rendered as a north-east- and
south-west-pointing twin-arrow, optionally with a
corner at the arrowheads.
@example
@group
##################
##
##
############ ##
#### ##
## ## ##
## ## ##
## ## ## ## ##
## ## ## ## ##
## ## ##
## ## ##
## ####
## ############
##
##
##################
@end group
@end example
@vskip 0pt plus 1filll
@page
@item all-resize
@cpindex Resizing
@cpindex Window resizing
This cursor is typically rendered as a cross between
a north-east and south-west-pointing twin-arrow and a
north-west- and south-east-pointing twin-arrow,
optionally with a corner at the arrow heads.
@example
@group
########## ##########
#### ####
## ## ## ##
## ## ## ##
## ## ## ##
## ##
## ##
##
## ##
## ##
## ## ## ##
## ## ## ##
## ## ## ##
#### ####
########## ##########
@end group
@end example
@end table
@cpindex Cell selection
@cpindex Tables, selection
In addition, it is advised that @code{nwse-select}
and @code{nesw-select} are rendered in the same
mannar as the other @code{*-select} cursors and
analogously to @code{nwse-resize} and
@code{nesw-resize}, respectively.
@cpindex Text, rotated
@cpindex Rotated text
It is also advised to make cursors intermediate to
@code{text} and @code{vertical-text}. These are named
with the pattern @code{text-*}, where @code{*} is
replaced by the number of degrees the text is rotated
anti-clockwise. This means that @code{text} should be
used if @code{text-0} is requested but missing, and
@code{vertical-text} should be used if @code{text-90}
is requested but missing. Finally, the closest
existing cursor should be used, and the cursor rotated
180 degrees of what is requested should be used if
there is no matching cursor with a rotation distance
within, but excluding, 90@tie{}degrees. @code{*}
should be in the interval [0,@tie{}360[, and a
period@tie{}(`.') should be used as a decimal
pointer, as it is used in most programming languages.
@node Colour Names
@section Colour Names
@cpindex Colour names
@cpindex System colours
@cpindex Colours, system
@cpindex Colours, names
@command{mds} protocols provide an optional way to
name colours. This is used primarily for colours
used by toolkits. These are called system colours.
But it is also possible to have names for common
colours that should be tunable. These are called
named colours.
There are no colours is guaranteed to exist. Nor
is it guaranteed that value of named colours
reflect the names of them, in any aspect. For
example `red' could be a light blue, and
`light-red` could be a dark green. In fact, you
use assume that the names does not reflect the
actual colour. For example, if a terminal uses
named colours for the colours choosen by programs
via ANSI escape sequences, the use can change
these colours to create a theme she likes better,
even if the colours are no longer what ANSI
defines them.
There is however a list of recommended colour
names, with recommended definitions:
@table @code
@item black
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 30 m} or
@code{CSI 40 m}. This colour is usually pure
black.
@item red
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 31 m} or
@code{CSI 41 m}. This colour is usually a
medium red.
@item green
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 32 m} or
@code{CSI 42 m}. This colour is usually a
medium green.
@item yellow
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 33 m} or
@code{CSI 43 m}. This colour is usually a
medium yellow or medium orange.
@item blue
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 34 m} or
@code{CSI 44 m}. This colour is usually a
medium blue.
@item purple
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 35 m} or
@code{CSI 45 m}. This colour is usually a
medium purple, medium lilac or medium
fuchsia/magenta.
@item teal
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 36 m} or
@code{CSI 46 m}. This colour is usually a
medium teal or medium turquoise/cyan
@item grey
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequences @code{CSI 37 m} or
@code{CSI 47 m}. This colour is usually around
50% grey.
@item dark-grey
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 30 m}.
This colour is usually around 25% grey.
@item light-red
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 31 m}.
This colour is usually the same colour as,
but brighter than, @code{red}.
@item light-green
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 32 m}.
This colour is usually the same colour as,
but brighter than, @code{green}.
@item light-yellow
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 33 m}.
This colour is usually a bright yellow.
@item light-blue
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 34 m}.
This colour is usually the same colour as,
but brighter than, @code{blue}.
@item light-purple
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 35 m}.
This colour is usually the same colour as,
but brighter than, @code{purple}.
@item light-teal
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 36 m}.
This colour is usually the same colour as,
but brighter than, @code{teal}.
@item white
It is recommended that terminals use this as
the default colour for the colour selected by
the ANSI escape sequence @code{CSI 1 ; 37 m}.
This colour is usually a pure white or very
bright grey.
@item background
It is recommended that terminals use this as
the default background colour. This should
be noted, that it is not recommened for or
programs.
@item foreground
It is recommended that terminals use this as
the default text colour. This should be noted,
that it is not recommened for or programs.
@item desktop-background
The default background colour on the desktop.
@item desktop-foreground
The colour for text on icons and gadgets
on the desktop.
@item desktop-selection
The background for text on icons that
have been selected on the desktop.
@item desktop-selection-foreground
The colour for text on icons that
have been selected on the desktop.
@item desktop-foreground-hover
The colour for text on icons on the desktop,
when the icon is being hovered.
@item desktop-selection-hover
The background for text on icons that
have been selected on the desktop, when the
icon is being hovered.
@item desktop-selection-foreground-hover
The colour for text on icons that
have been selected on the desktop, when the
icon is being hovered.
@item window-background
The background on windows.
@item window-foreground
The colour on text on windows, as well
as the colour of frames.
@item window-foreground-disabled
The colour on text, associated with disabled
components, on windows.
@item window-cursor
The colour on text cursors for selectable
text on windows.
@item window-selection
The colour on text-selection highlight for
selectable text on windows.
@item window-selection-foreground
The colour on text on selected for text on
windows.
@item link-foreground
The colour on text for unvisited links.
@item link-active-foreground
The colour on text for links that are currently
being visited.
@item link-visited-foreground
The colour on text for visited links.
@item link-broken-foreground
The colour on text for broken links.
@item link-background-foreground
The background colour for unvisited links.
@item link-active-background
The background colour for links that are
currently being visited.
@item link-visited-background
The background colour for visited links.
@item link-broken-background
The background colour for broken links.
@item link-selection
The colour on text highlight for selected
text on unvisited links.
@item link-active-selection
The colour on text highlight for selected
text on links that are currently being visited.
@item link-visited-selection
The colour on text highlight for selected
text on visited links.
@item link-broken-selection
The colour on text highlight for selected
text on broken links.
@item link-selection-foreground
The colour on selected text on unvisited links.
@item link-active-selection-foreground
The colour on selected text on links that are
currently being visited.
@item link-visited-selection-foreground
The colour on selected text on visited links.
@item link-broken-selection-foreground
The colour on selected text on broken links.
@item link-foreground-hover
The colour on text for unvisited links,
when the link is being hovered.
@item link-active-foreground-hover
The colour on text for links that are currently
being visited, when the link is being hovered.
@item link-visited-foreground-hover
The colour on text for visited links, when the
link is being hovered.
@item link-broken-foreground-hover
The colour on text for broken links, when the
link is being hovered.
@item link-background-foreground-hover
The background colour for unvisited links,
when the link is being hovered.
@item link-active-background-hover
The background colour for links that are
currently being visited, when the link is
being hovered.
@item link-visited-background-hover
The background colour for visited links,
when the link is being hovered.
@item link-broken-background-hover
The background colour for broken links,
when the link is being hovered.
@item link-selection-hover
The colour on text highlight for selected
text on unvisited links, when the link is
being hovered.
@item link-active-selection-hover
The colour on text highlight for selected
text on links that are currently being visited,
when the link is being hovered.
@item link-visited-selection-hover
The colour on text highlight for selected
text on visited links, when the link is being
hovered.
@item link-broken-selection-hover
The colour on text highlight for selected
text on broken links, when the link is being
hovered.
@item link-selection-foreground-hover
The colour on selected text on unvisited
links, when the link is being hovered.
@item link-active-selection-foreground-hover
The colour on selected text on links that are
currently being visited, when the link is being
hovered.
@item link-visited-selection-foreground-hover
The colour on selected text on visited links,
when the link is being hovered.
@item link-broken-selection-foreground-hover
The colour on selected text on broken links,
when the link is being hovered.
@item link-foreground-disabled
The colour on text for unvisited links, when
the link is disabled.
@item link-active-foreground-disabled
The colour on text for links that are currently
being visited, when the link is disabled.
@item link-visited-foreground-disabled
The colour on text for visited links, when
the link is disabled.
@item link-broken-foreground-disabled
The colour on text for broken links, when
the link is disabled.
@item link-background-disabled
The background colour for unvisited links,
when the link is disabled.
@item link-active-background-disabled
The background colour for links that are
currently being visited, when the link is disabled.
@item link-visited-background-disabled
The background colour for visited links, when
the link is disabled.
@item link-broken-background-disabled
The background colour for broken links, when
the link is disabled.
@item link-selection-disabled
The colour on text highlight for selected
text on unvisited links, when the link is disabled.
@item link-active-selection-disabled
The colour on text highlight for selected
text on links that are currently being visited,
when the link is disabled.
@item link-visited-selection-disabled
The colour on text highlight for selected
text on visited links, when the link is disabled.
@item link-broken-selection-disabled
The colour on text highlight for selected
text on broken links, when the link is disabled.
@item link-selection-foreground-disabled
The colour on selected text on unvisited links,
when the link is disabled.
@item link-active-selection-foreground-disabled
The colour on selected text on links that are
currently being visited, when the link is disabled.
@item link-visited-selection-foreground-disabled
The colour on selected text on visited links,
when the link is disabled.
@item link-broken-selection-foreground-disabled
The colour on selected text on broken links,
when the link is disabled.
@item button-background
The background colour on buttons and button-like
controls.
@item button-foreground
The colour on text on buttons and button-like
controls.
@item button-aura
The colour on aura around buttons and button-like
controls to mark that they have focus.
@item button-background-toggled
The background colour on buttons and button-like
controls, under that condition that the button
is toggled.
@item button-foreground-toggled
The colour on text on buttons and button-like
controls, under that condition that the button
is toggled.
@item button-aura-toggled
The colour on aura around buttons and button-like
controls to mark that they have focus, under that
condition that the button is toggled.
@item button-background-hover
The background colour on buttons and button-like
controls, when the button is being hovered.
@item button-foreground-hover
The colour on text on buttons and button-like
controls, when the button is being hovered.
@item button-aura-hover
The colour on aura around buttons and button-like
controls to mark that they have focus, when the
button is being hovered.
@item button-background-toggled-hover
The background colour on buttons and button-like
controls, when the button is being hovered, under
that condition that the button is toggled.
@item button-foreground-toggled-hover
The colour on text on buttons and button-like
controls, when the button is being hovered, under
that condition that the button is toggled.
@item button-aura-toggled-hover
The colour on aura around buttons and button-like
controls to mark that they have focus, when the
button is being hovered, under that condition that
the button is toggled.
@item button-background-disabled
The background colour on disabled buttons and
button-like controls.
@item button-foreground-disabled
The colour on text on disabled buttons and
button-like controls.
@item button-aura-disabled
The colour on aura around disabled buttons
and button-like controls to mark that they
have focus.
@item button-background-toggled-disabled
The background colour on disabled buttons and
button-like controls, under that condition that
the button is toggled.
@item button-foreground-toggled-disabled
The colour on text on disabled buttons and
button-like controls, under that condition that
the button is toggled.
@item button-aura-toggled-disabled
The colour on aura around disabled buttons and
button-like controls to mark that they have
focus, under that condition that the button is
toggled.
@item button-background-change
The background colour on buttons and button-like
controls, under the condition that the button is
being clicked.
@item button-foreground-change
The colour on text on buttons and button-like
controls, under the condition that the button is
being clicked.
@item button-aura-change
The colour on aura around buttons and button-like
controls to mark that they have focus, under the
condition that the button is being clicked.
@item button-background-toggled-change
The background colour on buttons and button-like
controls, under that condition that the button
is toggled and is being clicked.
@item button-foreground-toggled-change
The colour on text on buttons and button-like
controls, under that condition that the button
is toggled and is being clicked.
@item button-aura-toggled-change
The colour on aura around buttons and button-like
controls to mark that they have focus, under that
condition that the button is toggled and is being
clicked.
@item button-background-hover-change
The background colour on buttons and button-like
controls, under the condition that the button is
being clicked.
@item button-foreground-hover-change
The colour on text on buttons and button-like
controls, under the condition that the button is
being hovered and clicked.
@item button-aura-hover-change
The colour on aura around buttons and button-like
controls to mark that they have focus, under the
condition that the button is being hovered and
clicked.
@item button-background-toggled-hover-change
The background colour on buttons and button-like
controls, under that condition that the button
is toggled and is being hovered and clicked.
@item button-foreground-toggled-hover-change
The colour on text on buttons and button-like
controls, under that condition that the button
is toggled and is being hovered and clicked.
@item button-aura-toggled-hover-change
The colour on aura around buttons and button-like
controls to mark that they have focus, under that
condition that the button is toggled and is being
hovered and clicked.
@item input-background
The background colour on text-input components,
such as comboboxes and text-fields, as well as
lists and tables.
@item input-background-alternate
The alternate background colour on text-input
components, such as comboboxes and text-fields,
as well as lists and tables.
@item input-foreground
The colour on text on text-input components,
such as comboboxes and text-fields, as well as
lists and tables.
@item input-selection
The colour on text highlight for selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables. This
colour is usually blue.
@item input-selection-alternate
The alternate colour on text highlight for
selected text on text-input components, such as
comboboxes and text-fields, as well as lists and
tables. This colour is usually blue.
@item input-selection-foreground
The colour on selected text on text-input
components, such as comboboxes and text-fields,
as well as lists and tables.
@item input-mark
The colour on text highlight for secondarily
selected text on text-input components, such as
comboboxes and text-fields, as well as lists and
tables. This colour is usually yellow.
@item input-mark-foreground
The colour on secondarily selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables. This
colour is usually yellow.
@item input-cursor
The colour on the text cursor on text-input
components, such as comboboxes and text-fields,
as well as lists and tables.
@item input-aura
The colour on the aura around text-input components,
such as comboboxes and text-fields, as well as
lists and tables, to mark that they have focus.
@item input-background-hover
The background colour on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
component is being hovered.
@item input-background-alternate-hover
The alternate background colour on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the component is being hovered.
@item input-foreground-hover
The colour on text on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
component is being hovered.
@item input-selection-hover
The colour on text highlight for selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables, under
the condition that the component is being hovered.
@item input-selection-alternate-hover
The alternate colour on text highlight for selected
text on text-input components, such as comboboxes
and text-fields, as well as lists and tables, under
the condition that the component is being hovered.
@item input-selection-foreground-hover
The colour on selected text on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the component is being hovered.
@item input-mark-hover
The colour on text highlight for secondarily
selected text on text-input components, such as
comboboxes and text-fields, as well as lists and
tables, under the condition that the component
is being hovered.
@item input-mark-foreground-hover
The colour on secondarily selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables, under
the condition that the component is being hovered.
@item input-cursor-hover
The colour on the text cursor on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the component is being hovered.
@item input-aura-hover
The colour on the aura around text-input components,
such as comboboxes and text-fields, as well as
lists and tables, to mark that they have focus,
under the condition that the component is being
hovered.
@item input-background-disabled
The background colour on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
component is disabled.
@item input-background-alternate-disabled
The alternate background colour on text-input
components, such as comboboxes and text-fields, as
well as lists and tables, under the condition that
the component is disabled.
@item input-foreground-disabled
The colour on text on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
component is disabled.
@item input-selection-disabled
The colour on text highlight for selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables, under
the condition that the component is disabled.
@item input-selection-alternate-disabled
The alternate colour on text highlight for selected
text on text-input components, such as comboboxes and
text-fields, as well as lists and tables, under the
condition that the component is disabled.
@item input-selection-foreground-disabled
The colour on selected text on text-input components,
such as comboboxes and text-fields, as well as lists
and tables, under the condition that the component
is disabled.
@item input-mark-disabled
The colour on text highlight for secondarily
selected text on text-input components, such as
comboboxes and text-fields, as well as lists and
tables, under the condition that the component
is disabled.
@item input-mark-foreground-disabled
The colour on secondarily selected text on text-input
components, such as comboboxes and text-fields, as
well as lists and tables, under the condition that
the component is disabled.
@item input-cursor-disabled
The colour on the text cursor on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the component is disabled.
@item input-aura-disabled
The colour on the aura around text-input components,
such as comboboxes and text-fields, as well as
lists and tables, to mark that they have focus,
under the condition that the component is disabled.
@item input-background-selected
The background colour on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
item is selected.
@item input-background-alternate-selected
The alternate background colour on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the item is selected.
@item input-foreground-selected
The colour on text on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
item is selected.
@item input-selection-selected
The colour on text highlight for selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables, under
the condition that the item is selected.
@item input-selection-alternate-selected
The alternate colour on text highlight for
selected text on text-input components, such as
comboboxes and text-fields, as well as lists and
tables, under the condition that the item is
selected.
@item input-selection-foreground-selected
The colour on selected text on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the item is selected.
@item input-cursor-selected
The colour on the text cursor on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the item is selected.
@item input-aura-selected
The colour on the aura around text-input components,
such as comboboxes and text-fields, as well as
lists and tables, to mark that they have focus,
under the condition that the item is selected.
@item input-background-selected-hover
The background colour on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
item is selected and is being hovered.
@item input-background-alternate-selected-hover
The alternate background colour on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the item is selected and is being hovered.
@item input-foreground-selected-hover
The colour on text on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
item is selected and is being hovered.
@item input-selection-selected-hover
The colour on text highlight for selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables, under
the condition that the item is selected and is
being hovered.
@item input-selection-alternate-selected-hover
The alternate colour on text highlight for selected
text on text-input components, such as comboboxes
and text-fields, as well as lists and tables, under
the condition that the item is selected and is
being hovered.
@item input-selection-foreground-selected-hover
The colour on selected text on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the item is selected and is being hovered.
@item input-cursor-selected-hover
The colour on the text cursor on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the item is selected and is being hovered.
@item input-aura-selected-hover
The colour on the aura around text-input components,
such as comboboxes and text-fields, as well as
lists and tables, to mark that they have focus,
under the condition that the item is selected and
is being hovered.
@item input-background-selected-disabled
The background colour on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
item is selected but disabled.
@item input-background-alternate-selected-disabled
The alternate background colour on text-input
components, such as comboboxes and text-fields, as
well as lists and tables, under the condition that
the item is selected but disabled.
@item input-foreground-selected-disabled
The colour on text on text-input components,
such as comboboxes and text-fields, as well as
lists and tables, under the condition that the
item is selected but disabled.
@item input-selection-selected-disabled
The colour on text highlight for selected text on
text-input components, such as comboboxes and
text-fields, as well as lists and tables, under
the condition that the item is selected but disabled.
@item input-selection-alternate-selected-disabled
The alternate colour on text highlight for selected
text on text-input components, such as comboboxes and
text-fields, as well as lists and tables, under the
condition that the item is selected but disabled.
@item input-selection-foreground-selected-disabled
The colour on selected text on text-input components,
such as comboboxes and text-fields, as well as lists
and tables, under the condition that the item is
selected butdisabled.
@item input-cursor-selected-disabled
The colour on the text cursor on text-input
components, such as comboboxes and text-fields,
as well as lists and tables, under the condition
that the item is selected but disabled.
@item input-aura-selected-disabled
The colour on the aura around text-input components,
such as comboboxes and text-fields, as well as
lists and tables, to mark that they have focus,
under the condition that the item is selected but
disabled.
@item input-delimiter
The colour on lines in tables used to delimit rows
or coloumns.
@item input-delimiter-disabled
The colour on lines in tables used to delimit rows
or coloumns, when the table is disabled.
@item option-background
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is not checked.
@item option-foreground
The colour on text for checkboxes and radioboxes,
under the condition that the box is not checked.
@item option-aura
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is not checked.
@item option-background-active
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is checked.
@item option-foreground-active
The colour on text for checkboxes and radioboxes,
under the condition that the box is checked.
@item option-aura-active
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is checked.
@item option-background-intermediate
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is in intermediate mode, that is, paritally checked.
@item option-foreground-intermediate
The colour on text for checkboxes and radioboxes,
under the condition that the box is in intermediate
mode, that is, paritally checked.
@item option-aura-intermediate
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is in intermediate
mode, that is, paritally checked.
@item option-background-hover
The background colour for the box on hovered
checkboxes and radioboxes, under the condition
that the box is not checked.
@item option-foreground-hover
The colour on text for hovered checkboxes and
radioboxes, under the condition that the box is
not checked.
@item option-aura-hover
The colour of the aura around hovered checkboxes
and radioboxes to mark them as having focus,
under the condition that the box is not checked.
@item option-background-active-hover
The background colour for the box on hovered
checkboxes and radioboxes, under the condition
that the box is checked.
@item option-foreground-active-hover
The colour on text for hovered checkboxes and
radioboxes, under the condition that the box is
checked.
@item option-aura-active-hover
The colour of the aura around hovered checkboxes
and radioboxes to mark them as having focus, under
the condition that the box is checked.
@item option-background-intermediate-hover
The background colour for the box on hovered
checkboxes and radioboxes, under the condition
that the box is in intermediate mode, that is,
paritally checked.
@item option-foreground-intermediate-hover
The colour on text for hovered checkboxes and
radioboxes, under the condition that the box is
in intermediate mode, that is, paritally checked.
@item option-aura-intermediate-hover
The colour of the aura around hovered checkboxes
and radioboxes to mark them as having focus, under
the condition that the box is in intermediate
mode, that is, paritally checked.
@item option-background-disabled
The background colour for the box on disabled
checkboxes and radioboxes, under the condition
that the box is not checked.
@item option-foreground-disabled
The colour on text for disabled checkboxes and
radioboxes, under the condition that the box is
not checked.
@item option-aura-disabled
The colour of the aura around disabled checkboxes
and radioboxes to mark them as having focus,
under the condition that the box is not checked.
@item option-background-active-disabled
The background colour for the box on disabled
checkboxes and radioboxes, under the condition
that the box is checked.
@item option-foreground-active-disabled
The colour on text for disabled checkboxes and
radioboxes, under the condition that the box is
checked.
@item option-aura-active-disabled
The colour of the aura around disabled checkboxes
and radioboxes to mark them as having focus, under
the condition that the box is checked.
@item option-background-intermediate-disabled
The background colour for the box on disabled
checkboxes and radioboxes, under the condition
that the box is in intermediate mode, that is,
paritally checked.
@item option-foreground-intermediate-disabled
The colour on text for disabled checkboxes and
radioboxes, under the condition that the box is
in intermediate mode, that is, paritally checked.
@item option-aura-intermediate-disabled
The colour of the aura around disabled checkboxes
and radioboxes to mark them as having focus, under
the condition that the box is in intermediate
mode, that is, paritally checked.
@item option-background-change
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is not checked but is being clicked.
@item option-foreground-change
The colour on text for checkboxes and radioboxes,
under the condition that the box is not checked
but is being clicked.
@item option-aura-change
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is not checked but
is being clicked.
@item option-background-active-change
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is checked and is being clicked.
@item option-foreground-active-change
The colour on text for checkboxes and radioboxes,
under the condition that the box is checked and
is being clicked.
@item option-aura-active-change
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is checked and is
being clicked.
@item option-background-intermediate-change
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is in intermediate mode, that is, paritally checked
and is being clicked.
@item option-foreground-intermediate-change
The colour on text for checkboxes and radioboxes,
under the condition that the box is in intermediate
mode, that is, paritally checked, and is being
clicked.
@item option-aura-intermediate-change
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is in intermediate
mode, that is, paritally checked and is being
clicked.
@item option-background-hover-change
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is not checked but is being hovered and clicked.
@item option-foreground-hover-change
The colour on text for checkboxes and radioboxes,
under the condition that the box is not checked
but is being hovered and clicked.
@item option-aura-hover-change
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is not checked but
is being hovered and clicked.
@item option-background-active-hover-change
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is checked and is being hovered and clicked.
@item option-foreground-active-hover-change
The colour on text for checkboxes and radioboxes,
under the condition that the box is checked and
is being hovered and clicked.
@item option-aura-active-hover-change
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is checked and is
being hovered and clicked.
@item option-background-intermediate-hover-change
The background colour for the box on checkboxes
and radioboxes, under the condition that the box
is in intermediate mode, that is, paritally checked
and is being hovered and clicked.
@item option-foreground-intermediate-hover-change
The colour on text for checkboxes and radioboxes,
under the condition that the box is in intermediate
mode, that is, paritally checked, and is being
hovered and clicked.
@item option-aura-intermediate-hover-change
The colour of the aura around checkboxes and
radioboxes to mark them as having focus, under
the condition that the box is in intermediate
mode, that is, paritally checked and is being
hovered and clicked.
@item tabpane-background
Background overriding @code{window-background}
inside tabpanes.
@item tabpane-frame
The colour on tabpane frames.
@item tabgroup-background
The colour on the background on tab groups.
@item tabgroup-background-hover
The colour on the background on tab groups, for
hovered groups.
@item tab-background
The background colour on tabs.
@item tab-foreground
The colour on text on tabs.
@item tab-head
The colour of a the head on tabs.
@item tab-background-active
The background colour on active tabs.
@item tab-foreground-active
The colour on text on active tabs.
@item tab-head-active
The colour of a the head on active tabs.
@item tab-background-hover
The background colour on hovered tabs.
@item tab-foreground-hover
The colour on text on hovered tabs.
@item tab-head-hover
The colour of a the head on hovered tabs.
@item tab-background-active-hover
The background colour on active and hovered tabs.
@item tab-foreground-active-hover
The colour on text on active and hovered tabs.
@item tab-head-active-hover
The colour of a the head on active and
hovered tabs.
@item slider-background
The background colour in sliders.
@item slider-selected
The background colour in sliders, marking
the area that is selected.
@item slider-unselected
The background colour in sliders, marking
the area that is not selected.
@item slider-foreground
The colour on text over sliders indicating
the current value.
@item slider-knob
The colour of the knob used to change the
value on sliders.
@item slider-aura
The colour of the aura around knob, used to
change the value on sliders, marking the
slider as having focus.
@item slider-stop
The colour of the stop lines for sliders.
@item slider-background-hover
The background colour in sliders, under the
condition that the slider is being hovered.
@item slider-selected-hover
The background colour in sliders, marking
the area that is selected, under the condition
that the slider is being hovered.
@item slider-unselected-hover
The background colour in sliders, marking
the area that is not selected, under the
condition that the slider is being hovered.
@item slider-foreground-hover
The colour on text over sliders indicating
the current value, under the condition that
the slider is being hovered.
@item slider-knob-hover
The colour of the knob used to change the value
on sliders, under the condition that the slider
is being hovered.
@item slider-aura-hover
The colour of the aura around knob, used to
change the value on sliders, marking the
slider as having focus, under the condition
that the slider is being hovered.
@item slider-stop-hover
The colour of the stop lines for sliders,
under the condition that the slider is being
hovered.
@item slider-background-hover-selected
The background colour in sliders, under the
condition that the slider is being hovered
on the side of the slider that marks the
selection.
@item slider-selected-hover-selected
The background colour in sliders, marking
the area that is selected, under the condition
that the slider is being hovered on the side
of the slider that marks the selection.
@item slider-unselected-hover-selected
The background colour in sliders, marking
the area that is not selected, under the
condition that the slider is being hovered
on the side of the slider that marks the
selection.
@item slider-foreground-hover-selected
The colour on text over sliders indicating
the current value, under the condition that
the slider is being hovered on the side of
the slider that marks the selection.
@item slider-knob-hover-selected
The colour of the knob used to change the value
on sliders, under the condition that the slider
is being hovered on the side of the slider that
marks the selection.
@item slider-aura-hover-selected
The colour of the aura around knob, used to
change the value on sliders, marking the
slider as having focus, under the condition
that the slider is being hovered on the side
of the slider that marks the selection.
@item slider-stop-hover-selected
The colour of the stop lines for sliders,
under the condition that the slider is
being hovered on the side of the slider
that marks the selection.
@item slider-background-hover-unselected
The background colour in sliders, under the
condition that the slider is being hovered
on the side of the slider that does not mark
the selection.
@item slider-selected-hover-unselected
The background colour in sliders, marking
the area that is selected, under the condition
that the slider is being hovered on the side
of the slider that does not mark the selection.
@item slider-unselected-hover-unselected
The background colour in sliders, marking
the area that is not selected, under the
condition that the slider is being hovered
on the side of the slider that does not
mark the selection.
@item slider-foreground-hover-unselected
The colour on text over sliders indicating
the current value, under the condition that
the slider is being hovered on the side of
the slider that does not mark the selection.
@item slider-knob-hover-unselected
The colour of the knob used to change the value
on sliders, under the condition that the slider
is being hovered on the side of the slider that
does not mark the selection.
@item slider-aura-hover-unselected
The colour of the aura around knob, used to
change the value on sliders, marking the
slider as having focus, under the condition
that the slider is being hovered on the side
of the slider that does not mark the selection.
@item slider-stop-hover-unselected
The colour of the stop lines for sliders,
under the condition that the slider is being
hovered on the side of the slider that does
not mark the selection.
@item slider-background-hold
The background colour in sliders, under the
condition that the slider is being pressed.
@item slider-selected-hold
The background colour in sliders, marking
the area that is selected, under the condition
that the slider is being pressed.
@item slider-unselected-hold
The background colour in sliders, marking
the area that is not selected, under the
condition that the slider is being pressed.
@item slider-foreground-hold
The colour on text over sliders indicating
the current value, under the condition that
the slider is being pressed.
@item slider-knob-hold
The colour of the knob used to change the
value on sliders, under the condition that
the slider is being pressed.
@item slider-aura-hold
The colour of the aura around knob, used to
change the value on sliders, marking the
slider as having focus, under the condition
that the slider is being pressed.
@item slider-stop-hold
The colour of the stop lines for sliders,
under the condition that the slider is being
pressed.
@item slider-background-hold-selected
The background colour in sliders, under the
condition that the slider is being pressed
on the side of the slider that marks the
selection.
@item slider-selected-hold-selected
The background colour in sliders, marking
the area that is selected, under the condition
that the slider is being pressed on the side
of the slider that marks the selection.
@item slider-unselected-hold-selected
The background colour in sliders, marking
the area that is not selected, under the
condition that the slider is being pressed
on the side of the slider that marks the
selection.
@item slider-foreground-hold-selected
The colour on text over sliders indicating
the current value, under the condition that
the slider is being pressed on the side of
the slider that marks the selection.
@item slider-knob-hold-selected
The colour of the knob used to change the
value on sliders, under the condition that
the slider is being pressed on the side of
the slider that marks the selection.
@item slider-aura-hold-selected
The colour of the aura around knob, used to
change the value on sliders, marking the
slider as having focus, under the condition
that the slider is being pressed on the side
of the slider that marks the selection.
@item slider-stop-hold-selected
The colour of the stop lines for sliders,
under the condition that the slider is being
pressed on the side of the slider that marks
the selection.
@item slider-background-hold-unselected
The background colour in sliders, under the
condition that the slider is being pressed
on the side of the slider that does not mark
the selection.
@item slider-selected-hold-unselected
The background colour in sliders, marking
the area that is selected, under the condition
that the slider is being pressed on the side
of the slider that does not mark the selection.
@item slider-unselected-hold-unselected
The background colour in sliders, marking
the area that is not selected, under the
condition that the slider is being pressed
on the side of the slider that does not
mark the selection.
@item slider-foreground-hold-unselected
The colour on text over sliders indicating
the current value, under the condition that
the slider is being pressed on the side of
the slider that does not mark the selection.
@item slider-knob-hold-unselected
The colour of the knob used to change the
value on sliders, under the condition that the
slider is being pressed on the side of the
slider that does not mark the selection.
@item slider-aura-hold-unselected
The colour of the aura around knob, used to
change the value on sliders, marking the
slider as having focus, under the condition
that the slider is being pressed on the side
of the slider that does not mark the selection.
@item slider-stop-hold-unselected
The colour of the stop lines for sliders,
under the condition that the slider is being
pressed on the side of the slider that does
not mark the selection.
@item slider-background-disabled
The background colour in disabled sliders.
@item slider-selected-disabled
The background colour in disabled sliders,
marking the area that is selected.
@item slider-unselected-disabled
The background colour in disabled sliders,
marking the area that is not selected.
@item slider-foreground-disabled
The colour on text over disabled sliders
indicating the current value.
@item slider-knob-disabled
The colour of the knob used to change the
value on disabled sliders.
@item slider-aura-disabled
The colour of the aura around knob, used to
change the value on disabled sliders,
marking the slider as having focus.
@item slider-stop-disabled
The colour of the stop lines for disabled
sliders.
@item scroll-background
The background colour on scrolls.
@item scroll-foreground
The icon colour on buttons associated with
scrolls.
@item scroll-knob
The colour of the knob on scrolls.
@item scroll-button
The background colour on buttons associated
with scrolls.
@item scroll-background-hover
The background colour on scrolls, under the
condition that the area is being hovered.
@item scroll-foreground-hover
The icon colour on buttons associated with
scrolls, under the condition that the button
is being hovered.
@item scroll-knob-hover
The colour of the knob on scrolls, under the
condition that the knob is being hovered.
@item scroll-button-hover
The background colour on buttons associated
with scrolls, under the condition that the
button is being hovered.
@item scroll-background-hold
The background colour on scrolls, under the
condition that the area is being pressed.
@item scroll-foreground-hold
The icon colour on buttons associated with
scrolls, under the condition that the button
is being pressed.
@item scroll-knob-hold
The colour of the knob on scrolls, under the
condition that the knob is being pressed.
@item scroll-button-hold
The background colour on buttons associated
with scrolls, under the condition that the
button is being pressed.
@item scroll-background-disabled
The background colour on scrolls, under the
condition that the scroll is disabled.
@item scroll-foreground-disabled
The icon colour on buttons associated with
scrolls, under the condition that the button
is disabled.
@item scroll-knob-disabled
The colour of the knob on scrolls, under the
condition that the scroll is disabled.
@item scroll-button-disabled
The background colour on buttons associated
with scrolls, under the condition that the
button is disabled.
@item progress-background
The background colour on progressbars.
@item progress-progress
The colour of the bar, on progressbars,
indicating how much progress has been
made, or the colour of a marquee bar.
This colour is usually blue, but sometimes
green.
@item progress-good
The colour of the bar, on progressbars,
when the progressbar is used to indicate
a state rather than a progress, and the
state is considered good. This colour is
usually green.
@item progress-normal
The colour of the bar, on progressbars,
when the progressbar is used to indicate
a state rather than a progress, and the
state is considered normal. This colour is
usually yellow or green.
@item progress-bad
The colour of the bar, on progressbars,
when the progressbar is used to indicate
a state rather than a progress, and the
state is considered bad. This colour is
usually orange or yellow.
@item progress-critical
The colour of the bar, on progressbars,
when the progressbar is used to indicate
a state rather than a progress, and the
state is considered critical. This colour
is usually red.
@item progress-foreground
The colour of text on progressbars, on
the area that is not covered by a bar.
@item progress-foreground-progress
The colour of text on progressbars, on
the area that is covered by a bar
indicating how much progress has been
made or a marquee bar.
@item progress-foreground-good
The colour of text on progressbars, on
the area that is covered by a bar
indicating a good state.
@item progress-foreground-normal
The colour of text on progressbars, on
the area that is covered by a bar
indicating a normal state.
@item progress-foreground-bad
The colour of text on progressbars, on
the area that is covered by a bar
indicating a bad state.
@item progress-foreground-critical
The colour of text on progressbars, on
the area that is covered by a bar
indicating a critical state.
@item menu-background
The background colour on menus and menu-items.
@item menu-foreground
The colour on text on menus and menu-items.
@item menu-delimiter
The colour on group-separation lines in menus.
@item menu-tear
The colour on lines on menu-tearing menu-items.
@item menu-background-disabled
The background colour on disabled menus and
menu-items.
@item menu-foreground-disabled
The colour on text on disabled menus and
menu-items.
@item menu-tear-disabled
The colour on lines on disabled menu-tearing
menu-items.
@item menu-background-hover
The background colour on menus and menu-items
that are being hovered.
@item menu-foreground-hover
The colour on text on menus and menu-items
that are being hovered.
@item menu-tear-hover
The colour on lines on menu-tearing menu-items.
@item menu-background-disabled-hover
The background colour on disabled menus and
menu-items that are being hovered.
@item menu-foreground-disabled-hover
The colour on text on disabled menus and
menu-items that are being hovered.
@item menu-tear-disabled-hover
The colour on lines on disabled menu-tearing
menu-items that are being hovered.
@item menu-background-open
The background colour on menus and menu-items
that are opened, that is submenus are visible.
@item menu-foreground-open
The colour on text on menus and menu-items
that are opened, that is submenus are visible.
@item toolbar-background
The background colour on toolbars.
@item toolbar-foreground
The colour on text on toolbars.
@item toolbar-delimiter
The colour on group-separation lines in
toolbars.
@item toolbar-handle
The colour on the handle used to move
toolbars.
@item tooltip-background
The background colour on tooltips.
@item tooltip-foreground
The colour on text on tooltips.
@item notification-background
The background on notification.
@item notification-foreground
The colour on text on notification.
@item notification-low
Colour on notifications to indicate
that they are of low priority.
This colour is usually green or blue.
@item notification-normal
Colour on notifications to indicate
that they are of normal priority.
This colour is usually blue or the
same as @code{notification-background}.
@item notification-high
Colour on notifications to indicate
that they are of high priority.
This colour is usually orange.
@item notification-critical
Colour on notifications to indicate
that they are of critical priority.
This colour is usually red.
@end table
@node Nesting Applications
@section Nesting Applications
@cpindex Nesting applications
@cpindex Applications, nesting
@cpindex Embedding applications
@cpindex Applications, embedding
@vrindex @env{MDS_EMBED}
Applications that want to embed another other
application within it, should create a socket and
start the other application with the environment
variable @env{MDS_EMBED} set to the windows ID of the
socket that the application should be embedded in.
All @command{mds} applications must be aware of the
environment variable @env{MDS_EMBED}@. The
application may choose not to embed itself in the
announced socket, however it should have good reason
for not doing this.
All @command{mds} application must unset the
environment variable @env{MDS_EMBED} before it starts
any other program.
@comment TODO
@c How do we solve this for compatibility with X, Wayland and Mir?
@node The Real Display Server
@section The Real Display Server
@cpindex Real display server
@cpindex Actual display server
@cpindex Preferred display server
@cpindex Display server, real
@cpindex Display server, actual
@cpindex Display server, preferred
@cpindex Compatibility layers
@vrindex @env{PREFERRED_DISPLAY}
The environment variable @env{PREFERRED_DISPLAY},
should be set with the value @command{mds}, if and only
if @command{mds} is started as a display server and
not as a compatibility layer.
@env{PREFERRED_DISPLAY} is a space-separated (U+0020)
list of supported display server protocol, ordered by
preference.
If @command{mds} is started as a compatibility layer,
@command{mds} should be added to @env{PREFERRED_DISPLAY}
if and only if @env{PREFERRED_DISPLAY} lists any
other display protocol.
If a compatibility server is successfully started, it
shoul be listed in @env{PREFERRED_DISPLAY}@. Be sure
to keep the list ordered by preference.
@table @code
@item mir
@pgindex @command{mds-mmds}
@cpindex Compatibility layer, Mir
@cpindex Mir compatibility layer
Should be added if you are running a
@command{mir}-to-@command{mds} server,
like @command{mds-mmds}.
@item wayland
@pgindex @command{mds-wmds}
@cpindex Compatibility layer, Wayland
@cpindex Wayland compatibility layer
Should be added if you are running a
@command{wayland}-to-@command{mds} server,
like @command{mds-wmds}.
@item x11
@pgindex @command{mds-xmds}
@cpindex Compatibility layer, X.org
@cpindex X.org compatibility layer
Should be added if you are running an
@command{X}-to-@command{mds} server, like
@command{mds-xmds}.
@end table
@node New Concepts
@chapter New Concepts
@menu
* Metadisplay Server:: Goals and features of metadisplays.
* Endomonitor:: Goals and features of endomonitors.
@end menu
@node Metadisplay Server
@section Metadisplay Server
@cpindex Metadisplay server
@pgindex @code{mds-meta}
@cpindex Display server, meta
@cpindex Multi-display systems
A metadisplay server is a server that is connected to
one or more display server's simultaneously.
Additionally, it is acting as a display server on its
own. Any server, or even client, running in this
display will effectively be running in all of the
displays connected to the metadisplay.
The idea of the metadisplay server came from the
idea of letting the user have the clipboard shared
across any number of @emph{selected} display servers.
Rather than having a clipboard server written
specifically for this, it was seen as more
appropriate to have a server than could let any
server run inside any number of display server. Not
only will this let the user run any server this way.
It also makes it possible to run them across any
number of computers.
@pgindex @code{@command{mds-host}}
@pgindex @command{mds-remote}
@cpindex Networking
If a hosting server, like @command{mds-host}, runs
inside a metadisplay, any number of computers can
connect to the metadisplay using a server like
@command{mds-remote}. This creates a metadisplay
with multiple display from multiple computers. If a
clipboard server runs in this metadisplay, all of
these display on all of these computers will share
clipboard server.
Whilst not removing or degrading any functionality. A
negative property of this setup it that it is
centralised rather than distributed. If the computer
hosting the metadisplay crashes, the other computers
will no longer share this metadisplay, and lose the
connection to any server running in it.
In addition to a the clipboard server, there is a
host of other servers that makes sense to run in
multiple displays or across multiple computer:
drag-and-drop servers, human input device servers,
output servers, and even windowing servers.
@node Endomonitor
@section Endomonitor
@pgindex @command{mds-endomon}
@cpindex CRTC
@cpindex Cathode ray tube controller
@cpindex Presentation
@cpindex Display of content
@cpindex Content, display
@cpindex Endomonitor
@cpindex Monitor, endo-
@cpindex Cinerama
@pgindex @command{mds-cinerama}
There are two forms of logical monitors: cineramas
and endomonitor. A cinerama combines monitors into
one monitor. Endomonitors takes a subset of a single
monitor. Similar to having two monitors with
overlaping output,@footnote{For example a monitor with
mode--position 1600x1200+0+0 and a monitor with
mode--position 1600x1200+800+600.} An endomonitor
overlaps with another monitor, but only with that
monitor and cannot be outside it even partially. But
it does not need to cover it completely. This allows
you to put a full-screen window on the endomonitor and
thus only partially cover the physical monitor; for
example keeping the clock visible.
Endomonitors do not need to be placed inside a
physical monitor. They can be placed inside logical
monitor too. Putting an endomonitor inside a cinerama
lets you create a logical monitor that covers multiple
monitors partially.
@node Discussion
@chapter Discussion
@menu
* Server Architecture:: Discussion on fundamental design choices.
* Fixing X.org Issues:: Can we avoid the problems X.org has?
* Why Not Wayland:: Why Wayland Won't Cut It.
* Why Not Mir:: Why Mir Won't Cut It.
* Desktop Environments:: What are desktop environments' relationship to mds?
* Why Dither Colours:: Is dithering not a thing of the past?
@end menu
@node Server Architecture
@section Server Architecture
@cpindex Server architecture
@cpindex Architecture, servers
This chapter aims to enumerate advantages and
disadvantages with micro-display servers, traditional
monolithic display servers and other possible
designs. Please chime in with any insight.
@menu
* The Microserver Architecture:: The microserver architecture.
* The Monolithic Server Architecture:: The monolithic server architecture.
* The Hybrid Server Architecture:: The hybrid server architecture.
* The Megalithic Server Architecture:: The megalithic server architecture.
* The Modular Server Architecture:: The modular server architecture.
* The Modular Microserver Architecture:: The modular microserver architecture.
* The Exoserver Architecture:: The exoserver architecture.
@end menu
@node The Microserver Architecture
@subsection The Microserver Architecture
@cpindex Microserver architecture
@cpindex Architecture, microserver
@cpindex Microdisplay servers
Description: The display server is implement with
multiple binaries that speak with each other using a
well defined protocol.
@noindent
Implementations: mds.
@noindent
Advantages:
@itemize @bullet{}
@item
@cpindex Code quality
@cpindex Quality of code
Knowing the names of the servers you use and their
purpose makes it very easy to find where you want to
do patching in the source code.
@item
@cpindex Code quality
@cpindex Quality of code
Spaghetti code to a larger extent is virtually
impossible; the microserver architecture guarantees a
certain quality of the code architecture for the
display server.
@item
@cpindex Flexibility
If the message passing used in the display server
allows for message modification and retrieval
ordering, extending, modifying and using the display
server in unforeseen ways becomes much easier, and
will often not require any modifications to the
existing servers.
@item
@cpindex Flexibility
Replacing the display server is easier for a
micro-display server than it is for a monolithic
display server, because the servers could be replaced
one by one and could even support running under two
distinct protocol during the transitional period.
@item
@cpindex Code quality
@cpindex Quality of code
Not as many subprotocols needs to be defined. For
example, recording the output of the display does not
require a special protocol, one only needs to write a
server that listens on messages passed between
servers.
@item
@cpindex Stability
If a server crashes it does not crash the entire
session. Crashes can most often be repaired.
@item
@cpindex Flexibility
Because servers can easily be omitted and replaced
when starting the display server, it becomes much
easier to mount the display server on top of an
already running display server. For example, if you
want the performance of @code{weston} but then
flexibility and functionallity of @command{mds}, you
could start @command{mds} inside @code{weston} and
replace a small set of the servers with variants
written to running on top of Wayland; of course with
some functionallity of @command{mds} missing.
@item
@cpindex Security
It is trivial to only have setuid on for the part of
the display server where it is required.
@end itemize
@node The Monolithic Server Architecture
@subsection The Monolithic Server Architecture
@cpindex Monolithic server architecture
@cpindex Architecture, monolithic server
@cpindex Monolithic display servers
Description: The display server is implemented as one
binary.
@noindent
@cpindex X11
@cpindex X.org
@cpindex Mir
@cpindex Wayland
@cpindex Weston
@cpindex Surface Flinger
@cpindex Android/Linux, Surface Flinger
@cpindex Quartz Compositor
@cpindex Mac OS X, Quartz Compositor
@cpindex OS X, Quartz Compositor
@cpindex Desktop Window Manager
@cpindex Windows, Desktop Window Manager
Implementations: X11@footnote{X11 is a protocol, I
beleave all X11 servers are monolithic, atleast the
major ones are}, Mir, Wayland@footnote{Wayland is not
actually monolithic, it is just a protocol. But
Wayland is written with a monolithic mindset, and it
is preferred that the display server implementation
is monolithic.}, Surface Flinger, Quartz Compositor,
Desktop Window Manager.
@noindent
Advantages:
@itemize @bullet{}
@item
@cpindex Confidentiality
@cpindex Privacy
@cpindex Security
@cpindex Flexibility
The monolithic architecture makes it trivial to
isolate information for clients to achieve
confidentiality. Prioritising confidentiality however
leads to problems implementing features such as
screenshooting and global hotkeys.
@item
@cpindex Performance
Monolithic server does not need to pass messages
between modules, but can rather perform normal
function calls and achieve greater performance.
@item
@cpindex Size
Monolithic display servers can have a smaller memory
footprint than its full-fledged counterparts.
@end itemize
@node The Hybrid Server Architecture
@subsection The Hybrid Server Architecture
@cpindex Hybrid server architecture
@cpindex Architecture, hybrid server
@cpindex Hybrid display servers
@cpindex Milliserver architecture
@cpindex Architecture, milliserver
@cpindex Millidisplay servers
@cpindex Macroserver architecture
@cpindex Architecture, macroserver
@cpindex Macrodisplay servers
Description: The display server is implemeneted with
the microserver architecture except some components
are built into the master server for performance or
security reasons.
@noindent
Hybrid display server could arguably be called
milli-display servers@footnote{Playing of the
International System of Units and its illogical
prefix names.} to emphasis that they are small,
but not as small as micro-display servers, are
much more closely related to micro-display servers
than monolithic display servers, and, in constrast
with OS kernels, have a proper distinction from
monolithic systems and microsystems. @footnote{I
don't know about calling them macro-display servers,
that implies that they are the total opposite of
micro-display servers, since ‘macro’ means large
and ‘micro’ means small.}
@noindent
Implementations: none?
@noindent
Advantages:
@itemize @bullet{}
@item
Can achieve most of the microserver architecture's
advantages, but not always to the same extent.
@item
@cpindex Confidentiality
@cpindex Privacy
@cpindex Security
@cpindex Flexibility
By integrating some servers into the master server,
the hybrid architecture can isolate information for
clients to achieve confidentiality. Prioritising
confidentiality however leads to problems implementing
features such as screenshooting and global hotkeys.
@item
@cpindex Performance
Large and high frequency messages does not need to be
passed around to other servers if they are integrated
into the master server. This lets hybrid display
server achieve the same perfomance performance as
monolithic display servers for tasks where it is
desirable.
@end itemize
@noindent
The mds protocol and its reference implemention can
easily be made into a hybrid display server protocol
and an implementation thereof.
@node The Megalithic Server Architecture
@subsection The Megalithic Server Architecture
@cpindex Megalithic server architecture
@cpindex Architecture, megalithic server
@cpindex Megalithic display servers
@cpindex Megaserver architecture
@cpindex Architecture, megaserver
@cpindex Megadisplay servers
Description: A monolithic display server where
applications are loaded or compiled into the display
server itself.
@noindent
These are also known as mega-display servers.
@noindent
Implementations: none?
@noindent
Advantages:
@itemize @bullet{}
@item
@cpindex Performance
No interprocess communication is required, apart from
letting the display server know to load modules if it
does not compile in its programs. This lets megalithic
display server achieve even greater performance than
monolithic display servers.
@end itemize
@noindent
Disadvantages:
@itemize @bullet{}
@item
@cpindex Code quality
@cpindex Quality of code
Imposes restrictions on which languages applications
can use.
@item
@cpindex Flexibility
Imposes restrictions on how applications can behave.
@item
@cpindex Flexibility
@cpindex Code quality
@cpindex Quality of code
Cannot be networked without exposing an alternative
display server protocol.
@item
@cpindex Stability
The display becomes more crash prune; if an
application crashes it is likely to crash the entire
display.
@item
@cpindex Security
Applications will run with the same privileges as the
display server, which is root on most operating
systems.
@end itemize
@noindent
@cpindex Gaming
Megalithic display servers could be interesting for
high-performing gaming consoles.
@node The Modular Server Architecture
@subsection The Modular Server Architecture
@cpindex Modular server architecture
@cpindex Architecture, modular server
@cpindex Modular display servers
Description: A monolithic display server where
server-like programs can be loaded as modules into
the display server but applicates are connected with
interprocess communication.
@noindent
Implementations: none?@footnote{Desktop Window Manager
is partially modular, but as of yet, this cannot be
utilised by end-users.}
@noindent
Advantages:
@itemize @bullet{}
@item
@cpindex Flexibility
Can achieve that flexibility of micro-display servers,
but not when networked, with the same memory footprint
as monolithic display servers.
@item
Has the same advantages as monolithic kernels.
@item
@cpindex Performance
Applications that require absolute performance can
be loaded as modules and achieve the same performance
as megalithic kernels, however with the same caveats.
@end itemize
@noindent
With a little work the mds protocol could be
transformed into a modular server display protocol,
and with some work the reference implementation could
be made into a modular server display.
@node The Modular Microserver Architecture
@subsection The Modular Microserver Architecture
@cpindex Modular microserver architecture
@cpindex Architecture, modular microserver
@cpindex Modular microdisplay servers
Description: A modular display server with a module
that enables clients to act as modules that
communicates via interprocess communication rather
than being loaded into the display server.
@noindent
Implementations: none?
@noindent
Advantages:
@itemize @bullet{}
@item
The modular microserver architecture seem to provide
all of the advantages of the other architecture but
none of the disadvantages. However, modules can still
crash and bring down the display server, but the idea
is to not load unstable modules but let the be
servers. Therefore exo-diplay server are slightly
more robust.
@end itemize
@noindent
With a little work the mds protocol could be
transformed into a modular server display protocol,
and with some work the reference implementation could
be made into a modular server display. Then the
untransformed version of @command{mds-server} could
be made into a module for the transformed version.
@node The Exoserver Architecture
@subsection The Exoserver Architecture
@cpindex Exoserver architecture
@cpindex Architecture, exoserver
@cpindex Exodisplay servers
Description: An exo-display server is a tiny display
server that attempts to let applications access the
underlaying system directly and implements basic
interprocess communication to let applications share
vital information and coordinate with each other.
@noindent
Implementations: none?
@noindent
Advantages:
@itemize @bullet{}
@item
@cpindex Performance
Can achieve the same performance as megalithic
display servers.
@item
@cpindex Stability
Can achieve the same robustness as micro-display
servers.
@end itemize
@noindent
Disadvantages:
@itemize @bullet{}
@item
@cpindex Flexibility
@cpindex Code quality
@cpindex Quality of code
Cannot be networked without exposing an alternative
display server protocol.
@end itemize
@noindent
Exo-display servers could be interesting for
high-performing gaming consoles.
@node Fixing X.org Issues
@section Fixing X.org Issues
X.org is been critiqued for several shortcoming, some
of which have caused people to start on new display
servers to replace X.org. This chapter will list some
issues and discuss how they can be avoided in mds.
@menu
* Automatic Cleanup:: Cleanup up after applications.
* Input Problems:: Problems related to human input.
* Other Issues:: Other issues in X.org.
@end menu
@node Automatic Cleanup
@subsection Automatic Cleanup
@cpindex Automatic cleanup
@cpindex Cleanup, automatic
@cpindex Resolution change
@cpindex Games
A common critique of X.org is that the monitor
resolution is not restored if a game change the
resolution and for some reason, for instance a
software crash, does not switch back before exiting.
This problem is not intrinsic to the protocol, but
rather because of a lacking protocol. You can run a
program like @command{xrandr} to change the monitor
resolution for the entirety of the session and
@command{xrandr} can exit when the resolution has
changed. This is how it should be. However, there is
no way to tell an X.org server to switch back if the
connection between the program and server is lost.
This is easily fixed by adding a lifespan parameter
as found in @ref{set-gamma}.
@cpindex Gamma correction
A similar critique of X.org is that gamma ramps are
not restored when an application exits. Either the
ones complaining about this do not understand why
gamma ramps exists, namely so you can calibrate the
monitor's output in respect to the colours, and just
think it is a way to make the video in games
brighter. Or they think we should have daemons
running idly to have gamma adjustments. Or, more
likely and more validly, its is poorly phrased and
they actually want a way for applications, like
games, to inform the display server to undo its
modifications to the gamma ramps when the program
exits. This is already supported by the mds protocol.
@node Input Problems
@subsection Input Problems
@cpindex Grab, input
@cpindex Keyboard, grab
@cpindex Mouse, grab
@cpindex Input grabbing
X11 allows programs to exclusively grab keyboard and
mouse input. When a program that does this misbehaves
or become unresponsive, you cannot do anything but
manage it from another computer or restart the
computer. In mds exclusively grabbing is achieved by
setting the client priority for the related message
to the highest priority. @footnote{If multiple
clients do this, it is arbitrary who gets the message
first and can stop the others from getting it.} This
is however not allowed (but nothing will stop you) as
the idea is that clients should either select a
predefined priority, select a priority between
servers it to be between, or select a priority of 50
percent or 150 percent of another servers priority.
Thus, unless a client breaks this rule, you can always
have your server for switching to the TTY at a higher
priority than other programs.
A similar, and probably related, problem in X.org is
that global keybindings don't work when a popup or
menu has focus. (Thankfully GTK+ will close that item
if it receives unexpected input.) I have hard time
seeing how this could become an issue in mds.
@cpindex Hotkeys
@cpindex Keyboard bindings
@cpindex Bindings, keyboard
@cpindex Keyboard shortcuts
@cpindex Shortcuts, keyboard
Another issue related to the keyboard in X.org is
that hotkeys in programs do not work in a few
situtations because the program was not designed with
another keyboard layout in mind than the keyboard
layout the developer used. I suggest that programs
restrain themself from including
@key{Alternative Graph} in their hotkeys and only use
@key{Shift} for @key{a} through @key{Z} and
@key{Space}. However, what I would really like to see
is that toolkits lets users modify all hotkeys. If
program additionally restrain themself to having all
hotkeys contain control or alt the keyboard layouts
with non-latin alphabets would not suffer because
they do not use the latin alphabet.
@node Other Issues
@subsection Other Issues
@cpindex Re-executing servers
@cpindex Updating, online
@cpindex Online updating
@cpindex Version update
@sgindex @code{SIGUSR1}
@sgindex @code{SIGUPDATE}
X11 display servers do not let you upgrade or
otherwise replace graphics drivers online. Or other
parts of it. X11 display servers could allow you to
send a signal, for instance @code{SIGUSR1}, to upgrade
the whole server, however this is not favourable, and
X.org does not do this. The reference implemention of
the mds protocol lets you safely upgrade any part of
it online by sending @code{SIGUSR1} to the server that
should be upgraded. On catastrophic failure in this
process the server would restart and lose volatile
data, but the server should be upgraded and it would
ask all running clients for resend information the
server lost.
@cpindex Threading
@cpindex Multi-threading
@cpindex Pervasively parallel processing
@cpindex Pervasive threading
Another issue with X.org is that it is not
multithreaded, which can cased intensive programs
to freeze your desktop. mds is inherently pervasively
parallel and only subsystems, rather than the whole
system, can suffer from this. It is however easy for
mds servers to implement pervasive threading, that
is, letting each request spin up a new thread in the
server.
@node Why Not Wayland
@section Why Not Wayland
@cpindex Wayland
Development of @command{mds} started out of concern
that Wayland would not meet our needs, and the
knowledge that X does not. We are now however aware
that Wayland meets our needs even less than X@.
@footnote{Not even counting that the documentation
for Wayland is way more lacking that X's
documentation.}
@cpindex Flexibility
Wayland only has protocols for drawing onto a buffer
and input devices, and some very limited output
protocols. Wayland is inherently inflexible. If
anyone wants to add additional functionally, must do
so in the compositor --- the window manager --- and
publish the protocol. It is then up to all other
compostors (window managers) to implement the
protocol.
It should be noted that Wayland does not even have an
official protocol for applying gamma corrects. Some
compositors (window managers) choose to implement it
by using @command{colord}.
Additionally, screenshooting, screen recording and
global hotkeys must be implemented in the compositor
(window manager). Why? Because of security. In
Wayland, security always trumps useability and
usefulness.
Another huge limitation of Wayland is that it does
not have any network protocol. For it to be network,
the compositor must implement a network protocol ---
and there is no official network protocol. When this
is all done, a compositor proxy must be written that
can communicate with it.
@node Why Not Mir
@section Why Not Mir
@cpindex Mir
The major problem with Mir, and why we need
@command{mds} instead, is that contributions to Mir
are subject Canonical's contributions-limiting
agreement (CLA).
@cpindex Flexibility
Mir, like Wayland, is very limited. Mir is however
easier to extend. Ignoring the CLA, Mir is better
tham Wayland, but for similar reasons it is still not
good enough.
Mir is however licensed under the GNU General Public
License version 3 and GNU Lesser General Public
License version 3. Much better than the MIT license,
and hopefully we can steal some stuff.
@node Desktop Environments
@section Desktop Environments
@cpindex Goals of @command{mds}
@cpindex Desktop environments
@cpindex Environment, desktop
A design goal of @command{mds} is to bring unity to
the graphical environment. Something desktop
environments traditionally have been impairing.
Traditionally a desktop environment would implement,
or implement some of:
@itemize @bullet{}
@item
Window layout management (window manager)
@item
Window decoration (window manager)
@item
Workspaces (window manager)
@item
Compositor (window manager)
@item
Taskbars
@item
Status icon trays
@item
Launchers
@item
Application menus
@item
Autostart of applications
@item
Keyboard bindings
@item
Rat bindings
@item
Rat barriers
@item
Desktop
@item
Widgets
@item
Their own display manager (login screen)
@item
Their own screensaver and screenlocker
@item
Their own graphical toolkit
@item
A bunch of random graphical tools
@end itemize
This is absolute madness, a waste of time and creates
fragmentation.
There is no problem for a desktop environment
development team to implement all this for their
desktop environment for @command{mds}. However doing
so is discourage for the mentioned reasons as well as
because doing so means that the user needs to know
what not to launch, that is, what the desktop
environment will start.
@menu
* Window Management:: Window management in mds.
* Application Management:: Application management in mds.
* Input Management:: Management of input peripherals in mds.
* The Desktop:: The desktop in mds.
@end menu
@node Window Management
@subsection Window Management
@cpindex Window management
@cpindex Widdow layout managers
@cpindex Hotkeys
@cpindex Keyboard bindings
@cpindex Bindings, keyboard
@cpindex Keyboard shortcuts
@cpindex Shortcuts, keyboard
@pgindex @command{mds-keybind}
For @command{mds}, a desktop environment should not
have its own window layout manager. A better solution
is to have a few well written window layout manager
that are different from each other in how windows are
layed out. These should not listen for keyboard
actions to figure out how it shall rearrange the
windows. Instead they should listen on the display
server's messaging system for such commands, and
@command{mds-keybind} or similar server should be
configured with all hotkeys.
@cpindex Window decorators
@cpindex Decorators, windows
There are a few classes of window decorator. A
desktop environment still do not need its own. They
can however create themes for existing decorators.
What we need here is a small set of window decorators
that are very customisable.
@cpindex Workspaces
@cpindex Pagers
Workspaces in X is poorly done. Window managers
implement it, and pagers are window manager dependent
@footnote{Well, there is Extended Window Manager
Hints (EWMH), but it is very restricted.}. Yet there
are very few properties they can have:
@itemize @bullet{}
@item
Do workspaces span outputs, screens or the display?
@item
Are workspaces dependent on outputs, screens or
displays?
@item
Do workspaces have a geometrical position?
@item
Are new workspaces created when needed?
@end itemize
Clearly what we need is one workspace manager where
these can be configured. And the desktop environments
can create their own pagers if they see fit, but all
pagers work everywhere.
@cpindex Compositors
@cpindex Fancy effects
@cpindex Effects, fancy
Traditionally desktop environments wrote their own
compositor for flash or otherwise fancy effects, or
write a quirks to a common one so the common on could
be used. With all other parts, of what has
traditionally be the window manager, independent of
the desktop environment, creating one universal
compositor with plugin support for effects the
desktop environment want to have, such be no problem.
@node Application Management
@subsection Application Management
@cpindex Application management
@cpindex Taskbars
@cpindex Extended Window Manager Hints
@cpindex EWMH (Extended Window Manager Hints)
Many X desktop environments provide taskbars, where
all windows are listed. However because of Extended
Window Manager Hints (EWMH), and the ability to read
windows' position and wait for windows to move, this
is not actually necessary. Of course, desktop
environments may need to do this to theme the
environment. A taskbar for @command{mds} should:
@itemize @bullet{}
@item
be about to restrict listed windows a those under
specific outputs, and
@item
be about to restrict listed windows to viewed
workspaces.
@end itemize
@cpindex Status icon tray
@cpindex System tray
@cpindex Tray, status icons
@cpindex Icon, status, tray
Traditionally, status icon trays have been
implemented with window embed method. And apart
from there being two competing standard, this is
pretty sane. But ther have been some restrictions
@command{mds} does not suffer:
@itemize @bullet{}
@item
icons should not be rearranged, and
@item
embedder did not know of the background looked where
the icon was added.
@end itemize
Desktop environments should feel free to create their
own themed application launchers and application
menus. This functionally is already de facto
standardised, and there is no reason to change
anything.
@cpindex Startup of applications, automatic
@cpindex Automatic startup of application
@cpindex Application, startup, automatic
@pgindex @file{mdsinitrc}
Some desktop environments provide a method to for
automatically starting applications during the
startup of a desktop environment. This is
discouraged. It is better to teach the user to edit
@file{~/.mdsinitrc}.
@node Input Management
@subsection Input Management
@cpindex Input management
@cpindex Window management
@cpindex Hotkeys
@cpindex Keyboard bindings
@cpindex Bindings, keyboard
@cpindex Keyboard shortcuts
@cpindex Shortcuts, keyboard
@pgindex @command{mds-keybind}
Many desktop environments and window managers for X
implement global keyboard bindings. This is not how
you should do this. The servers should recognise
commands passed via @command{mds}'s interprocess
communication. Configurations of the keyboard
bindings should be done in a server like
@command{mds-keybind}.
@pgindex @command{mds-ratbind}
@cpindex Rat bindings
@cpindex Mouse bindings
@cpindex Pointer bindings
@cpindex Hotcorners
@pgindex @command{mds-ratbarrier}
@cpindex Cursor barriers
@cpindex Rat pointer barriers
@cpindex Mouse pointer barriers
@cpindex Pointer barriers
@cpindex Screen edges, barriers
@cpindex Barriers, rat
Similarily some desktop environments implement rat
bindings@footnote{Notably hot corners.} and rat
barriers. This too should be done via servers like
like @command{mds-ratbind} and like
@command{mds-ratbarrier}.
@node The Desktop
@subsection The Desktop
@cpindex Desktop
@cpindex File manager
@cpindex Background
@cpindex Root window
@cpindex Window, root
Desktop environments provide their own desktop
because they want it to fit the rest of the
environment. For example, it can use components of
the desktop environment's file manager. This practice
is however problematic, because they also implement
the background, which is also implemented on top of
the root windows. @command{mds} desktops should use a
transparent background and let the root window be
used for implementing the background.
@cpindex Desktop widgets
@cpindex Widgets, desktop
Additionally, some desktop environments provide
desktop widgets. These can either be drawn on the
root window, the desktop window or as
always-on-bottom windows. In @command{mds}, windows
can have Z-order priority. That is, you can specify
how important it is that your window is at the bottom
or at the top. For widgets with input, it is
recommended to use this to put the widget just above
the desktop window. For windows without input, it is
recommended draw on the root windows. However doing so
requires that be listen for updates to the backgrund.
@node Why Dither Colours
@section Why Dither Colours
@cpindex Colour dithering
@cpindex Dithering of colours
Now that almost all computers, and all modern computers,
have support for 24-bit colour, colour dithering have
faded to unexistence. The common logic is that the colours
are good enough, or that we can only perceive 10 million
colours, and 24-bit colour gives us almost 17 million
colours. However, we can see the difference between
two colours if they are next to each other and painted
on large areas, even if the difference is the smallest
that 24-bit colour can bring us.
So whilst 24-bit colour is good enough in most cases,
it is not enough in gradients where the difference
between the end colours are low, especially when these
colours are bright. Therefore we still need dithering
in some cases.
Now that we get increasingly higher pixel pitch our
display output, dithering is going to look increasingly
better.
Since we somehow got stuck at 24-bit colour, dithering
is important.
@node GNU General Public License
@appendix GNU General Public License
@include gpl.texinfo
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include fdl.texinfo
@node Concept index
@unnumbered Concept index
@printindex cp
@node Data type index
@unnumbered Data type index
@printindex tp
@node Function index
@unnumbered Function index
@printindex fn
@node Option index
@unnumbered Option index
@printindex op
@node Program index
@unnumbered Program index
@printindex pg
@node Protocol index
@unnumbered Protocol index
@printindex pr
@node Signal index
@unnumbered Signal index
@printindex sg
@node Unicode block index
@unnumbered Unicode block index
@printindex ub
@node Variable index
@unnumbered Variable index
@printindex vr
@bye
TODO toolkit guidelines
screen reading
keyboard commands
rat commands
look and feel
configurations
TODO other input devices
3d pointer
joystick
gamepad
infrared remote
steering wheel
pedals
gloves
multitouch (screen, rat)
acceleroscope
gyroscope
camera
3d camera
TODO 3d output
TODO protocol: embed: embedding windows inside other windows such as a status icon tray
TODO protocol: arcade: a game takes over control over outputs for increased performance
TODO protocol: startup: a mechanism allowing a desktop environment to track application startup
TODO protocol: drag;; drag and drop should be usable for saving files.
TODO protocol: keytrans: changing keyboard layout
TODO protocol: rat
TODO protocol: cursor
TODO protocol: state
TODO protocol: focus;; multifocus
TODO protocol: compositor
TODO protocol: crtc
TODO protocol: presentation
TODO protocol: network
TODO protocol: decorator
TODO protocol: workspace
TODO protocol: ping
TODO notifications (balloons, bubbles)
TODO virtual resolution (the screen is larger than the output)
TODO taskbar features:
progress bars (any number) with colours
control buttons such as play, pause, previous and next
urgency alert
stack all windows that belongs to the same process
stack all windows with the same class
extensible right-click menu
right-click menu includes actions to start a new process
TODO application menu features:
different ways to start an program, for example,
browers may include a safe-browsing mode.
TODO In `Rat Cursors` use anchors and references to hyperlink names.
|