Working with keyboard mapping

The following model shows how input methods are used by applications. Use this information to help you customize keyboard mapping.

Input processing is divided into three steps:

  1. keycode/keystate(raw) - > keysym/modifier(new)

    This step is application and environment-dependent. The application is responsible for mapping the raw key event into a keysym/modifier for input to the input method.

    In the AIXwindows environment, the client uses the server's keysym table, xmodmap, which is installed at the server, to perform this step. The xmodmap defines the mapping of the Shift, Lock, and Alt-Graphic keys. The client uses the xmodmap as well as the Shift and Lock modifiers from the X event to determine the keysym/modifier represented by this event.

    For example, if you press the XK_a keysym with a Shift modifier, the xmodmap maps it to the XK_A keysym. Because you used the Shift key to map the key code to a keysym, the application should mask the Shift modifier from the original X event. Consequently, the input to the input method would be the XK_A keysym and no modifier.

    In another environment, if the device provides no additional information, the input method receives the XK_a keysym with the Shift modifier. The input method should perform the same mapping in both cases and return the letter A.

  2. keysym/modifier(new) - > localized string

    This step depends on the localized IMED and varies with each locale. It notifies the IMED that a key event occurred and to ask for an indication that their IMED uses the key event internally. This occurs when the application calls the IMFilter subroutine.

    If the IMED indicates that the key event is used for internal processing, the application ignores the event. Because the IMED is the first to see the event, this step should be done before the application interprets the event. The IMED only uses key events that are essential.

    If the IMED indicates the event is not used for internal processing, the application performs the next step.

  3. keysym/modifier(new) - > customized string

    This step occurs when the application calls the IMLookupString subroutine. The input method keymap (created by the keycomp command) defines the mapping for this phase. It is the last attempt to map the key event to a string and allows a user to customize the mapping.

    If the keysym/modifier (new) combination is defined in the input method keymap (imkeymap), a string is returned. Otherwise, the key event is unknown to the input method.