XChangeKeyboardMapping(display, first_keycode, keysyms_per_keycode, keysyms, num_codes)
      Display *display;
      int first_keycode;
      int keysyms_per_keycode;
      KeySym *keysyms;
      int num_codes;


display Specifies the connection to the X server.
first_keycode Specifies the first KeyCode that is to be changed.
keysyms_per_keycode Specifies the number of KeySyms per KeyCode.
keysyms Specifies an array of KeySyms.
num_codes Specifies the number of KeyCodes that are to be changed.


The XChangeKeyboardMapping() function defines the symbols for the specified number of KeyCodes starting with first_keycode. The symbols for KeyCodes outside this range remain unchanged. The number of elements in keysyms must be:

num_codes * keysyms_per_keycode

The specified first_keycode must be greater than or equal to min_keycode returned by XDisplayKeycodes(), or a BadValue error results. In addition, the following expression must be less than or equal to max_keycode as returned by XDisplayKeycodes(), or a BadValue error results:

first_keycode + num_codes - 1

KeySym number N, counting from zero, for KeyCode K has the following index in keysyms, counting from zero:

(K - first_keycode) * keysyms_per_keycode + N

The specified keysyms_per_keycode can be chosen arbitrarily by the client to be large enough to hold all desired symbols. A special KeySym value of NoSymbol should be used to fill in unused elements for individual KeyCodes. It is legal for NoSymbol to appear in nontrailing positions of the effective list for a KeyCode. XChangeKeyboardMapping() generates a MappingNotify event.

There is no requirement that the X server interpret this mapping. It is merely stored for reading and writing by clients.

XChangeKeyboardMapping() can generate BadAlloc and BadValue errors.


BadAlloc The server failed to allocate the requested source or server memory.
BadValue Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.

See also

XDeleteModifiermapEntry(), XDisplayKeycodes(), XFree(), XFreeModifiermap(), XGetKeyboardMapping(), XGetModifierMapping(), XInsertModifiermapEntry(), XNewModifiermap(), XSetModifierMapping(), XSetPointerMapping(), "Keyboard Encoding".
Christophe Tronche, [email protected]