summaryrefslogtreecommitdiff
path: root/lib/libX11/specs/XKB/ch13.xml
blob: 0f65e9c66c343adef71a1c375970ea0b96cd9a78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
	  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id='Keyboard_Geometry'>
<title>Keyboard Geometry</title>

<para>
The Xkb description of a keyboard includes an optional keyboard geometry that
describes the physical appearance of the keyboard. Keyboard geometry describes
the shape, location, and color of all keyboard keys or other visible keyboard
components such as indicators. The information contained in a keyboard geometry
is sufficient to allow a client program to draw an accurate two-dimensional
image of the keyboard.
</para>


<para>
You can retrieve a keyboard geometry from an X server that supports Xkb, or you
can allocate it from scratch and initialize it in a client program. The
keyboard geometry need not have any correspondence with the physical keyboard
that is connected to the X server.
</para>


<para>
Geometry measurements are specified in mm/10 units. The origin (0,0) is in the
top left corner of the keyboard image. A component’s own origin is also its
upper left corner. In some cases a component needs to be drawn rotated. For
example, a special keyboard may have a section of keys arranged in rows in a
rectangular area, but the entire rectangle may not be in alignment with the
rest of the keyboard, and instead, it is rotated from horizontal by 30°.
Rotation for a geometry object is specified in 1/10° increments about its
origin. An example of a keyboard with rotated sections is shown in <link linkend="figure13.1">Figure 13.1</link>.
</para>

<figure id='figure13.1'>
  <title>Rotated Keyboard Sections</title>
  <mediaobject>
   <imageobject> <imagedata format="SVG" fileref="XKBlib-7.svg"/>
   </imageobject>
  </mediaobject>
</figure>


<!-- <H5 CLASS="Figure">
Rotated Keyboard Sections</H5>
-->

<para>
Some geometry components include a
<structfield>priority</structfield>,
which indicates the order in which overlapping objects should be drawn.
Objects should be drawn in order from highest priority (0) to lowest (255).
</para>


<para id='XkbGeometryRec'>
<indexterm significance="preferred" zone="XkbGeometryRec">
<primary><structname>XkbGeometryRec</structname></primary></indexterm>
The keyboard geometry’s top-level description is stored in a
<structname>XkbGeometryRec</structname>
structure. This structure contains three types of information:
</para>

<orderedlist>
  <listitem>
    <para>
Lists of items, not used to draw the basic keyboard, but indexed by the
geometry descriptions that comprise the entire keyboard geometry (colors,
geometry properties, key aliases, shapes)
    </para>
  </listitem>
  <listitem>
    <para>
A number of singleton items that describe the keyboard as a whole (keyboard
name, width and height, a color for the keyboard as a whole, and a color for
keyboard key labels)
    </para>
  </listitem>
  <listitem>
    <para>
A list of the keyboard’s sections and nonkey doodads
    </para>
  </listitem>
</orderedlist>

<para>
The top-level geometry is described in more detail in the following.
</para>


<para>
The lists of items used by components of the keyboard geometry description is
as follows:
</para>

<itemizedlist>
<listitem>
  <para>
The top-level keyboard geometry description includes a list of up to
<symbol>XkbGeomMaxColors</symbol>
(32)
<firstterm>color names</firstterm>.
A color name is a string whose interpretation is not specified by Xkb. The
<structname>XkbColorRec</structname>
structure provides a field for this name as well as a pixel field. The pixel
field is a convenient place for an application to store a pixel value or color
definition, if it needs to. All other geometry data structures refer to colors
using their indices in this global list.
  </para>
</listitem>
<listitem>
  <para>
The top-level keyboard geometry description includes a list of
<firstterm>geometry properties</firstterm>.
A geometry property associates an arbitrary string with an equally arbitrary
name. Geometry properties can be used to provide hints to programs that display
images of keyboards, but they are not interpreted by Xkb. No other geometry
structures refer to geometry properties. As an example of a possible use of
<structfield>properties</structfield>,
consider the pause/break key on most PC keyboards: the <quote>break</quote>
symbol is
usually on the front of the key and is often a different color. A program might
set a property to:
  </para>
  <para>
LBL_PAUS = "{Pause/top/black,Break/front/red}"
  </para>
  <para>
and use the property information to draw the key with a front label as well as
a top label.
  </para>
</listitem>
<listitem>
  <para>
The top-level keyboard geometry description includes a list of
<firstterm>key aliases</firstterm>
(see <xref linkend="Symbolic_Names" />). Key aliases allow the keyboard layout designer to assign
multiple key names to a single key.
  </para>
<note><para>Key aliases defined in the geometry component of a keyboard mapping
override those defined in the keycodes component of the server database, which
are stored in the
<structname>XkbNamesRec</structname>

(<structfield>xkb-&gt;names</structfield>).
Therefore, consider the key aliases defined by the geometry before
considering key aliases supplied by the keycodes.</para></note>
</listitem>
<listitem>
  <para>
The top-level keyboard geometry description includes a list of
<structfield>shapes</structfield>;
other keyboard components refer to shapes by their index in this list. A
shape consists of an arbitrary name of type Atom and one or more closed-polygon
<structfield>outlines</structfield>.
All points in an outline are specified relative to the origin of its
enclosing shape, that is, whichever shape that contains this outline in its
list of outlines. One outline is the primary outline. The primary outline is by
default the first outline, or it can be optionally specified by the
<structfield>primary</structfield>
field in the
<structname>XkbShapeRec</structname>
structure. A keyboard display application can generate a simpler but still
accurate keyboard image by displaying only the primary outlines for each shape.
Nonrectangular keys must include a rectangular
<firstterm>approximation</firstterm>
as one of the outlines associated with the shape. The approximation is not
normally displayed but can be used by very simple keyboard display applications
to generate a recognizable but degraded image of the keyboard.
  </para>
</listitem>
</itemizedlist>

<para>
The
<structname>XkbGeometryRec</structname>
top-level geometry description contains the following information that
pertains to the keyboard as a whole:
</para>

<itemizedlist>
<listitem>
  <para>
A
<firstterm>keyboard symbolic name</firstterm>
of type Atom to help users identify the keyboard.
  </para>
</listitem>
<listitem>
  <para>
The
<structfield>width</structfield>
and
<structfield>height</structfield>
of the keyboard, in mm/10. For nonrectangular keyboards, the width and height
describe the smallest bounding box that encloses the outline of the keyboard.
  </para>
</listitem>
<listitem>
  <para>
The
<firstterm>base color</firstterm>
of the keyboard is the predominant color on the keyboard and is used as the
default color for any components whose color is not explicitly specified.
  </para>
</listitem>
<listitem>
  <para>
The
<firstterm>label color</firstterm>
is the color used to draw the labels on most of the keyboard keys.
  </para>
</listitem>
<listitem>
  <para>
The
<firstterm>label font</firstterm>
is a string that describes the font used to draw labels on most keys; label
fonts are arbitrary strings, because Xkb does not specify the format or name
space for font names.
  </para>
</listitem>
</itemizedlist>

<para>
The keyboard is subdivided into named
<structfield>sections</structfield>
of related keys and doodads. The sections and doodads on the keyboard are
listed in the
<structname>XkbGeometryRec</structname>
top-level keyboard geometry description. A section is composed of keys that
are physically together and logically related. <link linkend="figure13.2">Figure 13.2</link> shows a keyboard
that is divided into four sections. A
<structfield>doodad</structfield>
describes some visible aspect of the keyboard that is not a key and is not a
section.
</para>

<figure id='figure13.2'>
  <title>Keyboard with Four Sections</title>
  <mediaobject>
   <imageobject> <imagedata format="SVG" fileref="XKBlib-8.svg"/>
   </imageobject>
  </mediaobject>
</figure>

<!--
<H5 CLASS="Figure">
Keyboard with Four Sections</H5>
-->

<sect1 id='Shapes_and_Outlines'>
<title>Shapes and Outlines</title>

<para>
A
<structfield>shape</structfield>,
used to draw keyboard components and stored in a
<structname>XkbShapeRec</structname>
structure, has:
</para>

<itemizedlist>
<listitem>
  <para>
An arbitrary name of type Atom.
  </para>
</listitem>
<listitem>
  <para>
Bounds (two x and y coordinates) that describe the corners of a rectangle
containing the shape’s top surface outline.
  </para>
</listitem>
<listitem>
  <para>
A list of one or more outlines (described below).
  </para>
</listitem>
<listitem>
  <para>
Optional pointers to a primary and an approximation outline (described below).
If either of these pointers is
<symbol>NULL</symbol>,
the default primary/approximation outline is the first one in the list of
outlines for the shape.
  </para>
</listitem>
</itemizedlist>

<para>
An
<firstterm>outline</firstterm>,
stored in a
<structname>XkbOutlineRec</structname>
structure, is a list of one or more points that describes a single
closed-polygon, as follows:
</para>

<itemizedlist>
<listitem>
  <para>
A list with a single point describes a rectangle with one corner at the origin
of the shape (0,0) and the opposite corner at the specified point.
  </para>
</listitem>
<listitem>
  <para>
A list of two points describes a rectangle with one corner at the position
specified by the first point and the opposite corner at the position specified
by the second point.
  </para>
</listitem>
<listitem>
  <para>
A list of three or more points describes an arbitrary polygon. If necessary,
the polygon is automatically closed by connecting the last point in the list
with the first.
  </para>
</listitem>
<listitem>
  <para>
