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 re‐
41 turned.
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 ad‐
83 dition, the following expression must be less than or equal to max_key‐
84 code as returned by XDisplayKeycodes, or a BadValue error results:
85
86 first_keycode + num_codes - 1
87
88 KeySym number N, counting from zero, for KeyCode K has the following
89 index in keysyms, counting from zero:
90
91 (K - first_keycode) * keysyms_per_keycode + N
92
93 The specified keysyms_per_keycode can be chosen arbitrarily by the
94 client to be large enough to hold all desired symbols. A special
95 KeySym value of NoSymbol should be used to fill in unused elements for
96 individual KeyCodes. It is legal for NoSymbol to appear in nontrailing
97 positions of the effective list for a KeyCode. XChangeKeyboardMapping
98 generates a MappingNotify event.
99
100 There is no requirement that the X server interpret this mapping. It
101 is merely stored for reading and writing by clients.
102
103 XChangeKeyboardMapping can generate BadAlloc and BadValue errors.
104
105 The XGetKeyboardMapping function returns the symbols for the specified
106 number of KeyCodes starting with first_keycode. The value specified in
107 first_keycode must be greater than or equal to min_keycode as returned
108 by XDisplayKeycodes, or a BadValue error results. In addition, the
109 following expression must be less than or equal to max_keycode as re‐
110 turned by XDisplayKeycodes:
111
112 first_keycode + keycode_count - 1
113
114 If this is not the case, a BadValue error results. The number of ele‐
115 ments in the KeySyms list is:
116
117 keycode_count * keysyms_per_keycode_return
118
119 KeySym number N, counting from zero, for KeyCode K has the following
120 index in the list, counting from zero:
121 (K - first_code) * keysyms_per_code_return + N
122
123 The X server arbitrarily chooses the keysyms_per_keycode_return value
124 to be large enough to report all requested symbols. A special KeySym
125 value of NoSymbol is used to fill in unused elements for individual
126 KeyCodes. To free the storage returned by XGetKeyboardMapping, use
127 XFree.
128
129 XGetKeyboardMapping can generate a BadValue error.
130
131 The XDisplayKeycodes function returns the min-keycodes and max-keycodes
132 supported by the specified display. The minimum number of KeyCodes re‐
133 turned is never less than 8, and the maximum number of KeyCodes re‐
134 turned is never greater than 255. Not all KeyCodes in this range are
135 required to have corresponding keys.
136
137 The XSetModifierMapping function specifies the KeyCodes of the keys (if
138 any) that are to be used as modifiers. If it succeeds, the X server
139 generates a MappingNotify event, and XSetModifierMapping returns Map‐
140 pingSuccess. X permits at most 8 modifier keys. If more than 8 are
141 specified in the XModifierKeymap structure, a BadLength error results.
142
143 The modifiermap member of the XModifierKeymap structure contains 8 sets
144 of max_keypermod KeyCodes, one for each modifier in the order Shift,
145 Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod5. Only nonzero KeyCodes
146 have meaning in each set, and zero KeyCodes are ignored. In addition,
147 all of the nonzero KeyCodes must be in the range specified by min_key‐
148 code and max_keycode in the Display structure, or a BadValue error re‐
149 sults.
150
151 An X server can impose restrictions on how modifiers can be changed,
152 for example, if certain keys do not generate up transitions in hard‐
153 ware, if auto-repeat cannot be disabled on certain keys, or if multiple
154 modifier keys are not supported. If some such restriction is violated,
155 the status reply is MappingFailed, and none of the modifiers are
156 changed. If the new KeyCodes specified for a modifier differ from
157 those currently defined and any (current or new) keys for that modifier
158 are in the logically down state, XSetModifierMapping returns Mapping‐
159 Busy, and none of the modifiers is changed.
160
161 XSetModifierMapping can generate BadAlloc and BadValue errors.
162
163 The XGetModifierMapping function returns a pointer to a newly created
164 XModifierKeymap structure that contains the keys being used as modi‐
165 fiers. The structure should be freed after use by calling XFreeModi‐
166 fiermap. If only zero values appear in the set for any modifier, that
167 modifier is disabled.
168
169 The XNewModifiermap function returns a pointer to XModifierKeymap
170 structure for later use.
171
172 The XInsertModifiermapEntry function adds the specified KeyCode to the
173 set that controls the specified modifier and returns the resulting
174 XModifierKeymap structure (expanded as needed).
175
176 The XDeleteModifiermapEntry function deletes the specified KeyCode from
177 the set that controls the specified modifier and returns a pointer to
178 the resulting XModifierKeymap structure.
179
180 The XFreeModifiermap function frees the specified XModifierKeymap
181 structure.
182
184 The XModifierKeymap structure contains:
185
186 typedef struct {
187 int max_keypermod; /* This server's max number of keys per modifier */
188 KeyCode *modifiermap; /* An 8 by max_keypermod array of the modifiers */
189 } XModifierKeymap;
190
192 BadAlloc The server failed to allocate the requested resource or
193 server memory.
194
195 BadValue Some numeric value falls outside the range of values accepted
196 by the request. Unless a specific range is specified for an
197 argument, the full range defined by the argument's type is
198 accepted. Any argument defined as a set of alternatives can
199 generate this error.
200
202 XFree(3), XkbGetMap(3), XSetPointerMapping(3)
203 Xlib - C Language X Interface
204
205
206
207X Version 11 libX11 1.7.0 XChangeKeyboardMapping(3)