1XkbKeyAction(3) XKB FUNCTIONS XkbKeyAction(3)
2
3
4
6 XkbKeyAction - Returns the key action
7
9 XkbAction XkbKeyAction (XkbDescPtr xkb, KeyCode keycode, int idx);
10
12 - xkb Xkb description of interest
13
14 - keycode
15 keycode of interest
16
17 - idx index for group and shift level
18
20 A key action defines the effect key presses and releases have on the
21 internal state of the server. For example, the expected key action
22 associated with pressing the Shift key is to set the Shift modifier.
23 There is zero or one key action associated with each keysym bound to
24 each key.
25
26 Just as the entire list of key symbols for the keyboard mapping is held
27 in the syms field of the client map, the entire list of key actions for
28 the keyboard mapping is held in the acts array of the server map. The
29 total size of acts is specified by size_acts, and the number of entries
30 is specified by num_acts.
31
32 The key_acts array, indexed by keycode, describes the actions associ‐
33 ated with a key. The key_acts array has min_key_code unused entries at
34 the start to allow direct indexing using a keycode. If a key_acts entry
35 is zero, it means the key does not have any actions associated with it.
36 If an entry is not zero, the entry represents an index into the acts
37 field of the server map, much as the offset field of a KeySymMapRec
38 structure is an index into the syms field of the client map.
39
40 The reason the acts field is a linear list of XkbActions is to reduce
41 the memory consumption associated with a keymap. Because Xkb allows
42 individual keys to have multiple shift levels and a different number of
43 groups per key, a single two-dimensional array of KeySyms would poten‐
44 tially be very large and sparse. Instead, Xkb provides a small two-
45 dimensional array of XkbActions for each key. To store all of these
46 individual arrays, Xkb concatenates each array together in the acts
47 field of the server map.
48
49 The key action structures consist only of fields of type char or
50 unsigned char. This is done to optimize data transfer when the server
51 sends bytes over the wire. If the fields are anything but bytes, the
52 server has to sift through all of the actions and swap any nonbyte
53 fields. Because they consist of nothing but bytes, it can just copy
54 them out.
55
56 XkbKeyAction returns the key action indexed by idx in the two-dimen‐
57 sional array of key actions associated with the key corresponding to
58 keycode.idx may be computed from the group and shift level of interest
59 as follows:
60
61 idx = group_index * key_width + shift_level
62
64 The KeySymMapRec structure is defined as follows:
65
66 #define XkbNumKbdGroups 4
67 #define XkbMaxKbdGroup (XkbNumKbdGroups-1)
68
69 typedef struct { /∗ map to keysyms for a single keycode
70 */
71 unsigned char kt_index[XkbNumKbdGroups]; /∗ key type index for
72 each group */
73 unsigned char group_info; /∗ # of groups and out of range group
74 handling */
75 unsigned char width; /∗ max # of shift levels for key */
76 unsigned short offset; /∗ index to keysym table in syms array
77 */
78 } XkbSymMapRec, *XkbSymMapPtr;
79
80
81
82
83X Version 11 libX11 1.6.7 XkbKeyAction(3)