A nonzero value for the
<structfield>corner_radius</structfield>
field specifies that the corners of the polygon should be drawn as circles
with the specified radius.
  </para>
</listitem>
</itemizedlist>

<para>
All points in an outline are specified relative to the origin of the enclosing
shape. Points in an outline may have negative values for the X and Y coordinate.
</para>


<para>
One outline is the primary outline; a keyboard display application can generate
a simple but still accurate keyboard image by displaying only the primary
outlines for each shape. The default primary outline is the first in a
shape’s list of outlines. If the
<structfield>primary</structfield>
field of the
<structname>XkbShapeRec</structname>
structure is not
<symbol>NULL</symbol>,
it points to the primary outline. A rectangular
<firstterm>approximation</firstterm>
must be included for nonrectangular keys as one of the outlines associated
with the shape; the approximation is not normally displayed but can be used by
very simple keyboard display applications to generate a recognizable but
degraded image of the keyboard.
</para>

</sect1>
<sect1 id='Sections'>
<title>Sections</title>

<para>
As previously noted, a keyboard is subdivided into
<structfield>sections</structfield>
of related keys. Each section has its own coordinate system — if a section
is rotated, the coordinates of any components within the section are
interpreted relative to the edges that were on the top and left before
rotation. The components that make up a section, stored in a
<structname>XkbSectionRec</structname>,
include:
</para>

<itemizedlist>
<listitem>
  <para>
An arbitrary name of type Atom.
  </para>
</listitem>
<listitem>
  <para>
A priority, to indicate drawing order. 0 is the highest priority, 255 the
lowest.
  </para>
</listitem>
<listitem>
  <para>
Origin of the section, relative to the origin of the keyboard.
  </para>
</listitem>
<listitem>
  <para>
The width and height and the angle of rotation.
  </para>
</listitem>
<listitem>
  <para>
A list of
<structfield>rows</structfield>.
A row is a list of horizontally or vertically adjacent keys. Horizontal rows
parallel the (prerotation) top of the section, and vertical rows parallel the
(prerotation) left of the section. All keys in a horizontal row share a common
top coordinate; all keys in a vertical row share a left coordinate. <link linkend="figure13.3">Figure 13.3</link>
shows the alpha section from the keyboard shown in <link linkend="figure13.2">Figure 13.2</link>, divided into
rows. Rows and keys are defined below.
  </para>
</listitem>
</itemizedlist>

<figure id='figure13.3'>
  <title>Rows in a Section</title>
  <mediaobject>
    <imageobject> <imagedata format="SVG" fileref="XKBlib-9.svg"/>
    </imageobject>
  </mediaobject>
</figure>



<!--
<H5 CLASS="Figure">
Rows in a Section</H5>
-->
<itemizedlist>
<listitem>
  <para>
An optional list of
<structfield>doodads</structfield>;
any type of doodad can be enclosed within a section. Position and angle of
rotation are relative to the origin and angle of rotation of the sections that
contain them. Priority for doodads in a section is relative to the other
components of the section, not to the keyboard as a whole.
  </para>
</listitem>
<listitem>
  <para>
An optional
<firstterm>overlay</firstterm>
with a name of type Atom and a list of overlay rows (described below).
  </para>
</listitem>
<listitem>
  <para>
Bounds (two x and y coordinates) that describe the corners of a rectangle
containing the entire section.
  </para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id='Rows_and_Keys'>
<title>Rows and Keys</title>

<para>
A row description
(<structname>XkbRowRec</structname>)
consists of the coordinates of its origin relative to its enclosing section,
a flag indicating whether the row is horizontal or vertical, and a list of keys
in the row.
</para>


<para>
A key description
(<structname>XkbKeyRec</structname>)
consists of a key name, a shape, a key color, and a gap. The key name should
correspond to one of the keys named in the keyboard names description, the
shape specifies the appearance of the key, and the key color specifies the
color of the key (not the label on the key; the label color is stored in the
<structname>XkbGeometryRec</structname>).
Keys are normally drawn immediately adjacent to one another from left to
right (or top to bottom) within a row. The gap field specifies the distance
between a key and its predecessor.
</para>


</sect1>
<sect1 id='Doodads'>
<title>Doodads</title>

<para>
Doodads can be global to the keyboard or part of a section. Doodads have
symbolic names of arbitrary length. The only doodad name whose interpretation
is specified by Xkb is <quote>Edges</quote>, which, if present, describes the
outline of the entire keyboard.
</para>


<para>
Each doodad’s origin is stored in fields named
<structfield>left</structfield>
and
<structfield>top</structfield>,
which are the coordinates of the doodad’s origin relative to its enclosing
object, whether it be a section or the top-level keyboard. The priority for
doodads that are listed in the top-level geometry is relative to the other
doodads listed in the top-level geometry and the sections listed in the
top-level geometry. The priority for doodads listed in a section are relative
to the other components of the section. Each doodad is stored in a structure
with a
<structfield>type</structfield>
field, which specifies the type of doodad.
</para>

<para>
Xkb supports five types of doodads:
</para>

<itemizedlist>
<listitem>
  <para>
An
<firstterm>indicator doodad</firstterm>
describes one of the physical keyboard indicators. Indicator doodads specify
the shape of the indicator, the indicator color when it is lit
(<emphasis>on_color</emphasis>)
and the indicator color when it is dark
(<emphasis>off_color</emphasis>).

  </para>
</listitem>
<listitem>
  <para>
An
<firstterm>outline doodad</firstterm>
describes some aspect of the keyboard to be drawn as one or more hollow,
closed polygons. Outline doodads specify the shape, color, and angle of
rotation about the doodad origin at which they should be drawn.
  </para>
</listitem>
<listitem>
  <para>
A
<firstterm>solid doodad</firstterm>
describes some aspect of the keyboard to be drawn as one or more filled
polygons. Solid doodads specify the shape, color, and angle of rotation about
the doodad origin at which they should be drawn.
  </para>
</listitem>
<listitem>
  <para>
A
<firstterm>text doodad</firstterm>
describes a text label somewhere on the keyboard. Text doodads specify the
label string, the font and color to use when drawing the label, and the angle
of rotation of the doodad about its origin.
  </para>
</listitem>
<listitem>
  <para>
A
<firstterm>logo doodad</firstterm>
is a catch-all, which describes some other visible element of the keyboard. A
logo doodad is essentially an outline doodad with an additional symbolic name
that describes the element to be drawn. If a keyboard display program
recognizes the symbolic name, it can draw something appropriate within the
bounding region of the shape specified in the doodad. If the symbolic name does
not describe a recognizable image, it should draw an outline using the
specified shape, outline, and angle of rotation. The Xkb extension does not
specify the interpretation of logo names.
  </para>
</listitem>
</itemizedlist>

<para>
The structures these doodads are stored in and the values of the
<structfield>type</structfield>
fields are shown in <link linkend="table13.1">Table 13.1</link>.
</para>

<table id='table13.1' frame='topbot'>
<title>Doodad Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='3' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='1.0*'/>
<colspec colname='c3' colwidth='1.0*'/>
<thead>
<row rowsep='1'>
  <entry>Doodad</entry>
  <entry>Structure</entry>
  <entry>Type</entry>
  </row>
</thead>
<tbody>
  <row>
    <entry>
<emphasis>indicator doodad</emphasis>
</entry>
    <entry>
<structname>XkbIndicatorDoodadRec</structname>
</entry>
    <entry>
<symbol>XkbIndicatorDoodad</symbol>
</entry>
  </row>
  <row>
    <entry>
<emphasis>outline doodad</emphasis>
</entry>
    <entry>
<structname>XkbShapeDoodadRec</structname>
</entry>
    <entry>
<symbol>XkbOutlineDoodad</symbol>
</entry>
  </row>
  <row>
    <entry>
<emphasis>solid doodad</emphasis>
</entry>
    <entry>
<structname>XkbShapeDoodadRec</structname>
</entry>
    <entry>
<symbol>XkbSolidDoodad</symbol>
</entry>
  </row>
  <row>
    <entry>
<emphasis>text doodad</emphasis>
</entry>
    <entry>
<structname>XkbTextDoodadRec</structname>
</entry>
    <entry>
<symbol>XkbTextDoodad</symbol>
</entry>
  </row>
  <row>
    <entry>
<emphasis>logo doodad</emphasis>
</entry>
    <entry>
<structname>XkbLogoDoodadRec</structname>
</entry>
    <entry>
<symbol>XkbLogoDoodad</symbol>
</entry>
  </row>
</tbody>
</tgroup>
</table>

</sect1>
<sect1 id='Overlay_Rows_and_Overlay_Keys'>
<title>Overlay Rows and Overlay Keys</title>

<para>
An
<firstterm>overlay row</firstterm>

(<structname>XkbOverlayRowRec</structname>)
contains a pointer to the row it overlays and a list of
<firstterm>overlay keys</firstterm>.
</para>


<para>
Each overlay key definition
(<structname>XkbOverlayKeyRec</structname>)
indicates a key that can yield multiple keycodes and consists of a field
named
<structfield>under</structfield>,
which specifies the primary name of the key and a field named
<structfield>over</structfield>,
which specifies the name for the key when the overlay keycode is selected.
The key specified in
<structfield>under</structfield>
must be a member of the section that contains the overlay key definition,
while the key specified in over must not be.
</para>


</sect1>
<sect1 id='Drawing_a_Keyboard_Representation'>
<title>Drawing a Keyboard Representation</title>

