16.1 Keyboard Utility Functions

This section discusses mapping between KeyCodes and KeySyms, classifying KeySyms, and mapping between KeySyms and string names. The first three functions in this section operate on a cached copy of the server keyboard mapping. The first four KeySyms for each KeyCode are modified according to the rules given in "Keyboard Encoding". To obtain the untransformed KeySyms defined for a key, use the functions described in section "Keyboard Encoding".

To obtain a KeySym for the KeyCode of an event, use XLookupKeysym().

To obtain a KeySym for a specific KeyCode, use XKeycodeToKeysym().

To obtain a KeyCode for a key having a specific KeySym, use XKeysymToKeycode().

The mapping between KeyCodes and KeySyms is cached internal to Xlib. When this information is changed at the server, an Xlib function must be called to refresh the cache. To refresh the stored modifier and keymap information, use XRefreshKeyboardMapping().

To obtain the uppercase and lowercase forms of a KeySym, us XConvertCase().

KeySyms have string names as well as numeric codes. To convert the name of the KeySym to the KeySym code, use XStringToKeysym().

To convert a KeySym code to the name of the KeySym, use XKeysymToString().

Next: KeySym Classification Macros

Christophe Tronche, [email protected]