DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Configuring the keyboard for the server

About the server keyboard

Every time you press a key on your keyboard while running the X server, the following signals are exchanged:


scancodes
hardware-dependent codes generated by keystrokes and received by the X server

keycodes
codes sent by the X server to the client indicating which key was pressed. Keycodes by themselves do not indicate what the keystroke means; the client must request that information from the X server.

modifiers
flags, such as ``shift'' and ``control,'' that the server sends with each keycode to the client. The client's interpretation of the keycode may depend on the state of the modifiers. For example, the state of the shift modifier determines whether an alphabetic character should be lowercase or uppercase. Because the X server encodes the states of the eight modifiers (shift, lock, control, mod1, mod2, mod3, mod4, and mod5) in a single byte of data, modifiers are often referred to as ``modifier bits.''

keysyms
codes that specify the glyphs appearing on the keys. The X server also maintains a list of strings that describe the keysyms, such as ``a'', ``B'', and ``Control.''
The X server keeps track of the mappings of keycodes to keysyms, and mappings of keysyms to modifiers in two tables in its memory:

keymap table
contains a list of keycodes that the X server sends, and the keysyms and strings that correspond to them. The order of keysyms in the keymap table determines which keysym corresponds to the shifted or unshifted key.

modifier map
contains a list of keysyms and keycodes to which each of the eight modifiers are ``attached.'' For example, the default configuration attaches the mod1 modifier to the Alt_L and Alt_R keysyms and to the keycodes corresponding to the left and right <Alt> keys. When either <Alt> key is pressed, or when any key mapped to the Alt_L or Alt_R keysyms is pressed, the mod1 modifier is on.
To change the behavior of your keyboard while the X server is running, you need only modify these two tables.

Because many non-U.S. keyboards have more than two symbols on each key, the Shift modifier is supplemented by a modifier known as the ``group modifier,'' and the keysym, Mode_Switch. If the keymap table specifies more than two keysyms for a key, the state of the group modifier determines whether the Shift modifier toggles between the first and second keysyms, which are referred to as ``group 1,'' or between the third and fourth keysyms, which are referred to as ``group 2.'' When you configure the X server for a non-U.S. keyboard, xsconfig.sh (see the xsconfig(X) manual page) maps Mode_Switch to the mod3 modifier. Consequently, any key mapped to Mode_Switch in the keymap table acts as the group modifier.

The X server's initial keyboard configuration is read from a configuration file, .Xsco.cfg. If the X server finds .Xsco.cfg in the user's home directory, it reads that file. Otherwise, it reads the system-wide default configuration file, /usr/lib/X11/.Xsco.cfg.

You can modify the contents of the keymap table and modifier map while the X server is running, but the initial mapping of scancodes and keycodes, and of keysyms to strings, can only be modified by compiling a new configuration file. You create keyboard configuration files with the xsconfig.sh script, which allows you to create default keyboard configurations for a variety of character sets, languages, and keyboards.

See also:


Next topic: Changing the modifier map
Previous topic: Configuring the keyboard for the server

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003