<para>
To draw a representation of the keyboard, draw in the following order:

<programlisting>
     Draw the top-level keyboard as a rectangle, using its width and height.
     For each component (section or doodad) of the top-level geometry, in priority order:
        If component is a section
           For each row, in the order it appears in the section
              Draw keys in the order they appear in the row
           Draw doodads within the section in priority order.
        Else draw doodad
</programlisting></para>

</sect1>
<sect1 id='Geometry_Data_Structures'>
<title>Geometry Data Structures</title>

<para>
In the following figures, a solid arrow denotes a pointer to an array of
structures or a singleton structure. A dotted arrow denotes an index or a
pointer into the array.
</para>

<!--
<MAP NAME="XKBlib-10">
</MAP>
-->
<figure id='figure13.4'>
  <title>Xkb Geometry Data Structures</title>
  <mediaobject>
   <imageobject> <imagedata format="SVG" fileref="XKBlib-10.svg"/>
   </imageobject>
  </mediaobject>
</figure>

<!--
<H5 CLASS="Figure">
Xkb Geometry Data Structures</H5>
<P CLASS="SmallBody">
&nbsp;</P>
<MAP NAME="XKBlib-11">
</MAP>
-->
<figure id='figure13.5'>
  <title>Xkb Geometry Data Structures (Doodads)</title>
  <mediaobject>
   <imageobject> <imagedata format="SVG" fileref="XKBlib-11.svg"/>
   </imageobject>
  </mediaobject>
</figure>

<!--
<H5 CLASS="Figure">
Xkb Geometry Data Structures (Doodads)</H5>
-->

<!--
<MAP NAME="XKBlib-12">
</MAP>
-->
<figure id='figure13.6'>
  <title>Xkb Geometry Data Structures (Overlays)</title>
  <mediaobject>
   <imageobject> <imagedata format="SVG" fileref="XKBlib-12.svg"/>
   </imageobject>
  </mediaobject>
</figure>

<!--
<H5 CLASS="Figure">
Xkb Geometry Data Structures (Overlays)</H5>
-->
<para><programlisting>
typedef struct _XkbGeometry {    /* top-level keyboard geometry structure */
    Atom              name;            /* keyboard name */
    unsigned short    width_mm;        /* keyboard width in <superscript>mm</superscript>/<subscript>10</subscript> */
    unsigned short    height_mm;       /* keyboard height in <superscript>mm</superscript>/<subscript>10</subscript> */
    char *            label_font;      /* font for key labels */
    XkbColorPtr       label_color;     /* color for key labels
                                          - pointer into colors array */
    XkbColorPtr       base_color;      /* color for basic keyboard
                                          - pointer into colors array */
    unsigned short    sz_properties;   /* size of properties array */
    unsigned short    sz_colors;       /* size of colors array */
    unsigned short    sz_shapes;       /* size of shapes array */
    unsigned short    sz_sections;     /* size of sections array */
    unsigned short    sz_doodads;      /* size of doodads array */
    unsigned short    sz_key_aliases;  /* size of key aliases array */
    unsigned short    num_properties;  /* number of properties in the
                                           properties array */
    unsigned short    num_colors;      /* number of colors in the
                                           colors array */
    unsigned short    num_shapes;      /* number of shapes in the
                                           shapes array */
    unsigned short    num_sections;    /* number of sections in the
                                           sections array */
    unsigned short    num_doodads;     /* number of doodads in the
                                           doodads array */
    unsigned short    num_key_aliases; /* number of key aliases in the
                                           key_aliases array */
    XkbPropertyPtr    properties;      /* properties array */
    XkbColorPtr       colors;          /* colors array */
    XkbShapePtr       shapes;          /* shapes array */
    XkbSectionPtr     sections;        /* sections array */
    XkbDoodadPtr      doodads;         /* doodads array */
    XkbKeyAliasPtr    key_aliases;     /* key aliases array */
} <structname>XkbGeometryRec</structname>, *XkbGeometryPtr;
</programlisting></para>

<para>
The
<structfield>doodads</structfield>
array is only for doodads not contained in any of the
<structfield>sections</structfield>
that has its own
<structfield>doodads</structfield>.
The key aliases contained in the
<structfield>key_aliases</structfield>
array take precedence over any defined in the keycodes component of the
keyboard description.
</para>

<para><programlisting>
typedef struct _XkbProperty {
    char *      name;                   /* property name */
    char *      value;                  /* property value */
} <structname>XkbPropertyRec</structname>, *XkbPropertyPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbColor {
    unsigned int      pixel;            /* color */
    char *            spec;             /* color name */
} <structname>XkbColorRec</structname>, *XkbColorPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbKeyAliasRec {
    char      real[XkbKeyNameLength];   /* real name of the key */
    char      alias[XkbKeyNameLength];  /* alias for the key */
} <structname>XkbKeyAliasRec</structname>, *XkbKeyAliasPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbPoint {              /* x, y coordinates */
    short      x;
    short      y;
} <structname>XkbPointRec</structname>, *XkbPointPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbOutline {
    unsigned short      num_points;     /* number of points in the outline */
    unsigned short      sz_points;      /* size of the points array */
    unsigned short      corner_radius;  /* draw corners as circles
                                           with this radius */
    XkbPointPtr         points;         /* array of points defining
                                           the outline */
} <structname>XkbOutlineRec</structname>, *XkbOutlinePtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbBounds {
    short      x1, y1;       /* upper left corner of the bounds, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short      x2, y2;       /* lower right corner of the bounds, in <superscript>mm</superscript>/<subscript>10</subscript> */
} <structname>XkbBoundsRec</structname>, *XkbBoundsPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbShape {
    Atom              name;             /* shape’s name */
    unsigned short    num_outlines;     /* number of outlines for the shape */
    unsigned short    sz_outlines;      /* size of the outlines array */
    XkbOutlinePtr     outlines;         /* array of outlines for the shape */
    XkbOutlinePtr     approx;           /* pointer into the array to the
                                           approximating outline */
    XkbOutlinePtr     primary;          /* pointer into the array to the
                                           primary outline */
    XkbBoundsRec      bounds;           /* bounding box for the shape;
                                           encompasses all outlines */
} <structname>XkbShapeRec</structname>, *XkbShapePtr;
</programlisting></para>

<para>
If
<structfield>approx</structfield>
and/or
<structfield>primary</structfield>
is
<symbol>NULL</symbol>,
the default value is used. The default primary outline is the first element
in the outlines array, as is the default approximating outline.
</para>

<para><programlisting>
typedef struct _XkbKey {           /* key in a row */
    XkbKeyNameRec    name;         /* key name */
    short            gap;          /* gap in <superscript>mm</superscript>/<subscript>10</subscript> from previous key in row */
    unsigned char    shape_ndx;    /* index of shape for key */
    unsigned char    color_ndx;    /* index of color for key body */
} <structname>XkbKeyRec</structname>, *XkbKeyPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbRow {           /* row in a section */
    short               top;       /* top coordinate of row origin,
                                      relative to section’s origin */
    short               left;      /* left coordinate of row origin,
                                      relative to section’s origin */
    unsigned short      num_keys;  /* number of keys in the keys array */
    unsigned short      sz_keys;   /* size of the keys array */
    int                 vertical;  /* <symbol>True</symbol> &rArr;vertical row,
                                      <symbol>False</symbol> &rArr;horizontal row */
    XkbKeyPtr           keys;      /* array of keys in the row */
    XkbBoundsRec        bounds;    /* bounding box for the row */
} <structname>XkbRowRec</structname>, *XkbRowPtr;
</programlisting></para>

<para>
<structfield>top</structfield>
and
<structfield>left</structfield>
are in
<superscript>mm</superscript>/<subscript>10</subscript>.
</para>

<para><programlisting>
typedef struct _XkbOverlayRec {
    Atom              name;           /* overlay name */
    XkbSectionPtr     section_under;  /* the section under this overlay */
    unsigned short    num_rows;       /* number of rows in the rows array */
    unsigned short    sz_rows;        /* size of the rows array */
    XkbOverlayRowPtr  rows;           /* array of rows in the overlay */
    XkbBoundsPtr      bounds;         /* bounding box for the overlay */
} <structname>XkbOverlayRec</structname>, *XkbOverlayPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbOverlayRow {
    unsigned short      row_under;    /* index into the row under this
                                         overlay row */
    unsigned short      num_keys;     /* number of keys in the keys array */
    unsigned short      sz_keys;      /* size of the keys array */
    XkbOverlayKeyPtr    keys;         /* array of keys in the overlay row */
} <structname>XkbOverlayRowRec</structname>, *XkbOverlayRowPtr;
</programlisting></para>

<para>
<structfield>row_under</structfield>
is an index into the array of
<structfield>rows</structfield>
in the section under this overlay. The section under this overlay row is the
one pointed to by
<structfield>section_under</structfield>
in this overlay row’s
<structname>XkbOverlayRec</structname>.
</para>

