1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
|
<chapter id='Keyboard_Controls'>
<title>Keyboard Controls</title>
<para>
The Xkb extension is composed of two parts: a server extension, and a
client-side X library extension. This chapter discusses functions used to
modify controls effecting the behavior of the server portion of the Xkb
extension. Chapter 11 discusses functions used to modify controls that affect
only the behavior of the client portion of the extension; those controls are
known as Library Controls.
</para>
<para>
Xkb contains control features that affect the entire keyboard, known as global
keyboard controls. Some of the controls may be selectively enabled and
disabled; these controls are known as the <emphasis>
Boolean Controls</emphasis>
. Boolean Controls can be turned on or off under program control and can also
be automatically set to an on or off condition when a client program exits. The
remaining controls, known as the <emphasis>
Non-Boolean Controls</emphasis>
, are always active. The<emphasis>
XkbControlsRec</emphasis>
structure describes the current state of most of the global controls and the
attributes effecting the behavior of each of these Xkb features. This chapter
describes the Xkb controls and how to manipulate them.
</para>
<para>
There are two possible components for each of the Boolean Controls: attributes
describing how the control should work, and a state describing whether the
behavior as a whole is enabled or disabled. The attributes and state for most
of these controls are held in the <emphasis>
XkbControlsRec</emphasis>
structure (see section 10.8).
</para>
<para>
You can manipulate the Xkb controls individually, via convenience functions, or
as a whole. To treat them as a group, modify an <emphasis>
XkbControlsRec</emphasis>
structure to describe all of the changes to be made, and then pass that
structure and appropriate flags to an Xkb library function, or use a <emphasis>
XkbControlsChangesRec</emphasis>
(see section 10.10.1) to reduce network traffic. When using a convenience
function to manipulate one control individually, you do not use an <emphasis>
XkbControlsRec</emphasis>
structure directly.
</para>
<para>
The Xkb controls are grouped as shown in Table 10.1. <!-- xref -->
</para>
<table frame='topbot'>
<title>Xkb Keyboard Controls</title>
<?dbfo keep-together="always" ?>
<tgroup cols='3' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.5*'/>
<colspec colname='c2' colwidth='1.5*'/>
<colspec colname='c3' colwidth='1.0*'/>
<thead>
<row rowsep='1'>
<entry>Type of Control</entry>
<entry>Control Name</entry>
<entry>Boolean Control?</entry>
</row>
</thead>
<tbody>
<row>
<entry>Controls for enabling and disabling other controls</entry>
<entry>EnabledControls</entry>
<entry>No</entry>
</row>
<row>
<entry></entry>
<entry>AutoReset</entry>
<entry>No</entry>
</row>
<row>
<entry>Control for bell behavior</entry>
<entry>AudibleBell</entry>
<entry>Boolean</entry>
</row>
<row>
<entry>Controls for repeat key behavior</entry>
<entry>PerKeyRepeat</entry>
<entry>No</entry>
</row>
<row>
<entry></entry>
<entry>RepeatKeys</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>DetectableAutorepeat</entry>
<entry>Boolean</entry>
</row>
<row>
<entry>Controls for keyboard overlays</entry>
<entry>Overlay1</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>Overlay2</entry>
<entry>Boolean</entry>
</row>
<row>
<entry>Controls for using the mouse from the keyboard</entry>
<entry>MouseKeys</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>MouseKeysAccel</entry>
<entry>Boolean</entry>
</row>
<row>
<entry>Controls for better keyboard access by </entry>
<entry>AccessXFeedback</entry>
<entry>Boolean</entry>
</row>
<row>
<entry>physically impaired persons</entry>
<entry>AccessXKeys</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>AccessXTimeout</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>BounceKeys</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>SlowKeys</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>StickyKeys</entry>
<entry>Boolean</entry>
</row>
<row>
<entry>Controls for general keyboard mapping</entry>
<entry>GroupsWrap</entry>
<entry>No</entry>
</row>
<row>
<entry></entry>
<entry>IgnoreGroupLock</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>IgnoreLockMods</entry>
<entry>No</entry>
</row>
<row>
<entry></entry>
<entry>InternalMods</entry>
<entry>No</entry>
</row>
<row>
<entry>Miscellaneous per-client controls</entry>
<entry>GrabsUseXKBState</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>LookupStateWhenGrabbed</entry>
<entry>Boolean</entry>
</row>
<row>
<entry></entry>
<entry>SendEventUsesXKBState</entry>
<entry>Boolean</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The individual categories and controls are described first, together with
functions for manipulating them. A description of the <emphasis>
XkbControlsRec</emphasis>
structure and the general functions for dealing with all of the controls at
once follow at the end of the chapter.
</para>
<sect1 id='Controls_that_Enable_and_Disable_Other_Controls'>
<title>Controls that Enable and Disable Other Controls</title>
<para>
Enable and disable the boolean controls under program control by using the
<emphasis>
EnabledControls</emphasis>
control; enable and disable them upon program exit by configuring the
<emphasis>
AutoReset</emphasis>
control.
</para>
<sect2 id='The_EnabledControls_Control'>
<title>The EnabledControls Control</title>
<para>
The <emphasis>
EnabledControls</emphasis>
control is a bit mask where each bit that is turned on means the corresponding
control is enabled, and when turned off, disabled. It corresponds to the
<emphasis>
enabled_ctrls</emphasis>
field of an <emphasis>
XkbControlsRec</emphasis>
structure (see section 10.8). The bits describing which controls are turned on
or off are defined in Table 10.7. <!-- xref -->
</para>
<para>
Use <emphasis>
XkbChangeEnabledControls</emphasis>
to manipulate the <emphasis>
EnabledControls</emphasis>
control.
</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>
XkbChangeEnabledControls</emphasis>
(<emphasis>
dpy</emphasis>
, <emphasis>
device_spec</emphasis>
, <emphasis>
mask</emphasis>
,<emphasis>
values</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* keyboard device to modify */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
mask</emphasis>
; /* 1 bit -> controls to enable / disable */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
values</emphasis>
; /* 1 bit => enable, 0 bit => disable */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
The <emphasis>
mask</emphasis>
parameter specifies the boolean controls to be enabled or disabled, and the
<emphasis>
values</emphasis>
mask specifies the new state for those controls. Valid values for both of
these masks are composed of a bitwise inclusive OR of bits taken from the set
of mask bits in Table 10.7, using only those masks with "ok" in the <emphasis>
enabled_ctrls</emphasis>
column.
</para>
<para>
If the X server does not support a compatible version of Xkb or the Xkb
extension has not been properly initialized, <emphasis>
XkbChangeEnabledControls</emphasis>
returns <emphasis>
False</emphasis>
; otherwise, it sends the request to the X server and returns <emphasis>
True</emphasis>
.
</para>
<para>
Note that the <emphasis>
EnabledControls</emphasis>
control only enables and disables controls; it does not configure them. Some
controls, such as the <emphasis>
AudibleBell</emphasis>
control, have no configuration attributes and are therefore manipulated solely
by enabling and disabling them. Others, however, have additional attributes to
configure their behavior. For example, the <emphasis>
RepeatControl</emphasis>
control uses <emphasis>
repeat_delay</emphasis>
and <emphasis>
repeat_interval</emphasis>
fields to describe the timing behavior of keys that repeat. The <emphasis>
RepeatControl</emphasis>
behavior is turned on or off depending on the value of the <emphasis>
XkbRepeatKeysMask</emphasis>
bit, but you must use other means, as described in this chapter, to configure
its behavior in detail.
</para>
</sect2>
<sect2 id='The_AutoReset_Control'>
<title>The AutoReset Control</title>
<para>
You can configure the boolean controls to automatically be enabled or disabled
when a program exits. This capability is controlled via two masks maintained in
the X server on a per-client basis. There is no client-side Xkb data structure
corresponding to these masks. Whenever the client exits for any reason, any
boolean controls specified in the <emphasis>
auto-reset mask</emphasis>
are set to the corresponding value from the <emphasis>
auto-reset values</emphasis>
mask. This makes it possible for clients to "clean up after themselves"
automatically, even if abnormally terminated. The bits used in the masks
correspond to the <emphasis>
EnabledControls</emphasis>
control bits.
</para>
<para>
For example, a client that replaces the keyboard bell with some other audible
cue might want to turn off the <emphasis>
AudibleBell</emphasis>
control to prevent the server from also generating a sound and avoid
cacophony. If the client were to exit without resetting the <emphasis>
AudibleBell </emphasis>
control, the user would be left without any feedback at all. Setting <emphasis>
AudibleBell</emphasis>
in both the auto-reset mask and auto-reset values guarantees that the audible
bell will be turned back on when the client exits.
</para>
<para>
To get the current values of the auto-reset controls, use <emphasis>
XkbGetAutoResetControls</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'>
Bool <emphasis>
XkbGetAutoResetControls</emphasis>
(<emphasis>
dpy</emphasis>
, <emphasis>
auto_ctrls</emphasis>
, <emphasis>
auto_values</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
auto_ctrls</emphasis>
; /* specifies which bits in <emphasis>
auto_values</emphasis>
are relevant */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
auto_values</emphasis>
; /* 1 bit => corresponding control has auto-reset on */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetAutoResetControls</emphasis>
backfills <emphasis>
auto_ctrls</emphasis>
and <emphasis>
auto_values</emphasis>
with the <emphasis>
AutoReset</emphasis>
control attributes for this particular client. It returns <emphasis>
True</emphasis>
if successful, and <emphasis>
False</emphasis>
otherwise.
</para>
<para>
To change the current values of the <emphasis>
AutoReset</emphasis>
control attributes, use <emphasis>
XkbSetAutoResetControls.</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'>
Bool <emphasis>
XkbSetAutoResetControls</emphasis>
(<emphasis>
dpy</emphasis>
, <emphasis>
changes</emphasis>
,<emphasis>
auto_ctrls</emphasis>
, <emphasis>
auto_values</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
changes</emphasis>
; /* controls for which to change auto-reset values */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
auto_ctrls</emphasis>
; /* controls from changes that should auto reset */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
auto_values</emphasis>
; /* 1 bit => auto-reset on */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetAutoResetControls changes the auto-reset status and associated auto-reset
values for the controls selected by </emphasis>
<emphasis>
changes</emphasis>
<emphasis>
. For any control selected by </emphasis>
<emphasis>
changes</emphasis>
<emphasis>
, if the corresponding bit is set in </emphasis>
<emphasis>
auto_ctrls</emphasis>
<emphasis>
, the control is configured to auto-reset when the client exits. If the
corresponding bit in </emphasis>
<emphasis>
auto_values</emphasis>
<emphasis>
is on, the control is turned on when the client exits; if zero, the control is
turned off when the client exits.</emphasis>
For any control selected by <emphasis>
changes</emphasis>
, if the corresponding bit is not set in <emphasis>
auto_ctrls</emphasis>
, the control is configured to not reset when the client exits. For example:
</para>
<para>
<emphasis>
To leave the auto-reset controls for </emphasis>
<emphasis>
StickyKeys</emphasis>
<emphasis>
the way they are:</emphasis>
</para>
<para><programlisting>
ok = XkbSetAutoResetControls(dpy, 0, 0, 0);
</programlisting></para>
<para>
<emphasis>
To change the auto-reset controls so that </emphasis>
<emphasis>
StickyKeys</emphasis>
<emphasis>
are unaffected when the client exits:</emphasis>
</para>
<para><programlisting>
ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, 0, 0);
</programlisting></para>
<para>
<emphasis>
To change the auto-reset controls so that </emphasis>
<emphasis>
StickyKeys</emphasis>
<emphasis>
are turned off when the client exits:</emphasis>
</para>
<para><programlisting>
ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask, 0);
</programlisting></para>
<para>
<emphasis>
To change the auto-reset controls so that </emphasis>
<emphasis>
StickyKeys</emphasis>
<emphasis>
are turned on when the client exits:</emphasis>
</para>
<para><programlisting>
ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask,
XkbStickyKeysMask);
</programlisting></para>
<para>
<emphasis>
XkbSetAutoResetControls</emphasis>
backfills <emphasis>
auto_ctrls</emphasis>
and <emphasis>
auto_values</emphasis>
with the auto-reset controls for this particular client. Note that all of the
bits are valid in the returned values, not just the ones selected in the
<emphasis>
changes</emphasis>
mask.
</para>
</sect2>
</sect1>
<sect1 id='Control_for_Bell_Behavior'>
<title>Control for Bell Behavior</title>
<para>
The X server’s generation of sounds is controlled by the <emphasis>
AudibleBell</emphasis>
control. Configuration of different bell sounds is discussed in Chapter 9.
</para>
<sect2 id='The_AudibleBell_Control'>
<title>The AudibleBell Control</title>
<para>
The <emphasis>
AudibleBell</emphasis>
control is a boolean control that has no attributes. As such, you may enable
and disable it using either the <emphasis>
EnabledControls</emphasis>
control or the <emphasis>
AutoReset</emphasis>
control discussed in section 10.1.1. When enabled, protocol requests to <!-- xref -->
generate a sound result in the X server actually producing a real sound; when
disabled, requests to the server to generate a sound are ignored unless the
sound is forced. See section 9.2. <!-- xref -->
</para>
</sect2>
</sect1>
<sect1 id='Controls_for_Repeat_Key_Behavior'>
<title>Controls for Repeat Key Behavior</title>
<para>
The repeating behavior of keyboard keys is governed by three controls, the
<emphasis>
PerKeyRepeat</emphasis>
control, which is always active, and the <emphasis>
RepeatKeys</emphasis>
and <emphasis>
DetectableAutorepeat</emphasis>
controls, which are boolean controls that may be enabled and disabled.
<emphasis>
PerKeyRepeat</emphasis>
determines which keys are allowed to repeat. <emphasis>
RepeatKeys</emphasis>
governs the behavior of an individual key when it is repeating. <emphasis>
DetectableAutorepeat</emphasis>
allows a client to detect when a key is repeating as a result of being held
down.
</para>
<sect2 id='The_PerKeyRepeat_Control'>
<title>The PerKeyRepeat Control</title>
<para>
The <emphasis>
PerKeyRepeat</emphasis>
control is a bitmask long enough to contain a bit for each key on the device;
it determines which individual keys are allowed to repeat. The Xkb <emphasis>
PerKeyRepeat</emphasis>
control provides no functionality different from that available via the core X
protocol. There are no convenience functions in Xkb for manipulating this
control. The <emphasis>
PerKeyRepeat</emphasis>
control settings are carried in the <emphasis>
per_key_repeat</emphasis>
field of an <emphasis>
XkbControlsRec</emphasis>
structure, discussed in section 10.8. <!-- xref -->
</para>
</sect2>
<sect2 id='The_RepeatKeys_Control'>
<title>The RepeatKeys Control</title>
<para>
The core protocol allows only control over whether or not the entire keyboard
or individual keys should auto-repeat when held down. <emphasis>
RepeatKeys</emphasis>
is a boolean control that extends this capability by adding control over the
delay until a key begins to repeat and the rate at which it repeats. <emphasis>
RepeatKeys</emphasis>
is coupled with the core auto-repeat control: when <emphasis>
RepeatKeys</emphasis>
is enabled or disabled, the core auto-repeat is enabled or disabled and vice
versa.
</para>
<para>
Auto-repeating keys are controlled by two attributes. The first, <emphasis>
timeout</emphasis>
, is the delay after the initial press of an auto-repeating key and the first
generated repeat event. The second, <emphasis>
interval</emphasis>
, is the delay between all subsequent generated repeat events. As with all
boolean controls, configuring the attributes that determine how the control
operates does not automatically enable the control as a whole; see section 10.1.
</para>
<para>
To get the current attributes of the <emphasis>
RepeatKeys</emphasis>
control for a keyboard device, use <emphasis>
XkbGetAutoRepeatRate</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'>
Bool <emphasis>
XkbGetAutoRepeatRate</emphasis>
(<emphasis>
display, device_spec, timeout_rtrn, interval_rtrn</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* desired device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
* timeout_rtrn</emphasis>
; /* backfilled with initial repeat delay, ms */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
* interval_rtrn</emphasis>
; /* backfilled with subsequent repeat delay, ms */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetAutoRepeatRate</emphasis>
queries the server for the current values of the <emphasis>
RepeatControls</emphasis>
control attributes, backfills <emphasis>
timeout_rtrn</emphasis>
and <emphasis>
interval_rtrn</emphasis>
with them, and returns <emphasis>
True</emphasis>
. If a compatible version of the Xkb extension is not available in the server
<emphasis>
XkbGetAutoRepeatRate</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
<para>
To set the attributes of the RepeatKeys control for a keyboard device, use
<emphasis>
XkbSetAutoRepeatRate</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'>
Bool <emphasis>
XkbSetAutoRepeatRate</emphasis>
(<emphasis>
display, device_spec, timeout, interval</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device to configure, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
timeout</emphasis>
; /* initial delay, ms */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
interval</emphasis>
; /* delay between repeats, ms */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetAutoRepeatRate</emphasis>
sends a request to the X server to configure the <emphasis>
AutoRepeat</emphasis>
control attributes to the values specified in <emphasis>
timeout</emphasis>
and <emphasis>
interval</emphasis>
.
</para>
<para>
<emphasis>
XkbSetAutoRepeatRate</emphasis>
does not wait for a reply; it normally returns <emphasis>
True</emphasis>
. Specifying a zero value for either <emphasis>
timeout</emphasis>
or <emphasis>
interval</emphasis>
causes the server to generate a <emphasis>
BadValue</emphasis>
protocol error. If a compatible version of the Xkb extension is not available
in the server, <emphasis>
XkbSetAutoRepeatRate</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
</sect2>
<sect2 id='The_DetectableAutorepeat_Control'>
<title>The DetectableAutorepeat Control</title>
<para>
Auto-repeat is the generation of multiple key events by a keyboard when the
user presses a key and holds it down. Keyboard hardware and device-dependent X
server software often implement auto-repeat by generating multiple <emphasis>
KeyPress</emphasis>
events with no intervening <emphasis>
KeyRelease</emphasis>
event. The standard behavior of the X server is to generate a <emphasis>
KeyRelease</emphasis>
event for every <emphasis>
KeyPress</emphasis>
event. If the keyboard hardware and device-dependent software of the X server
implement auto-repeat by generating multiple <emphasis>
KeyPress</emphasis>
events, the device-independent part of the X server by default synthetically
generates a <emphasis>
KeyRelease</emphasis>
event after each <emphasis>
KeyPress</emphasis>
event. This provides predictable behavior for X clients, but does not allow
those clients to detect the fact that a key is auto-repeating.
</para>
<para>
Xkb allows clients to request <emphasis>
detectable auto-repeat</emphasis>
. If a client requests and the server supports <emphasis>
DetectableAutorepeat</emphasis>
, Xkb generates <emphasis>
KeyRelease</emphasis>
events only when the key is physically released. If <emphasis>
DetectableAutorepeat</emphasis>
is not supported or has not been requested, the server synthesizes a <emphasis>
KeyRelease</emphasis>
event for each repeating <emphasis>
KeyPress</emphasis>
event it generates.
</para>
<para>
<emphasis>
DetectableAutorepeat</emphasis>
, unlike the other controls in this chapter, is not contained in the <emphasis>
XkbControlsRec</emphasis>
structure, nor can it be enabled or disabled via the <emphasis>
EnabledControls</emphasis>
control. Instead, query and set <emphasis>
DetectableAutorepeat</emphasis>
using <emphasis>
XkbGetDetectableAutorepeat</emphasis>
and <emphasis>
XkbSetDetectableAutorepeat</emphasis>
.
</para>
<para>
<emphasis>
DetectableAutorepeat</emphasis>
is a condition that applies to all keyboard devices for a client’s
connection to a given X server; it cannot be selectively set for some devices
and not for others. For this reason, none of the Xkb library functions
involving <emphasis>
DetectableAutorepeat</emphasis>
involve a device specifier.
</para>
<para>
To determine whether or not the server supports <emphasis>
DetectableAutorepeat</emphasis>
, use <emphasis>
XkbGetDetectableAutorepeat</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'>
Bool <emphasis>
XkbGetDetectableAutorepeat</emphasis>
(<emphasis>
display, supported_rtrn</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Bool *<emphasis>
supported_rtrn</emphasis>
; /* backfilled <emphasis>
True</emphasis>
if <emphasis>
DetectableAutorepeat</emphasis>
supported */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetDetectableAutorepeat</emphasis>
queries the server for the current state of <emphasis>
DetectableAutorepeat</emphasis>
and waits for a reply. If <emphasis>
supported_rtrn</emphasis>
is not <emphasis>
NULL</emphasis>
, it backfills supported_rtrn with <emphasis>
True</emphasis>
if the server supports <emphasis>
DetectableAutorepeat</emphasis>
, and <emphasis>
False</emphasis>
otherwise. <emphasis>
XkbGetDetectableAutorepeat</emphasis>
returns the current state of <emphasis>
DetectableAutorepeat</emphasis>
for the requesting client: <emphasis>
True</emphasis>
if <emphasis>
DetectableAutorepeat</emphasis>
is set, and <emphasis>
False</emphasis>
otherwise.
</para>
<para>
To set <emphasis>
DetectableAutorepeat</emphasis>
, use <emphasis>
XkbSetDetectableAutorepeat</emphasis>
. This request affects all keyboard activity for the requesting client only;
other clients still see the expected nondetectable auto-repeat behavior, unless
they have requested otherwise.
</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>
XkbSetDetectableAutorepeat</emphasis>
(<emphasis>
display, detectable, supported_rtrn</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Bool<emphasis>
detectable</emphasis>
; /* <emphasis>
True</emphasis>
=> set <emphasis>
DetectableAutorepeat</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
Bool *<emphasis>
supported_rtrn</emphasis>
; /* backfilled <emphasis>
True</emphasis>
if <emphasis>
DetectableAutorepeat</emphasis>
supported */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetDetectableAutorepeat</emphasis>
sends a request to the server to set <emphasis>
DetectableAutorepeat</emphasis>
on for the current client if <emphasis>
detectable</emphasis>
is <emphasis>
True</emphasis>
, and off it <emphasis>
detectable</emphasis>
is <emphasis>
False</emphasis>
; it then waits for a reply. If <emphasis>
supported_rtrn</emphasis>
is not <emphasis>
NULL</emphasis>
, <emphasis>
XkbSetDetectableAutorepeat</emphasis>
backfills <emphasis>
supported_rtrn</emphasis>
with <emphasis>
True</emphasis>
if the server supports <emphasis>
DetectableAutorepeat</emphasis>
, and <emphasis>
False</emphasis>
if it does not. <emphasis>
XkbSetDetectableAutorepeat</emphasis>
returns the current state of <emphasis>
DetectableAutorepeat</emphasis>
for the requesting client: <emphasis>
True</emphasis>
if <emphasis>
DetectableAutorepeat</emphasis>
is set, and <emphasis>
False</emphasis>
otherwise.
</para>
</sect2>
</sect1>
<sect1 id='Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls'>
<title>Controls for Keyboard Overlays (Overlay1 and Overlay2 Controls)</title>
<para>
A keyboard overlay allows some subset of the keyboard to report alternate
keycodes when the overlay is enabled. For example, a keyboard overlay can be
used to simulate a numeric or editing keypad on a keyboard that does not
actually have one by reusing some portion of the keyboard as an overlay. This
technique is very common on portable computers and embedded systems with small
keyboards.
</para>
<para>
Xkb includes direct support for two keyboard overlays, using the <emphasis>
Overlay1</emphasis>
and <emphasis>
Overlay2</emphasis>
controls. When <emphasis>
Overlay1</emphasis>
is enabled, all of the keys that are members of the first keyboard overlay
generate an alternate keycode. When <emphasis>
Overlay2</emphasis>
is enabled, all of the keys that are members of the second keyboard overlay
generate an alternate keycode. The two overlays are mutually exclusive; any
particular key may be in at most one overlay. <emphasis>
Overlay1</emphasis>
and <emphasis>
Overlay2</emphasis>
are boolean controls. As such, you may enable and disable them using either
the <emphasis>
EnabledControls</emphasis>
control or the <emphasis>
AutoReset</emphasis>
control discussed in section 10.1.1. <!-- xref -->
</para>
<para>
To specify the overlay to which a key belongs and the alternate keycode it
should generate when that overlay is enabled, assign it either the <emphasis>
XkbKB_Overlay1</emphasis>
or <emphasis>
XkbKB_Overlay2</emphasis>
key behaviors, as described in section 16.2. <!-- xref -->
</para>
</sect1>
<sect1 id='Controls_for_Using_the_Mouse_from_the_Keyboard'>
<title>Controls for Using the Mouse from the Keyboard</title>
<para>
Using Xkb, it is possible to configure the keyboard to allow simulation of the
X pointer device. This simulation includes both movement of the pointer itself
and press and release events associated with the buttons on the pointer. Two
controls affect this behavior: the <emphasis>
MouseKeys</emphasis>
control determines whether or not simulation of the pointer device is active,
as well as configuring the default button; the <emphasis>
MouseKeysAccel</emphasis>
control determines the movement characteristics of the pointer when simulated
via the keyboard. Both of them are boolean controls; as such, you may enable
and disable them using either the <emphasis>
EnabledControls</emphasis>
control or the <emphasis>
AutoReset</emphasis>
control discussed in section 10.1.1. The individual keys that simulate <!-- xref -->
different aspects of the pointer device are determined by the keyboard mapping,
discussed in Chapter 16. <!-- xref -->
</para>
<sect2 id='The_MouseKeys_Control'>
<title>The MouseKeys Control</title>
<para>
The <emphasis>
MouseKeys</emphasis>
control allows a user to control all the mouse functions from the keyboard.
When <emphasis>
MouseKeys</emphasis>
are enabled, all keys with <emphasis>
MouseKeys</emphasis>
actions bound to them generate core pointer events instead of normal <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events.
</para>
<para>
The <emphasis>
MouseKeys</emphasis>
control has a single attribute, <emphasis>
mk_dflt_btn</emphasis>
that specifies the core button number to be used by mouse keys actions that do
not explicitly specify a button. There is no convenience function for getting
or setting the attribute; instead use <emphasis>
XkbGetControls</emphasis>
and <emphasis>
XkbSetControls</emphasis>
(see sections 10.9 and 10.10). <!-- xref -->
</para>
<note><para><emphasis>
MouseKeys</emphasis>
can also be turned on and off by pressing the key combination necessary to
produce an <emphasis>
XK_Pointer_EnableKeys</emphasis>
keysym. The de facto default standard for this is <emphasis>
Shift+Alt+NumLock</emphasis>
, but this may vary depending on the keymap.</para></note>
</sect2>
<sect2 id='The_MouseKeysAccel_Control'>
<title>The MouseKeysAccel Control</title>
<para>
When the <emphasis>
MouseKeysAccel</emphasis>
control is enabled, the effect of a key-activated pointer motion action
changes as a key is held down. If the control is disabled, pressing a
mouse-pointer key yields one mouse event. When <emphasis>
MouseKeysAccel</emphasis>
is enabled, mouse movement is defined by an initial distance specified in the
<emphasis>
XkbSA_MovePtr</emphasis>
action and the following fields in the <emphasis>
XkbControlsRec</emphasis>
structure (see section 10.8). <!-- xref -->
</para>
<table frame='topbot'>
<title>MouseKeysAccel Fields</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>Field</entry>
<entry>Function</entry>
</row>
</thead>
<tbody>
<row>
<entry>mk_delay</entry>
<entry>Time (ms) between the initial key press and the first repeated
motion event</entry>
</row>
<row>
<entry>mk_interval</entry>
<entry>Time (ms) between repeated motion events</entry>
</row>
<row>
<entry>mk_time_to_max</entry>
<entry>Number of events (count) before the pointer reaches maximum
speed</entry>
</row>
<row>
<entry>mk_max_speed</entry>
<entry>The maximum speed (in pixels per event) the pointer reaches</entry>
</row>
<row>
<entry>mk_curve</entry>
<entry>The ramp used to reach maximum pointer speed</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
There are no convenience functions to query or change the attributes of the
<emphasis>
MouseKeysAccel</emphasis>
control; instead use <emphasis>
XkbGetControls</emphasis>
and <emphasis>
XkbSetControls</emphasis>
(see sections 10.9 and 10.10). <!-- xref -->
</para>
<para>
The effects of the attributes of the <emphasis>
MouseKeysAccel</emphasis>
control depend on whether the <emphasis>
XkbSA_MovePtr</emphasis>
action (see section 16.1) specifies relative or absolute pointer motion. <!-- xref -->
</para>
<sect3 id='Absolute_Pointer_Motion'>
<title>Absolute Pointer Motion</title>
<para>
If an <emphasis>
XkbSA_MovePtr</emphasis>
action specifies an absolute position for one of the coordinates but still
allows acceleration, all repeated events contain any absolute coordinates
specified in the action. For example, if the <emphasis>
XkbSA_MovePtr</emphasis>
action specifies an absolute position for the X direction, but a relative
motion for the Y direction, the pointer accelerates in the Y direction, but
stays at the same X position.
</para>
</sect3>
<sect3 id='Relative_Pointer_Motion'>
<title>Relative Pointer Motion</title>
<para>
If the <emphasis>
XkbSA_MovePtr</emphasis>
action specifies relative motion, the initial event always moves the cursor
the distance specified in the action. After <emphasis>
mk_delay</emphasis>
milliseconds, a second motion event is generated, and another occurs every
<emphasis>
mk_interval</emphasis>
milliseconds until the user releases the key.
</para>
<para>
Between the time of the second motion event and <emphasis>
mk_time_to_max</emphasis>
intervals, the change in pointer distance per interval increases with each
interval. After <emphasis>
mk_time_to_max</emphasis>
intervals have elapsed, the change in pointer distance per interval remains
the same and is calculated by multiplying the original distance specified in
the action by <emphasis>
mk_max_speed</emphasis>
.
</para>
<para>
For example, if the <emphasis>
XkbSA_MovePtr</emphasis>
action specifies a relative motion in the X direction of 5, <emphasis>
mk_delay</emphasis>
=160, <emphasis>
mk_interval</emphasis>
=40, <emphasis>
mk_time_to_max</emphasis>
=30, and <emphasis>
mk_max_speed</emphasis>
=30, the following happens when the user presses the key:
</para>
<itemizedlist>
<listitem>
<para>
The pointer immediately moves 5 pixels in the X direction when the key is
pressed.
</para>
</listitem>
<listitem>
<para>
After 160 milliseconds (<emphasis>
mk_delay</emphasis>
), and every 40 milliseconds thereafter (<emphasis>
mk_interval</emphasis>
), the pointer moves in the X direction.
</para>
</listitem>
<listitem>
<para>
The distance in the X direction increases with each interval until 30 intervals
(<emphasis>
mk_time_to_max</emphasis>
) have elapsed.
</para>
</listitem>
<listitem>
<para>
After 30 intervals, the pointer stops accelerating, and moves 150 pixels
(<emphasis>
mk_max_speed</emphasis>
* the original distance) every interval thereafter, until the key is released.
</para>
</listitem>
</itemizedlist>
<para>
The increase in pointer difference for each interval is a function of<emphasis>
mk_curve.</emphasis>
Events after the first but before maximum acceleration has been achieved are
accelerated according to the formula:
</para>
<mediaobject>
<imageobject> <imagedata format="SVG" fileref="XKBlib-3.svg"/>
</imageobject>
</mediaobject>
<para>
Where <emphasis>
action_delta</emphasis>
is the relative motion specified by the <emphasis>
XkbSA_MovePtr</emphasis>
action, <emphasis>
mk_max_speed </emphasis>
and <emphasis>
mk_time_to_max</emphasis>
are parameters to the <emphasis>
MouseKeysAccel</emphasis>
control, and the curveFactor is computed using the <emphasis>
MouseKeysAccel</emphasis>
<emphasis>
mk_curve</emphasis>
parameter as follows:
</para>
<mediaobject>
<imageobject> <imagedata format="SVG" fileref="XKBlib-4.svg"/>
</imageobject>
</mediaobject>
<para>
With the result that a <emphasis>
mk_curve</emphasis>
of zero causes the distance moved to increase linearly from <emphasis>
action_delta</emphasis>
to <mediaobject>
<imageobject> <imagedata format="SVG" fileref="XKBlib-5.svg"/>
</imageobject>
</mediaobject>
. A negative <emphasis>
mk_curve</emphasis>
causes an initial sharp increase in acceleration that tapers off, and a
positive curve yields a slower initial increase in acceleration followed by a
sharp increase as the number of pointer events generated by the action
approaches <emphasis>
mk_time_to_max</emphasis>
. The legal values for <emphasis>
mk_curve</emphasis>
are between -1000 and 1000.
</para>
<para>
A distance vs. time graph of the pointer motion is shown in Figure 10.1. <!-- xref -->
</para>
<mediaobject>
<imageobject> <imagedata format="SVG" fileref="XKBlib-6.svg"/>
</imageobject>
<caption>MouseKeys Acceleration</caption>
</mediaobject>
<!--
<H5 CLASS="Figure">
MouseKeys Acceleration</H5>
-->
</sect3>
</sect2>
</sect1>
<sect1 id='Controls_for_Better_Keyboard_Access_by_Physically_ImpairedPersons'>
<title>Controls for Better Keyboard Access by Physically Impaired
Persons</title>
<para>
The Xkb extension includes several controls specifically aimed at making
keyboard use more effective for physically impaired people. All of these
controls are boolean controls and may be individually enabled and disabled, as
well as configured to tune their specific behavior. The behavior of these
controls is based on the AccessDOS package
<footnote><para>
AccessDOS provides access to the DOS operating system for people with physical
impairments and was developed by the Trace R&D Center at the University of
Wisconsin. For more information on AccessDOS, contact the Trace R&D Center,
Waisman Center and Department of Industrial Engineering, University of
Wisconsin-Madison WI 53705-2280. Phone: 608-262-6966. e-mail: info@trace.wisc.edu.
</para></footnote>.
</para>
<sect2 id='The_AccessXKeys_Control'>
<title>The AccessXKeys Control</title>
<para>
Enabling or disabling the keyboard controls through a graphical user interface
may be impossible for people who need to use the controls. For example, a user
who needs <emphasis>
SlowKeys</emphasis>
(see section 10.6.6) may not even be able to start the graphical application, <!-- xref -->
let alone use it, if <emphasis>
SlowKeys</emphasis>
is not enabled. To allow easier access to some of the controls, the <emphasis>
AccessXKeys</emphasis>
control provides a set of special key sequences similar to those available in
AccessDOS.
</para>
<para>
When the <emphasis>
AccessXKeys</emphasis>
control is enabled, the user can turn controls on or off from the keyboard by
entering the following standard key sequences:
</para>
<itemizedlist>
<listitem>
<para>
Holding down a shift key by itself for eight seconds toggles the <emphasis>
SlowKeys</emphasis>
control.
</para>
</listitem>
<listitem>
<para>
Pressing and releasing the left or right <emphasis>
Shift</emphasis>
key five times in a row, without any intervening key events and with less than
30 seconds delay between consecutive presses, toggles the state of the
<emphasis>
StickyKeys</emphasis>
control.
</para>
</listitem>
<listitem>
<para>
Simultaneously operating two or more modifier keys deactivates the <emphasis>
StickyKeys</emphasis>
control.
</para>
</listitem>
</itemizedlist>
<para>
When the <emphasis>
AccessXKeys</emphasis>
control is disabled, Xkb does not look for the above special key sequences.
</para>
<para>
Some of these key sequences optionally generate audible feedback of the change
in state, as described in section 10.6.3, or <!-- xref -->
<emphasis>XkbControlsNotify</emphasis>
events, described in section 10.11. <!-- xref -->
</para>
</sect2>
<sect2 id='The_AccessXTimeout_Control'>
<title>The AccessXTimeout Control</title>
<para>
In environments where computers are shared, features such as <emphasis>
SlowKeys</emphasis>
present a problem: if <emphasis>
SlowKeys</emphasis>
is on, the keyboard can appear to be unresponsive because keys are not
accepted until they are held for a certain period of time. To help solve this
problem, Xkb provides an <emphasis>
AccessXTimeout</emphasis>
control to automatically change the enabled/disabled state of any boolean
controls and to change the value of the <emphasis>
AccessXKeys</emphasis>
and <emphasis>
AccessXFeedback</emphasis>
control attributes if the keyboard is idle for a specified period of time.
</para>
<para>
When a timeout as specified by <emphasis>
AccessXTimeout</emphasis>
occurs and a control is consequently modified, Xkb generates an <emphasis>
XkbControlsNotify</emphasis>
event. For more information on <emphasis>
XkbControlsNotify</emphasis>
events, refer to section 10.11. <!-- xref -->
</para>
<para>
Use <emphasis>
XkbGetAccessXTimeout</emphasis>
to query the current <emphasis>
AccessXTimeout</emphasis>
options for a keyboard device.
</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>
XkbGetAccessXTimeout</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec</emphasis>
,<emphasis>
timeout_rtrn</emphasis>
,<emphasis>
ctrls_mask_rtrn</emphasis>
,<emphasis>
ctrls_values_rtrn</emphasis>
,<emphasis>
options_mask_rtrn, options_values_rtrn</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device to query, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned short * <emphasis>
timeout_rtrn</emphasis>
; /* delay until AccessXTimeout, seconds */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int *<emphasis>
ctrls_mask_rtrn</emphasis>
; /* backfilled with controls to modify */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
ctrls_values_rtrn</emphasis>
; /* backfilled with on/off status for controls */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned short * <emphasis>
opts_mask_rtrn</emphasis>
; /* backfilled with <emphasis>
ax_options</emphasis>
to modify */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned short * <emphasis>
opts_values_rtrn</emphasis>
; /* backfilled with values for <emphasis>
ax_options</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetAccessXTimeout</emphasis>
sends a request to the X server to obtain the current values for the <emphasis>
AccessXTimeout</emphasis>
attributes, waits for a reply, and backfills the values into the appropriate
arguments.<emphasis>
</emphasis>
The parameters <emphasis>
opts_mask_rtrn</emphasis>
and <emphasis>
opts_values_rtrn</emphasis>
are backfilled with the options to modify and the values for <emphasis>
ax_options</emphasis>
, which is a field in the
<emphasis>XkbControlsRec</emphasis>
structure (see section 10.8). <!-- xref -->
<emphasis>
XkbGetAccessXTimeout </emphasis>
returns<emphasis>
</emphasis>
<emphasis>
True</emphasis>
if successful; if a compatible version of the Xkb extension is not available
in the server, <emphasis>
XkbGetAccessXTimeout</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
<para>
To configure the <emphasis>
AccessXTimeout</emphasis>
options for a keyboard device, use <emphasis>
XkbSetAccessXTimeout</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'>
Bool <emphasis>
XkbSetAccessXTimeout</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec, timeout, ctrls_mask, ctrls_values, opts_mask,
opts_values</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
device_spec</emphasis>
; /* device to configure, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned short <emphasis>
timeout</emphasis>
; /* seconds idle until AccessXTimeout occurs */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
ctrls_mask</emphasis>
; /* boolean controls to modify */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
ctrls_values</emphasis>
; /* new bits for controls selected by <emphasis>
ctrls_mask</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned short <emphasis>
opts_mask</emphasis>
; /* <emphasis>
ax_options</emphasis>
to change */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned short <emphasis>
opts_values</emphasis>
; /* new bits for <emphasis>
ax_options</emphasis>
selected by <emphasis>
opts_mask</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
timeout</emphasis>
specifies the number of seconds the keyboard must be idle before the controls
are modified. <emphasis>
ctrls_mask</emphasis>
specifies what controls are to be enabled or disabled, and <emphasis>
ctrls_values</emphasis>
specifies whether those controls are to be enabled or disabled. The bit values
correspond to those for enabling and disabling boolean controls (see section
10.1.1). The <emphasis>
opts_mask</emphasis>
field specifies which attributes of the <emphasis>
AccessXKeys</emphasis>
and <emphasis>
AccessXFeedback</emphasis>
controls are to be changed, and <emphasis>
opts_values</emphasis>
specifies the new values for those options. The bit values correspond to those
for the <emphasis>
ax_options</emphasis>
field of an <emphasis>
XkbDescRec</emphasis>
(see section 10.8). <!-- xref -->
</para>
<para>
<emphasis>
XkbSetAccessXTimeout</emphasis>
sends a request to configure the <emphasis>
AccessXTimeout</emphasis>
control to the server.<emphasis>
</emphasis>
It does not wait for a reply, and normally returns <emphasis>
True</emphasis>
. If a compatible version of the Xkb extension is not available in the server,
<emphasis>
XkbSetAccessXTimeout</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
</sect2>
<sect2 id='The_AccessXFeedback_Control'>
<title>The AccessXFeedback Control</title>
<para>
Just as some keyboards can produce keyclicks to indicate when a key is pressed
or repeating, Xkb can provide feedback for the controls by using special beep
codes. Use the <emphasis>
AccessXFeedback</emphasis>
control to configure the specific types of operations that generate feedback.
</para>
<para>
There is no convenience function for modifying the <emphasis>
AccessXFeedback</emphasis>
control, although the feedback as a whole can be enabled or disabled just as
other boolean controls are (see section 10.1). Individual beep codes are turned
on or off by modifying the following bits in the <emphasis>
ax_options</emphasis>
field of an <emphasis>
XkbControlsRec</emphasis>
structure and using <emphasis>
XkbSetControls</emphasis>
(see section 10.10): <!-- xref -->
</para>
<table frame='topbot'>
<title>AccessXFeedback 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='1.0*'/>
<thead>
<row rowsep='1'>
<entry>Action</entry>
<entry>Beep Code</entry>
<entry>ax_options bit</entry>
</row>
</thead>
<tbody>
<row>
<entry>LED turned on</entry>
<entry>High-pitched beep</entry>
<entry>XkbAX_IndicatorFBMask</entry>
</row>
<row>
<entry>LED turned off</entry>
<entry>Low-pitched beep</entry>
<entry>XkbAX_IndicatorFBMask</entry>
</row>
<row>
<entry>More than one LED changed state</entry>
<entry>Two high-pitched beeps</entry>
<entry>XkbAX_IndicatorFBMask</entry>
</row>
<row>
<entry>Control turned on</entry>
<entry>Rising tone</entry>
<entry>XkbAX_FeatureFBMask</entry>
</row>
<row>
<entry>Control turned off</entry>
<entry>Falling tone</entry>
<entry>XkbAX_FeatureFBMask</entry>
</row>
<row>
<entry>More than one control changed state</entry>
<entry>Two high-pitched beeps</entry>
<entry>XkbAX_FeatureFBMask</entry>
</row>
<row>
<entry>SlowKeys and BounceKeys about to be turned on or off</entry>
<entry>Three high-pitched beeps</entry>
<entry>XkbAX_SlowWarnFBMask</entry>
</row>
<row>
<entry>SlowKeys key pressed</entry>
<entry>Medium-pitched beep</entry>
<entry>XkbAX_SKPressFBMask</entry>
</row>
<row>
<entry>SlowKeys key accepted</entry>
<entry>Medium-pitched beep</entry>
<entry>XkbAX_SKAcceptFBMask</entry>
</row>
<row>
<entry>SlowKeys key rejected</entry>
<entry>Low-pitched beep</entry>
<entry>XkbAX_SKRejectFBMask</entry>
</row>
<row>
<entry>Accepted SlowKeys key released</entry>
<entry>Medium-pitched beep</entry>
<entry>XkbAX_SKReleaseFBMask</entry>
</row>
<row>
<entry>BounceKeys key rejected</entry>
<entry>Low-pitched beep</entry>
<entry>XkbAX_BKRejectFBMask</entry>
</row>
<row>
<entry>StickyKeys key latched</entry>
<entry>Low-pitched beep followed by high-pitched beep</entry>
<entry>XkbAX_StickyKeysFBMask</entry>
</row>
<row>
<entry>StickyKeys key locked</entry>
<entry>High-pitched beep</entry>
<entry>XkbAX_StickyKeysFBMask</entry>
</row>
<row>
<entry>StickyKeys key unlocked</entry>
<entry>Low-pitched beep</entry>
<entry>XkbAX_StickyKeysFBMask</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Implementations that cannot generate continuous tones may generate multiple
beeps instead of falling and rising tones; for example, they can generate a
high-pitched beep followed by a low-pitched beep instead of a continuous
falling tone. Other implementations can only ring the bell with one fixed
pitch. In these cases, use the <emphasis>
XkbAX_DumbBellFBMask</emphasis>
bit of <emphasis>
ax_options</emphasis>
to indicate that the bell can only ring with a fixed pitch.
</para>
<para>
When any of the above feedbacks occur, Xkb may generate a <emphasis>
XkbBellNotify</emphasis>
event (see section 9.4). <!-- xref -->
</para>
</sect2>
<sect2 id='AccessXNotify_Events'>
<title>AccessXNotify Events</title>
<para>
The server can generate <emphasis>
XkbAccessXNotify</emphasis>
events for some of the global keyboard controls. The structure for the
<emphasis>
XkbAccessXNotify</emphasis>
event type is as follows:
</para>
<para><programlisting>
typedef struct {
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> XkbAccessXNotify</emphasis> */
int device; /* Xkb device ID, will not be <emphasis> XkbUseCoreKbd</emphasis> */
int detail; /* XkbAXN_* */
KeyCode keycode; /* key of event */
int slowKeysDelay; /* current SlowKeys delay */
int debounceDelay; /* current debounce delay */
} <emphasis>XkbAccessXNotifyEvent</emphasis>;
</programlisting></para>
<para>
The <emphasis>
detail</emphasis>
field describes what AccessX event just occurred and can be any of the values
in Table 10.4. <!-- xref -->
</para>
<table frame='topbot'>
<title>AccessXNotify Events</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>detail</entry>
<entry>Reason</entry>
</row>
</thead>
<tbody>
<row>
<entry>XkbAXN_SKPress</entry>
<entry>A key was pressed when SlowKeys was enabled.</entry>
</row>
<row>
<entry>XkbAXN_SKAccept</entry>
<entry>A key was accepted (held longer than the SlowKeys delay).</entry>
</row>
<row>
<entry>XkbAXN_SKRelease</entry>
<entry>An accepted SlowKeys key was released.</entry>
</row>
<row>
<entry>XkbAXN_SKReject</entry>
<entry>A key was rejected (released before the SlowKeys delay
expired).</entry>
</row>
<row>
<entry>XkbAXN_BKAccept</entry>
<entry>A key was accepted by BounceKeys.</entry>
</row>
<row>
<entry>XkbAXN_BKReject</entry>
<entry>A key was rejected (pressed before the BounceKeys delay
expired).</entry>
</row>
<row>
<entry>XkbAXN_AXKWarning</entry>
<entry>AccessXKeys is about to turn on/off StickyKeys or BounceKeys.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <emphasis>
keycode</emphasis>
field reports the keycode of the key for which the event occurred. If the
action is related to <emphasis>
SlowKeys</emphasis>
, the <emphasis>
slowKeysDelay</emphasis>
field contains the current <emphasis>
SlowKeys</emphasis>
acceptance delay. If the action is related to <emphasis>
BounceKeys</emphasis>
, the <emphasis>
debounceDelay</emphasis>
field contains the current <emphasis>
BounceKeys</emphasis>
debounce delay.
</para>
<sect3 id='Selecting_for_AccessX_Events'>
<title>Selecting for AccessX Events</title>
<para>
To receive <emphasis>
XkbAccessXNotify</emphasis>
events under all possible conditions, use <emphasis>
XkbSelectEvents</emphasis>
(see section 4.3) and pass <emphasis> <!-- xref -->
XkbAccesXNotifyMask</emphasis>
in both <emphasis>
bits_to_change</emphasis>
and <emphasis>
values_for_bits</emphasis>
.
</para>
<para>
To receive <emphasis>
XkbStateNotify</emphasis>
events only under certain conditions, use <emphasis>
XkbSelectEventDetails</emphasis>
using <emphasis>
XkbAccessXNotify</emphasis>
as the <emphasis>
event_type</emphasis>
and specifying the desired state changes in <emphasis>
bits_to_change</emphasis>
and <emphasis>
values_for_bits</emphasis>
using mask bits from Table 10.5. <!-- xref -->
</para>
<table frame='topbot'>
<title>AccessXNotify Event Details</title>
<?dbfo keep-together="always" ?>
<tgroup cols='3' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.5*'/>
<colspec colname='c2' colwidth='1.0*'/>
<colspec colname='c3' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>XkbAccessXNotify Event Details</entry>
<entry>Value</entry>
<entry>Circumstances</entry>
</row>
</thead>
<tbody>
<row>
<entry>XkbAXN_SKPressMask</entry>
<entry>(1<<0)</entry>
<entry>Slow key press notification wanted</entry>
</row>
<row>
<entry>XkbAXN_SKAcceptMask</entry>
<entry>(1<<1)</entry>
<entry>Slow key accept notification wanted</entry>
</row>
<row>
<entry>XkbAXN_SKRejectMask</entry>
<entry>(1<<2)</entry>
<entry>Slow key reject notification wanted</entry>
</row>
<row>
<entry>XkbAXN_SKReleaseMask</entry>
<entry>(1<<3)</entry>
<entry>Slow key release notification wanted</entry>
</row>
<row>
<entry>XkbAXN_BKAcceptMask</entry>
<entry>(1<<4)</entry>
<entry>Bounce key accept notification wanted</entry>
</row>
<row>
<entry>XkbAXN_BKRejectMask</entry>
<entry>(1<<5)</entry>
<entry>Bounce key reject notification wanted</entry>
</row>
<row>
<entry>XkbAXN_AXKWarningMask</entry>
<entry>(1<<6)</entry>
<entry>AccessX warning notification wanted</entry>
</row>
<row>
<entry>XkbAXN_AllEventsMask</entry>
<entry>(0x7f)</entry>
<entry>All AccessX features notifications wanted</entry>
</row>
</tbody>
</tgroup>
</table>
</sect3>
</sect2>
<sect2 id='StickyKeys_RepeatKeys_and_MouseKeys_Events'>
<title>StickyKeys, RepeatKeys, and MouseKeys Events</title>
<para>
The <emphasis>
StickyKeys</emphasis>
, <emphasis>
RepeatKeys</emphasis>
, and <emphasis>
MouseKeys</emphasis>
controls do not generate specific events. Instead, the latching, unlatching,
locking, or unlocking of modifiers using <emphasis>
StickyKeys</emphasis>
generates <emphasis>
XkbStateNotify</emphasis>
events as described in section 5.4. Repeating keys generate normal <emphasis> <!-- xref -->
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events, though the auto-repeat can be detected using <emphasis>
DetectableAutorepeat</emphasis>
(see section 10.3.3). Finally, <emphasis> <!-- xref -->
MouseKeys</emphasis>
generates pointer events identical to those of the core pointer device.
</para>
</sect2>
<sect2 id='The_SlowKeys_Control'>
<title>The SlowKeys Control</title>
<para>
Some users may accidentally bump keys while moving a hand or typing stick
toward the key they want. Usually, the keys that are accidentally bumped are
just hit for a very short period of time. The <emphasis>
SlowKeys</emphasis>
control helps filter these accidental bumps by telling the server to wait a
specified period, called the <emphasis>
SlowKeys acceptance delay</emphasis>
, before delivering key events. If the key is released before this period
elapses, no key events are generated. Users can then bump any number of keys on
their way to the one they want without accidentally getting those characters.
Once they have reached the key they want, they can then hold the desired key
long enough for the computer to accept it. <emphasis>
SlowKeys</emphasis>
is a boolean control with one configurable attribute.
</para>
<para>
When the <emphasis>
SlowKeys</emphasis>
control is active, the server reports the initial key press, subsequent
acceptance or rejection, and release of any key to interested clients by
sending an appropriate <emphasis>
AccessXNotify</emphasis>
event (see section 10.6.4). <!-- xref -->
</para>
<para>
To get the <emphasis>
SlowKeys</emphasis>
acceptance delay for a keyboard device, use <emphasis>
XkbGetSlowKeysDelay</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'>
Bool <emphasis>
XkbGetSlowKeysDelay</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec</emphasis>
,<emphasis>
delay_rtrn</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
delay_rtrn</emphasis>
; /* backfilled with <emphasis>
SlowKeys</emphasis>
delay, ms */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetSlowKeysDelay </emphasis>
requests the attributes of the <emphasis>
SlowKeys</emphasis>
control from the server, waits for a reply and backfills <emphasis>
delay_rtrn </emphasis>
with the <emphasis>
SlowKeys</emphasis>
delay attribute. <emphasis>
XkbGetSlowKeysDelay </emphasis>
returns <emphasis>
True</emphasis>
if successful; if a compatible version of the Xkb extension is not available
in the server, <emphasis>
XkbGetSlowKeysDelay</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
<para>
To set the <emphasis>
SlowKeys</emphasis>
acceptance delay for a keyboard device, use <emphasis>
XkbSetSlowKeysDelay</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'>
Bool <emphasis>
XkbSetSlowKeysDelay</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec</emphasis>
,<emphasis>
delay</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device to configure, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
delay</emphasis>
; /* <emphasis>
SlowKeys</emphasis>
delay, ms */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetSlowKeysDelay</emphasis>
sends a request to configure the <emphasis>
SlowKeys</emphasis>
control to the server.<emphasis>
</emphasis>
It does not wait for a reply, and normally returns <emphasis>
True</emphasis>
. Specifying a value of <emphasis>
0</emphasis>
for the <emphasis>
delay </emphasis>
parameter causes <emphasis>
XkbSetSlowKeys</emphasis>
to generate a <emphasis>
BadValue</emphasis>
protocol error. If a compatible version of the Xkb extension is not available
in the server <emphasis>
XkbSetSlowKeysDelay</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
</sect2>
<sect2 id='The_BounceKeys_Control'>
<title>The BounceKeys Control</title>
<para>
Some users may accidentally "bounce" on a key when they release it. They press
it once, then accidentally press it again after they release it. The <emphasis>
BounceKeys</emphasis>
control temporarily disables a key after it has been pressed, effectively
"debouncing" the keyboard. The period of time the key is disabled after it is
released is known as the <emphasis>
BounceKeys delay</emphasis>
. <emphasis>
BounceKeys</emphasis>
is a boolean control.
</para>
<para>
When the <emphasis>
BounceKeys</emphasis>
control is active, the server reports acceptance or rejection of any key to
interested clients by sending an appropriate <emphasis>
AccessXNotify</emphasis>
event (see section 10.6.4). <!-- xref -->
</para>
<para>
Use <emphasis>
XkbGetBounceKeysDelay</emphasis>
to query the current <emphasis>
BounceKeys</emphasis>
delay for a keyboard device.
</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>
XkbGetBounceKeysDelay</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec</emphasis>
,<emphasis>
delay_rtrn</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
delay_rtrn</emphasis>
; /* backfilled with bounce keys delay, ms */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetBounceKeysDelay </emphasis>
requests the attributes of the <emphasis>
BounceKeys</emphasis>
control from the server, waits for a reply, and backfills <emphasis>
delay_rtrn </emphasis>
with the <emphasis>
BounceKeys</emphasis>
delay attribute. <emphasis>
XkbGetBounceKeysDelay </emphasis>
returns<emphasis>
</emphasis>
<emphasis>
True</emphasis>
if successful; if a compatible version of the Xkb extension is not available
in the server <emphasis>
XkbGetSlowKeysDelay</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
<para>
To set the <emphasis>
BounceKeys</emphasis>
delay for a keyboard device, use <emphasis>
XkbSetBounceKeysDelay</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'>
Bool <emphasis>
XkbSetBounceKeysDelay</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec</emphasis>
,<emphasis>
delay</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
device_spec</emphasis>
; /* device to configure, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
delay</emphasis>
; /* bounce keys delay, ms */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetBounceKeysDelay</emphasis>
sends a request to configure the <emphasis>
BounceKeys</emphasis>
control to the server.<emphasis>
</emphasis>
It does not wait for a reply and normally returns <emphasis>
True</emphasis>
. Specifying a value of <emphasis>
zero </emphasis>
for the <emphasis>
delay </emphasis>
parameter causes <emphasis>
XkbSetBounceKeysDelay</emphasis>
to generate a <emphasis>
BadValue</emphasis>
protocol error. If a compatible version of the Xkb extension is not available
in the server, <emphasis>
XkbSetBounceKeysDelay</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
</sect2>
<sect2 id='The_StickyKeys_Control'>
<title>The StickyKeys Control</title>
<para>
Some people find it difficult or even impossible to press two keys at once. For
example, a one-fingered typist or someone using a mouth stick cannot press the
<emphasis>
Shift</emphasis>
and <emphasis>
1</emphasis>
keys at the same time. The <emphasis>
StickyKeys</emphasis>
control solves this problem by changing the behavior of the modifier keys.
With <emphasis>
StickyKeys</emphasis>
, the user can first press a modifier, release it, then press another key. For
example, to get an exclamation point on a PC-style keyboard, the user can press
the <emphasis>
Shift</emphasis>
key, release it, and then press the <emphasis>
1</emphasis>
key.
</para>
<para>
<emphasis>
StickyKeys</emphasis>
also allows users to lock modifier keys without requiring special locking
keys. When <emphasis>
StickyKeys</emphasis>
is enabled, a modifier is latched when the user presses it just once. The user
can press a modifier twice in a row to lock it, and then unlock it by pressing
it one more time.
</para>
<para>
When a modifier is latched, it becomes unlatched when the user presses a
nonmodifier key or a pointer button. For instance, to enter the sequence
<emphasis>
Shift</emphasis>
+<emphasis>
Control</emphasis>
+<emphasis>
Z</emphasis>
the user could press and release the <emphasis>
Shift</emphasis>
key to latch it, then press and release the <emphasis>
Control</emphasis>
key to latch it, and finally press and release the Z key. Because the
<emphasis>
Control</emphasis>
key is a modifier key, pressing it does not unlatch the <emphasis>
Shift</emphasis>
key. Thus, after the user presses the <emphasis>
Control</emphasis>
key, both the <emphasis>
Shift</emphasis>
and <emphasis>
Control</emphasis>
modifiers are latched. When the user presses the <emphasis>
Z</emphasis>
key, the effect is as though the user had pressed <emphasis>
Shift</emphasis>
+<emphasis>
Control</emphasis>
+<emphasis>
Z</emphasis>
. In addition, because the <emphasis>
Z</emphasis>
key is not a modifier key, the <emphasis>
Shift</emphasis>
and <emphasis>
Control</emphasis>
modifiers are unlatched.
</para>
<para>
Locking a modifier key means that the modifier affects any key or pointer
button the user presses until the user unlocks it or it is unlocked
programmatically. For example, to enter the sequence ("XKB") on a keyboard
where ‘(’ is a shifted ‘9’, ‘)’ is a shifted ‘0’, and ‘"’
is a shifted single quote, the user could press and release the <emphasis>
Shift</emphasis>
key twice to lock the <emphasis>
Shift</emphasis>
modifier. Then, when the user presses the <emphasis>
9</emphasis>
, <emphasis>
‘</emphasis>
, <emphasis>
x</emphasis>
, <emphasis>
k</emphasis>
, <emphasis>
b</emphasis>
, <emphasis>
‘</emphasis>
, and <emphasis>
0</emphasis>
keys in sequence, it generates ("XKB"). To unlock the <emphasis>
Shift</emphasis>
modifier, the user can press and release the <emphasis>
Shift</emphasis>
key.
</para>
<para>
<emphasis>StickyKeys</emphasis>
is a boolean control with two separate attributes that may be individually
configured: one to automatically disable it, and one to control the latching
behavior of modifier keys.
</para>
<sect3 id='StickyKeys_Options'>
<title>StickyKeys Options</title>
<para>
The <emphasis>
StickyKeys</emphasis>
control has two options that can be accessed via the <emphasis>
ax_options</emphasis>
of an <emphasis>
XkbControlsRec</emphasis>
structure (see section 10.8). The first option, <emphasis>
TwoKeys</emphasis>
, specifies whether <emphasis>
StickyKeys</emphasis>
should automatically turn off when two keys are pressed at the same time. This
feature is useful for shared computers so people who do not want them do not
need to turn <emphasis>
StickyKeys</emphasis>
off if a previous user left <emphasis>
StickyKeys</emphasis>
on. The second option, <emphasis>
LatchToLock</emphasis>
, specifies whether or not <emphasis>
StickyKeys</emphasis>
locks a modifier when pressed twice in a row.
</para>
<para>
Use <emphasis>
XkbGetStickyKeysOptions</emphasis>
to query the current <emphasis>
StickyKeys</emphasis>
attributes for a keyboard device.
</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>
XkbGetStickyKeysOptions</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec</emphasis>
,<emphasis>
options_rtrn</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
options_rtrn</emphasis>
; /* backfilled with StickyKeys option mask */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetStickyKeysOptions </emphasis>
requests the attributes of the <emphasis>
StickyKeys</emphasis>
control from the server, waits for a reply, and backfills <emphasis>
options_rtrn </emphasis>
with a mask indicating whether the individual <emphasis>
StickyKeys</emphasis>
options are on or off. Valid bits in <emphasis>
options_rtrn</emphasis>
are:
</para>
<para>
<programlisting>
<emphasis>XkbAX_TwoKeysMask</emphasis>
<emphasis>XkbAX_LatchToLockMask</emphasis>
</programlisting>
</para>
<para>
<emphasis>
XkbGetStickyKeysOptions </emphasis>
returns <emphasis>
True</emphasis>
if successful; if a compatible version of the Xkb extension is not available
in the server <emphasis>
XkbGetStickyKeysOptions</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
<para>
To set the <emphasis>
StickyKeys</emphasis>
attributes for a keyboard device, use <emphasis>
XkbSetStickyKeysOptions</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'>
Bool <emphasis>
XkbSetStickyKeysOptions</emphasis>
(<emphasis>
display</emphasis>
,<emphasis>
device_spec, mask, values</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device to configure, or XkbUseCoreKbd */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
mask</emphasis>
; /* selects StickyKeys attributes to modify */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
values;</emphasis>
/* values for selected attributes */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetStickyKeysOptions</emphasis>
sends a request to configure the <emphasis>
StickyKeys</emphasis>
control to the server.<emphasis>
</emphasis>
It does not wait for a reply and normally returns <emphasis>
True</emphasis>
. The valid bits to use for both the <emphasis>
mask</emphasis>
and <emphasis>
values</emphasis>
parameters are:
</para>
<para>
<programlisting>
<emphasis>XkbAX_TwoKeysMask</emphasis>
<emphasis>XkbAX_LatchToLockMask</emphasis>
</programlisting>
</para>
<para>
If a compatible version of the Xkb extension is not available in the server,
<emphasis>
XkbSetStickyKeysOptions</emphasis>
returns <emphasis>
False</emphasis>
.
</para>
</sect3>
</sect2>
</sect1>
<sect1 id='Controls_for_General_Keyboard_Mapping'>
<title>Controls for General Keyboard Mapping</title>
<para>
There are several controls that apply to the keyboard mapping in general. They
control handling of out-of-range group indices and how modifiers are processed
and consumed in the server. These are:
</para>
<para>
<programlisting>
<emphasis>GroupsWrap</emphasis>
<emphasis>IgnoreGroupLock</emphasis>
<emphasis>IgnoreLockMods</emphasis>
<emphasis>InternalMods </emphasis>
</programlisting>
</para>
<para>
<emphasis>
IgnoreGroupLock</emphasis>
is a boolean control; the rest are always active.
</para>
<para>
Without the modifier processing options provided by Xkb, passive grabs set via
translations in a client (for example, <emphasis>
Alt<KeyPress>space</emphasis>
) do not trigger if any modifiers other than those specified by the translation
are set. This results in problems in the user interface when either <emphasis>
NumLock</emphasis>
or a secondary keyboard group is active. The <emphasis>
IgnoreLockMods</emphasis>
and <emphasis>
IgnoreGroupLock</emphasis>
controls make it possible to avoid this behavior without exhaustively
specifying a grab for every possible modifier combination.
</para>
<sect2 id='The_GroupsWrap_Control'>
<title>The GroupsWrap Control</title>
<para>
The <emphasis>
GroupsWrap</emphasis>
control determines how illegal groups are handled on a global basis. There are
a number of valid keyboard sequences that can cause the effective group number
to go out of range. When this happens, the group must be normalized back to a
valid number. The <emphasis>
GroupsWrap</emphasis>
control specifies how this is done.
</para>
<para>
When dealing with group numbers, all computations are done using the group
index, which is the group number minus one. There are three different
algorithms; the <emphasis>
GroupsWrap</emphasis>
control specifies which one is used:
</para>
<itemizedlist>
<listitem>
<para>XkbRedirectIntoRange</para>
<para>
All invalid group numbers are converted to a valid group number by taking the
last four bits of the <emphasis>
GroupsWrap</emphasis>
control and using them as the group index. If the result is still out of
range, Group one is used.
</para>
</listitem>
<listitem>
<para>
XkbClampIntoRange
</para>
<para>
All invalid group numbers are converted to the nearest valid group number.
Group numbers larger than the highest supported group number are mapped to the
highest supported group; those less than one are mapped to group one.
</para>
</listitem>
<listitem>
<para>XkbWrapIntoRange</para>
<para>
All invalid group numbers are converted to a valid group number using integer
modulus applied to the group index.
</para>
</listitem>
</itemizedlist>
<para>
There are no convenience functions for manipulating the <emphasis>
GroupsWrap</emphasis>
control. Manipulate the <emphasis>
GroupsWrap</emphasis>
control via the <emphasis>
groups_wrap</emphasis>
field in the <emphasis>
XkbControlsRec</emphasis>
structure, then use <emphasis>
XkbSetControls</emphasis>
and <emphasis>
XkbGetControls</emphasis>
(see section 10.9 and section 10.10) to query and change this control. <!-- xref -->
</para>
<note><para>See also section 15.3.2 or a discussion of the related field, <!-- xref -->
<emphasis>
group_info</emphasis>
, which also normalizes a group under certain circumstances.</para></note>
</sect2>
<sect2 id='The_IgnoreLockMods_Control'>
<title>The IgnoreLockMods Control</title>
<para>
The core protocol does not provide a way to exclude specific modifiers from
grab calculations, with the result that locking modifiers sometimes have
unanticipated side effects.
</para>
<para>
The <emphasis>
IgnoreLockMods</emphasis>
control specifies modifiers that should be excluded from grab calculations.
These modifiers are also not reported in any core events except <emphasis>
KeyPress</emphasis>
and <emphasis>
KeyRelease</emphasis>
events that do not activate a passive grab and that do not occur while a grab
is active.
</para>
<para>
Manipulate the <emphasis>
IgnoreLockMods</emphasis>
control via the <emphasis>
ignore_lock</emphasis>
field in the <emphasis>
XkbControlsRec</emphasis>
structure, then use <emphasis>
XkbSetControls</emphasis>
and <emphasis>
XkbGetControls</emphasis>
(see sections 10.9 and 10.10) to query and change this control. Alternatively, <!-- xref -->
use <emphasis>
XkbSetIgnoreLockMods</emphasis>
.
</para>
<para>
To set the modifiers that, if locked, are not to be reported in matching events
to passive grabs, use <emphasis>
XkbSetIgnoreLockMods.</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'>
Bool <emphasis>
XkbSetIgnoreLockMods</emphasis>
(<emphasis>
display, device_spec, affect_real, real_values, affect_virtual,
virtual_values</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
affect_real</emphasis>
; /* mask of real modifiers affected by this call */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
real_values</emphasis>
; /* values for affected real modifiers (1=>set, 0=>unset) */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
affect_virtual</emphasis>
; /* mask of virtual modifiers affected by this call */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
virtual_values</emphasis>
; /* values for affected virtual modifiers (1=>set, 0=>unset)
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetIgnoreLockMods</emphasis>
sends a request to the server to change the server’s <emphasis>
IgnoreLockMods</emphasis>
control. <emphasis>
affect_real</emphasis>
and <emphasis>
real_values</emphasis>
are masks of real modifier bits indicating which real modifiers are to be
added and removed from the server’s <emphasis>
IgnoreLockMods</emphasis>
control. Modifiers selected by both <emphasis>
affect_real</emphasis>
and <emphasis>
real_values</emphasis>
are added to the server’s <emphasis>
IgnoreLockMods</emphasis>
control; those selected by <emphasis>
affect_real</emphasis>
but not by <emphasis>
real_values</emphasis>
are removed from the server’s <emphasis>
IgnoreLockMods</emphasis>
control. Valid values for <emphasis>
affect_real</emphasis>
and <emphasis>
real_values</emphasis>
consist of any combination of the eight core modifier bits: <emphasis>
ShiftMask</emphasis>
, <emphasis>
LockMask</emphasis>
, <emphasis>
ControlMask</emphasis>
, <emphasis>
Mod1Mask</emphasis>
- <emphasis>
Mod5Mask</emphasis>
. <emphasis>
affect_virtual</emphasis>
and <emphasis>
virtual_values</emphasis>
are masks of virtual modifier bits indicating which virtual modifiers are to
be added and removed from the server’s <emphasis>
IgnoreLockMods</emphasis>
control. Modifiers selected by both <emphasis>
affect_virtual</emphasis>
and <emphasis>
virtual_values</emphasis>
are added to the server’s <emphasis>
IgnoreLockMods</emphasis>
control; those selected by <emphasis>
affect_virtual</emphasis>
but not by <emphasis>
virtual_values</emphasis>
are removed from the server’s <emphasis>
IgnoreLockMods</emphasis>
control.<emphasis>
</emphasis>
See section 7.1 for a discussion of virtual modifier masks to use in <emphasis> <!-- xref -->
affect_virtual</emphasis>
and <emphasis>
virtual_values</emphasis>
. <emphasis>
XkbSetIgnoreLockMods</emphasis>
does not wait for a reply from the server. It returns <emphasis>
True</emphasis>
if the request was sent, and <emphasis>
False</emphasis>
otherwise.
</para>
</sect2>
<sect2 id='The_IgnoreGroupLock_Control'>
<title>The IgnoreGroupLock Control</title>
<para>
The <emphasis>
IgnoreGroupLock</emphasis>
control is a boolean control with no attributes. If enabled, it specifies that
the locked state of the keyboard group should not be considered when activating
passive grabs.
</para>
<para>
Because <emphasis>
IgnoreGroupLock</emphasis>
is a boolean control with no attributes, use the general boolean controls
functions (see section 10.1) to change its state. <!-- xref -->
</para>
</sect2>
<sect2 id='The_InternalMods_Control'>
<title>The InternalMods Control</title>
<para>
The core protocol does not provide any means to prevent a modifier from being
reported in events sent to clients; Xkb, however makes this possible via the
<emphasis>
InternalMods</emphasis>
control. It specifies modifiers that should be consumed by the server and not
reported to clients. When a key is pressed and a modifier that has its bit set
in the <emphasis>
InternalMods</emphasis>
control is reported to the server, the server uses the modifier when
determining the actions to apply for the key. The server then clears the bit,
so it is not actually reported to the client. In addition, modifiers specified
in the <emphasis>
InternalMods</emphasis>
control are not used to determine grabs and are not used to calculate core
protocol compatibility state.
</para>
<para>
Manipulate the <emphasis>
InternalMods</emphasis>
control via the <emphasis>
internal</emphasis>
field in the <emphasis>
XkbControlsRec</emphasis>
structure, using <emphasis>
XkbSetControls</emphasis>
and <emphasis>
XkbGetControls</emphasis>
(see sections10.9 and 10.10). Alternatively, use <emphasis> <!-- xref -->
XkbSetServerInternalMods</emphasis>
.
</para>
<para>
To set the modifiers that are consumed by the server before events are
delivered to the client, use <emphasis>
XkbSetServerInternalMods.</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'>
Bool <emphasis>
XkbSetServerInternalMods</emphasis>
(<emphasis>
display, device_spec, affect_real, real_values, affect_virtual,
virtual_values</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
;‘ /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
affect_real</emphasis>
; /* mask of real modifiers affected by this call */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
real_values</emphasis>
; /* values for affected real modifiers (1=>set, 0=>unset) */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
affect_virtual</emphasis>
; /* mask of virtual modifiers affected by this call */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
virtual_values</emphasis>
; /* values for affected virtual modifiers (1=>set, 0=>unset)
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetServerInternalMods</emphasis>
sends a request to the server to change the internal modifiers consumed by the
server. <emphasis>
affect_real</emphasis>
and <emphasis>
real_values</emphasis>
are masks of real modifier bits indicating which real modifiers are to be
added and removed from the server’s internal modifiers control. Modifiers
selected by both <emphasis>
affect_real</emphasis>
and <emphasis>
real_values</emphasis>
are added to the server’s internal modifiers control; those selected by
<emphasis>
affect_real</emphasis>
but not by <emphasis>
real_values</emphasis>
are removed from the server’s internal modifiers mask. Valid values for
<emphasis>
affect_real</emphasis>
and <emphasis>
real_values</emphasis>
consist of any combination of the eight core modifier bits: <emphasis>
ShiftMask</emphasis>
, <emphasis>
LockMask</emphasis>
, <emphasis>
ControlMask</emphasis>
, <emphasis>
Mod1Mask</emphasis>
- <emphasis>
Mod5Mask</emphasis>
.<emphasis>
affect_virtual</emphasis>
and <emphasis>
virtual_values</emphasis>
are masks of virtual modifier bits indicating which virtual modifiers are to
be added and removed from the server’s internal modifiers control. Modifiers
selected by both <emphasis>
affect_virtual</emphasis>
and <emphasis>
virtual_values</emphasis>
are added to the server’s internal modifiers control; those selected by
<emphasis>
affect_virtual</emphasis>
but not by <emphasis>
virtual_values</emphasis>
are removed from the server’s internal modifiers control.<emphasis>
</emphasis>
See section 7.1 for a discussion of virtual modifier masks to use in <emphasis> <!-- xref -->
affect_virtual</emphasis>
and <emphasis>
virtual_values</emphasis>
.<emphasis>
XkbSetServerInternalMods</emphasis>
does not wait for a reply from the server. It returns <emphasis>
True</emphasis>
if the request was sent and <emphasis>
False</emphasis>
otherwise.
</para>
</sect2>
</sect1>
<sect1 id='The_XkbControlsRec_Structure'>
<title>The XkbControlsRec Structure</title>
<para>
Many of the individual controls described in sections 10.1 through 10.7 may be
manipulated via convenience functions discussed in those sections. Some of
them, however, have no convenience functions. The <emphasis>
XkbControlsRec</emphasis>
structure allows the manipulation of one or more of the controls in a single
operation and to track changes to any of them in conjunction with the <emphasis>
XkbGetControls</emphasis>
and <emphasis>
XkbSetControls</emphasis>
functions. This is the only way to manipulate those controls that have no
convenience functions.
</para>
<para>
The <emphasis>
XkbControlsRec</emphasis>
structure is defined as follows:
</para>
<para>
<programlisting>
#define XkbMaxLegalKeyCode 255
#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8)
</programlisting>
</para>
<para>
<programlisting>
typedef struct {
unsigned char mk_dflt_btn; /* default button for keyboard driven mouse */
unsigned char num_groups; /* number of keyboard groups */
unsigned char groups_wrap; /* how to wrap out-of-bounds groups */
XkbModsRec internal; /* defines server internal modifiers */
XkbModsRec ignore_lock; /* modifiers to ignore when checking for grab */
unsigned int enabled_ctrls; /* 1 bit => corresponding boolean control enabled */
unsigned short repeat_delay; /* ms delay until first repeat */
unsigned short repeat_interval; /* ms delay between repeats */
unsigned short slow_keys_delay; /* ms minimum time key must be down to be ok */
unsigned short debounce_delay; /* ms delay before key reactivated */
unsigned short mk_delay; /* ms delay to second mouse motion event */
unsigned short mk_interval; /* ms delay between repeat mouse events */
unsigned short mk_time_to_max; /* # intervals until constant mouse move */
unsigned short mk_max_speed; /* multiplier for maximum mouse speed */
short mk_curve; /* determines mouse move curve type */
unsigned short ax_options; /* 1 bit => Access X option enabled */
unsigned short ax_timeout; /* seconds until Access X disabled */
unsigned short axt_opts_mask; /* 1 bit => options to reset on Access X timeout */
unsigned short axt_opts_values; /* 1 bit => turn option on, 0=> off */
unsigned int axt_ctrls_mask; /* which bits in <emphasis> enabled_ctrls</emphasis> to modify */
unsigned int axt_ctrls_values; /* values for new bits in <emphasis> enabled_ctrls</emphasis> */
unsigned char per_key_repeat[XkbPerKeyBitArraySize]; /* per key auto repeat */
} <emphasis>XkbControlsRec</emphasis>, *XkbControlsPtr;
</programlisting>
</para>
<para>
The general-purpose functions that work with the <emphasis>
XkbControlsRec</emphasis>
structure use a mask to specify which controls are to be manipulated. Table
10.6 lists these controls, the masks used to select them in the general
function calls (<emphasis>
which</emphasis>
parameter), and the data fields in the <emphasis>
XkbControlsRec</emphasis>
structure that comprise each of the individual controls. Also listed are the
bit used to turn boolean controls on and off and the section where each control
is described in more detail.
</para>
<table frame='topbot'>
<title>Xkb Controls</title>
<?dbfo keep-together="auto" ?>
<tgroup cols='5' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='2.0*'/>
<colspec colname='c2' colwidth='3.1*'/>
<colspec colname='c3' colwidth='2.2*'/>
<colspec colname='c4' colwidth='2.6*'/>
<colspec colname='c5' colwidth='1.0*'/>
<thead>
<row rowsep='1'>
<entry>Control</entry>
<entry>Control Selection Mask (which parameter)</entry>
<entry>Relevant XkbControlsRec Data Fields</entry>
<entry>Boolean Control enabled_ctrls bit</entry>
<entry>Section</entry>
</row>
</thead>
<tbody>
<row>
<entry>AccessXFeedback</entry>
<entry>XkbAccessXFeedbackMask</entry>
<entry>ax_options: XkbAX_*FBMask</entry>
<entry>XkbAccessXFeedback­Mask</entry>
<entry>10.6.3</entry> <!-- xref -->
</row>
<row>
<entry>AccessXKeys</entry>
<entry></entry>
<entry></entry>
<entry>XkbAccessXKeys­Mask</entry>
<entry>10.6.1</entry> <!-- xref -->
</row>
<row>
<entry>AccessXTimeout</entry>
<entry>XkbAccessXTimeoutMask</entry>
<entry>
<para>ax_timeout</para>
<para>axt_opts_mask</para>
<para>axt_opts_values</para>
<para>axt_ctrls_mask</para>
<para>axt_ctrls_values</para>
</entry>
<entry>XkbAccessXTimeout­Mask</entry>
<entry>10.6.2</entry>
</row>
<row>
<entry>AudibleBell</entry>
<entry></entry>
<entry></entry>
<entry>XkbAudibleBellMask</entry>
<entry>9.2</entry>
</row>
<row>
<entry>AutoReset</entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry>10.1.2</entry>
</row>
<row>
<entry>BounceKeys</entry>
<entry>XkbBounceKeysMask</entry>
<entry>debounce_delay</entry>
<entry>XkbBounceKeysMask</entry>
<entry>10.6.7</entry>
</row>
<row>
<entry>Detectable-Autorepeat</entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry>10.3.3</entry>
</row>
<row>
<entry>EnabledControls</entry>
<entry>XkbControlsEnabledMask</entry>
<entry>enabled_ctrls</entry>
<entry><emphasis>Non-Boolean Control</emphasis></entry>
<entry>10.1.1</entry>
</row>
<row>
<entry>GroupsWrap</entry>
<entry>XkbGroupsWrapMask</entry>
<entry>groups_wrap</entry>
<entry><emphasis>Non-Boolean Control</emphasis></entry>
<entry>10.7.1</entry>
</row>
<row>
<entry>IgnoreGroupLock</entry>
<entry></entry>
<entry></entry>
<entry>XkbIgnoreGroupLock­Mask</entry>
<entry>10.7.3</entry>
</row>
<row>
<entry>IgnoreLockMods</entry>
<entry>XkbIgnoreLockModsMask</entry>
<entry>ignore_lock</entry>
<entry><emphasis>Non-Boolean Control</emphasis></entry>
<entry>5.1</entry>
</row>
<row>
<entry>InternalMods</entry>
<entry>XkbInternalModsMask</entry>
<entry>internal</entry>
<entry><emphasis>Non-Boolean Control</emphasis></entry>
<entry>5.1</entry>
</row>
<row>
<entry>MouseKeys</entry>
<entry>XkbMouseKeysMask</entry>
<entry>mk_dflt_btn</entry>
<entry>XkbMouseKeysMask</entry>
<entry>10.5.1</entry>
</row>
<row>
<entry>MouseKeysAccel</entry>
<entry>XkbMouseKeysAccelMask</entry>
<entry>
<para>mk_delay</para>
<para>mk_interval</para>
<para>mk_time_to_max</para>
<para>mk_max_speed</para>
<para>mk_curve</para>
</entry>
<entry>XkbMouseKeysAccel­Mask</entry>
<entry>10.5.2</entry>
</row>
<row>
<entry>Overlay1</entry>
<entry></entry>
<entry></entry>
<entry>XkbOverlay1Mask</entry>
<entry>10.4</entry>
</row>
<row>
<entry>Overlay2</entry>
<entry></entry>
<entry></entry>
<entry>XkbOverlay2Mask</entry>
<entry>10.4</entry>
</row>
<row>
<entry>PerKeyRepeat</entry>
<entry>XkbPerKeyRepeatMask</entry>
<entry>per_key_repeat</entry>
<entry><emphasis>Non-Boolean Control</emphasis></entry>
<entry>10.3.1</entry>
</row>
<row>
<entry>RepeatKeys</entry>
<entry>XkbRepeatKeysMask</entry>
<entry>
<para>repeat_delay</para>
<para>repeat_interval</para>
</entry>
<entry>XkbRepeatKeysMask</entry>
<entry>10.3</entry>
</row>
<row>
<entry>SlowKeys</entry>
<entry>XkbSlowKeysMask</entry>
<entry>slow_keys_delay</entry>
<entry>XkbSlowKeysMask</entry>
<entry>10.6.6</entry>
</row>
<row>
<entry>StickyKeys</entry>
<entry>XkbStickyKeysMask</entry>
<entry>
<para>ax_options:</para>
<para>XkbAX_Two­KeysMask</para>
<para>XkbAX_Latch­ToLockMask</para>
</entry>
<entry>XkbStickyKeysMask</entry>
<entry>10.6.8</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Table 10.7 shows the actual values for the individual mask bits used to select <!-- xref -->
controls for modification and to enable and disable the control. Note that the
same mask bit is used to specify general modifications to the parameters used
to configure the control (<emphasis>
which</emphasis>
), and to enable and disable the control (<emphasis>
enabled_ctrls</emphasis>
). The anomalies in the table (no "ok" in column) are for controls that have no
configurable attributes; and for controls that are not boolean controls and
therefore cannot be enabled or disabled.
</para>
<table frame='topbot'>
<title>Controls Mask Bits</title>
<?dbfo keep-together="always" ?>
<tgroup cols='4' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='2.6*'/>
<colspec colname='c2' colwidth='2.0*'/>
<colspec colname='c3' colwidth='1.3*'/>
<colspec colname='c4' colwidth='2.0*'/>
<thead>
<row rowsep='1'>
<entry>Mask Bit</entry>
<entry>which or changed_ctrls</entry>
<entry>enabled_ctrls</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>XkbRepeatKeysMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<0)</entry>
</row>
<row>
<entry>XkbSlowKeysMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<1)</entry>
</row>
<row>
<entry>XkbBounceKeysMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<2)</entry>
</row>
<row>
<entry>XkbStickyKeysMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<3)</entry>
</row>
<row>
<entry>XkbMouseKeysMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<4)</entry>
</row>
<row>
<entry>XkbMouseKeysAccelMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<5)</entry>
</row>
<row>
<entry>XkbAccessXKeysMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<6)</entry>
</row>
<row>
<entry>XkbAccessXTimeoutMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<7)</entry>
</row>
<row>
<entry>XkbAccessXFeedbackMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(1L<<8)</entry>
</row>
<row>
<entry>XkbAudibleBellMask</entry>
<entry></entry>
<entry>ok</entry>
<entry>(1L<<9)</entry>
</row>
<row>
<entry>XkbOverlay1Mask</entry>
<entry></entry>
<entry>ok</entry>
<entry>(1L<<10)</entry>
</row>
<row>
<entry>XkbOverlay2Mask</entry>
<entry></entry>
<entry>ok</entry>
<entry>(1L<<11)</entry>
</row>
<row>
<entry>XkbIgnoreGroupLockMask</entry>
<entry></entry>
<entry>ok</entry>
<entry>(1L<<12)</entry>
</row>
<row>
<entry>XkbGroupsWrapMask</entry>
<entry>ok</entry>
<entry></entry>
<entry>(1L<<27)</entry>
</row>
<row>
<entry>XkbInternalModsMask</entry>
<entry>ok</entry>
<entry></entry>
<entry>(1L<<28)</entry>
</row>
<row>
<entry>XkbIgnoreLockModsMask</entry>
<entry>ok</entry>
<entry></entry>
<entry>(1L<<29)</entry>
</row>
<row>
<entry>XkbPerKeyRepeatMask</entry>
<entry>ok</entry>
<entry></entry>
<entry>(1L<<30)</entry>
</row>
<row>
<entry>XkbControlsEnabledMask</entry>
<entry>ok</entry>
<entry></entry>
<entry>(1L<<31)</entry>
</row>
<row>
<entry>XkbAccessXOptionsMask</entry>
<entry>ok</entry>
<entry>ok</entry>
<entry>(XkbStickyKeysMask | XkbAccessXFeedbackMask)</entry>
</row>
<row>
<entry>XkbAllBooleanCtrlsMask</entry>
<entry></entry>
<entry>ok</entry>
<entry>(0x00001FFF) </entry>
</row>
<row>
<entry>XkbAllControlsMask</entry>
<entry>ok</entry>
<entry></entry>
<entry>(0xF8001FFF)</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The individual fields of the <emphasis>
XkbControlsRec</emphasis>
structure are defined as follows.
</para>
<sect2>
<title/>
<sect3 id='mk_dflt_btn'>
<title>mk_dflt_btn</title>
<para>
<emphasis>
mk_dflt_btn is an attribute of the </emphasis>
<emphasis>
MouseKeys</emphasis>
<emphasis>
control</emphasis>
(see section 10.5<emphasis> <!-- xref -->
). It</emphasis>
specifies the mouse button number to use for keyboard simulated mouse button
operations. Its value should be one of the core symbols <emphasis>
Button1</emphasis>
- <emphasis>
Button5</emphasis>
.
</para>
</sect3>
<sect3 id='num_groups'>
<title>num_groups</title>
<para>
<emphasis>
num_groups</emphasis>
is not a part of any control, but is reported in the <emphasis>
XkbControlsRec</emphasis>
structure whenever any of its components are fetched from the server. It
reports the number of groups the particular keyboard configuration uses and is
computed automatically by the server whenever the keyboard mapping changes.
</para>
</sect3>
<sect3 id='groups_wrap'>
<title>groups_wrap</title>
<para>
<emphasis>
groups_wrap</emphasis>
is an attribute of the <emphasis>
GroupsWrap</emphasis>
control (see section 10.7.1). It specifies the handling of illegal groups on a <!-- xref -->
global basis. Valid values for <emphasis>
groups_wrap</emphasis>
are shown in Table 10.8.
</para>
<table frame='topbot'>
<title>GroupsWrap options (groups_wrap field)</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='1.0*'/>
<thead>
<row rowsep='1'>
<entry>groups_wrap symbolic name</entry>
<entry>value</entry>
</row>
</thead>
<tbody>
<row>
<entry>XkbWrapIntoRange</entry>
<entry>(0x00)</entry>
</row>
<row>
<entry>XkbClampIntoRange</entry>
<entry>(0x40)</entry>
</row>
<row>
<entry>XkbRedirectIntoRange</entry>
<entry>(0x80)</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
When <emphasis>
groups_wrap</emphasis>
is set to <emphasis>
XkbRedirectIntoRange</emphasis>
, its four low-order bits specify the index of the group to use.
</para>
</sect3>
<sect3 id='internal'>
<title>internal</title>
<para>
<emphasis>
internal</emphasis>
is an attribute of the <emphasis>
InternalMods</emphasis>
control (see section 10.7.4). It specifies modifiers to be consumed in the <!-- xref -->
server and not passed on to clients when events are reported. Valid values
consist of any combination of the eight core modifier bits: <emphasis>
ShiftMask</emphasis>
, <emphasis>
LockMask</emphasis>
, <emphasis>
ControlMask</emphasis>
, <emphasis>
Mod1Mask</emphasis>
- <emphasis>
Mod5Mask</emphasis>
.
</para>
</sect3>
<sect3 id='ignore_lock'>
<title>ignore_lock</title>
<para>
<emphasis>
ignore_lock</emphasis>
is an attribute of the <emphasis>
IgnoreLockMods</emphasis>
control (see section 10.7.2). It specifies modifiers to be ignored in grab <!-- xref -->
calculations. Valid values consist of any combination of the eight core
modifier bits: <emphasis>
ShiftMask</emphasis>
, <emphasis>
LockMask</emphasis>
, <emphasis>
ControlMask</emphasis>
, <emphasis>
Mod1Mask</emphasis>
- <emphasis>
Mod5Mask</emphasis>
.
</para>
</sect3>
<sect3 id='enabled_ctrls'>
<title>enabled_ctrls</title>
<para>
<emphasis>
enabled_ctrls</emphasis>
is an attribute of the <emphasis>
EnabledControls</emphasis>
control (see section 10.1.1). It contains one bit per boolean control. Each <!-- xref -->
bit determines whether the corresponding control is enabled or disabled; a one
bit means the control is enabled. The mask bits used to enable these controls
are listed in Table 10.7, using only those masks with "ok" in the <emphasis>
enabled_ctrls</emphasis>
column.
</para>
</sect3>
<sect3 id='repeat_delay_and_repeat_interval'>
<title>repeat_delay and repeat_interval</title>
<para>
<emphasis>
repeat_delay</emphasis>
and <emphasis>
repeat_interval</emphasis>
are attributes of the <emphasis>
RepeatKeys</emphasis>
control (see section 10.3.2). <emphasis> <!-- xref -->
repeat_delay</emphasis>
is the initial delay before a key begins repeating, in milliseconds; <emphasis>
repeat_interval</emphasis>
is the delay between subsequent key events, in milliseconds.
</para>
</sect3>
<sect3 id='slow_keys_delay'>
<title>slow_keys_delay</title>
<para>
<emphasis>
slow_keys_delay</emphasis>
is an attribute of the <emphasis>
SlowKeys</emphasis>
control (see section 10.6.6). Its value specifies the <emphasis> <!-- xref -->
SlowKeys</emphasis>
acceptance delay period in milliseconds before a key press is accepted by the
server.
</para>
</sect3>
<sect3 id='debounce_delay'>
<title>debounce_delay</title>
<para>
<emphasis>
debounce_delay</emphasis>
is an attribute of the <emphasis>
BounceKeys</emphasis>
control (see section 10.6.7). Its value specifies the <emphasis> <!-- xref -->
BounceKeys</emphasis>
delay period in milliseconds for which the key is disabled after having been
pressed before another press of the same key is accepted by the server.
</para>
</sect3>
<sect3 id='mk_delay_mk_interval_mk_time_to_max_mk_max_speed_and_mk_curve'>
<title>mk_delay, mk_interval, mk_time_to_max, mk_max_speed, and mk_curve</title>
<para>
<emphasis>
mk_delay</emphasis>
, <emphasis>
mk_interval</emphasis>
, <emphasis>
mk_time_to_max</emphasis>
, <emphasis>
mk_max_speed</emphasis>
, and <emphasis>
mk_curve</emphasis>
are attributes of the <emphasis>
MouseKeysAccel</emphasis>
control. Refer to section 10.5.2 for a description of these fields and the <!-- xref -->
units involved.
</para>
</sect3>
<sect3 id='ax_options'>
<title>ax_options</title>
<para>
The <emphasis>
ax_options</emphasis>
field contains attributes used to configure two different controls, the
<emphasis>
StickyKeys</emphasis>
control (see section 10.6.8) and the <emphasis> <!-- xref -->
AccessXFeedback</emphasis>
control (see section 10.6.3). The <emphasis> <!-- xref -->
ax_options</emphasis>
field is a bitmask and may include any combination of the bits defined in
Table 10.9. <!-- xref -->
</para>
<table frame='topbot'>
<title>Access X Enable/Disable Bits (ax_options field)</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.3*'/>
<colspec colname='c3' colwidth='0.7*'/>
<thead>
<row rowsep='1'>
<entry>Access X Control</entry>
<entry>ax_options bit</entry>
<entry>value</entry>
</row>
</thead>
<tbody>
<row>
<entry>AccessXFeedback</entry>
<entry>XkbAX_SKPressFBMask</entry>
<entry>(1L<<0)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_SKAcceptFBMask</entry>
<entry>(1L << 1)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_FeatureFBMask</entry>
<entry>(1L << 2)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_SlowWarnFBMask</entry>
<entry>(1L << 3)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_IndicatorFBMask</entry>
<entry>(1L << 4)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_StickyKeysFBMask</entry>
<entry>(1L << 5)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_SKReleaseFBMask</entry>
<entry>(1L << 8)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_SKRejectFBMask</entry>
<entry>(1L << 9)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_BKRejectFBMask</entry>
<entry>(1L << 10)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_DumbBellFBMask</entry>
<entry>(1L << 11)</entry>
</row>
<row>
<entry>StickyKeys</entry>
<entry>XkbAX_TwoKeysMask</entry>
<entry>(1L << 6)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_LatchToLockMask</entry>
<entry>(1L << 7)</entry>
</row>
<row>
<entry></entry>
<entry>XkbAX_AllOptionsMask</entry>
<entry>(0xFFF)</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The fields pertaining to each control are relevant only when the control is
enabled (<emphasis>
XkbAccessXFeedbackMask</emphasis>
or <emphasis>
XkbStickyKeysMask</emphasis>
bit is turned on in the <emphasis>
enabled_cntrls</emphasis>
field).
</para>
<para>
Xkb provides a set of convenience macros for working with the <emphasis>
ax_options</emphasis>
field of an <emphasis>
XkbControlsRec</emphasis>
structure:
</para>
<para><programlisting>
#define <emphasis>XkbAX_NeedOption</emphasis>
(c,w) ((c)->ax_options&(w))
</programlisting></para>
<para>
The <emphasis>
XkbAX_NeedOption</emphasis>
macro is useful for determining whether a particular AccessX option is enabled
or not. It accepts a pointer to an <emphasis>
XkbControlsRec</emphasis>
structure and a valid mask bit from Table 10.9. If the specified mask bit in
the <emphasis>
ax_options</emphasis>
field of the controls structure is set, the macro returns the mask bit.
Otherwise, it returns zero. Thus,
</para>
<para>
XkbAX_NeedOption(ctlrec, XkbAX_LatchToLockMask)
</para>
<para>
is nonzero if the latch to lock transition for latching keys is enabled, and
zero if it is disabled. Note that <emphasis>
XkbAX_NeedOption</emphasis>
only determines whether or not the particular capability is configured to
operate; the <emphasis>
XkbAccessXFeedbackMask</emphasis>
bit must also be turned on in <emphasis>
enabled_ctrls</emphasis>
for the capability to actually be functioning.
</para>
<para><programlisting>
#define <emphasis>XkbAX_AnyFeedback</emphasis>
(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
</programlisting></para>
<para>
The <emphasis>
XkbAX_AnyFeeback</emphasis>
macro accepts a pointer to an <emphasis>
XkbControlsRec</emphasis>
structure and tells whether the <emphasis>
AccessXFeedback</emphasis>
control is enabled or not. If the <emphasis>
AccessXFeedback</emphasis>
control is enabled, the macro returns <emphasis>
XkbAccessXFeedbackMask</emphasis>
. Otherwise, it returns zero.
</para>
<para><programlisting>
#define <emphasis>XkbAX_NeedFeedback</emphasis>
(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))
</programlisting></para>
<para>
The <emphasis>
XkbAX_NeedFeedback</emphasis>
macro is useful for determining if both the <emphasis>
AccessXFeedback</emphasis>
control and a particular AccessX feedback option are enabled. The macro
accepts a pointer to an <emphasis>
XkbControlsRec</emphasis>
structure and a feedback option from the table above. If both the <emphasis>
AccessXFeedback</emphasis>
control and the specified feedback option are enabled, the macro returns
<emphasis>
True</emphasis>
. Otherwise it returns <emphasis>
False</emphasis>
.
</para>
</sect3>
<sect3
id='ax_timeout_axt_opts_mask_axt_opts_values_axt_ctrls_mask_and_axt_ctrls_values'>
<title>ax_timeout, axt_opts_mask, axt_opts_values, axt_ctrls_mask, and axt_ctrls_values</title>
<para>
<emphasis>
ax_timeout</emphasis>
, <emphasis>
act_opts_mask</emphasis>
, <emphasis>
axt_opts_values</emphasis>
, <emphasis>
axt_ctrls_mask</emphasis>
, and <emphasis>
axt_ctrls_values</emphasis>
are attributes of the <emphasis>
AccessXTimeout</emphasis>
control. Refer to section 10.6.2 for a description of these fields and the <!-- xref -->
units involved.
</para>
</sect3>
<sect3 id='per_key_repeat'>
<title>per_key_repeat</title>
<para>
The <emphasis>
per_key_repeat</emphasis>
field mirrors the <emphasis>
auto_repeats</emphasis>
field of the core protocol <emphasis>
XKeyboardState</emphasis>
structure: changing the <emphasis>
auto_repeats</emphasis>
field automatically changes <emphasis>
per_key_repeat</emphasis>
and vice versa. It is provided for convenience and to reduce protocol traffic.
For example, to obtain the individual repeat key behavior as well as the repeat
delay and rate, use <emphasis>
XkbGetControls</emphasis>
. If the <emphasis>
per_key_repeat</emphasis>
were not in this structure, you would have to call both <emphasis>
XGetKeyboardControl</emphasis>
and <emphasis>
XkbGetControls</emphasis>
to get this information. The bits correspond to keycodes. The first seven keys
(keycodes 1-7) are indicated in <emphasis>
per_key_repeat</emphasis>
[0], with bit position 0 (low order) corresponding to the fictitious keycode 0.
Following array elements correspond to 8 keycodes per element. A 1 bit
indicates that the key is a repeating key.
</para>
</sect3>
</sect2>
</sect1>
<sect1 id='Querying_Controls'>
<title>Querying Controls</title>
<para>
Use <emphasis>
XkbGetControls</emphasis>
to find the current state of Xkb server controls.
</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>
XkbGetControls</emphasis>
(<emphasis>
display, which, xkb)</emphasis>
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned long<emphasis>
which</emphasis>
; /* mask of controls requested */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr<emphasis>
xkb</emphasis>
; /* keyboard description for controls information*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetControls</emphasis>
queries the server for the requested control information, waits for a reply,
and then copies the server’s values for the requested information into the
<emphasis>
ctrls</emphasis>
structure of the <emphasis>
xkb</emphasis>
argument. Only those components specified by the <emphasis>
which</emphasis>
parameter are copied. Valid values for <emphasis>
which</emphasis>
are any combination of the masks listed in Table 10.7 that have "ok" in the
<emphasis>
which</emphasis>
column.
</para>
<para>
If <emphasis>
xkb</emphasis>
-><emphasis>
ctrls </emphasis>
is <emphasis>
NULL</emphasis>
, <emphasis>
XkbGetControls</emphasis>
allocates and initializes it before obtaining the values specified by
<emphasis>
which</emphasis>
. If <emphasis>
xkb</emphasis>
-><emphasis>
ctrls</emphasis>
is not <emphasis>
NULL</emphasis>
, <emphasis>
XkbGetControls</emphasis>
modifies only those portions of <emphasis>
xkb</emphasis>
-><emphasis>
ctrls</emphasis>
corresponding to the values specified by <emphasis>
which</emphasis>
.
</para>
<para>
<emphasis>
XkbGetControls</emphasis>
returns <emphasis>
Success</emphasis>
if successful; otherwise, it returns <emphasis>
BadAlloc</emphasis>
if it cannot obtain sufficient storage, <emphasis>
BadMatch</emphasis>
if <emphasis>
xkb</emphasis>
is <emphasis>
NULL</emphasis>
or <emphasis>
which</emphasis>
is empty, or <emphasis>
BadImplementation</emphasis>
.
</para>
<para>
To free the <emphasis>
ctrls</emphasis>
member of a keyboard description, use <emphasis>
XkbFreeControls</emphasis>
(see section 10.12)
</para>
<para>
The <emphasis>
num_groups</emphasis>
field in the <emphasis>
ctrls</emphasis>
structure is always filled in by <emphasis>
XkbGetControls</emphasis>
, regardless of which bits are selected by <emphasis>
which</emphasis>
.
</para>
</sect1>
<sect1 id='Changing_Controls'>
<title>Changing Controls</title>
<para>
There are two ways to make changes to controls: either change a local copy
keyboard description and call <emphasis>
XkbSetControls</emphasis>
, or, to reduce network traffic, use an<emphasis>
XkbControlsChangesRec</emphasis>
structure and call <emphasis>
XkbChangeControls</emphasis>
.
</para>
<para>
To change the state of one or more controls, first modify the <emphasis>
ctrls</emphasis>
structure in a local copy of the keyboard description and then use <emphasis>
XkbSetControls</emphasis>
to copy those changes to the X server.
</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>
XkbSetControls</emphasis>
(<emphasis>
display, which, xkb)</emphasis>
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned long <emphasis>
which </emphasis>
; /* mask of controls to change */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* <emphasis>
ctrls</emphasis>
field contains new values to be set */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
For each bit that is set in the <emphasis>
which</emphasis>
parameter, <emphasis>
XkbSetControls</emphasis>
sends the corresponding values from the <emphasis>
xkb</emphasis>
-><emphasis>
ctrls</emphasis>
field to the server. Valid values for <emphasis>
which</emphasis>
are any combination of the masks listed in Table 10.7 that have "ok" in the
<emphasis>
which</emphasis>
column.
</para>
<para>
If <emphasis>
xkb</emphasis>
-><emphasis>
ctrls</emphasis>
is <emphasis>
NULL</emphasis>
, the server does not support a compatible version of Xkb, or the Xkb extension
has not been properly initialized, <emphasis>
XkbSetControls</emphasis>
returns <emphasis>
False</emphasis>
. Otherwise, it sends the request to the X server and returns <emphasis>
True</emphasis>
.
</para>
<para>
Note that changes to attributes of controls in the <emphasis>
XkbControlsRec</emphasis>
structure are apparent only when the associated control is enabled, although
the corresponding values are still updated in the X server. For example, the
<emphasis>
repeat_delay</emphasis>
and <emphasis>
repeat_interval</emphasis>
fields are ignored unless the <emphasis>
RepeatKeys</emphasis>
control is enabled (that is, the X server’s equivalent of <emphasis>
xkb->ctrls</emphasis>
has <emphasis>
XkbRepeatKeyMask</emphasis>
set in <emphasis>
enabled_ctrls</emphasis>
). It is permissible to modify the attributes of a control in one call to
XkbSetControls and enable the control in a subsequent call. See section 10.1.1 <!-- xref -->
for more information on enabling and disabling controls.
</para>
<para>
Note that the <emphasis>
enabled_ctrls</emphasis>
field is itself a control — the <emphasis>
EnabledControls</emphasis>
control. As such, to set a specific configuration of enabled and disabled
boolean controls, you must set <emphasis>
enabled_ctrls</emphasis>
to the appropriate bits to enable only the controls you want and disable all
others, then specify the <emphasis>
XkbControlsEnabledMask</emphasis>
in a call to <emphasis>
XkbSetControls</emphasis>
. Because this is somewhat awkward if all you want to do is enable and disable
controls, and not modify any of their attributes, a convenience function is
also provided for this purpose (<emphasis>
XkbChangeEnabledControls</emphasis>
, section 10.1.1). <!-- xref -->
</para>
<sect2 id='The_XkbControlsChangesRec_Structure'>
<title>The XkbControlsChangesRec Structure</title>
<para>
The <emphasis>
XkbControlsChangesRec</emphasis>
structure allows applications to track modifications to an <emphasis>
XkbControlsRec</emphasis>
structure and thereby reduce the amount of traffic sent to the server. The
same <emphasis>
XkbControlsChangesRec</emphasis>
structure may be used in several successive modifications to the same
<emphasis>
XkbControlsRec</emphasis>
structure, then subsequently used to cause all of the changes, and only the
changes, to be propagated to the server. The <emphasis>
XkbControlsChangesRec</emphasis>
structure is defined as follows:
</para>
<para><programlisting>
typedef struct _XkbControlsChanges {
unsigned int changed_ctrls; /* bits indicating changed control data */
unsigned int enabled_ctrls_changes; /* bits indicating enabled/disabled controls */
Bool num_groups_changed; /* <emphasis> True</emphasis> if
number of keyboard groups changed */
} <emphasis>XkbControlsChangesRec</emphasis>,*XkbControlsChangesPtr;
</programlisting></para>
<para>
The <emphasis>
changed_ctrls</emphasis>
field is a mask specifying which logical sets of data in the controls
structure have been modified. In this context, modified means <emphasis>
set</emphasis>
, that is, if a value is set to the same value it previously contained, it has
still been modified, and is noted as changed. Valid values for <emphasis>
changed_ctrls</emphasis>
are any combination of the masks listed in Table 10.7 that have "ok" in the
<emphasis>
changed_ctrls</emphasis>
column. Setting a bit implies the corresponding data fields from the "Relevant
XkbControlsRec Data Fields" column in Table 10.6 have been modified. The
<emphasis>
enabled_ctrls_changes</emphasis>
field specifies which bits in the <emphasis>
enabled_ctrls</emphasis>
field have changed. If the number of keyboard groups has changed, the
<emphasis>num_groups_changed</emphasis>
field is set to <emphasis>True</emphasis>.
</para>
<para>
If you have an Xkb description with controls that have been modified and an
<emphasis>
XkbControlsChangesRec</emphasis>
that describes the changes that have been made, the <emphasis>
XkbChangeControls</emphasis>
function provides a flexible method for updating the controls in a server to
match those in the changed keyboard 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'>
Bool <emphasis>
XkbChangeControls</emphasis>
(<emphasis>
dpy, xkb, changes</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* keyboard description with changed <emphasis>
xkb->ctrls</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbControlsChangesPtr <emphasis>
changes</emphasis>
; /* which parts of <emphasis>
xkb->ctrls</emphasis>
have changed */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbChangeControls</emphasis>
copies any controls fields specified by <emphasis>
changes</emphasis>
from the keyboard description controls structure, <emphasis>
xkb</emphasis>
-><emphasis>
ctrls</emphasis>
, to the server specified by <emphasis>
dpy</emphasis>
.
</para>
</sect2>
</sect1>
<sect1 id='Tracking_Changes_to_Keyboard_Controls'>
<title>Tracking Changes to Keyboard Controls</title>
<para>
Whenever a field in the controls structure changes in the server’s keyboard
description, the server sends an <emphasis>
XkbControlsNotify</emphasis>
event to all interested clients.To receive <emphasis>
XkbControlsNotify</emphasis>
events under all possible conditions, use <emphasis>
XkbSelectEvents</emphasis>
(see section 4.3) and pass <emphasis>
XkbControlsNotifyMask</emphasis>
in both <emphasis>
bits_to_change</emphasis>
and <emphasis>
values_for_bits</emphasis>
.
</para>
<para>
To receive <emphasis>
XkbControlsNotify</emphasis>
events only under certain conditions, use <emphasis>
XkbSelectEventDetails</emphasis>
using <emphasis>
XkbControlsNotify</emphasis>
as the <emphasis>
event_type</emphasis>
and specifying the desired state changes in <emphasis>
bits_to_change</emphasis>
and <emphasis>
values_for_bits</emphasis>
using mask bits from Table 10.7. <!-- xref -->
</para>
<para>
The structure for the <emphasis>
XkbControlsNotify</emphasis>
event is defined as follows:
</para>
<para><programlisting>
typedef struct {
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> XkbCompatMapNotify</emphasis> */
int device; /* Xkb device ID, will not be <emphasis> XkbUseCoreKbd</emphasis> */
unsigned int changed_ctrls; /* bits indicating which controls data have changed*/
unsigned int enabled_ctrls; /* controls currently enabled in server */
unsigned int enabled_ctrl_changes; /* bits indicating enabled/disabled controls */
int num_groups; /* current number of keyboard groups */
KeyCode keycode; /* != 0 => keycode of key causing change */
char event_type; /* Type of event causing change */
char req_major; /* major event code of event causing change */
char req_minor; /* minor event code of event causing change */
} <emphasis>XkbControlsNotifyEvent</emphasis>;
</programlisting></para>
<para>
The <emphasis>
changed_ctrls</emphasis>
field specifies the controls components that have changed and consists of bits
taken from the masks defined in Table 10.7 with "ok" in the <emphasis>
changed_ctrls</emphasis>
column.
</para>
<para>
The controls currently enabled in the server are reported in the <emphasis>
enabled_ctrls</emphasis>
field. If any controls were just enabled or disabled (that is, the contents of
the <emphasis>
enabled_ctrls</emphasis>
field changed), they are flagged in the <emphasis>
enabled_ctrl_changes</emphasis>
field. The valid bits for these fields are the masks listed in Table 10.7 with
"ok" in the <emphasis>
enabled_ctrls</emphasis>
column. The <emphasis>
num_groups</emphasis>
field reports the number of groups bound to the key belonging to the most
number of groups and is automatically updated when the keyboard mapping changes.
</para>
<para>
If the change was caused by a request from a client, the <emphasis>
keycode</emphasis>
and <emphasis>
event_type</emphasis>
fields are set to <emphasis>
zero </emphasis>
and the <emphasis>
req_major</emphasis>
and <emphasis>
req_minor</emphasis>
fields identify the request. The <emphasis>
req_major</emphasis>
value is the same as the major extension opcode. Otherwise, <emphasis>
event_type</emphasis>
is set to the type of event that caused the change (one of <emphasis>
KeyPress</emphasis>
, <emphasis>
KeyRelease</emphasis>
, <emphasis>
DeviceKeyPress</emphasis>
, <emphasis>
DeviceKeyRelease</emphasis>
, <emphasis>
ButtonPress</emphasis>
or <emphasis>
ButtonRelease</emphasis>
), and <emphasis>
req_major</emphasis>
and <emphasis>
req_minor</emphasis>
are undefined. If <emphasis>
event_type</emphasis>
is <emphasis>
KeyPress</emphasis>
, <emphasis>
KeyRelease</emphasis>
, <emphasis>
DeviceKeyPress</emphasis>
, or <emphasis>
DeviceKeyRelease</emphasis>
, the <emphasis>
keycode</emphasis>
field is set to the key that caused the change. If <emphasis>
event_type</emphasis>
is <emphasis>
ButtonPress</emphasis>
or <emphasis>
ButtonRelease</emphasis>
, <emphasis>
keycode</emphasis>
contains the button number.
</para>
<para>
When a client receives an <emphasis>
XkbControlsNotify</emphasis>
event, it can note the changes in a changes structure using <emphasis>
XkbNoteControlsChanges</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>
XkbNoteControlsChanges</emphasis>
(<emphasis>
changes</emphasis>
,<emphasis>
new</emphasis>
,<emphasis>
wanted</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbControlsChangesPtr <emphasis>
changes</emphasis>
; /* records changes indicated by new */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbControlsNotifyEvent * <emphasis>
new</emphasis>
; /* tells which things have changed */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
wanted</emphasis>
; /* tells which parts of new to record in changes */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
The <emphasis>
wanted</emphasis>
parameter is a bitwise inclusive OR of bits taken from the set of masks
specified in Table 10.7 with "ok" in the <emphasis>
changed_ctrls</emphasis>
column. <emphasis>
XkbNoteControlsChanges</emphasis>
copies any changes reported in <emphasis>
new</emphasis>
and specified in <emphasis>
wanted</emphasis>
into the changes record specified by <emphasis>
old</emphasis>
.
</para>
<para>
Use <emphasis>
XkbGetControlsChanges</emphasis>
to update a local copy of a keyboard description with the changes previously
noted by one or more calls to <emphasis>
XkbNoteControlsChanges.</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>
XkbGetControlsChanges</emphasis>
(<emphasis>
dpy</emphasis>
,<emphasis>
xkb</emphasis>
,<emphasis>
changes</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* <emphasis>
xkb->ctrls</emphasis>
will be updated */
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbNameChangesPtr <emphasis>
changes</emphasis>
; /* indicates which parts of <emphasis>
xkb->ctrls</emphasis>
to update */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetControlsChanges</emphasis>
examines the <emphasis>
changes</emphasis>
parameter, queries the server for the necessary information, and copies the
results into the <emphasis>
xkb</emphasis>
-><emphasis>
ctrls</emphasis>
keyboard description. If the <emphasis>
ctrls</emphasis>
field of <emphasis>
xkb</emphasis>
is <emphasis>
NULL</emphasis>
, <emphasis>
XkbGetControlsChanges</emphasis>
allocates and initializes it. To free the <emphasis>
ctrls</emphasis>
field, use <emphasis>
XkbFreeControls</emphasis>
(see section 10.12). <!-- xref -->
</para>
<para>
<emphasis>
XkbGetControlsChanges</emphasis>
returns <emphasis>
Success</emphasis>
if successful and can generate <emphasis>
BadAlloc</emphasis>
, <emphasis>
BadImplementation,</emphasis>
and <emphasis>
BadMatch</emphasis>
errors.
</para>
</sect1>
<sect1 id='Allocating_and_Freeing_an_XkbControlsRec'>
<title>Allocating and Freeing an XkbControlsRec</title>
<para>
The need to allocate an <emphasis>
XkbControlsRec</emphasis>
structure seldom arises; Xkb creates one when an application calls <emphasis>
XkbGetControls</emphasis>
or a related function. For those situations where there is not an <emphasis>
XkbControlsRec</emphasis>
structure allocated in the <emphasis>
XkbDescRec</emphasis>
, allocate one by calling <emphasis>
XkbAllocControls</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>
XkbAllocControls</emphasis>
(<emphasis>
xkb, which</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr <emphasis>
xkb</emphasis>
; /* Xkb description in which to allocate ctrls rec */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int<emphasis>
which</emphasis>
; /* mask of components of <emphasis>
ctrls</emphasis>
to allocate */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbAllocControls</emphasis>
allocates the <emphasis>
ctrls</emphasis>
field of the <emphasis>
xkb</emphasis>
parameter, initializes all fields to zero, and returns <emphasis>
Success</emphasis>
. If the <emphasis>
ctrls</emphasis>
field is not <emphasis>
NULL</emphasis>
, <emphasis>
XkbAllocControls</emphasis>
simply returns <emphasis>
Success</emphasis>
. If <emphasis>
xkb</emphasis>
is <emphasis>
NULL</emphasis>
, <emphasis>
XkbAllocControls</emphasis>
reports a <emphasis>
BadMatch</emphasis>
error. If the <emphasis>
ctrls</emphasis>
field could not be allocated, it reports a <emphasis>
BadAlloc</emphasis>
error.
</para>
<para>
The <emphasis>
which</emphasis>
mask specifies the individual fields of the <emphasis>
ctrls</emphasis>
structure to be allocated and can contain any of the valid masks defined in
Table 10.7. Because none of the currently existing controls have any structures
associated with them, which is currently of little practical value in this call.
</para>
<para>
To free memory used by the <emphasis>
ctrls</emphasis>
member of an <emphasis>
XkbDescRec </emphasis>
structure, use <emphasis>
XkbFreeControls:</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>
XkbFreeControls</emphasis>
(<emphasis>
xkb, which, free_all</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
XkbDescPtr<emphasis>
xkb</emphasis>
; /* Xkb description in which to free controls components */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
which</emphasis>
; /* mask of components of <emphasis>
ctrls</emphasis>
to free */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Bool <emphasis>
free_all</emphasis>
; /* <emphasis>
True</emphasis>
=> free everything + ctrls itself */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbFreeControls</emphasis>
frees the specified components of the <emphasis>
ctrls</emphasis>
field in the <emphasis>
xkb</emphasis>
keyboard description and sets the corresponding structure component values to
<emphasis>
NULL</emphasis>
or <emphasis>
zero</emphasis>
. The <emphasis>
which</emphasis>
mask specifies the fields of <emphasis>
ctrls</emphasis>
to be freed and can contain any of the controls components specified in Table
10.7.
</para>
<para>
If <emphasis>
free_all</emphasis>
is <emphasis>
True</emphasis>
, <emphasis>
XkbFreeControls</emphasis>
frees every non-<emphasis>
NULL</emphasis>
structure component in the controls, frees the <emphasis>
XkbControlsRec</emphasis>
structure referenced by the <emphasis>
ctrls</emphasis>
member of <emphasis>
xkb</emphasis>
, and sets <emphasis>
ctrls</emphasis>
to <emphasis>
NULL.</emphasis>
</para>
</sect1>
<sect1 id='The_Miscellaneous_Per_client_Controls'>
<title>The Miscellaneous Per-client Controls</title>
<para>
You can configure the boolean per-client controls which affect the state
reported in button and key events. See section 12.1.1, 12.3, 12.5, and 16.3.11 <!-- xref -->
of the XKB Protocol specification for more details.
</para>
<para>
To get the current values of the <emphasis>
per-client</emphasis>
controls, use <emphasis>
XkbGetPerClientControls</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'>
Bool <emphasis>
XkbGetPerClientControls</emphasis>
(<emphasis>
dpy</emphasis>
, <emphasis>
ctrls</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
ctrls</emphasis>
; /* 1 bit => corresponding control is on */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbGetPerClientControls</emphasis>
backfills <emphasis>
ctrls</emphasis>
with the <emphasis>
per-client </emphasis>
control attributes for this particular client. It returns <emphasis>
True</emphasis>
if successful, and <emphasis>
False</emphasis>
otherwise.
</para>
<para>
To change the current values of the <emphasis>
per-client</emphasis>
control attributes, use <emphasis>
XkbSetPerClientControls.</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'>
Bool <emphasis>
XkbSetPerClientControls</emphasis>
(<emphasis>
dpy</emphasis>
, <emphasis>
ctrls</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
dpy</emphasis>
; /* connection to X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
change</emphasis>
; /* 1 bit => change control */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int * <emphasis>
value</emphasis>
; /* 1 bit => control on */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<emphasis>
XkbSetPerClientControls changes the per-client values for the controls selected
by </emphasis>
<emphasis>
change to the corresponding value in value. Legal values for change and value
are: XkbPCF_GrabsUseXKBStateMask, XkbPCF_LookupStateWhenGrabbed, and
XkbPCF_SendEventUsesXKBState. More than one control may be changed at one time
by OR-ing the values together. XkbSetPerClientControls backfills value with the
</emphasis>
<emphasis>
per-client </emphasis>
<emphasis>
control attributes for this particular client. </emphasis>
It returns <emphasis>
True</emphasis>
if successful, and <emphasis>
False</emphasis>
otherwise.
</para>
</sect1>
</chapter>
|