Next: , Previous: , Up: Control Functions   [Contents][Index]


15.4 Keyboard Encodings

Handling the great diversity of keyboard devices and international language character encodings is a difficult problem for interactive programs that need to receive text input but must also be portable. The X Window System solves this problem by using different sets of encodings for device keys (keycodes) and for character symbols (keysyms). Each X server maintains a keyboard mapping that associates keycodes and keysyms, and which can be returned or changed by client programs.

To handle text input, a CLX client program must follow these steps:

  1. Receive a :key-press (or :key-release) event containing a keycode.
  2. Convert the keycode into its corresponding keysym, based on the current keyboard mapping. See keycode->keysym.
  3. Convert the keysym into the corresponding Common Lisp character. See keysym->character.