<para><programlisting>
typedef struct _XkbOverlayKey {
    XkbKeyNameRec      over;      /* name of this overlay key */
    XkbKeyNameRec      under;     /* name of the key under this overlay key */
} <structname>XkbOverlayKeyRec</structname>, *XkbOverlayKeyPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbSection {
    Atom            name;          /* section name */
    unsigned char   priority;      /* drawing priority, 0&rArr;highest, 255&rArr;lowest */
    short           top;           /* top coordinate of section origin */
    short           left;          /* left coordinate of row origin */
    unsigned short  width;         /* section width, in <superscript>mm</superscript>/<subscript>10</subscript> */
    unsigned short  height;        /* section height, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short           angle;         /* angle of section rotation,
                                      counterclockwise */
    unsigned short  num_rows;      /* number of rows in the rows array */
    unsigned short  num_doodads;   /* number of doodads in the doodads array */
    unsigned short  num_overlays;  /* number of overlays in the overlays array */
    unsigned short  sz_rows;       /* size of the rows array */
    unsigned short  sz_doodads;    /* size of the doodads array */
    unsigned short  sz_overlays;   /* size of the overlays array */
    XkbRowPtr       rows;          /* section rows array */
    XkbDoodadPtr    doodads;       /* section doodads array */
    XkbBoundsRec    bounds;        /* bounding box for the section,
                                      before rotation */
    XkbOverlayPtr   overlays;      /* section overlays array */
} <structname>XkbSectionRec</structname>, *XkbSectionPtr;
</programlisting></para>

<para>
<structfield>top</structfield>
and
<structfield>left</structfield>
are the origin of the section, relative to the origin of the keyboard, in
<superscript>mm</superscript>/<subscript>10</subscript>.
<structfield>angle</structfield>
is in
<superscript>1</superscript>/<subscript>10</subscript>
degrees.
</para>

<sect2 id='DoodadRec_Structures'>
<title>DoodadRec Structures</title>

<para>
The doodad arrays in the
<structname>XkbGeometryRec</structname>
and the
<structname>XkbSectionRec</structname>
may contain any of the doodad structures and types shown in
<link linkend="table13.1">Table 13.1</link>.
</para>


<para>
The doodad structures form a union:
</para>

<para><programlisting>
typedef union _XkbDoodad {
      XkbAnyDoodadRec        any;
      XkbShapeDoodadRec      shape;
      XkbTextDoodadRec       text;
      XkbIndicatorDoodadRec  indicator;
      XkbLogoDoodadRec       logo;
} <structname>XkbDoodadRec</structname>, *XkbDoodadPtr;
</programlisting></para>

<para>
The
<structfield>top</structfield>
and
<structfield>left</structfield>
coordinates of each doodad are the coordinates of the origin of the doodad
relative to the keyboard’s origin if the doodad is in the
<structname>XkbGeometryRec</structname>
doodad array, and with respect to the section’s origin if the doodad is in a
<structname>XkbSectionRec</structname>
doodad array. The
<structfield>color_ndx</structfield>
or
<structfield>on_color_ndx</structfield>
and
<structfield>off_color_ndx</structfield>
fields are color indices into the
<structname>XkbGeometryRec</structname>’s
color array and are the colors to draw the doodads with. Similarly, the
<structfield>shape_ndx</structfield>
fields are indices into the
<structname>XkbGeometryRec</structname>’s
shape array.
</para>

<para><programlisting>
typedef struct _XkbShapeDoodad {
    Atom             name;         /* doodad name */
    unsigned char    type;         /* <symbol>XkbOutlineDoodad</symbol>
                                      or <symbol>XkbSolidDoodad</symbol> */
    unsigned char    priority;     /* drawing priority,
                                       0&rArr;highest, 255&rArr;lowest */
    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            angle;        /* angle of rotation, clockwise,
                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
    unsigned short   color_ndx;    /* doodad color */
    unsigned short   shape_ndx;    /* doodad shape */
} <structname>XkbShapeDoodadRec</structname>, *XkbShapeDoodadPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbTextDoodad {
    Atom             name;         /* doodad name */
    unsigned char    type;         /* <symbol>XkbTextDoodad</symbol> */
    unsigned char    priority;     /* drawing priority,
                                     0&rArr;highest, 255&rArr;lowest */
    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            angle;        /* angle of rotation, clockwise,
                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
    short            width;        /* width in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            height;       /* height in <superscript>mm</superscript>/<subscript>10</subscript> */
    unsigned short   color_ndx;    /* doodad color */
    char *           text;         /* doodad text */
    char *           font;         /* arbitrary font name for doodad text */
} <structname>XkbTextDoodadRec</structname>, *XkbTextDoodadPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbIndicatorDoodad {
    Atom             name;         /* doodad name */
    unsigned char    type;         /* <symbol>XkbIndicatorDoodad</symbol> */
    unsigned char    priority;     /* drawing priority, 0&rArr;highest, 255&rArr;lowest */
    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            angle;        /* angle of rotation, clockwise,
                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
    unsigned short   shape_ndx;    /* doodad shape */
    unsigned short   on_color_ndx; /* color for doodad if indicator is on */
    unsigned short   off_color_ndx;/* color for doodad if indicator is off */
} <structname>XkbIndicatorDoodadRec</structname>, *XkbIndicatorDoodadPtr;
</programlisting></para>

<para><programlisting>
typedef struct _XkbLogoDoodad {
    Atom             name;         /* doodad name */
    unsigned char    type;         /* <symbol>XkbLogoDoodad</symbol> */
    unsigned char    priority;     /* drawing priority, 0&rArr;highest, 255&rArr;lowest */
    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
    short            angle;        /* angle of rotation, clockwise,
                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
    unsigned short   color_ndx;    /* doodad color */
    unsigned short   shape_ndx;    /* doodad shape */
    char *           logo_name;    /* text for logo */
} <structname>XkbLogoDoodadRec</structname>, *XkbLogoDoodadPtr
</programlisting></para>

</sect2>
</sect1>
<sect1 id='Getting_Keyboard_Geometry_From_the_Server'>
<title>Getting Keyboard Geometry From the Server</title>

<para>
You can load a keyboard geometry as part of the keyboard description returned
by
<function>XkbGetKeyboard</function>.
However, if a keyboard description has been previously loaded, you can
instead obtain the geometry by calling the
<function>XkbGetGeometry</function>.
In this case, the geometry returned is the one associated with the keyboard
whose device ID is contained in the keyboard description.
</para>

<para>
To load a keyboard geometry if you already have the keyboard description, use
<function>XkbGetGeometry</function>.
</para>

<indexterm significance="preferred" zone="XkbGetGeometry"><primary><function>XkbGetGeometry</function></primary></indexterm>
<funcsynopsis id="XkbGetGeometry">
  <funcprototype>
    <funcdef>Status <function>XkbGetGeometry</function></funcdef>
<!-- (
<parameter>dpy</parameter>,
<parameter>xkb</parameter>
) -->

    <paramdef>Display *<parameter>dpy</parameter></paramdef>
    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>dpy</parameter>
    </term>
    <listitem>
      <para>
        connection to the X server
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>xkb</parameter>
    </term>
    <listitem>
      <para>
        keyboard description that contains the ID for the keyboard and into
        which the geometry should be loaded
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbGetGeometry</function>
can return
<errorname>BadValue</errorname>,
<errorname>BadImplementation</errorname>,
<errorname>BadName</errorname>,
<errorname>BadAlloc</errorname>,
or
<errorname>BadLength</errorname>
errors or
<symbol>Success</symbol>
if it succeeds.
</para>

<para>
It is also possible to load a keyboard geometry by name. The X server maintains
a database of keyboard components (see <xref linkend="Server_Database_of_Keyboard_Components" />). To load a keyboard geometry
description from this database by name, use
<function>XkbGetNamedGeometry</function>.
</para>

<indexterm significance="preferred" zone="XkbGetNamedGeometry"><primary><function>XkbGetNamedGeometry</function></primary></indexterm>
<funcsynopsis id="XkbGetNamedGeometry">
  <funcprototype>
    <funcdef>Status <function>XkbGetNamedGeometry</function></funcdef>
<!-- (
<parameter>dpy</parameter>,
<parameter>xkb</parameter>,
<parameter>name</parameter>
) -->

    <paramdef>Display *<parameter>dpy</parameter></paramdef>
    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
    <paramdef>Atom <parameter>name</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>dpy</parameter>
    </term>
    <listitem>
      <para>
        connection to the X server
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>xkb</parameter>
    </term>
    <listitem>
      <para>
        keyboard description into which the geometry should be loaded
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>name</parameter>
    </term>
    <listitem>
      <para>
        name of the geometry to be loaded
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbGetNamedGeometry</function>
can return
<errorname>BadName</errorname>
if the
<parameter>name</parameter>
cannot be found.
</para>

</sect1>
<sect1 id='Using_Keyboard_Geometry'>
<title>Using Keyboard Geometry</title>

<para>
Xkb provides a number of convenience functions to help use a keyboard geometry.
These include functions to return the bounding box of a shape’s top surface
and to update the bounding box of a shape row or section.
</para>

<para>
A shape is made up of a number of outlines. Each outline is a polygon made up
of a number of points. The bounding box of a shape is a rectangle that contains
all the outlines of that shape.
</para>

<figure id='figure13.7'>
  <title>Key Surface, Shape Outlines, and Bounding Box</title>
  <mediaobject>
   <imageobject> <imagedata format="SVG" fileref="XKBlib-13.svg"/>
   </imageobject>
   </mediaobject>
</figure>


<!--
<H5 CLASS="Figure">
Key Surface, Shape Outlines, and Bounding Box</H5>
-->

<para>
To determine the bounding box of the top surface of a shape, use
<function>XkbComputeShapeTop</function>.
</para>

<indexterm significance="preferred" zone="XkbComputeShapeTop"><primary><function>XkbComputeShapeTop</function></primary></indexterm>
<funcsynopsis id="XkbComputeShapeTop">
  <funcprototype>
    <funcdef>Bool <function>XkbComputeShapeTop</function></funcdef>
