KeySym *XGetKeyboardMapping(display, first_keycode, keycode_count, 
      Display *display;
      KeyCode first_keycode;
      int keycode_count;
      int *keysyms_per_keycode_return;


display Specifies the connection to the X server.
first_keycode Specifies the first KeyCode that is to be returned.
keycode_count Specifies the number of KeyCodes that are to be returned.
keysyms_per_keycode_return Returns the number of KeySyms per KeyCode.


The XGetKeyboardMapping() function returns the symbols for the specified number of KeyCodes starting with first_keycode. The value specified in first_keycode must be greater than or equal to min_keycode as 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():

first_keycode + keycode_count - 1

If this is not the case, a BadValue error results. The number of elements in the KeySyms list is:

keycode_count * keysyms_per_keycode_return

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

(K - first_code) * keysyms_per_code_return + N

The X server arbitrarily chooses the keysyms_per_keycode_return value to be large enough to report all requested symbols. A special KeySym value of NoSymbol is used to fill in unused elements for individual KeyCodes. To free the storage returned by XGetKeyboardMapping(), use XFree().

XGetKeyboardMapping() can generate a BadValue error.


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

XChangeKeyboardMapping(), XDeleteModifiermapEntry(), XDisplayKeycodes(), XFree(), XFreeModifiermap(), XGetModifierMapping(), XInsertModifiermapEntry(), XNewModifiermap(), XSetModifierMapping(), XSetPointerMapping(), "Keyboard Encoding".
Christophe Tronche, ch@tronche.com