1XChangeKeyboardMapping(3) XLIB FUNCTIONS XChangeKeyboardMapping(3)
2
3
4
6 XChangeKeyboardMapping, XGetKeyboardMapping, XDisplayKeycodes, XSetMod‐
7 ifierMapping, XGetModifierMapping, XNewModifiermap, XInsertModi‐
8 fiermapEntry, XDeleteModifiermapEntry, XFreeModifierMap XModifierKeymap
9 - manipulate keyboard encoding and keyboard encoding structure
10
12 int XChangeKeyboardMapping(Display *display, int first_keycode, int
13 keysyms_per_keycode, KeySym *keysyms, int num_codes);
14
15 KeySym *XGetKeyboardMapping(Display *display, KeyCode first_keycode,
16 int keycode_count, int *keysyms_per_keycode_return);
17
18 int XDisplayKeycodes(Display *display, int *min_keycodes_return, int
19 *max_keycodes_return);
20
21 int XSetModifierMapping(Display *display, XModifierKeymap *modmap);
22
23 XModifierKeymap *XGetModifierMapping(Display *display);
24
25 XModifierKeymap *XNewModifiermap(int max_keys_per_mod);
26
27 XModifierKeymap *XInsertModifiermapEntry(XModifierKeymap *modmap, Key‐
28 Code keycode_entry, int modifier);
29
30 XModifierKeymap *XDeleteModifiermapEntry(XModifierKeymap *modmap, Key‐
31 Code keycode_entry, int modifier);
32
33 int XFreeModifiermap(XModifierKeymap *modmap);
34
36 display Specifies the connection to the X server.
37
38 first_keycode
39 Specifies the first KeyCode that is to be changed or
40 returned.
41
42 keycode_count
43 Specifies the number of KeyCodes that are to be returned.
44
45 keycode_entry
46 Specifies the KeyCode.
47
48 keysyms Specifies an array of KeySyms.
49
50 keysyms_per_keycode
51 Specifies the number of KeySyms per KeyCode.
52
53 keysyms_per_keycode_return
54 Returns the number of KeySyms per KeyCode.
55
56 max_keys_per_mod
57 Specifies the number of KeyCode entries preallocated to the
58 modifiers in the map.
59
60 max_keycodes_return
61 Returns the maximum number of KeyCodes.
62
63 min_keycodes_return
64 Returns the minimum number of KeyCodes.
65
66 modifier Specifies the modifier.
67
68 modmap Specifies the XModifierKeymap structure.
69
70 num_codes Specifies the number of KeyCodes that are to be changed.
71
73 The XChangeKeyboardMapping function defines the symbols for the speci‐
74 fied number of KeyCodes starting with first_keycode. The symbols for
75 KeyCodes outside this range remain unchanged. The number of elements
76 in keysyms must be:
77
78 num_codes * keysyms_per_keycode
79
80 The specified first_keycode must be greater than or equal to min_key‐
81 code returned by XDisplayKeycodes, or a BadValue error results. In
82 addition, the following expression must be less than or equal to
83 max_keycode as returned by XDisplayKeycodes, or a BadValue error
84 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
110 returned 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
133 returned is never less than 8, and the maximum number of KeyCodes
134 returned 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
149 results.
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), XSetPointerMapping(3)
203 Xlib - C Language X Interface
204
205
206
207X Version 11 libX11 1.3.4 XChangeKeyboardMapping(3)