<!-- (
<parameter>shape</parameter>,
<parameter>bounds_rtrn</parameter>
) -->

    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
    <paramdef>XkbBoundsPtr <parameter>bounds_rtrn</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>shape</parameter>
    </term>
    <listitem>
      <para>
        shape to be examined
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>bounds_rtrn</parameter>
    </term>
    <listitem>
      <para>
        backfilled with the bounding box for the shape
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbComputeShapeTop</function>
returns a
<structname>BoundsRec</structname>
that contains two x and y coordinates. These coordinates describe the corners
of a rectangle that contains the outline that describes the top surface of the
shape. The top surface is defined to be the approximating outline if the
<structfield>approx</structfield>
field of
<parameter>shape</parameter>
is not
<symbol>NULL</symbol>.
If
<structfield>approx</structfield>
is
<symbol>NULL</symbol>,
the top surface is defined as the last outline in the
<parameter>shape</parameter>’s
array of outlines.
<function>XkbComputeShapeTop</function>
returns
<symbol>False</symbol>
if
<parameter>shape</parameter>
is
<symbol>NULL</symbol>
or if there are no outlines for the shape; otherwise, it returns
<symbol>True</symbol>.
</para>


<para>
A
<structname>ShapeRec</structname>
contains a
<structname>BoundsRec</structname>
that describes the bounds of the shape. If you add or delete an outline to or
from a shape, the bounding box must be updated. To update the bounding box of a
shape, use <function>XkbComputeShapeBounds</function>.
</para>


<indexterm significance="preferred" zone="XkbComputeShapeBounds"><primary><function>XkbComputeShapeBounds</function></primary></indexterm>
<funcsynopsis id="XkbComputeShapeBounds">
  <funcprototype>
    <funcdef>Bool <function>XkbComputeShapeBounds</function></funcdef>
<!-- (
<parameter>shape</parameter>
) -->

    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>shape</parameter>
    </term>
    <listitem>
      <para>
        shape to be examined
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbComputeShapeBounds</function>
updates the
<structname>BoundsRec</structname>
contained in the
<parameter>shape</parameter>
by examining all the outlines of the shape and setting the
<structname>BoundsRec</structname>
to the minimum x and minimum y, and maximum x and maximum y values found in
those outlines.
<function>XkbComputeShapeBounds</function>
returns
<symbol>False</symbol>
if
<parameter>shape</parameter>
is
<symbol>NULL</symbol>
or if there are no outlines for the shape; otherwise, it returns
<symbol>True</symbol>.
</para>

<para>
If you add or delete a key to or from a row, or if you update the shape of one
of the keys in that row, you may need to update the bounding box of that row.
To update the bounding box of a row, use <function>XkbComputeRowBounds</function>.
</para>

<indexterm significance="preferred" zone="XkbComputeRowBounds"><primary><function>XkbComputeRowBounds</function></primary></indexterm>
<funcsynopsis id="XkbComputeRowBounds">
  <funcprototype>
    <funcdef>Bool <function>XkbComputeRowBounds</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>section</parameter>,
<parameter>row</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry that contains the <parameter>section</parameter>
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section that contains the row
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>row</parameter>
    </term>
    <listitem>
      <para>
        row to be examined and updated
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbComputeRowBounds</function>
checks the bounds of all keys in the
<parameter>row</parameter>
and updates the bounding box of the row if necessary.
<function>XkbComputeRowBounds</function>
returns
<symbol>False</symbol>
if any of the arguments is
<symbol>NULL</symbol>;
otherwise, it returns
<symbol>True</symbol>.
</para>

<para>
If you add or delete a row to or from a section, or if you change the geometry
of any of the rows in that section, you may need to update the bounding box for
that section. To update the bounding box of a section, use
<function>XkbComputeSectionBounds</function>.
</para>

<indexterm significance="preferred" zone="XkbComputeSectionBounds"><primary><function>XkbComputeSectionBounds</function></primary></indexterm>
<funcsynopsis id="XkbComputeSectionBounds">
  <funcprototype>
    <funcdef>Bool <function>XkbComputeSectionBounds</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>section</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry that contains the <parameter>section</parameter>
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section to be examined and updated
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbComputeSectionBounds</function>
examines all the rows of the
<parameter>section</parameter>
and updates the bounding box of that section so that it contains all rows.
<function>XkbComputeSectionBounds</function>
returns
<symbol>False</symbol>
if any of the arguments is
<symbol>NULL</symbol>;
otherwise, it returns
<symbol>True</symbol>.
</para>

<para>
Keys that can generate multiple keycodes may be associated with multiple names.
Such keys have a primary name and an alternate name. To find the alternate name
by using the primary name for a key that is part of an overlay, use
<function>XkbFindOverlayForKey</function>.
</para>

<indexterm significance="preferred" zone="XkbFindOverlayForKey"><primary><function>XkbFindOverlayForKey</function></primary></indexterm>
<funcsynopsis id="XkbFindOverlayForKey">
  <funcprototype>
    <funcdef>char *<function>XkbFindOverlayForKey</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>section</parameter>,
<parameter>under</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>char *<parameter>under</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry that contains the <parameter>section</parameter>
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section to be searched for matching keys
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>under</parameter>
    </term>
    <listitem>
      <para>
        .primary name of the key to be considered
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbFindOverlayForKey</function>
uses the primary name of the key,
<parameter>under</parameter>,
to look up the alternate name, which it returns.
</para>


</sect1>
<sect1 id='Adding_Elements_to_a_Keyboard_Geometry'>
<title>Adding Elements to a Keyboard Geometry</title>

<para>
Xkb provides functions to add a single new element to the top-level keyboard
geometry. In each case the
<structfield>num_<replaceable>*</replaceable></structfield>
fields of the corresponding structure is incremented by 1. These functions do
not change
<structfield>sz_<replaceable>*</replaceable></structfield>
unless there is no more room in the array. Some of these functions fill in the
values of the element’s structure from the arguments. For other functions,
you must explicitly write code to fill the structure’s elements.
</para>


<para>
The top-level geometry description includes a list of
<firstterm>geometry properties</firstterm>.
A geometry property associates an arbitrary string with an equally arbitrary
name. Programs that display images of keyboards can use geometry properties as
hints, but they are not interpreted by Xkb. No other geometry structures refer
to geometry properties.
</para>


<para>
To add one property to an existing keyboard geometry description, use
<function>XkbAddGeomProperty</function>.
</para>

<indexterm significance="preferred" zone="XkbAddGeomProperty"><primary><function>XkbAddGeomProperty</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomProperty">
  <funcprototype>
    <funcdef>XkbPropertyPtr <function>XkbAddGeomProperty</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>name</parameter>,
<parameter>value</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>char *<parameter>name</parameter></paramdef>
    <paramdef>char *<parameter>value</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>name</parameter>
    </term>
    <listitem>
      <para>
        name of the new property
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>value</parameter>
    </term>
    <listitem>
      <para>
        value for the new property
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAddGeomProperty</function>
adds one property with the specified
<parameter>name</parameter>
and
<parameter>value</parameter>
to the keyboard geometry specified by geom.
<function>XkbAddGeomProperty</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the property. To allocate space for an arbitrary number of properties, use the
XkbAllocGeomProps function.
</para>


<para>
To add one key alias to an existing keyboard geometry description, use
<function>XkbAddGeomKeyAlias</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomKeyAlias"><primary><function>XkbAddGeomKeyAlias</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomKeyAlias">
  <funcprototype>
    <funcdef>XkbKeyAliasPtr <function>XkbAddGeomKeyAlias</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>alias, real</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>char *<parameter>alias</parameter></paramdef>
    <paramdef>char *<parameter>real</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>alias</parameter>
    </term>
    <listitem>
      <para>
        alias to be added
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>real</parameter>
    </term>
    <listitem>
      <para>
        real name to be bound to the new alias
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAddGeomKeyAlias</function>
adds one key alias with the value alias to the geometry geom, and associates
it with the key whose real name is real.
<function>XkbAddGeomKeyAlias</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the alias. To allocate space for an arbitrary number of aliases, use the
XkbAllocGeomKeyAliases function.
</para>


<para>
To add one color name to an existing keyboard geometry description, use
<function>XkbAddGeomColor</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomColor"><primary><function>XkbAddGeomColor</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomColor">
  <funcprototype>
    <funcdef>XkbColorPtr <function>XkbAddGeomColor</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>spec</parameter>,
<parameter>pixel</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>char *<parameter>spec</parameter></paramdef>
    <paramdef>unsigned int <parameter>pixel</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>spec</parameter>
    </term>
    <listitem>
      <para>
        color to be added
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>pixel</parameter>
    </term>
    <listitem>
      <para>
        color to be added
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAddGeomColor</function>
adds the specified color
<structfield>name</structfield>
and
<parameter>pixel</parameter>
to the specified geometry
<parameter>geom</parameter>.
The top-level geometry description includes a list of up to
<emphasis>MaxColors</emphasis>
(32)
<emphasis>color names</emphasis>.
A color
<structfield>name</structfield>
is a string whose interpretation is not specified by Xkb and neither is the
<parameter>pixel</parameter>
value’s interpretation. All other geometry data structures refer to colors
using their indices in this global list or pointers to colors in this list.
<function>XkbAddGeomColor</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the color. To allocate space for an arbitrary number of colors to a geometry,
use the
<function>XkbAllocGeomColors</function>
function.
</para>

