1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
|
<chapter id='Xkb_Server_Keyboard_Mapping'>
<title>Xkb Server Keyboard Mapping</title>
<para>
The <emphasis>
server</emphasis>
field of the complete Xkb keyboard description (see section 6.1) is a pointer
to the Xkb server map.
</para>
<para>
Figure 16.1 shows the relationships between elements in the server map:
</para>
<mediaobject>
<imageobject> <imagedata format="SVG" fileref="XKBlib-16.svg"/>
</imageobject>
<caption>Server Map Relationships</caption>
</mediaobject>
<!--
<H5 CLASS="Figure">
Server Map Relationships</H5>
-->
<para>
The Xkb server map contains the information the server needs to interpret key
events and is of type <emphasis>
XkbServerMapRec</emphasis>
:
</para>
<para><programlisting>
#define XkbNumVirtualMods 16
</programlisting></para>
<para><programlisting>
typedef struct { /* Server Map */
unsigned short num_acts; /* # of occupied entries in <emphasis> acts</emphasis> */
unsigned short size_acts; /* # of entries in <emphasis> acts</emphasis> */
XkbAction * acts; /* linear 2d tables of key actions, 1 per keycode */
XkbBehavior * behaviors; /* key behaviors,1 per keycode */
unsigned short * key_acts; /* index into <emphasis> acts</emphasis> , 1 per keycode */
unsigned char * explicit; /* explicit overrides of core remapping, 1 per key */
unsigned char vmods[XkbNumVirtualMods]; /* real mods bound to virtual mods */
unsigned short * vmodmap; /* virtual mods bound to key, 1 per keycode*/
} <emphasis>XkbServerMapRec</emphasis>, *XkbServerMapPtr;
</programlisting></para>
<para>
The <emphasis>
num_acts</emphasis>
, <emphasis>
size_acts</emphasis>
, <emphasis>
acts</emphasis>
, and <emphasis>
key_acts</emphasis>
fields specify the key actions, defined in section 16.1. The <emphasis>
behaviors</emphasis>
field describes the behavior for each key and is defined in section 16.2. The
<emphasis>
explicit</emphasis>
field describes the explicit components for a key and is defined in section
16.3. The <emphasis>
vmods</emphasis>
and the <emphasis>
vmodmap</emphasis>
fields describe the virtual modifiers and the per-key virtual modifier mapping
and are defined in section 16.4.
</para>
<sect1 id='Key_Actions'>
<title>Key Actions</title>
<para>
A key action defines the effect key presses and releases have on the internal
state of the server. For example, the expected key action associated with
pressing the <emphasis>
Shift</emphasis>
key is to set the <emphasis>
Shift</emphasis>
modifier. There is zero or one key action associated with each keysym bound to
each key.
</para>
<para>
Just as the entire list of key symbols for the keyboard mapping is held in the
<emphasis>
syms</emphasis>
field of the client map, the entire list of key actions for the keyboard
mapping is held in the <emphasis>
acts</emphasis>
array of the server map. The total size of <emphasis>
acts</emphasis>
is specified by <emphasis>
size_acts</emphasis>
, and the number of entries is specified by <emphasis>
num_acts</emphasis>.
</para>
<para>
The <emphasis>
key_acts</emphasis>
array, indexed by keycode, describes the actions associated with a key. The
<emphasis>
key_acts</emphasis>
array has <emphasis>
min_key_code</emphasis>
unused entries at the start to allow direct indexing using a keycode. If a
<emphasis>
key_acts</emphasis>
entry is <emphasis>
zero</emphasis>
, it means the key does not have any actions associated with it. If an entry is
not <emphasis>
zero</emphasis>
, the entry represents an index into the <emphasis>
acts</emphasis>
field of the server map, much as the <emphasis>
offset</emphasis>
field of a <emphasis>
KeySymMapRec</emphasis>
structure is an index into the <emphasis>
syms</emphasis>
field of the client map.
</para>
<para>
The reason the <emphasis>
acts</emphasis>
field is a linear list of <emphasis>
XkbAction</emphasis>
s is to reduce the memory consumption associated with a keymap. Because Xkb
allows individual keys to have multiple shift levels and a different number of
groups per key, a single two-dimensional array of <emphasis>
KeySyms</emphasis>
would potentially be very large and sparse. Instead, Xkb provides a small
two-dimensional array of <emphasis>
XkbAction</emphasis>
s for each key. To store all of these individual arrays, Xkb concatenates each
array together in the <emphasis>
acts</emphasis>
field of the server map.
</para>
<para>
The key action structures consist only of fields of type char or unsigned char.
This is done to optimize data transfer when the server sends bytes over the
wire. If the fields are anything but bytes, the server has to sift through all
of the actions and swap any nonbyte fields. Because they consist of nothing but
bytes, it can just copy them out.
</para>
<para>
Xkb provides the following macros, to simplify accessing information pertaining
to key actions:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Bool <emphasis>
XkbKeyHasActions</emphasis>
(<emphasis>
xkb, keycode</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
KeyCode <emphasis>
keycode</emphasis>
; /* keycode of interest */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbKeyHasActions</emphasis>
returns <emphasis>
True</emphasis>
if the key corresponding to <emphasis>
keycode</emphasis>
has any actions associated with it; otherwise, it returns <emphasis>
False</emphasis>
.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
int <emphasis>
XkbKeyNumActions</emphasis>
(<emphasis>
xkb, keycode</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
KeyCode <emphasis>
keycode</emphasis>
; /* keycode of interest */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbKeyNumActions</emphasis>
computes the number of actions associated with the key corresponding to
<emphasis>
keycode</emphasis>
. This should be the same value as the result of <emphasis>
XkbKeyNumSyms</emphasis>
(see section 15.3.3).
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
XkbKeyActionPtr <emphasis>
XkbKeyActionsPtr</emphasis>
(<emphasis>
xkb, keycode</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
KeyCode <emphasis>
keycode</emphasis>
; /* keycode of interest */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbKeyActionsPtr</emphasis>
returns a pointer to the two-dimensional array of key actions associated with
the key corresponding to <emphasis>
keycode</emphasis>
. Use<emphasis>
XkbKeyActionsPtr</emphasis>
only if the key actually has some actions associated with it, that is,
<emphasis>
XkbKeyNumActions</emphasis>
(xkb, keycode) returns something greater than zero.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
XkbAction <emphasis>
XkbKeyAction</emphasis>
(<emphasis>
xkb, keycode, idx</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
KeyCode <emphasis>
keycode</emphasis>
; /* keycode of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
idx</emphasis>
; /* index for group and shift level */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbKeyAction</emphasis>
returns the key action indexed by <emphasis>
idx</emphasis>
in the two-dimensional array of key actions associated with the key
corresponding to <emphasis>
keycode</emphasis>
. <emphasis>
idx</emphasis>
may be computed from the group and shift level of interest as follows:
</para>
<literallayout>
idx = group_index * key_width + shift_level
</literallayout>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
XkbAction <emphasis>
XkbKeyActionEntry</emphasis>
(<emphasis>
xkb, keycode, shift, grp</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
KeyCode <emphasis>
keycode</emphasis>
; /* keycode of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
shift</emphasis>
; /* shift level within group */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
grp</emphasis>
; /* group index for group of interest */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbKeyActionEntry</emphasis>
returns the key action corresponding to group <emphasis>
grp</emphasis>
and shift level <emphasis>
lvl</emphasis>
from the two-dimensional table of key actions associated with the key
corresponding to <emphasis>
keycode</emphasis>
.
</para>
<sect2 id='The_XkbAction_Structure'>
<title>The XkbAction Structure</title>
<para>
The description for an action is held in an <emphasis>
XkbAction</emphasis>
structure, which is a union of all possible Xkb action types:
</para>
<para><programlisting>
typedef union _XkbAction {
XkbAnyAction any;
XkbModAction mods;
XkbGroupAction group;
XkbISOAction iso;
XkbPtrAction ptr;
XkbPtrBtnAction btn;
XkbPtrDfltAction dflt;
XkbSwitchScreenAction screen;
XkbCtrlsAction ctrls;
XkbMessageAction msg;
XkbRedirectKeyAction redirect;
XkbDeviceBtnAction devbtn;
XkbDeviceValuatorAction devval;
unsigned char type;
} <emphasis>XkbAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field is provided for convenience and is the same as the type field in the
individual structures. The following sections describe the individual
structures for each action in detail.
</para>
</sect2>
<sect2 id='The_XkbAnyAction_Structure'>
<title>The XkbAnyAction Structure</title>
<para>
The <emphasis>
XkbAnyAction</emphasis>
structure is a convenience structure that refers to any of the actions:
</para>
<para><programlisting>
#define XkbAnyActionDataSize 7
</programlisting></para>
<para><programlisting>
typedef struct _XkbAnyAction {
unsigned char type; /* type of action; determines interpretation for data */
unsigned char data[XkbAnyActionDataSize];
} <emphasis>XkbAnyAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
data</emphasis>
field represents a structure for an action, and its interpretation depends on
the <emphasis>
type</emphasis>
field. The valid values for the <emphasis>
type</emphasis>
field, and the data structures associated with them are shown in Table 16.1:
</para>
<table frame='topbot'>
<title>Action Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='4' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.8*'/>
<colspec colname='c2' colwidth='2.0*'/>
<colspec colname='c3' colwidth='1.5*'/>
<colspec colname='c4' colwidth='1.0*'/>
<thead>
<row rowsep='1'>
<entry>Type</entry>
<entry>Structure for Data</entry>
<entry>XkbAction Union Member</entry>
<entry>Section</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_NoAction</emphasis></entry>
<entry>
<emphasis>XkbSA_NoAction</emphasis>
means the server does not perform an action for the key; this action does not
have an associated data structure.
</entry>
<entry>any</entry>
<entry></entry>
</row>
<row>
<entry>
<para><emphasis>XkbSA_SetMods</emphasis></para>
<para><emphasis>XkbSA_LatchMods</emphasis></para>
<para><emphasis>XkbSA_LockMods</emphasis></para>
</entry>
<entry><para><emphasis>XkbModAction</emphasis></para></entry>
<entry>mods</entry>
<entry>16.1.3</entry>
</row>
<row>
<entry>
<para><emphasis>XkbSA_SetGroup</emphasis></para>
<para><emphasis>XkbSA_LatchGroup</emphasis></para>
<para><emphasis>XkbSA_LockGroup</emphasis></para>
</entry>
<entry><emphasis>XkbGroupAction</emphasis></entry>
<entry>group</entry>
<entry>16.1.4</entry>
</row>
<row>
<entry><emphasis>XkbSA_MovePtr</emphasis></entry>
<entry><emphasis>XkbPtrAction</emphasis></entry>
<entry>ptr</entry>
<entry>16.1.5</entry>
</row>
<row>
<entry>
<para><emphasis>XKbSA_PtrBtn</emphasis></para>
<para><emphasis>XkbSA_LockPtrBtn</emphasis></para>
</entry>
<entry><emphasis>XkbPtrBtnAction</emphasis></entry><entry>btn</entry>
<entry>16.1.6</entry>
</row>
<row>
<entry><emphasis>XkbSA_SetPtrDflt</emphasis></entry>
<entry><emphasis>XkbPtrDfltAction</emphasis></entry>
<entry>dflt</entry>
<entry>16.1.7</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISOLock</emphasis></entry>
<entry><emphasis>XkbISOAction</emphasis></entry>
<entry>iso</entry>
<entry>16.1.8</entry>
</row>
<row>
<entry><emphasis>XkbSA_SwitchScreen</emphasis></entry>
<entry><emphasis>XkbSwitchScreenAction</emphasis></entry>
<entry>screen</entry>
<entry>16.1.9</entry>
</row>
<row>
<entry>
<para><emphasis>XkbSA_SetControls</emphasis></para>
<para><emphasis>XkbSA_LockControls</emphasis></para>
</entry>
<entry><emphasis>XkbCtrlsAction</emphasis></entry>
<entry>ctrls</entry>
<entry>16.1.10</entry>
</row>
<row>
<entry><emphasis>XkbSA_ActionMessage</emphasis></entry>
<entry><emphasis>XkbMessgeAction</emphasis></entry>
<entry>msg</entry>
<entry>16.1.11</entry>
</row>
<row>
<entry><emphasis>XkbSA_RedirectKey</emphasis></entry>
<entry><emphasis>XkbRedirectKeyAction</emphasis></entry>
<entry>redirect</entry>
<entry>16.1.12</entry>
</row>
<row>
<entry>
<para><emphasis>XkbSA_DeviceBtn</emphasis></para>
<para><emphasis>XKbSA_LockDeviceBtn</emphasis></para>
</entry>
<entry><emphasis>XkbDeviceBtnAction</emphasis></entry>
<entry>devbtn</entry>
<entry>16.1.13</entry>
</row>
<row>
<entry><emphasis>XkbSA_DeviceValuator</emphasis></entry>
<entry><emphasis>XkbDeviceValuatorAction</emphasis></entry>
<entry>devval</entry>
<entry>16.1.14</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id='Actions_for_Changing_Modifiers_State'>
<title>Actions for Changing Modifiers’ State</title>
<para>
Actions associated with the <emphasis>
XkbModAction</emphasis>
structure change the state of the modifiers when keys are pressed and released
(see Chapter 7 for a discussion of modifiers):
</para>
<para><programlisting>
typedef struct _XkbModAction {
unsigned char type; /* <emphasis> XkbSA_{Set|Latch|Lock}Mods</emphasis> */
unsigned char flags; /* with <emphasis> type</emphasis> , controls the effect on modifiers */
unsigned char mask; /* same as <emphasis> mask</emphasis> field of a modifier description */
unsigned char real_mods; /* same as <emphasis> real_mods</emphasis> field of a modifier description */
unsigned char vmods1; /* derived from <emphasis> vmods</emphasis> field of a modifier description */
unsigned char vmods2; /* derived from <emphasis> vmods</emphasis> field of a modifier description */
} <emphasis>XkbModAction</emphasis>;
</programlisting></para>
<para>
In the following description, the term <emphasis>
action modifiers</emphasis>
means the real modifier bits associated with this action. Depending on the
value of <emphasis>
flags</emphasis>
(see Table 16.3), these are designated either in the <emphasis>
mask</emphasis>
field of the <emphasis>
XkbModAction</emphasis>
structure itself or the real modifiers bound to the key for which the action
is being used. In the latter case, this is the client <emphasis>
map</emphasis>
-><emphasis>
modmap</emphasis>
[<emphasis>
keycode</emphasis>
] field.
</para>
<para>
The <emphasis>
type</emphasis>
field can have any of the values shown in Table 16.2.
</para>
<table frame='topbot'>
<title>Modifier Action Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Type</entry>
<entry>Effect</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_SetMods</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
A key press adds any action modifiers to the keyboard’s base modifiers.
</para>
</listitem>
<listitem>
<para>
A key release clears any action modifiers in the keyboard’s base modifiers,
provided no other key affecting the same modifiers is logically down.
</para>
</listitem>
<listitem>
<para>
If no other keys are physically depressed when this key is released, and
<emphasis>
XkbSA_ClearLocks</emphasis>
is set in the <emphasis>
flags</emphasis>
field, the key release unlocks any action modifiers.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LatchMods</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
Key press and key release events have the same effect as for <emphasis>
XkbSA_SetMods</emphasis>
; if no keys are physically depressed when this key is released, key release
events have the following additional effects:
</para>
</listitem>
<listitem>
<para>
Modifiers unlocked due to <emphasis>
XkbSA_ClearLocks</emphasis>
have no further effect.
</para>
</listitem>
<listitem>
<para>
If <emphasis>
XkbSA_LatchToLock</emphasis>
is set in the <emphasis>
flags</emphasis>
field, a key release locks and then unlatches any remaining action modifiers
that are already latched.
</para>
</listitem>
<listitem>
<para>
A key release latches any action modifiers not used by the <emphasis>
XkbSA_ClearLocks</emphasis>
and <emphasis>
XkbSA_LatchToLock</emphasis>
flags.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockMods</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
A key press sets the base state of any action modifiers. If <emphasis>
XkbSA_LockNoLock</emphasis>
is set in the <emphasis>
flags</emphasis>
field, a key press also sets the locked state of any action modifiers.
</para>
</listitem>
<listitem>
<para>
A key release clears any action modifiers in the keyboard’s base modifiers,
provided no other key that affects the same modifiers is down. If <emphasis>
XkbSA_LockNoUnlock</emphasis>
is not set in the <emphasis>
flags</emphasis>
field, and any of the action modifiers were locked before the corresponding
key press occurred, a key release unlocks them.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the masks shown in Table
16.3. A general meaning is given in the table, but the exact meaning depends on
the action <emphasis>type</emphasis>.
</para>
<table frame='topbot'>
<title>Modifier Action Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_UseModMapMods</emphasis></entry>
<entry>
If set, the action modifiers are determined by the modifiers bound by the
modifier mapping of the key. Otherwise, the action modifiers are set to the
modifiers specified by the <emphasis>
mask</emphasis>
, <emphasis>
real_mods</emphasis>
, <emphasis>
vmod1</emphasis>
, and <emphasis>
vmod2</emphasis>
fields.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ClearLocks</emphasis></entry>
<entry>
If set and no keys are physically depressed when this key transition
occurs, the server unlocks any action modifiers.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LatchToLock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LatchMods</emphasis>
, the server locks the action modifiers if they are already latched.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoLock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LockMods</emphasis>
, the server only unlocks the action modifiers.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoUnlock</emphasis></entry>
<entry>
If set, and the action is <emphasis>
XkbSA_LockMods</emphasis>
, the server only locks the action modifiers.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
If <emphasis>
XkbSA_UseModMapMods</emphasis>
is not set in the <emphasis>
flags</emphasis>
field, the <emphasis>
mask</emphasis>
, <emphasis>
real_mods</emphasis>
, <emphasis>
vmods1</emphasis>
, and <emphasis>
vmods2 </emphasis>
fields are used to determine the action modifiers. Otherwise they are ignored
and the modifiers bound to the key (client <emphasis>
map</emphasis>
-><emphasis>
modmap</emphasis>
[<emphasis>
keycode</emphasis>
]) are used instead.
</para>
<para>
The <emphasis>
mask</emphasis>
, <emphasis>
real_mods</emphasis>
, <emphasis>
vmods1</emphasis>
, and <emphasis>
vmods2</emphasis>
fields represent the components of an Xkb modifier description (see section
7.2). While the <emphasis>
mask</emphasis>
and <emphasis>
real_mods</emphasis>
fields correspond directly to the <emphasis>
mask</emphasis>
and <emphasis>
real_mods</emphasis>
fields of an Xkb modifier description, the <emphasis>
vmods1</emphasis>
and <emphasis>
vmods2</emphasis>
fields are combined to correspond to the <emphasis>
vmods</emphasis>
field of an Xkb modifier description. Xkb provides the following macros, to
convert between the two formats:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
unsigned short <emphasis>
XkbModActionVMods</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbAction <emphasis>
act</emphasis>
; /* action from which to extract virtual mods */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbModActionVMods</emphasis>
returns the <emphasis>
vmods1</emphasis>
and <emphasis>
vmods2</emphasis>
fields of <emphasis>
act</emphasis>
converted to the <emphasis>
vmods</emphasis>
format of an Xkb modifier description.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSetModActionVMods</emphasis>
(<emphasis>
act, vmods</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbAction <emphasis>
act</emphasis>
; /* action in which to set vmods */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned short <emphasis>
vmods</emphasis>
; /* virtual mods to set */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetModActionVMods</emphasis>
sets the <emphasis>
vmods1</emphasis>
and <emphasis>
vmods2</emphasis>
fields of <emphasis>
act</emphasis>
using the <emphasis>
vmods</emphasis>
format of an Xkb modifier description.
</para>
<note><para>Despite the fact that the first parameter of these two macros is of
type XkbAction, these macros may be used only with Actions of type <emphasis>
XkbModAction</emphasis>
and <emphasis>
XkbISOAction</emphasis>
.</para></note>
</sect2>
<sect2 id='Actions_for_Changing_Group_State'>
<title>Actions for Changing Group State</title>
<para>
Actions associated with the <emphasis>
XkbGroupAction</emphasis>
structure change the current group state when keys are pressed and released
(see Chapter 5 for a description of groups and keyboard state):
</para>
<para><programlisting>
typedef struct _XkbGroupAction {
unsigned char type; /* <emphasis> XkbSA_{Set|Latch|Lock}Group</emphasis> */
unsigned char flags; /* with <emphasis> type</emphasis> , controls the effect on groups */
char group_XXX; /* represents a group index or delta */
} <emphasis>XkbGroupAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field can have any of the following values:
</para>
<table frame='topbot'>
<title>Group Action Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Type</entry>
<entry>Effect</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_SetGroup</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
If the <emphasis>
XkbSA_GroupAbsolute</emphasis>
bit is set in the <emphasis>
flags</emphasis>
field, key press events change the base keyboard group to the group specified
by the <emphasis>
group_XXX</emphasis>
field. Otherwise, key press events change the base keyboard group by adding
the <emphasis>
group_XXX</emphasis>
field to the base keyboard group. In either case, the resulting effective
keyboard group is brought back into range depending on the value of the
<emphasis>
groups_wrap</emphasis>
field of the controls structure (see section 10.7.1).
</para>
</listitem>
<listitem>
<para>
If a key with an <emphasis>
XkbSA_ISOLock</emphasis>
action (see section 16.1.8) is pressed while this key is down, the key release
of this key has no effect. Otherwise, the key release cancels the effects of
the key press.
</para>
</listitem>
<listitem>
<para>
If the <emphasis>
XkbSA_ClearLocks</emphasis>
bit is set in the flags field, and no keys are physically depressed when this
key is released, the key release also sets the locked keyboard group to
<emphasis>
Group1</emphasis>
.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LatchGroup</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
Key press and key release events have the same effect as for <emphasis>
XkbSA_SetGroup</emphasis>
; if no keys are physically depressed when this key is released, key release
events have the following additional effects.
</para>
</listitem>
<listitem>
<para>
If the <emphasis>
XkbSA_LatchToLock</emphasis>
bit is set in the <emphasis>
flags</emphasis>
field and the latched keyboard group index is nonzero, the key release adds
the delta applied by the corresponding key press to the locked keyboard group
and subtracts it from the latched keyboard group. The locked and effective
keyboard group are brought back into range according to the value of the
<emphasis>
groups_wrap</emphasis>
field of the controls structure.
</para>
</listitem>
<listitem>
<para>
Otherwise, the key press adds the key press delta to the latched keyboard group.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockGroup</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
If the <emphasis>
XkbSA_GroupAbsolute</emphasis>
is set in the <emphasis>
flags</emphasis>
field, key press events set the locked keyboard group to the group specified
by the <emphasis>
group_XXX</emphasis>
field. Otherwise, key press events add the group specified by the <emphasis>
group_XXX</emphasis>
field to the locked keyboard group. In either case, the resulting locked and
effective keyboard groups are brought back into range depending on the value of
the <emphasis>
groups_wrap</emphasis>
field of the controls structure.
</para>
</listitem>
<listitem>
<para>
A key release has no effect.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the masks shown in Table
16.5. A general meaning is given in the table, but the exact meaning depends on
the action <emphasis>
type</emphasis>
.
</para>
<table frame='topbot'>
<title>Group Action Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_ClearLocks</emphasis></entry>
<entry>
If set and no keys are physically depressed when this key transition occurs,
the server sets the locked keyboard group to <emphasis>
Group1</emphasis>
on a key release.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LatchToLock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
SA_LatchGroup</emphasis>
, the server locks the action group if it is already latched.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_GroupAbsolute</emphasis></entry>
<entry>
If set, the <emphasis>
group_XXX</emphasis>
field represents an absolute group number. Otherwise, it represents a group
delta to be added to the current group to determine the new group number.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
group_XXX</emphasis>
field represents a signed character. Xkb provides the following macros to
convert between a signed integer value and a signed character:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
int <emphasis>
XkbSAGroup</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbAction <emphasis>
act</emphasis>
; /* action from which to extract group */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSAGroup</emphasis>
returns the <emphasis>
group_XXX</emphasis>
field of <emphasis>
act</emphasis>
converted to a signed int.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSASetGroup</emphasis>
(<emphasis>
act, grp</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbAction <emphasis>
act</emphasis>
; /* action from which to set group */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
grp</emphasis>
; /* group index to set in <emphasis>
group_XXX</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSASetGroup</emphasis>
sets the <emphasis>
group_XXX</emphasis>
field of <emphasis>
act</emphasis>
from the group index <emphasis>
grp</emphasis>
.
</para>
<note><para>Despite the fact that the first parameter of these two macros is of
type XkbAction, these macros may only be used with Actions of type <emphasis>
XkbGroupAction</emphasis>
and <emphasis>
XkbISOAction</emphasis>
.</para></note>
</sect2>
<sect2 id='Actions_for_Moving_the_Pointer'>
<title>Actions for Moving the Pointer</title>
<para>
Actions associated with the <emphasis>
XkbPtrAction</emphasis>
structure move the pointer when keys are pressed and released:
</para>
<para><programlisting>
typedef struct _XkbPtrAction {
unsigned char type; /* <emphasis> XkbSA_MovePtr</emphasis> */
unsigned char flags; /* determines type of pointer motion */
unsigned char high_XXX; /* x coordinate, high bits*/
unsigned char low_XXX; /* y coordinate, low bits */
unsigned char high_YYY; /* x coordinate, high bits */
unsigned char low_YYY; /* y coordinate, low bits */
} <emphasis>XkbPtrAction</emphasis>;
</programlisting></para>
<para>
If the <emphasis>
MouseKeys</emphasis>
control is not enabled (see section 10.5.1), <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events are treated as though the action is <emphasis>
XkbSA_NoAction</emphasis>.
</para>
<para>
If the <emphasis>
MouseKeys</emphasis>
control is enabled, a server action of type <emphasis>
XkbSA_MovePtr</emphasis>
instructs the server to generate core pointer <emphasis>
MotionNotify</emphasis>
events rather than the usual <emphasis>
KeyPress</emphasis>
event, and the corresponding <emphasis>
KeyRelease</emphasis>
event disables any mouse keys timers that were created as a result of handling
the <emphasis>
XkbSA_MovePtr</emphasis>
action.
</para>
<para>
The <emphasis>
type</emphasis>
field of the <emphasis>
XkbPtrAction</emphasis>
structure is always <emphasis>
XkbSA_MovePtr</emphasis>
.
</para>
<para>
The <emphasis>
flags</emphasis>
field is a bitwise inclusive OR of the masks shown in Table 16.6.
</para>
<table frame='topbot'>
<title>Pointer Action Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Action Type</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_NoAcceleration</emphasis></entry>
<entry>
If not set, and the <emphasis>
MouseKeysAccel</emphasis>
control is enabled (see section 10.5.2), the <emphasis>
KeyPress</emphasis>
initiates a mouse keys timer for this key; every time the timer expires, the
cursor moves.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_MoveAbsoluteX</emphasis></entry>
<entry>If set, the X portion of the structure specifies the new pointer X
coordinate. Otherwise, the X portion is added to the current pointer X
coordinate to determine the new pointer X coordinate.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_MoveAbsoluteY</emphasis></entry>
<entry>
If set, the Y portion of the structure specifies the new
pointer Y coordinate. Otherwise, the Y portion is added
to the current pointer Y coordinate to determine the new pointer Y coordinate.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Each of the X and Y coordinantes of the <emphasis>
XkbPtrAction</emphasis>
structure is composed of two signed 16-bit values, that is, the X coordinate
is composed of <emphasis>
high_XXX</emphasis>
and <emphasis>
low_XXX</emphasis>
, and similarly for the Y coordinate. Xkb provides the following macros, to
convert between a signed integer and two signed 16-bit values in <emphasis>
XkbPtrAction</emphasis>
structures:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
int <emphasis>
XkbPtrActionX</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbPtrAction <emphasis>
act</emphasis>
; /* action from which to extract X */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbPtrActionX</emphasis>
returns the <emphasis>
high_XXX</emphasis>
and <emphasis>
low_XXX</emphasis>
fields of <emphasis>
act</emphasis>
converted to a signed int.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
int <emphasis>
XkbPtrActionY</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbPtrAction <emphasis>
act</emphasis>
; /* action from which to extract Y */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbPtrActionY</emphasis>
returns the <emphasis>
high_YYY</emphasis>
and <emphasis>
low_YYY</emphasis>
fields of <emphasis>
act</emphasis>
converted to a signed int.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSetPtrActionX</emphasis>
(<emphasis>
act</emphasis>
, <emphasis>
x</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbPtrAction <emphasis>
act</emphasis>
; /* action in which to set X */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
x; </emphasis>
/* new value to set */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetPtrActionX</emphasis>
sets the <emphasis>
high_XXX</emphasis>
and <emphasis>
low_XXX</emphasis>
fields of <emphasis>
act</emphasis>
from the signed integer value <emphasis>
x</emphasis>
.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSetPtrActionY</emphasis>
(<emphasis>
act, y</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbPtrAction <emphasis>
act</emphasis>
; /* action in which to set Y */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
y</emphasis>
; /* new value to set */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetPtrActionX</emphasis>
sets the <emphasis>
high_YYY</emphasis>
and <emphasis>
low_YYY</emphasis>
fields of <emphasis>
act</emphasis>
from the signed integer value <emphasis>
y</emphasis>
.
</para>
</sect2>
<sect2 id='Actions_for_Simulating_Pointer_Button_Press_and_Release'>
<title>Actions for Simulating Pointer Button Press and Release</title>
<para>
Actions associated with the <emphasis>
XkbPtrBtnAction</emphasis>
structure simulate the press and release of pointer buttons when keys are
pressed and released:
</para>
<para><programlisting>
typedef struct _XkbPtrBtnAction {
unsigned char type; /*<emphasis> XkbSA_PtrBtn, XkbSA_LockPtrBtn</emphasis> */
unsigned char flags; /* with <emphasis> type</emphasis> , controls the effect on pointer buttons*/
unsigned char count; /* controls number of ButtonPress and ButtonRelease events */
unsigned char button; /* pointer button to simulate */
} <emphasis>XkbPtrBtnAction</emphasis>;
</programlisting></para>
<para>
If the <emphasis>
MouseKeys</emphasis>
(see section 10.5.1) control is not enabled, <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events are treated as though the action is <emphasis>
XkbSA_NoAction</emphasis>
.
</para>
<para>
The <emphasis>
type</emphasis>
field can have any one of the values shown in Table 16.7.
</para>
<table frame='topbot'>
<title>Pointer Button Action Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Type</entry>
<entry>Effect</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_PtrBtn</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
If<emphasis>
XkbSA_UseDfltButton</emphasis>
is set in the <emphasis>
flags</emphasis>
field, the event is generated for the pointer button specified by the
<emphasis>
mk_dflt_btn</emphasis>
attribute of the <emphasis>
MouseKeys</emphasis>
control (see section 10.5.1). Otherwise, the event is generated for the button
specified by the <emphasis>
button</emphasis>
field.
</para>
</listitem>
<listitem>
<para>
If the mouse button specified for this action is logically down, the key press
and corresponding key release are ignored and have no effect. Otherwise, a key
press causes one or more core pointer button events instead of the usual
<emphasis>
KeyPress</emphasis>
event. If <emphasis>
count</emphasis>
is <emphasis>
zero</emphasis>
, a key press generates a single <emphasis>
ButtonPress</emphasis>
event; if <emphasis>
count</emphasis>
is greater than <emphasis>
zero</emphasis>
, a key press generates <emphasis>
count</emphasis>
pairs of <emphasis>
ButtonPress</emphasis>
and <emphasis>
ButtonRelease</emphasis>
events.
</para>
</listitem>
<listitem>
<para>
If <emphasis>
count</emphasis>
is <emphasis>
zero</emphasis>
, a key release generates a core pointer <emphasis>
ButtonRelease</emphasis>
that matches the event generated by the corresponding <emphasis>
KeyPress</emphasis>
; if <emphasis>
count</emphasis>
is nonzero, a key release does not cause a <emphasis>
ButtonRelease</emphasis>
event. A key release never generates a key <emphasis>
KeyRelease</emphasis>
event.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockPtrBtn</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
If the button specified by the <emphasis>
MouseKeys</emphasis>
default button<emphasis>
</emphasis>
or <emphasis>
button</emphasis>
is not locked, a key press causes a <emphasis>
ButtonPress</emphasis>
event instead of a <emphasis>
KeyPress</emphasis>
event and locks the button. If the button is already locked or if <emphasis>
XkbSA_LockNoUnlock</emphasis>
is set in the <emphasis>
flags</emphasis>
field, a key press is ignored and has no effect.
</para>
</listitem>
<listitem>
<para>
If the corresponding key press was ignored, and if <emphasis>
XkbSA_LockNoLock</emphasis>
is not set in the <emphasis>
flags</emphasis>
field, a key release generates a <emphasis>
ButtonRelease</emphasis>
event instead of a <emphasis>
KeyRelease</emphasis>
event and unlocks the specified button. If the corresponding key press locked
a button, the key release is ignored and has no effect.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the masks shown in Table
16.8. A general meaning is given in the table, but the exact meaning depends on
the action <emphasis>
type.</emphasis>
:
</para>
<table frame='topbot'>
<title>Pointer Button Action Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_UseDfltButton</emphasis></entry>
<entry>
If set, the action uses the pointer button specified by the <emphasis>
mk_dflt_btn</emphasis>
attribute of the <emphasis>
MouseKeys</emphasis>
control (see section 10.5.1). Otherwise, the action uses the pointer button
specified by the<emphasis>
button </emphasis>
field.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoLock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LockPtrBtn</emphasis>
, the server only unlocks the pointer button.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoUnlock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LockPtrBtn</emphasis>
, the server only locks the pointer button.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id='Actions_for_Changing_the_Pointer_Button_Simulated'>
<title>Actions for Changing the Pointer Button Simulated</title>
<para>
Actions associated with the <emphasis>
XkbPtrDfltAction</emphasis>
structure change the <emphasis>
mk_dflt_btn</emphasis>
attribute of the <emphasis>
MouseKeys</emphasis>
control (see section 10.5.1):
</para>
<para><programlisting>
typedef struct _XkbPtrDfltAction {
unsigned char type; /* <emphasis> XkbSA_SetPtrDflt</emphasis> */
unsigned char flags; /* controls the pointer button number */
unsigned char affect; /* <emphasis> XkbSA_AffectDfltBtn</emphasis> */
char valueXXX; /* new default button member */
} <emphasis>XkbPtrDfltAction</emphasis>;
</programlisting></para>
<para>
If the <emphasis>
MouseKeys</emphasis>
control is not enabled, <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events are treated as though the action is <emphasis>
XkbSA_NoAction</emphasis>
. Otherwise, this action changes the <emphasis>
mk_dflt_btn</emphasis>
attribute of the <emphasis>
MouseKeys</emphasis>
control.
</para>
<para>
The <emphasis>
type</emphasis>
field of the <emphasis>
XkbPtrDfltAction</emphasis>
structure should always be <emphasis>
XkbSA_SetPtrDflt</emphasis>
.
</para>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the values shown in Table
16.9 (currently there is only one value defined).
</para>
<table frame='topbot'>
<title>Pointer Default Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_DfltBtnAbsolute</emphasis></entry>
<entry>
If set, the <emphasis>
value</emphasis>
field represents an absolute pointer button. Otherwise, the <emphasis>
value</emphasis>
field represents the amount to be added to the current default button.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
affect</emphasis>
field specifies what changes as a result of this action. The only valid value
for the <emphasis>
affect</emphasis>
field is <emphasis>XkbSA_AffectDfltBtn</emphasis>.
</para>
<para>
The <emphasis>
valueXXX</emphasis>
field is a signed character that represents the new button value for the
<emphasis>
mk_dflt_btn</emphasis>
attribute of the <emphasis>
MouseKeys</emphasis>
control (see section 10.5.1). If <emphasis>
XkbSA_DfltBtnAbsolute</emphasis>
is set in <emphasis>
flags</emphasis>
, <emphasis>
valueXXX</emphasis>
specifies the button to be used; otherwise, <emphasis>
valueXXX</emphasis>
specifies the amount to be added to the current default button. In either
case, illegal button choices are wrapped back around into range. Xkb provides
the following macros, to convert between the integer and signed character
values in <emphasis>
XkbPtrDfltAction</emphasis>
structures:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
int <emphasis>
XkbSAPtrDfltValue</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbAction <emphasis>
act</emphasis>
; /* action from which to extract group */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSAPtrDfltValue</emphasis>
returns the <emphasis>
valueXXX</emphasis>
field of <emphasis>
act</emphasis>
converted to a signed int.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSASetPtrDfltValue</emphasis>
(<emphasis>
act, val</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbPtrDfltAction <emphasis>
act</emphasis>
; /* action in which to set <emphasis>
valueXXX</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
val</emphasis>
; /* value to set in <emphasis>
valueXXX</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSASetPtrDfltValue</emphasis>
sets the <emphasis>
valueXXX</emphasis>
field of <emphasis>
act</emphasis>
from <emphasis>
val</emphasis>
.
</para>
</sect2>
<sect2 id='Actions_for_Locking_Modifiers_and_Group'>
<title>Actions for Locking Modifiers and Group</title>
<para>
Actions associated with the <emphasis>
XkbISOAction</emphasis>
structure lock modifiers and the group according to the ISO9995 specification.
</para>
<para>
Operated by itself, the <emphasis>
XkbISOAction</emphasis>
is just a caps lock. Operated simultaneously with another modifier key, it
transforms the other key into a locking key. For example, press <emphasis>
ISO_Lock</emphasis>
, press and release <emphasis>
Control_L</emphasis>
, release <emphasis>
ISO_Lock</emphasis>
ends up locking the <emphasis>
Control</emphasis>
modifier.
</para>
<para>
The default behavior is to convert:
</para>
<literallayout>
{Set,Latch}Mods to: LockMods
{Set,Latch}Group to: LockGroup
SetPtrBtn to: LockPtrBtn
SetControls to: LockControls
</literallayout>
<para>
The <emphasis>
affects</emphasis>
field allows you to turn those effects on or off individually. Set <emphasis>
XkbSA_ISONoAffectMods</emphasis>
to disable the first, <emphasis>
XkbSA_ISONoAffectGroup</emphasis>
to disable the second, and so forth.
</para>
<para><programlisting>
typedef struct _XkbISOAction {
unsigned char type; /* <emphasis>XkbSA_ISOLock</emphasis> */
unsigned char flags; /* controls changes to group or modifier state */
unsigned char mask; /* same as <emphasis>mask</emphasis> field of a modifier description */
unsigned char real_mods; /* same as <emphasis>real_mods</emphasis> field of a modifier description */
char group_XXX; /* group index or delta group */
unsigned char affect; /* specifies whether to affect mods, group, ptrbtn, or controls*/
unsigned char vmods1; /* derived from <emphasis>vmods</emphasis> field of a modifier description */
unsigned char vmods2; /* derived from <emphasis>vmods</emphasis> field of a modifier description */
} <emphasis>XkbISOAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field of the <emphasis>
XkbISOAction</emphasis>
structure should always be <emphasis>
XkbSA_ISOLock</emphasis>
.
</para>
<para>
The interpretation of the <emphasis>
flags</emphasis>
field depends on whether the <emphasis>
XkbSA_ISODfltIsGroup</emphasis>
is set in the <emphasis>
flags</emphasis>
field or not.
</para>
<para>
If the <emphasis>
XkbSA_ISODfltIsGroup</emphasis>
is set in the <emphasis>
flags</emphasis>
field, the action is used to change the group state. The remaining valid bits
of the <emphasis>
flags</emphasis>
field are composed of a bitwise inclusive OR using the masks shown in Table
16.10.
</para>
<table frame='topbot'>
<title>ISO Action Flags when XkbSA_ISODfltIsGroup is Set</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_ISODfltIsGroup</emphasis></entry>
<entry>
<para>
If set, the action is used to change the base group state. Must be set for the
remaining bits in this table to carry their interpretations.
</para>
<para>
A key press sets the base group as specified by the <emphasis>
group_XXX</emphasis>
field and the <emphasis>
XkbSA_GroupAbsolute</emphasis>
bit of the <emphasis>
flags</emphasis>
field (see section Note). If no other actions are transformed by the <emphasis>
XkbISO_Lock</emphasis>
action, a key release locks the group. Otherwise, a key release clears group
set by the key press.
</para>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_GroupAbsolute</emphasis></entry>
<entry>
If set, the <emphasis>
group_XXX</emphasis>
field represents an absolute group number. Otherwise, it represents a group
delta to be added to the current group to determine the new group number.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectMods</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_SetMods</emphasis>
or <emphasis>
XkbSA_LatchMods</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockMod</emphasis>
actions instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectGroup</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_SetGroup</emphasis>
or <emphasis>
XkbSA_LatchGroup</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockGroup</emphasis>
actions instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectPtr</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_PtrBtn</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockPtrBtn</emphasis>
actions instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectCtrls</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_SetControls</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockControls</emphasis>
actions instead.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
If the <emphasis>
XkbSA_ISODfltIsGroup</emphasis>
is not set in the <emphasis>
flags</emphasis>
field, the action is used to change the modifier state and the remaining valid
bits of the <emphasis>
flags</emphasis>
field are composed of a bitwise inclusive OR using the masks shown in Table
16.11.
</para>
<table frame='topbot'>
<title>ISO Action Flags when XkbSA_ISODfltIsGroup is Not Set</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_ISODfltIsGroup</emphasis> </entry>
<entry>
<para>
If not set, action is used to change the base modifier state. Must not be set
for the remaining bits in this table to carry their interpretations.
</para>
<para>
A key press sets the action modifiers in the keyboard’s base modifiers using
the <emphasis>
mask</emphasis>
, <emphasis>
real_mods</emphasis>
, <emphasis>
vmods1</emphasis>
, and <emphasis>
vmods2 </emphasis>
fields (see section 16.1.3). If no other actions are transformed by the
<emphasis>
XkbISO_Lock</emphasis>
action, a key release locks the action modifiers. Otherwise, a key release
clears the base modifiers set by the key press.
</para>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_UseModMapMods</emphasis></entry>
<entry>
If set, the action modifiers are determined by the modifiers bound by the
modifier mapping of the key. Otherwise, the action modifiers are set to the
modifiers specified by the <emphasis>
mask</emphasis>
, <emphasis>
real_mods</emphasis>
, <emphasis>
vmod1</emphasis>
, and <emphasis>
vmod2</emphasis>
fields.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoLock</emphasis></entry>
<entry>If set, the server only unlocks the action modifiers.</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoUnlock</emphasis></entry>
<entry>If set, the server only locks the action modifiers. </entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectMods</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_SetMods</emphasis>
or <emphasis>
XkbSA_LatchMods</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockMod</emphasis>
actions instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectGroup</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_SetGroup</emphasis>
or <emphasis>
XkbSA_LatchGroup</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockGroup</emphasis>
actions instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectPtr</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_PtrBtn</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockPtrBtn</emphasis>
actions instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectCtrls</emphasis></entry>
<entry>
If not set, any <emphasis>
XkbSA_SetControls</emphasis>
actions that occur simultaneously with the <emphasis>
XkbSA_ISOLock</emphasis>
action are treated as <emphasis>
XkbSA_LockControls</emphasis>
actions instead.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
group_XXX</emphasis>
field represents a signed character. Xkb provides macros to convert between a
signed integer value and a signed character as shown in section Note.
</para>
<para>
The <emphasis>
mask</emphasis>
, <emphasis>
real_mods</emphasis>
, <emphasis>
vmods1</emphasis>
, and <emphasis>
vmods2</emphasis>
fields represent the components of an Xkb modifier description (see section
7.2). While the <emphasis>
mask</emphasis>
and <emphasis>
real_mods</emphasis>
fields correspond directly to the <emphasis>
mask</emphasis>
and <emphasis>
real_mods</emphasis>
fields of an Xkb modifier description, the <emphasis>
vmods1</emphasis>
and <emphasis>
vmods2</emphasis>
fields are combined to correspond to the <emphasis>
vmods</emphasis>
field of an Xkb modifier description. Xkb provides macros to convert between
the two formats as shown in section 16.1.3.
</para>
<para>
The <emphasis>
affect</emphasis>
field is composed of a bitwise inclusive OR using the masks shown in Table
16.11.
</para>
<table frame='topbot'>
<title>ISO Action Affect Field Values</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Affect</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_ISODNoAffectMods</emphasis></entry>
<entry>
If <emphasis>
XkbSA_ISONoAffectMods</emphasis>
is not set, any <emphasis>
SA_SetMods</emphasis>
or <emphasis>
SA_LatchMods</emphasis>
actions occurring simultaneously with the <emphasis>
XkbISOAction</emphasis>
are treated as <emphasis>
SA_LockMods</emphasis>
instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectGroup</emphasis></entry>
<entry>
If <emphasis>
XkbSA_ISONoAffectGroup</emphasis>
is not set, any <emphasis>
SA_SetGroup</emphasis>
or <emphasis>
SA_LatchGroup</emphasis>
actions occurring simultaneously with the <emphasis>
XkbISOAction</emphasis>
are treated as <emphasis>
SA_LockGroup</emphasis>
instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectPtr</emphasis></entry>
<entry>
If <emphasis>
XkbSA_ISONoAffectPtr</emphasis>
is not set, any <emphasis>
SA_PtrBtn</emphasis>
actions occurring simultaneously with the <emphasis>
XkbISOAction</emphasis>
are treated as <emphasis>
SA_LockPtrBtn</emphasis>
instead.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_ISONoAffectCtrls</emphasis></entry>
<entry>
If <emphasis>
XkbSA_ISONoAffectCtrls</emphasis>
is not set, any <emphasis>
SA_SetControls</emphasis>
actions occurring simultaneously with the <emphasis>
XkbISOAction</emphasis>
are treated as <emphasis>
SA_LockControls</emphasis>
instead.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id='Actions_for_Changing_the_Active_Screen'>
<title>Actions for Changing the Active Screen</title>
<para>
Actions associated with the <emphasis>
XkbSwitchScreen</emphasis>
action structure change the active screen on a multiscreen display:
</para>
<note><para>This action is optional. Servers are free to ignore the action or
any of its flags if they do not support the requested behavior. If the action
is ignored, it behaves like <emphasis>
XkbSA_NoAction</emphasis>
. Otherwise, key press and key release events do not generate an event.
</para></note>
<para><programlisting>
typedef struct _XkbSwitchScreenAction {
unsigned char type; /* <emphasis> XkbSA_SwitchScreen</emphasis> */
unsigned char flags; /* controls screen switching */
char screenXXX; /* screen number or delta */
} <emphasis>XkbSwitchScreenAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field of the <emphasis>
XkbSwitchScreenAction</emphasis>
structure should always be <emphasis>
XkbSA_SwitchScreen</emphasis>.
</para>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the masks shown in Table
16.13.
</para>
<table frame='topbot'>
<title>Switch Screen Action Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_SwitchAbsolute</emphasis></entry>
<entry>
If set, the <emphasis>
screenXXX</emphasis>
field represents the index of the new screen. Otherwise, it represents an
offset from the current screen to the new screen.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_SwitchApplication</emphasis></entry>
<entry>
If not set, the action should switch to another screen on the same
server. Otherwise, it should switch to another X server or application that
shares the same physical display.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
screenXXX</emphasis>
field is a signed character value that represents either the relative or
absolute screen index, depending on the state of the <emphasis>
XkbSA_SwitchAbsolute</emphasis>
bit in the <emphasis>
flags</emphasis>
field. Xkb provides the following macros to convert between the integer and
signed character value for screen numbers in <emphasis>
XkbSwitchScreenAction</emphasis>
structures:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
int <emphasis>
XkbSAScreen</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbSwitchScreenAction <emphasis>
act</emphasis>
; /* action from which to extract screen */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSAScreen</emphasis>
returns the <emphasis>
screenXXX</emphasis>
field of <emphasis>
act</emphasis>
converted to a signed int.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSASetScreen</emphasis>
(<emphasis>
act, s</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbSwitchScreenAction <emphasis>
act</emphasis>
; /* action in which to set <emphasis>
screenXXX</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
s</emphasis>
; /* value to set in <emphasis>
screenXXX</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSASetScreen</emphasis>
sets the <emphasis>
screenXXX</emphasis>
field of <emphasis>
act</emphasis>
from <emphasis>
s</emphasis>
.
</para>
</sect2>
<sect2 id='Actions_for_Changing_Boolean_Controls_State'>
<title>Actions for Changing Boolean Controls State</title>
<para>
Actions associated with the <emphasis>
XkbCtrlsAction</emphasis>
structure change the state of the boolean controls (see section 10.1):
</para>
<para><programlisting>
typedef struct _XkbCtrlsAction {
unsigned char type; /* <emphasis> XkbSA_SetControls,
XkbSA_LockControls</emphasis> */
unsigned char flags; /* with <emphasis> type</emphasis>,
controls enabling and disabling of controls */
unsigned char ctrls3; /* <emphasis>ctrls0</emphasis> through
<emphasis> ctrls3</emphasis> represent the boolean controls */
unsigned char ctrls2; /* <emphasis>ctrls0</emphasis> through
<emphasis> ctrls3</emphasis> represent the boolean controls */
unsigned char ctrls1; /* <emphasis>ctrls0</emphasis> through
<emphasis> ctrls3</emphasis> represent the boolean controls */
unsigned char ctrls0; /* <emphasis>ctrls0</emphasis> through
<emphasis> ctrls3</emphasis> represent the boolean controls */
} <emphasis>XkbCtrlsAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field can have any one of the values shown in Table 16.14.
</para>
<table frame='topbot'>
<title>Controls Action Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Type</entry>
<entry>Effect</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_SetControls</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
A key press enables any boolean controls specified in the <emphasis>
ctrls</emphasis>
fields that were not already enabled at the time of the key press.
</para>
</listitem>
<listitem>
<para>
A key release disables any controls enabled by the key press.
</para>
</listitem>
<listitem>
<para>
This action can cause <emphasis>
XkbControlsNotify</emphasis>
events (see section 10.1).
</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockControls</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
If the <emphasis>
XkbSA_LockNoLock</emphasis>
bit is not set in the <emphasis>
flags</emphasis>
field, a key press enables any controls specified in the <emphasis>
ctrls</emphasis>
fields that were not already enabled at the time of the key press.
</para>
</listitem>
<listitem>
<para>
If the <emphasis>
XkbSA_LockNoUnlock</emphasis>
bit is not set in the <emphasis>
flags</emphasis>
field, a key release disables any controls specified in the <emphasis>
ctrls</emphasis>
fields that were not already disabled at the time of the key press.
</para>
</listitem>
<listitem>
<para>
This action can cause <emphasis>
XkbControlsNotify</emphasis>
events (see section 10.1).
</para>
</listitem>
</itemizedlist>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the masks shown in Table
16.15.
</para>
<table frame='topbot'>
<title>Control Action Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_LockNoLock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LockControls</emphasis>
, the server only disables controls.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoUnlock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LockControls</emphasis>
, the server only enables controls.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
XkbSA_SetControls</emphasis>
action implements a key that enables a boolean control when pressed and
disables it when released. The <emphasis>
XkbSA_LockControls</emphasis>
action is used to implement a key that toggles the state of a boolean control
each time it is pressed and released. The <emphasis>
XkbSA_LockNoLock</emphasis>
and <emphasis>
XkbSA_LockNoUnlock</emphasis>
flags allow modifying the toggling behavior to only unlock or only lock the
boolean control.
</para>
<para>
The <emphasis>
ctrls0</emphasis>
, <emphasis>
ctrls1</emphasis>
, <emphasis>
ctrls2</emphasis>
, and <emphasis>
ctrls3</emphasis>
fields represent the boolean controls in the <emphasis>
enabled_ctrls</emphasis>
field of the controls structure (see section 10.1). Xkb provides the following
macros, to convert between the two formats:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
unsigned int <emphasis>
XkbActionCtrls</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbCtrlsAction <emphasis>
act</emphasis>
; /* action from which to extract controls */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbActionCtrls</emphasis>
returns the <emphasis>
ctrls</emphasis>
fields of <emphasis>
act</emphasis>
converted to an unsigned int.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSAActionSetCtrls</emphasis>
(<emphasis>
act, ctrls</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbCtrlsAction <emphasis>
act</emphasis>
; /* action in which to set ctrls0-ctrls3 */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
ctrls</emphasis>
; /* value to set in ctrls0-ctrls3 */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSAActionSetCtrls</emphasis>
sets the <emphasis>
ctrls0</emphasis>
through <emphasis>
ctrls3</emphasis>
fields of <emphasis>
act</emphasis>
from <emphasis>
ctrls</emphasis>
.
</para>
</sect2>
<sect2 id='Actions_for_Generating_Messages'>
<title>Actions for Generating Messages</title>
<para>
Actions associated with the <emphasis>
XkbMessageAction</emphasis>
structure generate <emphasis>
XkbActionMessage</emphasis>
events:
</para>
<para><programlisting>
#define XkbActionMessageLength 6
</programlisting></para>
<para><programlisting>
typedef struct _XkbMessageAction {
unsigned char type; /* <emphasis> XkbSA_ActionMessage</emphasis> */
unsigned char flags; /* controls event generation via key presses and releases */
unsigned char message[XkbActionMessageLength]; /* message */
} <emphasis>XkbMessageAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field of the <emphasis>
XkbMessageAction</emphasis>
structure should always be <emphasis>
XkbSA_ActionMessage</emphasis>
.
</para>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the masks shown in Table
16.16.
</para>
<table frame='topbot'>
<title>Message Action Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_MessageOnPress</emphasis></entry>
<entry>
If set, key press events generate an <emphasis>
XkbActionMessage</emphasis>
event that reports the keycode, event type, and contents of the <emphasis>
message</emphasis>
field.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_MessageOnRelease</emphasis></entry>
<entry>
If set, key release events generate an <emphasis>
XkbActionMessage</emphasis>
event that reports the keycode, event type, and contents of the <emphasis>
message</emphasis>
field.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_MessageGenKeyEvent</emphasis></entry>
<entry>
If set, key press and key release events generate <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events, regardless of whether they generate <emphasis>
XkbActionMessage</emphasis>
events.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
message</emphasis>
field is an array of <emphasis>
XkbActionMessageLength</emphasis>
unsigned characters and may be set to anything the keymap designer wishes.
</para>
<sect3 id='Detecting_Key_Action_Messages'>
<title>Detecting Key Action Messages</title>
<para>
To receive <emphasis>
XkbActionMessage</emphasis>
events by calling either <emphasis>
XkbSelectEvents</emphasis>
or <emphasis>
XkbSelectEventDetails</emphasis>
(see section 4.3).
</para>
<para>
To receive <emphasis>
XkbActionMessage</emphasis>
events under all possible conditions, use <emphasis>
XkbSelectEvents</emphasis>
and pass <emphasis>
XkbActionMessageMask</emphasis>
in both <emphasis>
bits_to_change</emphasis>
and <emphasis>
values_for_bits</emphasis>
.
</para>
<para>
The <emphasis>
XkbActionMessage</emphasis>
event has no event details. However, you can call <emphasis>
XkbSelectEventDetails</emphasis>
using <emphasis>
XkbActionMessage</emphasis>
as the <emphasis>
event_type</emphasis>
and specifying <emphasis>
XkbAllActionMessageMask</emphasis>
in <emphasis>
bits_to_change</emphasis>
and <emphasis>
values_for_bits.</emphasis>
This has the same effect as a call to <emphasis>
XkbSelectEvents</emphasis>.
</para>
<para>
The structure for the <emphasis>
XkbActionMessage</emphasis>
event is defined as follows:
</para>
<para><programlisting>
typedef struct _XkbActionMessage {
int type; /* Xkb extension base event code */
unsigned long serial; /* X server serial number for event */
Bool send_event; /* <emphasis>True</emphasis> => synthetically generated */
Display * display; /* server connection where event generated */
Time time; /* server time when event generated */
int xkb_type; /* <emphasis>XkbActionMessage</emphasis> */
int device; /* Xkb device ID, will not be <emphasis> XkbUseCoreKbd</emphasis> */
KeyCode keycode; /* keycode of key triggering event */
Bool press; /* <emphasis>True</emphasis> => key press,
<emphasis>False</emphasis> => release */
Bool key_event_follows; /* <emphasis>True</emphasis> => KeyPress/KeyRelease follows */
char message[XkbActionMessageLength+1]; /* message text */
} <emphasis>XkbActionMessageEvent</emphasis>;
</programlisting></para>
<para>
The <emphasis>
keycode</emphasis>
is the keycode of the key that was pressed or released. The <emphasis>
press</emphasis>
field specifies whether the event was the result of a key press or key
release.
</para>
<para>
The <emphasis>
key_event_follows</emphasis>
specifies whether a <emphasis>
KeyPress</emphasis>
(if <emphasis>
press</emphasis>
is <emphasis>
True</emphasis>
) or <emphasis>
KeyRelease</emphasis>
(if <emphasis>
press</emphasis>
is <emphasis>
False</emphasis>
) event is also sent to the client. As with all other Xkb events, <emphasis>
XkbActionMessageEvent</emphasis>
s are delivered to all clients requesting them, regardless of the current
keyboard focus. However, the <emphasis>
KeyPress</emphasis>
or <emphasis>
KeyRelease</emphasis>
event that conditionally follows an <emphasis>
XkbActionMessageEvent</emphasis>
is sent only to the client selected by the current keyboard focus. <emphasis>
key_event_follows</emphasis>
is <emphasis>
True</emphasis>
only for the client that is actually sent the following <emphasis>
KeyPress</emphasis>
or <emphasis>
KeyRelease</emphasis>
event.
</para>
<para>
The <emphasis>
message</emphasis>
field is set to the message specified in the action and is guaranteed to be
<emphasis>
NULL</emphasis>
-terminated; the Xkb extension forces a <emphasis>
NULL</emphasis>
into <emphasis>
message</emphasis>
[<emphasis>
XkbActionMessageLength</emphasis>
].
</para>
</sect3>
</sect2>
<sect2 id='Actions_for_Generating_a_Different_Keycode'>
<title>Actions for Generating a Different Keycode</title>
<para>
Actions associated with the <emphasis>
XkbRedirectKeyAction</emphasis>
structure generate <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events containing a keycode different from the key that was pressed or
released:
</para>
<para><programlisting>
typedef struct _XkbRedirectKeyAction {
unsigned char type; /* <emphasis> XkbSA_RedirectKey</emphasis> */
unsigned char new_key; /* keycode to be put in event */
unsigned char mods_mask; /* mask of real mods to be reset */
unsigned char mods; /* mask of real mods to take values from */
unsigned char vmods_mask0; /* first half of mask of virtual mods to be reset */
unsigned char vmods_mask1; /* other half of mask of virtual mods to be reset */
unsigned char vmods0; /* first half of mask of virtual mods to take values from */
unsigned char vmods1; /* other half of mask of virtual mods to take values from */
} <emphasis>XkbRedirectKeyAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field for the <emphasis>
XkbRedirectKeyAction</emphasis>
structure should always be <emphasis>
XkbSA_RedirectKey</emphasis>
.
</para>
<para>
Key presses cause a <emphasis>
KeyPress</emphasis>
event for the key specified by the <emphasis>
new_key</emphasis>
field instead of the actual key. The state reported in this event reports the
current effective modifiers changed as follows: any real modifiers selected by
the <emphasis>
mods_mask</emphasis>
field are set to corresponding values from the <emphasis>
mods</emphasis>
field. Any real modifiers bound to the virtual modifiers specified by the
<emphasis>
vmods_mask0</emphasis>
and <emphasis>
vmods_mask1</emphasis>
fields are either set or cleared, depending on the corresponding values in the
<emphasis>
vmods0</emphasis>
and <emphasis>
vmods1</emphasis>
fields. If the real and virtual modifier definitions specify conflicting
values for a single modifier, the real modifier definition has priority.
</para>
<para>
Key releases cause a <emphasis>
KeyRelease</emphasis>
event for the key specified by the <emphasis>
new_key</emphasis>
field instead of the actual key. The state for this event consists of the
effective keyboard modifiers at the time of the release, changed as described
previously.
</para>
<para>
The <emphasis>
XkbSA_RedirectKey</emphasis>
action normally redirects to another key on the same device as the key that
caused the event, unless that device does not belong to the input extension
<emphasis>
KeyClass</emphasis>
, in which case this action causes an event on the core keyboard device. (The
input extension categorizes devices by breaking them into classes. Keyboards,
and other input devices with keys, are classified as KeyClass devices by the
input extension.)
</para>
<para>
The <emphasis>
vmods_mask0</emphasis>
and <emphasis>
vmods_mask1</emphasis>
fields actually represent one <emphasis>
vmods_mask</emphasis>
value, as described in Chapter 7. Xkb provides the following macros, to
convert between the two formats:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
unsigned int <emphasis>
XkbSARedirectVModsMask</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbRedirectKeyAction <emphasis>
act</emphasis>
; /* action from which to extract vmods */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSARedirectVModsMask</emphasis>
returns the <emphasis>
vmods_mask0</emphasis>
and <emphasis>
vmods_mask1</emphasis>
fields of <emphasis>
act</emphasis>
converted to an unsigned int.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSARedirectSetVModsMask</emphasis>
(<emphasis>
act, vm</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbRedirectKeyAction <emphasis>
act</emphasis>
; /* action in which to set vmods */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
vm</emphasis>
; /* new value for virtual modifier mask */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSARedirectSetVModsMask</emphasis>
sets the <emphasis>
vmods_mask0</emphasis>
and <emphasis>
vmods_mask1</emphasis>
fields of <emphasis>
act</emphasis>
from <emphasis>
vm</emphasis>
.
</para>
<para>
Similarly, the <emphasis>
vmods0</emphasis>
and <emphasis>
vmods1</emphasis>
fields actually represent one <emphasis>
vmods </emphasis>
value, as described in Chapter 7. To convert between the two formats, Xkb
provides the following convenience macros:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
unsigned int <emphasis>
XkbSARedirectVMods</emphasis>
(<emphasis>
act</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbRedirectKeyAction <emphasis>
act</emphasis>
; /* action from which to extract vmods */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<literallayout>
<emphasis>XkbSARedirectVModsMask</emphasis> returns the <emphasis>vmods0</emphasis>
and <emphasis>vmods1</emphasis> fields of <emphasis>act</emphasis>
converted to an unsigned int.
</literallayout>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
void <emphasis>
XkbSARedirectSetVMods</emphasis>
(<emphasis>
act, vm</emphasis>
) /* macro */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbRedirectKeyAction <emphasis>
act</emphasis>
; /* action in which to set vmods */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
v</emphasis>
; /* new value for virtual modifiers */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<literallayout>
<emphasis> XkbSARedirectSetVModsMask</emphasis> sets the <emphasis>vmods0</emphasis>
and <emphasis>vmods1</emphasis> of <emphasis>act</emphasis> from <emphasis>v</emphasis>.
</literallayout>
</sect2>
<sect2 id='Actions_for_Generating_DeviceButtonPress_and_DeviceButtonRelease'>
<title>Actions for Generating DeviceButtonPress and DeviceButtonRelease</title>
<para>
Actions associated with <emphasis>
XkbDeviceBtnAction</emphasis>
structures generate <emphasis>
DeviceButtonPress</emphasis>
and <emphasis>
DeviceButtonRelease</emphasis>
events instead of normal <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events:
</para>
<para><programlisting>
typedef struct _XkbDeviceBtnAction {
unsigned char type; /* <emphasis> XkbSA_DeviceBtn, XkbSA_LockDeviceBtn</emphasis> */
unsigned char flags; /* with <emphasis> type</emphasis> , specifies locking or unlocking */
unsigned char count; /* controls number of DeviceButtonPress and Release events */
unsigned char button; /* index of button on <emphasis> device</emphasis> */
unsigned char device; /* device ID of an X input extension device */
} <emphasis>XkbDeviceBtnAction</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field can have any one of the values shown in Table 16.17.
</para>
<table frame='topbot'>
<title>Device Button Action Types</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Type</entry>
<entry>Effect</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_DeviceBtn</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
If the button specified by this action is logically down, the key press and
corresponding release are ignored and have no effect. If the device or button
specified by this action are illegal, this action behaves like <emphasis>
XkbSA_NoAction</emphasis>.
</para>
</listitem>
<listitem>
<para>
Otherwise, key presses cause one or more input extension device events instead
of the usual key press event. If the <emphasis>
count</emphasis>
field is zero, a key press generates a single <emphasis>
DeviceButtonPress</emphasis>
event. If count is greater than zero, a key press event generates <emphasis>
count</emphasis>
pairs of <emphasis>
DeviceButtonPress</emphasis>
and <emphasis>
DeviceButtonRelease</emphasis>
events.
</para>
</listitem>
<listitem>
<para>
If <emphasis>
count</emphasis>
is zero, a key release generates an input extension <emphasis>
DeviceButtonRelease</emphasis>
event that matches the event generated by the corresponding key press. If
<emphasis>
count</emphasis>
is nonzero, a key release does not cause a <emphasis>
DeviceButtonRelease</emphasis>
event. Key releases never cause <emphasis>
KeyRelease</emphasis>
events.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockDeviceBtn</emphasis></entry>
<entry>
<itemizedlist>
<listitem>
<para>
If the device or button specified by this action are illegal, this action
behaves like <emphasis>XkbSA_NoAction</emphasis>.
</para>
</listitem>
<listitem>
<para>
Otherwise, if the specified button is not locked and the <emphasis>
XkbSA_LockNoLock</emphasis>
bit is not set in the <emphasis>
flags</emphasis>
field, a key press generates an input extension <emphasis>
DeviceButtonPress</emphasis>
event instead of a <emphasis>
KeyPress</emphasis>
event and locks the button. If the button is already locked or if <emphasis>
XkbSA_LockNoLock</emphasis>
bit is set in the <emphasis>
flags</emphasis>
field, the key press is ignored and has no effect.
</para>
</listitem>
<listitem>
<para>
If the corresponding key press was ignored, and if the <emphasis>
XkbSA_LockNoUnlock</emphasis>
bit is not set in the <emphasis>
flags</emphasis>
field, a key release generates an input extension <emphasis>
DeviceButtonRelease</emphasis>
event instead of a <emphasis>
KeyRelease</emphasis>
event and unlocks the button. If the corresponding key press locked a button,
the key release is ignored and has no effect.
</para>
</listitem>
</itemizedlist>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
flags</emphasis>
field is composed of the bitwise inclusive OR of the masks shown in Table
16.18.
</para>
<table frame='topbot'>
<title>Device Button Action Flags</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Flag</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_LockNoLock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LockDeviceBtn</emphasis>
, the server only unlocks the button.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_LockNoUnlock</emphasis></entry>
<entry>
If set, and the action type is <emphasis>
XkbSA_LockDeviceBtn</emphasis>
, the server only locks the button.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id='Actions_for_Simulating_Events_from_Device_Valuators'>
<title>Actions for Simulating Events from Device Valuators</title>
<para>
A <emphasis>
valuator</emphasis>
manipulates a range of values for some entity, like a mouse axis, a slider or
a dial. Actions associated with <emphasis>
XkbDeviceValuatorAction</emphasis>
structures are used to simulate events from one or two input extension device
valuators.
</para>
<para><programlisting>
typedef struct _XkbDeviceValuatorAction {
unsigned char type; /*<emphasis> XkbSA_DeviceValuator</emphasis> */
unsigned char device; /* device ID */
unsigned char v1_what; /* determines how valuator is to behave for valuator 1 */
unsigned char v1_ndx; /* specifies a real valuator */
unsigned char v1_value; /* the value for valuator 1 */
unsigned char v2_what; /* determines how valuator is to behave for valuator 2 */
unsigned char v2_ndx; /* specifies a real valuator */
unsigned char v2_value; /* the value for valuator 1 */
} <emphasis>XkbDeviceValuatorAction</emphasis>;
</programlisting></para>
<para>
If <emphasis>
device</emphasis>
is illegal or if neither <emphasis>
v1_ndx</emphasis>
nor <emphasis>
v2_ndx</emphasis>
specifies a legal valuator, this action behaves like <emphasis>
XkbSA_NoAction</emphasis>.
</para>
<para>
The low four bits of <emphasis>
v1_what</emphasis>
and <emphasis>
v2_what</emphasis>
specify the corresponding scale value (denoted <emphasis>
val<n>Scale</emphasis>
in Table 16.17), if needed. The high four bits of <emphasis>
v1_what</emphasis>
and <emphasis>
v2_what</emphasis>
specify the operation to perform to set the values. The high four bits of
<emphasis>
v1_what</emphasis>
and <emphasis>
v2_what</emphasis>
can have the values shown in Table 16.17; the use of <emphasis>
val<n>Scale</emphasis>
is shown in that table also.
</para>
<table frame='topbot'>
<title>Device Valuator v<n>_what High Bits Values</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Value of high bits</entry>
<entry>Effect</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbSA_IgnoreVal</emphasis></entry>
<entry>No action</entry>
</row>
<row>
<entry><emphasis>XkbSA_SetValMin</emphasis></entry>
<entry>
<emphasis>v<n>_value</emphasis> is set to its minimum legal value.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_SetValCenter</emphasis></entry>
<entry>
<emphasis>v<n>_value</emphasis>is centered (to (max-min)/2).
</entry>
</row>
<row>
<entry><emphasis>XkbSA_SetValMax</emphasis></entry>
<entry>
<emphasis>v<n>_value</emphasis> is set to its maximum legal value.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_SetValRelative</emphasis></entry>
<entry>
<emphasis>v<n>_value</emphasis> * (2
<emphasis>val<n>Scale</emphasis>) is added to
<emphasis>v<n>_value</emphasis>.
</entry>
</row>
<row>
<entry><emphasis>XkbSA_SetValAbsolute</emphasis></entry>
<entry>
<emphasis>v<n>_value</emphasis>
is set to (2 <emphasis>val<n>Scale</emphasis>).
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Illegal values for <emphasis>
XkbSA_SetValRelative</emphasis>
or <emphasis>
XkbSA_SetValAbsolute</emphasis>
are clamped into range. Note that all of these possibilities are legal for
absolute valuators. For relative valuators, only <emphasis>
XkbSA_SetValRelative</emphasis>
is permitted. Part of the input extension description of a device is the range
of legal values for all absolute valuators, whence the maximum and minimum
legal values shown in Table 16.17.
</para>
<para>
The following two masks are provided as a convenience to select either portion
of <emphasis>
v1_what</emphasis>
or <emphasis>
v2_what</emphasis>
:
</para>
<literallayout>
#define XkbSA_ValOpMask (0x70)
#define XkbSA_ValScaleMask (0x07)
</literallayout>
<para>
<emphasis>
v1_ndx</emphasis>
and <emphasis>
v2_ndx</emphasis>
specify valuators that actually exists. For example, most mice have two
valuators (x and y axes) so the only legal values for a mouse would be 0 and 1.
For a dial box with eight dials, any value in the range 0..7 would be correct.
</para>
</sect2>
<sect2 id='Obtaining_Key_Actions_for_Keys_from_the_Server'>
<title>Obtaining Key Actions for Keys from the Server</title>
<para>
To update the actions (the <emphasis>
key_acts</emphasis>
array) for a subset of the keys in a keyboard description, use <emphasis>
XkbGetKeyActions</emphasis>
.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Status <emphasis>
XkbGetKeyActions</emphasis>
(<emphasis>
dpy</emphasis>
,<emphasis>
first</emphasis>
, <emphasis>
num</emphasis>
,<emphasis>
xkb</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
first</emphasis>
; /* keycode of first key of interest */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
num</emphasis>
; /* number of keys desired */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* pointer to keyboard description where result is stored */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetKeyActions</emphasis>
sends a request to the server to obtain the actions for <emphasis>
num</emphasis>
keys on the keyboard starting with key <emphasis>
first</emphasis>
. It waits for a reply and returns the actions in the <emphasis>
server</emphasis>
-><emphasis>
key_acts</emphasis>
field of <emphasis>
xkb</emphasis>
. If successful, <emphasis>
XkbGetKeyActions</emphasis>
returns <emphasis>
Success</emphasis>
. The <emphasis>
xkb</emphasis>
parameter must be a pointer to a valid Xkb keyboard description.
</para>
<para>
If the <emphasis>
server</emphasis>
map in the <emphasis>
xkb</emphasis>
parameter has not been allocated, <emphasis>
XkbGetKeyActions</emphasis>
allocates and initializes it before obtaining the actions.
</para>
<para>
If the server does not have a compatible version of Xkb, or the Xkb extension
has not been properly initialized, <emphasis>
XkbGetKeyActions</emphasis>
returns <emphasis>
BadAccess</emphasis>
. If <emphasis>
num</emphasis>
is less than 1 or greater than <emphasis>
XkbMaxKeyCount</emphasis>
, <emphasis>
XkbGetKeyActions</emphasis>
returns <emphasis>
BadValue</emphasis>
. If any allocation errors occur, <emphasis>
XkbGetKeyActions</emphasis>
returns <emphasis>
BadAlloc</emphasis>
.
</para>
</sect2>
<sect2 id='Changing_the_Number_of_Actions_Bound_to_a_Key'>
<title>Changing the Number of Actions Bound to a Key</title>
<para>
To change the number of actions bound to a key, use <emphasis>
XkbResizeKeyAction</emphasis>
.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
XkbAction *<emphasis>
XkbResizeKeyActions</emphasis>
(<emphasis>
xkb</emphasis>
,<emphasis>
key</emphasis>
,<emphasis>
needed</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescRec *<emphasis>
xkb</emphasis>
; /* keyboard description to change */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
key</emphasis>
; /* keycode of key to change */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
needed</emphasis>
; /* new number of actions required */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
The <emphasis>
xkb</emphasis>
parameter points to the keyboard description containing the <emphasis>
key</emphasis>
whose number of actions is to be changed. The <emphasis>
key</emphasis>
parameter is the keycode of the key to change, and <emphasis>
needed</emphasis>
specifies the new number of actions required for the key.
</para>
<para>
<emphasis>
XkbResizeKeyActions</emphasis>
reserves the space needed for the actions and returns a pointer to the
beginning of the new array that holds the actions. It can change the <emphasis>
acts</emphasis>
, <emphasis>
num_acts</emphasis>
, and <emphasis>
size_acts</emphasis>
fields of <emphasis>
xkb</emphasis>
-><emphasis>
server</emphasis>
if it is necessary to reallocate the <emphasis>
acts </emphasis>
array.
</para>
<para>
If <emphasis>
needed</emphasis>
is greater than the current number of keysyms for the key, <emphasis>
XkbResizeKeyActions</emphasis>
initializes all new actions in the array to <emphasis>
NoAction</emphasis>
.
</para>
<para>
Because the number of actions needed by a key is normally computed as width *
number of groups, and <emphasis>
XkbResizeKeyActions</emphasis>
does not modify either the width or number of groups for the key, a
discrepancy exists on return from <emphasis>
XkbResizeKeyActions</emphasis>
between the space allocated for the actions and the number required. The
unused entries in the list of actions returned by <emphasis>
XkbResizeKeyActions</emphasis>
are not preserved across future calls to any of the map editing functions, so
you must update the key actions (which updates the width and number of groups
for the key) before calling another allocator function. A call to <emphasis>
XkbChangeTypesOfKey</emphasis>
updates these.
</para>
<para>
If any allocation errors occur while resizing the number of actions bound to
the key, <emphasis>
XkbResizeKeyActions</emphasis>
returns <emphasis>
NULL</emphasis>
.
</para>
<note><para>A change to the number of actions bound to a key should be
accompanied by a change in the number of symbols bound to a key. Refer to
section 15.3.7 for more information on changing the number of symbols bound to
a key.</para></note>
</sect2>
</sect1>
<sect1 id='Key_Behavior'>
<title>Key Behavior</title>
<para>
Key behavior refers to the demeanor of a key. For example, the expected
behavior of the <emphasis>
CapsLock</emphasis>
key is that it logically locks when pressed, and then logically unlocks when
pressed again.
</para>
<sect2 id='Radio_Groups_2'>
<title>Radio Groups</title>
<para>
Keys that belong to the same radio group have the <emphasis>
XkbKB_RadioGroup</emphasis>
type in the <emphasis>
type</emphasis>
field and the radio group index specified in the <emphasis>
data</emphasis>
field in the <emphasis>
XkbBehavior</emphasis>
structure. If the radio group has a name in the <emphasis>
XkbNamesRec</emphasis>
structure, the radio group index is the index into the <emphasis>
radio_group</emphasis>
array in the <emphasis>
XkbNamesRec</emphasis>
structure. A radio group key when pressed stays logically down until another
key in the radio group is pressed, when the first key becomes logically up and
the new key becomes logically down. Setting the <emphasis>
XkbKB_RGAllowNone</emphasis>
bit in the behavior for all of the keys of the radio group means that pressing
the logically down member of the radio group causes it to logically release, in
which case none of the keys of the radio group would be logically down. If
<emphasis>
XkbKB_RGAllowNone</emphasis>
is not set, there is no way to release the logically down member of the group.
</para>
<para>
The low five bits of the <emphasis>
data</emphasis>
field of the <emphasis>
XkbBehavior</emphasis>
structure are the group number, the high three bits are flags. The only flag
currently defined is:
</para>
<para><programlisting>
#define XkbRG_AllowNone 0x80
</programlisting></para>
</sect2>
<sect2 id='The_XkbBehavior_Structure'>
<title>The XkbBehavior Structure</title>
<para>
The <emphasis>
behaviors</emphasis>
field of the server map is an array of <emphasis>
XkbBehavior</emphasis>
structures, indexed by keycode, and contains the behavior for each key. The
<emphasis>
XkbBehavior</emphasis>
structure is defined as follows:
</para>
<para><programlisting>
typedef struct _XkbBehavior {
unsigned char type; /* behavior type + optional
<emphasis> XkbKB_Permanent</emphasis> bit */
unsigned char data;
} <emphasis>XkbBehavior</emphasis>;
</programlisting></para>
<para>
The <emphasis>
type</emphasis>
field specifies the Xkb behavior, and the value of the <emphasis>
data</emphasis>
field depends on the <emphasis>
type</emphasis>
. Xkb supports the key behaviors shown in Table 16.20.
</para>
<table frame='topbot'>
<title>Key Behaviors</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Type</entry>
<entry>Effect</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>XkbKB_Default</emphasis></entry>
<entry>
Press and release events are processed normally. The <emphasis>
data</emphasis>
field is unused.
</entry>
</row>
<row>
<entry><emphasis>XkbKB_Lock</emphasis></entry>
<entry>
If a key is logically up (that is, the corresponding bit of the core key map is
cleared) when it is pressed, the key press is processed normally and the
corresponding release is ignored. If the key is logically down when pressed,
the key press is ignored but the corresponding release is processed normally.
The <emphasis>
data</emphasis>
field is unused.
</entry>
</row>
<row>
<entry><emphasis>XkbKB_RadioGroup</emphasis></entry>
<entry>
<para>
If another member of the radio group is logically down (all members of the
radio group have the same index, specified in <emphasis>
data</emphasis>
) when a key is pressed, the server synthesizes a key release for the member
that is logically down and then processes the new key press event normally.
</para>
<para>
If the key itself is logically down when pressed, the key press event is
ignored, but the processing of the corresponding key release depends on the
value of the <emphasis>
Xkb_RGAllowNone</emphasis>
bit in <emphasis>
flags</emphasis>
. If it is set, the key release is processed normally; otherwise, the key
release is also ignored.
</para>
<para>
All other key release events are ignored.
</para>
</entry>
</row>
<row>
<entry><emphasis>XkbKB_Overlay1</emphasis></entry>
<entry>
If the <emphasis>
Overlay1</emphasis>
control is enabled (see section 10.4), <emphasis>
data</emphasis>
is interpreted as a keycode, and events from this key are reported as if they
came from <emphasis>
data</emphasis>
’s keycode. Otherwise, press and release events are processed normally.
</entry>
</row>
<row>
<entry><emphasis>XkbKB_Overlay2</emphasis></entry>
<entry>
If the <emphasis>
Overlay2</emphasis>
control is enabled (see section 10.4), <emphasis>
data</emphasis>
is interpreted as a keycode, and events from this key are reported as if they
came from <emphasis>
data</emphasis>
’s keycode. Otherwise, press and release events are processed normally.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Xkb also provides the mask, <emphasis>
XkbKB_Permanent</emphasis>
to specify whether the key behavior type should be simulated by Xkb or whether
the key behavior describes an unalterable physical, electrical, or software
aspect of the keyboard. If the <emphasis>
XkbKB_Permanent</emphasis>
bit is not set in the <emphasis>
type</emphasis>
field, Xkb simulates the behavior in software. Otherwise, Xkb relies upon the
keyboard to implement the behavior.
</para>
</sect2>
<sect2 id='Obtaining_Key_Behaviors_for_Keys_from_the_Server'>
<title>Obtaining Key Behaviors for Keys from the Server</title>
<para>
To obtain the behaviors (the <emphasis>
behaviors</emphasis>
array) for a subset of the keys in a keyboard description from the server, use
<emphasis>
XkbGetKeyBehaviors</emphasis>
:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Status <emphasis>
XkbGetKeyBehaviors</emphasis>
(<emphasis>
dpy</emphasis>
,<emphasis>
first</emphasis>
,<emphasis>
num</emphasis>
,<emphasis>
xkb</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
dpy</emphasis>
; /* connection to server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
first</emphasis>
; /* keycode of first key to get */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
num</emphasis>
; /* number of keys for which behaviors are desired */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description to contain the result */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetKeyBehaviors</emphasis>
sends a request to the server to obtain the behaviors for <emphasis>
num</emphasis>
keys on the keyboard starting with the key whose keycode is <emphasis>
first</emphasis>
. It waits for a reply and returns the behaviors in the <emphasis>
server</emphasis>
-><emphasis>
behaviors</emphasis>
field of <emphasis>
xkb</emphasis>
. If successful, <emphasis>
XkbGetKeyBehaviors</emphasis>
returns <emphasis>
Success</emphasis>
.
</para>
<para>
If the <emphasis>
server</emphasis>
map in the <emphasis>
xkb</emphasis>
parameter has not been allocated, <emphasis>
XkbGetKeyBehaviors</emphasis>
allocates and initializes it before obtaining the actions.
</para>
<para>
If the server does not have a compatible version of Xkb, or the Xkb extension
has not been properly initialized, <emphasis>
XkbGetKeyBehaviors</emphasis>
returns <emphasis>
BadAccess</emphasis>
. If <emphasis>
num</emphasis>
is less than 1 or greater than <emphasis>
XkbMaxKeyCount</emphasis>
, <emphasis>
XkbGetKeyBehaviors</emphasis>
returns <emphasis>
BadValue</emphasis>
. If any allocation errors occur, <emphasis>
XkbGetKeyBehaviors</emphasis>
returns <emphasis>
BadAlloc</emphasis>
.
</para>
</sect2>
</sect1>
<sect1 id='Explicit_ComponentsAvoiding_Automatic_Remapping_by_the_Server'>
<title>Explicit Components—Avoiding Automatic Remapping by the Server</title>
<para>
Whenever a client remaps the keyboard using core protocol requests, Xkb
examines the map to determine likely default values for the components that
cannot be specified using the core protocol (see section 17.1.2 for more
information on how Xkb chooses the default values).
</para>
<para>
This automatic remapping might replace definitions explicitly requested by an
application, so the Xkb keyboard description defines an explicit components
mask for each key. Any aspects of the automatic remapping listed in the
explicit components mask for a key are not changed by the automatic keyboard
mapping.
</para>
<para>
The explicit components masks are held in the <emphasis>
explicit</emphasis>
field of the server map, which is an array indexed by keycode. Each entry in
this array is a mask that is a bitwise inclusive OR of the values shown in
Table 16.21.
</para>
<table frame='topbot'>
<title>Explicit Component Masks</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='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Bit in Explicit Mask</entry>
<entry>Value</entry>
<entry>Protects Against</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>ExplicitKeyType1</emphasis></entry>
<entry>(1<<0)</entry>
<entry>
Automatic determination of the key type associated with <emphasis>
Group1.</emphasis>
</entry>
</row>
<row>
<entry><emphasis>ExplicitKeyType2</emphasis></entry>
<entry>(1<<1)</entry>
<entry>
Automatic determination of the key type associated with <emphasis>
Group2.</emphasis>
</entry>
</row>
<row>
<entry><emphasis>ExplicitKeyType3</emphasis></entry>
<entry>(1<<2)</entry>
<entry>
Automatic determination of the key type associated with <emphasis>
Group3.</emphasis>
</entry>
</row>
<row>
<entry><emphasis>ExplicitKeyType4</emphasis></entry>
<entry>(1<<3)</entry>
<entry>
Automatic determination of the key type associated with <emphasis>
Group4.</emphasis>
</entry>
</row>
<row>
<entry><emphasis>ExplicitInterpret</emphasis></entry>
<entry>(1<<4)</entry>
<entry>
Application of any of the fields of a symbol interpretation to the
key in question.
</entry>
</row>
<row>
<entry><emphasis>ExplicitAutoRepeat</emphasis></entry>
<entry>(1<<5)</entry>
<entry>Automatic determination of auto-repeat status for the key, as
specified in a symbol interpretation.</entry>
</row>
<row>
<entry><emphasis>ExplicitBehavior</emphasis></entry>
<entry>(1<<6)</entry>
<entry>
Automatic assignment of the <emphasis>
XkbKB_Lock</emphasis>
behavior to the key, if the <emphasis>
XkbSI_LockingKey</emphasis>
flag is set in a symbol interpretation.
</entry>
</row>
<row>
<entry><emphasis>ExplicitVModMap</emphasis></entry>
<entry>(1<<7)</entry>
<entry>
Automatic determination of the virtual modifier map for the key
based on the actions assigned to the key and the symbol interpretations that
match the key.
</entry>
</row>
</tbody>
</tgroup>
</table>
<sect2 id='Obtaining_Explicit_Components_for_Keys_from_the_Server'>
<title>Obtaining Explicit Components for Keys from the Server</title>
<para>
To obtain the explicit components (the <emphasis>
explicit</emphasis>
array) for a subset of the keys in a keyboard description, use <emphasis>
XkbGetKeyExplicitComponents</emphasis>.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Status <emphasis>
XkbGetKeyExplicitComponents</emphasis>
(<emphasis>
dpy</emphasis>
,<emphasis>
first</emphasis>
,<emphasis>
num</emphasis>
,<emphasis>
xkb</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
dpy</emphasis>
; /* connection to server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
first</emphasis>
; /* keycode of first key to fetch */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
num</emphasis>
; /* number of keys for which to get explicit info */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description in which to put results */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetKeyExplicitComponents</emphasis>
sends a request to the server to obtain the explicit components for <emphasis>
num</emphasis>
keys on the keyboard starting with key <emphasis>
first</emphasis>
. It waits for a reply and returns the explicit components in the <emphasis>
server</emphasis>
-><emphasis>
explicit</emphasis>
array of <emphasis>
xkb</emphasis>
. If successful, <emphasis>
XkbGetKeyExplicitComponents</emphasis>
returns <emphasis>
Success</emphasis>
. The <emphasis>
xkb</emphasis>
parameter must be a pointer to a valid Xkb keyboard description.
</para>
<para>
If the <emphasis>
server</emphasis>
map in the <emphasis>
xkb</emphasis>
parameter has not been allocated, <emphasis>
XkbGetKeyExplicitComponents</emphasis>
allocates and initializes it before obtaining the actions.
</para>
<para>
If the server does not have a compatible version of Xkb, or the Xkb extension
has not been properly initialized, <emphasis>
XkbGetKeyExplicitComponents</emphasis>
returns <emphasis>
BadMatch</emphasis>
. If <emphasis>
num</emphasis>
is less than 1 or greater than <emphasis>
XkbMaxKeyCount</emphasis>
, <emphasis>
XkbGetKeyExplicitComponents</emphasis>
returns <emphasis>
BadValue</emphasis>
. If any allocation errors occur, <emphasis>
XkbGetKeyExplicitComponents</emphasis>
returns <emphasis>
BadAlloc</emphasis>
.
</para>
</sect2>
</sect1>
<sect1 id='Virtual_Modifier_Mapping'>
<title>Virtual Modifier Mapping</title>
<para>
The <emphasis>
vmods</emphasis>
member of the server map is a fixed-length array containing <emphasis>
XkbNumVirtualMods</emphasis>
entries. Each entry corresponds to a virtual modifier and provides the binding
of the virtual modifier to the real modifier bits. Each entry in the <emphasis>
vmods</emphasis>
array is a bitwise inclusive OR of the legal modifier masks:
</para>
<literallayout>
<emphasis>ShiftMask</emphasis>
<emphasis>LockMask</emphasis>
<emphasis>ControlMask</emphasis>
<emphasis>Mod1Mask</emphasis>
<emphasis>Mod2Mask</emphasis>
<emphasis>Mod3Mask</emphasis>
<emphasis>Mod4Mask</emphasis>
<emphasis>Mod5Mask</emphasis>
</literallayout>
<para>
The <emphasis>
vmodmap</emphasis>
member of the server map is similar to the <emphasis>
modmap</emphasis>
array of the client map (see section 15.4), but is used to define the virtual
modifier mapping for each key. Like the <emphasis>
modmap</emphasis>
member, it is indexed by keycode, and each entry is a mask representing the
virtual modifiers bound to the corresponding key:
</para>
<itemizedlist>
<listitem>
<para>
Each of the bits in a <emphasis>
vmodmap</emphasis>
entry represents an index into the <emphasis>
vmods</emphasis>
member. That is, bit 0 of a <emphasis>
vmodmap</emphasis>
entry refers to index 0 of the <emphasis>
vmods</emphasis>
array, bit 1 refers to index 1, and so on.
</para>
</listitem>
<listitem>
<para>
If a bit is set in the <emphasis>
vmodmap</emphasis>
entry for a key, that key is bound to the corresponding virtual modifier in
the <emphasis>
vmods</emphasis>
array.
</para>
</listitem>
</itemizedlist>
<para>
The <emphasis>
vmodmap</emphasis>
and <emphasis>
vmods</emphasis>
members of the server map are the "master" virtual modifier definitions. Xkb
automatically propagates any changes to these fields to all other fields that
use virtual modifier mappings.
</para>
<para>
The overall relationship of fields dealing with virtual modifiers in an Xkb
keyboard description are shown in Figure 16.2.
</para>
<mediaobject>
<imageobject> <imagedata format="SVG" fileref="XKBlib-17.svg"/>
</imageobject>
<caption>Virtual Modifier Relationships</caption>
</mediaobject>
<!--
<H5 CLASS="Figure">
Virtual Modifier Relationships</H5>
-->
<sect2 id='Obtaining_Virtual_Modifier_Bindings_from_the_Server'>
<title>Obtaining Virtual Modifier Bindings from the Server</title>
<para>
To obtain a subset of the virtual modifier bindings (the <emphasis>
vmods</emphasis>
array) in a keyboard description, use <emphasis>
XkbGetVirtualMods</emphasis>
:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Status <emphasis>
XkbGetVirtualMods</emphasis>
(<emphasis>
dpy</emphasis>
,<emphasis>
which</emphasis>
,<emphasis>
xkb</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
dpy</emphasis>
; /* connection to server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
which</emphasis>
; /* mask indicating virtual modifier bindings to get */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description where results will be placed */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetVirtualMods</emphasis>
sends a request to the server to obtain the <emphasis>
vmods</emphasis>
entries for the virtual modifiers specified in the mask, <emphasis>
which</emphasis>
, and waits for a reply. See section 7.1 for a description of how to determine
the virtual modifier mask. For each bit set in <emphasis>
which</emphasis>
, <emphasis>
XkbGetVirtualMods</emphasis>
updates the corresponding virtual modifier definition in the <emphasis>
server->vmods</emphasis>
array of <emphasis>
xkb</emphasis>
. The <emphasis>
xkb</emphasis>
parameter must be a pointer to a valid Xkb keyboard description. If
successful, <emphasis>
XkbGetVirtualMods</emphasis>
returns <emphasis>
Success</emphasis>
.
</para>
<para>
If the <emphasis>
server</emphasis>
map has not been allocated in the <emphasis>
xkb</emphasis>
parameter, <emphasis>
XkbGetVirtualMods</emphasis>
allocates and initializes it before obtaining the virtual modifier bindings.
</para>
<para>
If the server does not have a compatible version of Xkb, or the Xkb extension
has not been properly initialized, <emphasis>
XkbGetVirtualMods</emphasis>
returns <emphasis>
BadMatch</emphasis>
. Any errors in allocation cause <emphasis>
XkbGetVirtualMods </emphasis>
to return <emphasis>
BadAlloc</emphasis>.
</para>
</sect2>
<sect2 id='Obtaining_Per_Key_Virtual_Modifier_Mappings_from_the_Server'>
<title>Obtaining Per-Key Virtual Modifier Mappings from the Server</title>
<para>
To obtain the virtual modifier map (the <emphasis>
vmodmap</emphasis>
array) for a subset of the keys in a keyboard description, use <emphasis>
XkbGetKeyVirtualModMap</emphasis>
:
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Status <emphasis>
XkbGetKeyVirtualModMap</emphasis>
(<emphasis>
dpy</emphasis>
,<emphasis>
first</emphasis>
,<emphasis>
num</emphasis>
,<emphasis>
xkb</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
dpy</emphasis>
; /* connection to server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
first</emphasis>
; /* keycode of first key to fetch */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
num</emphasis>
; /* # keys for which virtual mod maps are desired */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description where results will be placed */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetKeyVirutalModmap </emphasis>
sends a request to the server to obtain the virtual modifier mappings for
<emphasis>
num</emphasis>
keys on the keyboard starting with key <emphasis>
first</emphasis>
. It waits for a reply and returns the virtual modifier mappings in the
<emphasis>
server</emphasis>
-><emphasis>
vmodmap</emphasis>
array of <emphasis>
xkb</emphasis>
. If successful, <emphasis>
XkbGetKeyVirtualModMap</emphasis>
returns <emphasis>
Success</emphasis>
. The <emphasis>
xkb</emphasis>
parameter must be a pointer to a valid Xkb keyboard description
</para>
<para>
If the <emphasis>
server</emphasis>
map in the <emphasis>
xkb</emphasis>
parameter has not been allocated, <emphasis>
XkbGetKeyVirtualModMap</emphasis>
allocates and initializes it before obtaining the virtual modifier mappings.
</para>
<para>
If the server does not have a compatible version of Xkb, or the Xkb extension
has not been properly initialized, <emphasis>
XkbGetKeyVirtualModMap</emphasis>
returns <emphasis>
BadMatch</emphasis>
. If <emphasis>
num</emphasis>
is less than 1 or greater than <emphasis>
XkbMaxKeyCount</emphasis>
, <emphasis>
XkbGetKeyVirtualModMap</emphasis>
returns <emphasis>
BadValue</emphasis>
. If any allocation errors occur, <emphasis>
XkbGetKeyVirtualModMap</emphasis>
returns <emphasis>
BadAlloc</emphasis>
.
</para>
</sect2>
</sect1>
</chapter>
|