1XChangeKeyboardMapping(3) XLIB FUNCTIONS XChangeKeyboardMapping(3)
2
3
4
6 XChangeKeyboardMapping, XGetKeyboardMapping, XDisplayKeycodes, XSetMod‐
7 ifierMapping, XGetModifierMapping, XNewModifiermap, XInsertModi‐
8 fiermapEntry, XDeleteModifiermapEntry, XFreeModifiermap, XModi‐
9 fierKeymap - manipulate keyboard encoding and keyboard encoding struc‐
10 ture
11
13 int XChangeKeyboardMapping(Display *display, int first_keycode, int
14 keysyms_per_keycode, KeySym *keysyms, int num_codes);
15
16 KeySym *XGetKeyboardMapping(Display *display, KeyCode first_keycode,
17 int keycode_count, int *keysyms_per_keycode_return);
18
19 int XDisplayKeycodes(Display *display, int *min_keycodes_return, int
20 *max_keycodes_return);
21
22 int XSetModifierMapping(Display *display, XModifierKeymap *modmap);
23
24 XModifierKeymap *XGetModifierMapping(Display *display);
25
26 XModifierKeymap *XNewModifiermap(int max_keys_per_mod);
27
28 XModifierKeymap *XInsertModifiermapEntry(XModifierKeymap *modmap, Key‐
29 Code keycode_entry, int modifier);
30
31 XModifierKeymap *XDeleteModifiermapEntry(XModifierKeymap *modmap, Key‐
32 Code keycode_entry, int modifier);
33
34 int XFreeModifiermap(XModifierKeymap *modmap);
35
37 display Specifies the connection to the X server.
38
39 first_keycode
40 Specifies the first KeyCode that is to be changed or
41 returned.
42
43 keycode_count
44 Specifies the number of KeyCodes that are to be returned.
45
46 keycode_entry
47 Specifies the KeyCode.
48
49 keysyms Specifies an array of KeySyms.
50
51 keysyms_per_keycode
52 Specifies the number of KeySyms per KeyCode.
53
54 keysyms_per_keycode_return
55 Returns the number of KeySyms per KeyCode.
56
57 max_keys_per_mod
58 Specifies the number of KeyCode entries preallocated to the
59 modifiers in the map.
60
61 max_keycodes_return
62 Returns the maximum number of KeyCodes.
63
64 min_keycodes_return
65 Returns the minimum number of KeyCodes.
66
67 modifier Specifies the modifier.
68
69 modmap Specifies the XModifierKeymap structure.
70
71 num_codes Specifies the number of KeyCodes that are to be changed.
72
74 The XChangeKeyboardMapping function defines the symbols for the speci‐
75 fied number of KeyCodes starting with first_keycode. The symbols for
76 KeyCodes outside this range remain unchanged. The number of elements
77 in keysyms must be:
78
79 num_codes * keysyms_per_keycode
80
81 The specified first_keycode must be greater than or equal to min_key‐
82 code returned by XDisplayKeycodes, or a BadValue error results. In
83 addition, the following expression must be less than or equal to
84 max_keycode as returned by XDisplayKeycodes, or a BadValue error
85 results:
86
87 first_keycode + num_codes - 1
88
89 KeySym number N, counting from zero, for KeyCode K has the following
90 index in keysyms, counting from zero:
91
92 (K - first_keycode) * keysyms_per_keycode + N
93
94 The specified keysyms_per_keycode can be chosen arbitrarily by the
95 client to be large enough to hold all desired symbols. A special
96 KeySym value of NoSymbol should be used to fill in unused elements for
97 individual KeyCodes. It is legal for NoSymbol to appear in nontrailing
98 positions of the effective list for a KeyCode. XChangeKeyboardMapping
99 generates a MappingNotify event.
100
101 There is no requirement that the X server interpret this mapping. It
102 is merely stored for reading and writing by clients.
103
104 XChangeKeyboardMapping can generate BadAlloc and BadValue errors.
105
106 The XGetKeyboardMapping function returns the symbols for the specified
107 number of KeyCodes starting with first_keycode. The value specified in
108 first_keycode must be greater than or equal to min_keycode as returned
109 by XDisplayKeycodes, or a BadValue error results. In addition, the
110 following expression must be less than or equal to max_keycode as
111 returned by XDisplayKeycodes:
112
113 first_keycode + keycode_count - 1
114
115 If this is not the case, a BadValue error results. The number of ele‐
116 ments in the KeySyms list is:
117
118 keycode_count * keysyms_per_keycode_return
119
120 KeySym number N, counting from zero, for KeyCode K has the following
121 index in the list, counting from zero:
122 (K - first_code) * keysyms_per_code_return + N
123
124 The X server arbitrarily chooses the keysyms_per_keycode_return value
125 to be large enough to report all requested symbols. A special KeySym
126 value of NoSymbol is used to fill in unused elements for individual
127 KeyCodes. To free the storage returned by XGetKeyboardMapping, use
128 XFree.
129
130 XGetKeyboardMapping can generate a BadValue error.
131
132 The XDisplayKeycodes function returns the min-keycodes and max-keycodes
133 supported by the specified display. The minimum number of KeyCodes
134 returned is never less than 8, and the maximum number of KeyCodes
135 returned is never greater than 255. Not all KeyCodes in this range are
136 required to have corresponding keys.
137
138 The XSetModifierMapping function specifies the KeyCodes of the keys (if
139 any) that are to be used as modifiers. If it succeeds, the X server
140 generates a MappingNotify event, and XSetModifierMapping returns Map‐
141 pingSuccess. X permits at most 8 modifier keys. If more than 8 are
142 specified in the XModifierKeymap structure, a BadLength error results.
143
144 The modifiermap member of the XModifierKeymap structure contains 8 sets
145 of max_keypermod KeyCodes, one for each modifier in the order Shift,
146 Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod5. Only nonzero KeyCodes
147 have meaning in each set, and zero KeyCodes are ignored. In addition,
148 all of the nonzero KeyCodes must be in the range specified by min_key‐
149 code and max_keycode in the Display structure, or a BadValue error
150 results.
151
152 An X server can impose restrictions on how modifiers can be changed,
153 for example, if certain keys do not generate up transitions in hard‐
154 ware, if auto-repeat cannot be disabled on certain keys, or if multiple
155 modifier keys are not supported. If some such restriction is violated,
156 the status reply is MappingFailed, and none of the modifiers are
157 changed. If the new KeyCodes specified for a modifier differ from
158 those currently defined and any (current or new) keys for that modifier
159 are in the logically down state, XSetModifierMapping returns Mapping‐
160 Busy, and none of the modifiers is changed.
161
162 XSetModifierMapping can generate BadAlloc and BadValue errors.
163
164 The XGetModifierMapping function returns a pointer to a newly created
165 XModifierKeymap structure that contains the keys being used as modi‐
166 fiers. The structure should be freed after use by calling XFreeModi‐
167 fiermap. If only zero values appear in the set for any modifier, that
168 modifier is disabled.
169
170 The XNewModifiermap function returns a pointer to XModifierKeymap
171 structure for later use.
172
173 The XInsertModifiermapEntry function adds the specified KeyCode to the
174 set that controls the specified modifier and returns the resulting
175 XModifierKeymap structure (expanded as needed).
176
177 The XDeleteModifiermapEntry function deletes the specified KeyCode from
178 the set that controls the specified modifier and returns a pointer to
179 the resulting XModifierKeymap structure.
180
181 The XFreeModifiermap function frees the specified XModifierKeymap
182 structure.
183
185 The XModifierKeymap structure contains:
186
187 typedef struct {
188 int max_keypermod; /* This server's max number of keys per modifier */
189 KeyCode *modifiermap; /* An 8 by max_keypermod array of the modifiers */
190 } XModifierKeymap;
191
193 BadAlloc The server failed to allocate the requested resource or
194 server memory.
195
196 BadValue Some numeric value falls outside the range of values accepted
197 by the request. Unless a specific range is specified for an
198 argument, the full range defined by the argument's type is
199 accepted. Any argument defined as a set of alternatives can
200 generate this error.
201
203 XFree(3), XkbGetMap(3), XSetPointerMapping(3)
204 Xlib - C Language X Interface
205
206
207
208X Version 11 libX11 1.6.12 XChangeKeyboardMapping(3)