<para>
To add one outline to an existing shape, use
<function>XkbAddGeomOutline</function>.
</para>

<indexterm significance="preferred" zone="XkbAddGeomOutline"><primary><function>XkbAddGeomOutline</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomOutline">
  <funcprototype>
    <funcdef>XkbOutlinePtr <function>XkbAddGeomOutline</function></funcdef>
<!-- (
<parameter>shape</parameter>,
<parameter>sz_points</parameter>
) -->

    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
    <paramdef>int <parameter>sz_points</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>shape</parameter>
    </term>
    <listitem>
      <para>
        shape to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_points</parameter>
    </term>
    <listitem>
      <para>
        number of points to be reserved
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
An outline consists of an arbitrary number of points.
<function>XkbAddGeomOutline</function>
adds an outline to the specified
<parameter>shape</parameter>
by reserving
<parameter>sz_points</parameter>
points for it. The new outline is allocated and zeroed.
<function>XkbAddGeomOutline</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space. To
allocate space for an arbitrary number of outlines to a shape, use
XkbAllocGeomOutlines.
</para>


<para>
To add a shape to a keyboard geometry, use
<function>XkbAddGeomShape</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomShape"><primary><function>XkbAddGeomShape</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomShape">
  <funcprototype>
    <funcdef>XkbShapePtr <function>XkbAddGeomShape</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>name</parameter>,
<parameter>sz_outlines</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>Atom <parameter>name</parameter></paramdef>
    <paramdef>int <parameter>sz_outlines</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>name</parameter>
    </term>
    <listitem>
      <para>
        name of the new shape
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_outlines</parameter>
    </term>
    <listitem>
      <para>
        number of outlines to be reserved
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
A geometry contains an arbitrary number of shapes, each of which is made up of
an arbitrary number of outlines.
<function>XkbAddGeomShape</function>
adds a shape to a geometry
<parameter>geom</parameter>
by allocating space for
<parameter>sz_outlines</parameter>
outlines for it and giving it the name specified by name. If a shape with name
<parameter>name</parameter>
already exists in the geometry, a pointer to the existing shape is returned.
<function>XkbAddGeomShape</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space. To
allocate space for an arbitrary number of geometry shapes, use
<function>XkbAllocGeomShapes</function>.
</para>


<para>
To add one key at the end of an existing row of keys, use
<function>XkbAddGeomKey</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomKey"><primary><function>XkbAddGeomKey</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomKey">
  <funcprototype>
    <funcdef>XkbKeyPtr <function>XkbAddGeomKey</function></funcdef>
<!-- (
<parameter>row</parameter>
) -->

    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>row</parameter>
    </term>
    <listitem>
      <para>
        row to be updated
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
Keys are grouped into rows.
<function>XkbAddGeomKey</function>
adds one key to the end of the specified
<parameter>row</parameter>.
The key is allocated and zeroed.
<function>XkbAddGeomKey</function>
returns
<symbol>NULL</symbol>
if
<parameter>row</parameter>
is empty or if it was not able to allocate space for the key. To allocate
space for an arbitrary number of keys to a row, use XkbAllocGeomKeys.
</para>


<para>
To add one section to an existing keyboard geometry, use
<function>XkbAddGeomSection</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomSection"><primary><function>XkbAddGeomSection</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomSection">
  <funcprototype>
    <funcdef>XkbSectionPtr <function>XkbAddGeomSection</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>name</parameter>,
<parameter>sz_rows</parameter>,
<parameter>sz_doodads</parameter>,
<parameter>sz_overlays</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>Atom <parameter>name</parameter></paramdef>
    <paramdef>int <parameter>sz_rows</parameter></paramdef>
    <paramdef>int <parameter>sz_doodads</parameter></paramdef>
    <paramdef>int <parameter>sz_overlays</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>name</parameter>
    </term>
    <listitem>
      <para>
        name of the new section
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_rows</parameter>
    </term>
    <listitem>
      <para>
        number of rows to reserve in the section
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_doodads</parameter>
    </term>
    <listitem>
      <para>
        number of doodads to reserve in the section
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_overlays</parameter>
    </term>
    <listitem>
      <para>
        number of overlays to reserve in the section
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
A keyboard geometry contains an arbitrary number of sections.
<function>XkbAddGeomSection</function>
adds one section to an existing keyboard geometry
<parameter>geom</parameter>.
The new section contains space for the number of rows, doodads, and overlays
specified by
<parameter>sz_rows</parameter>,
<parameter>sz_doodads</parameter>,
and
<parameter>sz_overlays</parameter>.
The new section is allocated and zeroed and given the name specified by
<parameter>name</parameter>.
If a section with name
<parameter>name</parameter>
already exists in the geometry, a pointer to the existing section is
returned.
<function>XkbAddGeomSection</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the section. To allocate space for an arbitrary number of sections to a
geometry, use XkbAllocGeomSections.
</para>


<para>
To add a row to a section, use
<function>XkbAddGeomRow</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomRow"><primary><function>XkbAddGeomRow</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomRow">
  <funcprototype>
    <funcdef>XkbRowPtr <function>XkbAddGeomRow</function></funcdef>
