HPlogo HP Xlib Extensions: > Chapter 7 Internationalization Support

Controlling Keyboard Input Using HP's X Window System

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

The X Window System uses the concept of keysyms to control the mapping of keys into characters. The set of keysyms for a particular keyboard is organized into a table called the keymap. To get information about keyboard mapping or to set the keyboard mapping use the xmodmap command.

Mapping keyboard for both Extend-char and Meta

A common problem reported by people using HP's X Window System is the conflict between the use of the "extend-char" key to access the extended characters of "Roman8" or "Latin1" with HP's keyboards and the use of the "extend-char" key as a Meta key.

The default mapping is that both keys serve both purposes. However, since HP-UX 9.* it is possible to configure the keyboard so that one key is used as the "extend-char" key and the other as the Meta key.

The "xmodmap" command can be used to inquire and set the mapping for keys on the keyboard. Run the following command.

xmodmap -pm

For a US or West European keyboard in the default state, this prints:

xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift Shift_R (0xc), Shift_L (0xd)
lock Caps_Lock (0x37)
control Control_L (0xe)
mod1 Meta_R (0xa), Meta_L (0xb), Mode_switch (0x36)
mod2
mod3
mod4
mod5

The mod1 modifier has entries for both Meta keysyms and for Mode_switch as well; and this creates a problem. The solution is to use mod2 for Mode_switch and change the Meta_L key into the Mode_switch key. To do this, use "xmodmap" and execute the following command:

xmodmap mods

where mods contains the following four lines:

remove Mod1 = Meta_L Mode_switch
keysym Mode_switch = NoSymbol
keysym Meta_L = Mode_switch
add Mod2 = Mode_switch

The entries in the file need to be in this order. Again, type:

xmodmap -pm

The results should be:

xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift Shift_R (0xc), Shift_L (0xd)
lock Caps_Lock (0x37)
control Control_L (0xe)
mod1 Meta_R (0xa)
mod2 Mode_switch (0xb)
mod3
mod4
mod5

The keyboard then uses the left extend-char key for extended characters and the right extend-char key for Meta. The client must be linked against R4 or R5 Xlib for this to work.

Dead Key Compose processing

HP's X Window System has supported dead key compose processing for HP workstations for some time. This capability is now supported for non-HP servers (workstations and X-terminals) connected to HP systems.

In this form of compose processing a mute (or dead) key is struck followed by a second key. The initial key is a diacritic and the second key is the ASCII character to which the diacritic is to be applied. The diacritic character must be a special muting keysym to initiate the dead-key compose processing. The list of keysym names and the diacritic character to which they apply follows.

keysym name                diacritic character

hpmute_acute
hpmute_grave
hpmute_asciicircum ª
hpmute_diaeresis
hpmute_asciitilde ¬
acute
diaeresis

To find out which muting diacritics are supported by a keyboard type:

xmodmap -pk

The entries in the third and fourth column of the keymap are the extend and shift-extend characters.

To set the mute keysyms as they are for HP series 700 terminals execute:

xmodmap mutes

where mutes is a file containing the following five lines.

keysym r = r R hpmute_acute
keysym t = t T hpmute_grave
keysym y = y Y hpmute_asciicircum
keysym u = u U hpmute_diaeresis
keysym i = i I hpmute_asciitilde

This is the default condition for HP's ITF keyboards.

Multi-key Compose processing

Since HP-UX 9.*, HP's X Window System supports a form of compose processing that can be done using only ASCII characters. To use this form of compose processing, set a keysym to the Multi_key keysym. For example the "Enter/Print" key on an ITF keyboard could be used as the Multi_key. To do this, execute the following command:

xmodmap -e keysym Execute = Multi_key

Then, compose processing can be done by typing the Multi_key ("Print") followed by two other keys. One key should be the ASCII key that corresponds to one of the diacritic symbols and the other key should be the ASCII character to which the diacritic should be applied. The two keys can be typed in any order. For example, typing "Print ' e" generates a null character. The table of ASCII characters and the diacritics they are used for follows

ASCII character    diacritic character
'
`
^ ª
:
"
~ ¬
© 1995 Hewlett-Packard Development Company, L.P.