<!-- (
<parameter>section</parameter>,
<parameter>sz_keys</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>int <parameter>sz_keys</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_keys</parameter>
    </term>
    <listitem>
      <para>
        number of keys to be reserved
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
One of the components of a keyboard geometry section is one or more rows of
keys.
<function>XkbAddGeomRow</function>
adds one row to the specified
<parameter>section</parameter>.
The newly created row contains space for the number of keys specified in
<parameter>sz_keys</parameter>.
They are allocated and zeroed, but otherwise uninitialized.
<function>XkbAddGeomRow</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the row. To allocate space for an arbitrary number of rows to a section, use
the XkbAllocGeomRows function.
</para>


<para>
To add one doodad to a section of a keyboard geometry or to the top-level
geometry, use
<function>XkbAddGeomDoodad</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomDoodad"><primary><function>XkbAddGeomDoodad</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomDoodad">
  <funcprototype>
    <funcdef>XkbDoodadPtr <function>XkbAddGeomDoodad</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>section</parameter>,
<parameter>name</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>Atom <parameter>name</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry to which the doodad is added
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section, if any, to which the doodad is added
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>name</parameter>
    </term>
    <listitem>
      <para>
        name of the new doodad
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
A
<structfield>doodad</structfield>
describes some visible aspect of the keyboard that is not a key and is not a
section.
<function>XkbAddGeomDoodad</function>
adds a doodad with name specified by name to the geometry
<parameter>geom</parameter>
if section is
<symbol>NULL</symbol>
or to the section of the geometry specified by section if
<parameter>section</parameter>
is not
<symbol>NULL</symbol>.
<function>XkbAddGeomDoodad</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the doodad. If there is already a doodad with the name
<parameter>name</parameter>
in the doodad array for the geometry (if
<parameter>section</parameter>
is
<symbol>NULL</symbol>)
or the section (if
<parameter>section</parameter>
is non-
<symbol>NULL</symbol>),
a pointer to that doodad is returned. To allocate space for an arbitrary
number of doodads to a section, use the XkbAllocGeomSectionDoodads function. To
allocate space for an arbitrary number of doodads to a keyboard geometry, use
the XkbAllocGeomDoodads function.
</para>


<para>
To add one overlay to a section, use
<function>XkbAddGeomOverlay</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomOverlay"><primary><function>XkbAddGeomOverlay</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomOverlay">
  <funcprototype>
    <funcdef>XkbOverlayPtr <function>XkbAddGeomOverlay</function></funcdef>
<!-- (
<parameter>section</parameter>,
<parameter>name</parameter>,
<parameter>sz_rows</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>Atom <parameter>name</parameter></paramdef>
    <paramdef>int <parameter>sz_rows</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section to which an overlay will be added
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>name</parameter>
    </term>
    <listitem>
      <para>
        name of the overlay
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_rows</parameter>
    </term>
    <listitem>
      <para>
        number of rows to reserve in the overlay
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAddGeomOverlay</function>
adds an overlay with the specified name to the specified
<parameter>section</parameter>.
The new overlay is created with space allocated for sz_rows rows. If an
overlay with name
<parameter>name</parameter>
already exists in the section, a pointer to the existing overlay is
returned.
<function>XkbAddGeomOverlay</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the overlay. To allocate space for an arbitrary number of overlays to a
section, use the XkbAllocGeomOverlay function.
</para>


<para>
To add a row to an existing overlay, use
<function>XkbAddGeomOverlayRow</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomOverlayRow"><primary><function>XkbAddGeomOverlayRow</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomOverlayRow">
  <funcprototype>
    <funcdef>XkbOverlayRowPtr <function>XkbAddGeomOverlayRow</function></funcdef>
<!-- (
<parameter>overlay</parameter>,
<parameter>row_under, sz_keys</parameter>
) -->

    <paramdef>XkbOverlayPtr <parameter>overlay</parameter></paramdef>
    <paramdef>XkbRowPtr <parameter>row_under</parameter></paramdef>
    <paramdef>int <parameter>sz_keys</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>overlay</parameter>
    </term>
    <listitem>
      <para>
        overlay to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>row_under</parameter>
    </term>
    <listitem>
      <para>
        row to be overlaid in the section <parameter>overlay</parameter>
         overlays
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sz_keys</parameter>
    </term>
    <listitem>
      <para>
        number of keys to reserve in the row
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAddGeomOverlayRow</function>
adds one row to the
<parameter>overlay</parameter>.
The new row contains space for
<parameter>sz_keys</parameter>
keys. If
<parameter>row_under</parameter>
specifies a row that doesn’t exist on the underlying section,
<function>XkbAddGeomOverlayRow</function>
returns
<symbol>NULL</symbol>
and doesn’t change the overlay.
<function>XkbAddGeomOverlayRow</function>
returns
<symbol>NULL</symbol>
if any of the parameters is empty or if it was not able to allocate space for
the overlay.
</para>


<para>
To add a key to an existing overlay row, use
<function>XkbAddGeomOverlayKey</function>.
</para>


<indexterm significance="preferred" zone="XkbAddGeomOverlayKey"><primary><function>XkbAddGeomOverlayKey</function></primary></indexterm>
<funcsynopsis id="XkbAddGeomOverlayKey">
  <funcprototype>
    <funcdef>XkbOverlayKeyPtr <function>XkbAddGeomOverlayKey</function></funcdef>
<!-- (
<parameter>overlay</parameter>,
<parameter>row, under</parameter>
) -->

    <paramdef>XkbOverlayPtr <parameter>overlay</parameter></paramdef>
    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
    <paramdef>char *<parameter>under</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>overlay</parameter>
    </term>
    <listitem>
      <para>
        overlay to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>row</parameter>
    </term>
    <listitem>
      <para>
        row in overlay to be updated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>under</parameter>
    </term>
    <listitem>
      <para>
        primary name of the key to be considered
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAddGeomOverlayKey</function>
adds one key to the
<parameter>row</parameter>
in the
<parameter>overlay</parameter>.
If there is no key named
<parameter>under</parameter>
in the row of the underlying section,
<function>XkbAddGeomOverlayKey</function>
returns
<symbol>NULL</symbol>.
</para>


</sect1>
<sect1 id='Allocating_and_Freeing_Geometry_Components'>
<title>Allocating and Freeing Geometry Components</title>

<para>
Xkb provides a number of functions to allocate and free subcomponents of a
keyboard geometry. Use these functions to create or modify keyboard geometries.
Note that these functions merely allocate space for the new element(s), and it
is up to you to fill in the values explicitly in your code. These allocation
functions increase
<structfield>sz_<replaceable>*</replaceable></structfield>
but never touch
<structfield>num_<replaceable>*</replaceable></structfield>
(unless there is an allocation failure, in which case they reset both
<structfield>sz_<replaceable>*</replaceable></structfield>
and
<structfield>num_<replaceable>*</replaceable></structfield>
to zero). These functions return
<symbol>Success</symbol>
if they succeed,
<errorname>BadAlloc</errorname>
if they are not able to allocate space, or
<errorname>BadValue</errorname>
if a parameter is not as expected.
</para>


<para>
To allocate space for an arbitrary number of outlines to a shape, use
XkbAllocGeomOutlines.
</para>

<indexterm significance="preferred" zone="XkbAllocGeomOutlines"><primary><function>XkbAllocGeomOutlines</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomOutlines">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomOutlines</function></funcdef>
<!-- (
<parameter>shape</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>shape</parameter>
    </term>
    <listitem>
      <para>
        shape for which outlines should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new outlines required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomOutlines</function>
allocates space for
<parameter>num_needed</parameter>
outlines in the specified
<parameter>shape</parameter>.
The outlines are not initialized.
</para>


<para>
To free geometry outlines, use
<function>XkbFreeGeomOutlines</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomOutlines"><primary><function>XkbFreeGeomOutlines</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomOutlines">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomOutlines</function></funcdef>
<!-- (
<parameter>shape</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>shape</parameter>
    </term>
    <listitem>
      <para>
        shape in which outlines should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first outline to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of outlines to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all outlines are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all outlines are freed regardless of the value of first or count. Otherwise,
count outlines are freed beginning with the one specified by first.
</para>


<para>
To allocate space for an arbitrary number of keys to a row, use
XkbAllocGeomKeys.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomKeys"><primary><function>XkbAllocGeomKeys</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomKeys">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomKeys</function></funcdef>
<!-- (
<parameter>row</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>row</parameter>
    </term>
    <listitem>
      <para>
        row to which keys should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new keys required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomKeys</function>
allocates num_needed keys and adds them to the row. No initialization of the
keys is done.
</para>


<para>
To free geometry keys, use
<function>XkbFreeGeomKeys</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomKeys"><primary><function>XkbFreeGeomKeys</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomKeys">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomKeys</function></funcdef>
<!-- (
<parameter>row</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>row</parameter>
    </term>
    <listitem>
      <para>
        row in which keys should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first key to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of keys to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all keys are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all keys are freed regardless of the value of first or count. Otherwise,
count keys are freed beginning with the one specified by first.
</para>


<para>
To allocate geometry properties, use
<function>XkbAllocGeomProps</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomProps"><primary><function>XkbAllocGeomProps</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomProps">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomProps</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry for which properties should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new properties required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomProps</function>
allocates space for num_needed properties and adds them to the specified
geometry
<parameter>geom</parameter>.
No initialization of the properties is done. A geometry property associates
an arbitrary string with an equally arbitrary name. Geometry properties can be
used to provide hints to programs that display images of keyboards, but they
are not interpreted by Xkb. No other geometry structures refer to geometry
properties.
</para>


<para>
To free geometry properties, use
<function>XkbFreeGeomProperties</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomProperties"><primary><function>XkbFreeGeomProperties</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomProperties">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomProperties</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry in which properties should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first property to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of properties to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all properties are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all properties are freed regardless of the value of first or count.
Otherwise, count properties are freed beginning with the one specified by first.
</para>


<para>
To allocate geometry key aliases, use
<function>XkbAllocGeomKeyAliases</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomKeyAliases"><primary><function>XkbAllocGeomKeyAliases</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomKeyAliases">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomKeyAliases</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry for which key aliases should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new key aliases required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomKeyAliases</function>
allocates space for num_needed key aliases and adds them to the specified
geometry
<parameter>geom</parameter>.
A key alias is a pair of strings that associates an alternate name for a key
with the real name for that key.
</para>


<para>
To free geometry key aliases, use
<function>XkbFreeGeomKeyAliases</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomKeyAliases"><primary><function>XkbFreeGeomKeyAliases</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomKeyAliases">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomKeyAliases</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry in which key aliases should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first key alias to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of key aliases to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all key aliases are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all aliases in the top level of the specified geometry
<parameter>geom</parameter>
are freed regardless of the value of first or count. Otherwise, count aliases
in
<parameter>geom</parameter>
are freed beginning with the one specified by first.
</para>


<para>
To allocate geometry colors, use
<function>XkbAllocGeomColors</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomColors"><primary><function>XkbAllocGeomColors</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomColors">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomColors</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry for which colors should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new colors required.
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomColors</function>
allocates space for num_needed colors and adds them to the specified geometry
<parameter>geom</parameter>.
A color name is a string whose interpretation is not specified by Xkb. All
other geometry data structures refer to colors using their indices in this
global list or pointers to colors in this list.
</para>


<para>
To free geometry colors, use
<function>XkbFreeGeomColors</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomColors"><primary><function>XkbFreeGeomColors</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomColors">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomColors</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry in which colors should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first color to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of colors to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all colors are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all colors are freed regardless of the value of first or count. Otherwise,
count colors are freed beginning with the one specified by first.
</para>


<para>
To allocate points in an outline, use
<function>XkbAllocGeomPoints</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomPoints"><primary><function>XkbAllocGeomPoints</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomPoints">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomPoints</function></funcdef>
<!-- (
<parameter>outline</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbOutlinePtr <parameter>outline</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>outline</parameter>
    </term>
    <listitem>
      <para>
        outline for which points should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new points required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomPoints</function>
allocates space for
<parameter>num_needed</parameter>
points in the specified
<parameter>outline</parameter>.
The points are not initialized.
</para>


<para>
To free points in a outline, use
<function>XkbFreeGeomPoints</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomPoints"><primary><function>XkbFreeGeomPoints</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomPoints">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomPoints</function></funcdef>
<!-- (
<parameter>outline</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbOutlinePtr <parameter>outline</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>outline</parameter>
    </term>
    <listitem>
      <para>
        outline in which points should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first point to be freed.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of points to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all points are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all points are freed regardless of the value of first and count. Otherwise,
the number of points specified by count are freed, beginning with the point
specified by first in the specified outline.
</para>


<para>
To allocate space for an arbitrary number of geometry shapes, use
<function>XkbAllocGeomShapes</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomShapes"><primary><function>XkbAllocGeomShapes</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomShapes">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomShapes</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry for which shapes should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new shapes required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomShapes</function>
allocates space for
<parameter>num_needed</parameter>
shapes in the specified geometry
<parameter>geom</parameter>.
The shapes are not initialized.
</para>


<para>
To free geometry shapes, use
<function>XkbFreeGeomShapes</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomShapes"><primary><function>XkbFreeGeomShapes</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomShapes">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomShapes</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry in which shapes should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first shape to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of shapes to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all shapes are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all shapes in the geometry are freed regardless of the values of first and
count. Otherwise, count shapes are freed, beginning with the shape specified by
first.
</para>


<para>
To allocate geometry sections, use
<function>XkbAllocGeomSections</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomSections"><primary><function>XkbAllocGeomSections</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomSections">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomSections</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry for which sections should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new sections required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomSections</function>
allocates num_needed sections and adds them to the geometry geom. No
initialization of the sections is done.
</para>


<para>
To free geometry sections, use
<function>XkbFreeGeomSections</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomSections"><primary><function>XkbFreeGeomSections</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomSections">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomSections</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry in which sections should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first section to be freed.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of sections to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all sections are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all sections are freed regardless of the value of first and count. Otherwise,
the number of sections specified by count are freed, beginning with the section
specified by first in the specified geometry.
</para>


<para>
To allocate rows in a section, use
<function>XkbAllocGeomRows</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomRows"><primary><function>XkbAllocGeomRows</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomRows">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomRows</function></funcdef>
<!-- (
<parameter>section</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section for which rows should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new rows required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomRows</function>
allocates num_needed rows and adds them to the section. No initialization of
the rows is done.
</para>


<para>
To free rows in a section, use
<function>XkbFreeGeomRows</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomRows"><primary><function>XkbFreeGeomRows</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomRows">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomRows</function></funcdef>
<!-- (
<parameter>section</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section in which rows should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first row to be freed.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of rows to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all rows are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all rows are freed regardless of the value of first and count. Otherwise, the
number of rows specified by count are freed, beginning with the row specified
by first in the specified section.
</para>


<para>
To allocate overlays in a section, use
<function>XkbAllocGeomOverlays</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomOverlays"><primary><function>XkbAllocGeomOverlays</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomOverlays">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomOverlays</function></funcdef>
<!-- (
<parameter>section</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section for which overlays should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new overlays required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomOverlays</function>
allocates num_needed overlays and adds them to the section. No initialization
of the overlays is done.
</para>


<para>
To free rows in an section, use
<function>XkbFreeGeomOverlays</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomOverlays"><primary><function>XkbFreeGeomOverlays</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomOverlays">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomOverlays</function></funcdef>
<!-- (
<parameter>section</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section in which overlays should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first overlay to be freed.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of overlays to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all overlays are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all overlays are freed regardless of the value of first and count. Otherwise,
the number of overlays specified by count are freed, beginning with the overlay
specified by first in the specified section.
</para>


<para>
To allocate rows in a overlay, use
<function>XkbAllocGeomOverlayRows</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomOverlayRows"><primary><function>XkbAllocGeomOverlayRows</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomOverlayRows">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomOverlayRows</function></funcdef>
<!-- (
<parameter>overlay</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbOverlayPtr <parameter>overlay</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>overlay</parameter>
    </term>
    <listitem>
      <para>
        overlay for which rows should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new rows required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomOverlayRows</function>
allocates num_needed rows and adds them to the overlay. No initialization of
the rows is done.
</para>


<para>
To free rows in an overlay, use
<function>XkbFreeGeomOverlayRows</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomOverlayRows"><primary><function>XkbFreeGeomOverlayRows</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomOverlayRows">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomOverlayRows</function></funcdef>
<!-- (
<parameter>overlay</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>overlay</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>overlay</parameter>
    </term>
    <listitem>
      <para>
        section in which rows should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first row to be freed.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of rows to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all rows are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all rows are freed regardless of the value of first and count. Otherwise, the
number of rows specified by count are freed, beginning with the row specified
by first in the specified overlay.
</para>


<para>
To allocate keys in an overlay row, use
<function>XkbAllocGeomOverlayKeys</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomOverlayKeys"><primary><function>XkbAllocGeomOverlayKeys</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomOverlayKeys">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomOverlayKeys</function></funcdef>
<!-- (
<parameter>row</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbOverlayRowPtr <parameter>row</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>row</parameter>
    </term>
    <listitem>
      <para>
        row for which keys should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new rows required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomOverlayKeys</function>
allocates num_needed keys and adds them to the row. No initialization of the
keys is done.
</para>


<para>
To free keys in an overlay row, use
<function>XkbFreeGeomOverlayKeys</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomOverlayKeys"><primary><function>XkbFreeGeomOverlayKeys</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomOverlayKeys">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomOverlayKeys</function></funcdef>
<!-- (
<parameter>row</parameter>,
<parameter>first</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbOverlayRowPtr <parameter>row</parameter></paramdef>
    <paramdef>int <parameter>first</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>row</parameter>
    </term>
    <listitem>
      <para>
        row in which keys should be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>first</parameter>
    </term>
    <listitem>
      <para>
        first key to be freed.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of keys to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all keys are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If free_all is
<symbol>True</symbol>,
all keys are freed regardless of the value of first and count. Otherwise, the
number of keys specified by count are freed, beginning with the key specified
by first in the specified row.
</para>


<para>
To allocate doodads that are global to a keyboard geometry, use
<function>XkbAllocGeomDoodads</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomDoodads"><primary><function>XkbAllocGeomDoodads</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomDoodads">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomDoodads</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry for which doodads should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new doodads required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomDoodads</function>
allocates num_needed doodads and adds them to the specified geometry
<parameter>geom</parameter>.
No initialization of the doodads is done.
</para>


<para>
To allocate doodads that are specific to a section, use
<function>XkbAllocGeomSectionDoodads</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeomSectionDoodads"><primary><function>XkbAllocGeomSectionDoodads</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeomSectionDoodads">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeomSectionDoodads</function></funcdef>
<!-- (
<parameter>section</parameter>,
<parameter>num_needed</parameter>
) -->

    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
    <paramdef>int <parameter>num_needed</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>section</parameter>
    </term>
    <listitem>
      <para>
        section for which doodads should be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>num_needed</parameter>
    </term>
    <listitem>
      <para>
        number of new doodads required
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeomSectionDoodads</function>
allocates num_needed doodads and adds them to the specified
<parameter>section</parameter>.
No initialization of the doodads is done.
</para>


<para>
To free geometry doodads, use
<function>XkbFreeGeomDoodads</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeomDoodads"><primary><function>XkbFreeGeomDoodads</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeomDoodads">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeomDoodads</function></funcdef>
<!-- (
<parameter>doodads</parameter>,
<parameter>count</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbDoodadPtr <parameter>doodads</parameter></paramdef>
    <paramdef>int <parameter>count</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>doodads</parameter>
    </term>
    <listitem>
      <para>
        doodads to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>count</parameter>
    </term>
    <listitem>
      <para>
        number of doodads to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; all doodads are freed
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
If
<parameter>free_all</parameter>
is
<symbol>True</symbol>,
all doodads in the array are freed, regardless of the value of count.
Otherwise, count doodads are freed.
</para>


<para>
To allocate an entire geometry, use
<function>XkbAllocGeometry</function>.
</para>


<indexterm significance="preferred" zone="XkbAllocGeometry"><primary><function>XkbAllocGeometry</function></primary></indexterm>
<funcsynopsis id="XkbAllocGeometry">
  <funcprototype>
    <funcdef>Status <function>XkbAllocGeometry</function></funcdef>
<!-- (
<parameter>xkb</parameter>,
<parameter>sizes</parameter>
) -->

    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
    <paramdef>XkbGeometrySizesPtr <parameter>sizes</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>xkb</parameter>
    </term>
    <listitem>
      <para>
        keyboard description for which geometry is to be allocated
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>sizes</parameter>
    </term>
    <listitem>
      <para>
        initial sizes for all geometry components
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
<function>XkbAllocGeometry</function>
allocates a keyboard geometry and adds it to the keyboard description
specified by xkb. The keyboard description should be obtained via the
XkbGetKeyboard or XkbAllockeyboard functions. The sizes parameter specifies the
number of elements to be reserved for the subcomponents of the keyboard
geometry and can be zero or more. These subcomponents include the properties,
colors, shapes, sections, and doodads.
</para>


<para>
To free an entire geometry, use
<function>XkbFreeGeometry</function>.
</para>


<indexterm significance="preferred" zone="XkbFreeGeometry"><primary><function>XkbFreeGeometry</function></primary></indexterm>
<funcsynopsis id="XkbFreeGeometry">
  <funcprototype>
    <funcdef>void <function>XkbFreeGeometry</function></funcdef>
<!-- (
<parameter>geom</parameter>,
<parameter>which</parameter>,
<parameter>free_all</parameter>
) -->

    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
    <paramdef>unsigned int <parameter>which</parameter></paramdef>
    <paramdef>Bool <parameter>free_all</parameter></paramdef>
  </funcprototype>
</funcsynopsis>
<variablelist>
  <varlistentry>
    <term>
      <parameter>geom</parameter>
    </term>
    <listitem>
      <para>
        geometry to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>which</parameter>
    </term>
    <listitem>
      <para>
        mask of geometry components to be freed
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <parameter>free_all</parameter>
    </term>
    <listitem>
      <para>
        <symbol>True</symbol> &rArr; the entire geometry is freed.
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
The values of which and free_all determine how much of the specified geometry
is freed. The valid values for which are:

<programlisting>
#define      XkbGeomPropertiesMask  (1&lt;&lt;0)
#define      XkbGeomColorsMask      (1&lt;&lt;1)
#define      XkbGeomShapesMask      (1&lt;&lt;2)
#define      XkbGeomSectionsMask    (1&lt;&lt;3)
#define      XkbGeomDoodadsMask     (1&lt;&lt;4)
#define      XkbGeomAllMask         (0x1f)
</programlisting></para>

<para>
If free_all is
<symbol>True</symbol>,
the entire geometry is freed regardless of the value of which. Otherwise, the
portions of the geometry specified by which are freed.
</para>

</sect1>
</chapter>