[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Dec 1 02:55:52 1994 
Subject:problem with HP Xterminal key mappings in XVED 
From:"A.Sloman" 
Volume-ID:941202.01 

Does anyone know how to control the keypad mappings on an HP Xterminal?

Here in Birmingham, where we use VED with many different keyboards,
we have been trying to build up a uniform collection of keyboard
mappings for all machines, in particular using this for the top
row function keys
        F1       F2       F3       F4       F5        F6       F7
     +--------+--------+--------+--------+--------+--------+--------+
 Esc | mk top | mk end | yank   | yank   | yank   | yank   | yank   |
+Key | file   | file   |linepart| line   |linepart|linepart|linepart|
-----+--------+--------+--------+--------+--------+--------+--------+
 KEY | MARK   | MARK   | DELETE | DELETE | DELETE | DELETE | DELETE |
     | BEGIN  | END    | LINE < | LINE   | LINE > | WORD < | WORD > |
     +--------+--------+--------+--------+--------+--------+--------+

etc.

and using the UP DOWN LEFT RIGHT arrow keys for big moves and the
keypad keys 2, 4, 6 8 for small moves. This works on PCs running
X emulators, on NCD X terminals, on Suns and (almost) on HP X terminals.

Most of the time the set up works fine (even with Sun type 5 keyboards),
but when we try to use XVed on our HP Xterminal (which has a keyboard
layout like a PC), we find that somehow XVed is changing things so that
the arrow keys generate the same character sequences as the 2,4,6,8
keypad keys, making it impossible to give them different functions, and
therefore completely wasting part of the keyboard.

I.e. we want to have different mappings for the arrow keys in the
central keypad (UP DOWN LEFT RIGHT) and the arrow keys in the numeric
keypad (KP_8 KP_2 KP_4 KP_6) . This has been done by using identical
"translations" for these keysyms in the user's .Xdefaults file for Xterm
and for XpwScrollText, e.g.

(XVED):
*XpwScrollText*Translations: #override \
    <Key>F1: string(0x1b) string("[11~") \n\
    <Key>F2: string(0x1b) string("[12~") \n\
        .... etc. .....
    <Key>Up: string(0x1b) string("[A") \n\
    <Key>Down: string(0x1b) string("[B") \n\
    <Key>Right: string(0x1b) string("[C") \n\
    <Key>Left: string(0x1b) string("[D") \n\
        .... etc. ....
    <Key>KP_1: string(0x1b) string("Oq") \n\
    <Key>KP_2: string(0x1b) string("Or") \n\
    <Key>KP_3: string(0x1b) string("Os") \n\
    <Key>KP_4: string(0x1b) string("Ot") \n\
    <Key>KP_5: string(0x1b) string("Ou") \n\
    <Key>KP_6: string(0x1b) string("Ov") \n\
    <Key>KP_7: string(0x1b) string("Ow") \n\
    <Key>KP_8: string(0x1b) string("Ox") \n\
    <Key>KP_9: string(0x1b) string("Oy") \n\
        ..... etc....

(Ordinary VED in an Xterm window):
XTerm*VT100*Translations: #override \
        ..... etc....
    <Key>Up: string(0x1b) string("[A") \n\
    <Key>Down: string(0x1b) string("[B") \n\
    <Key>Right: string(0x1b) string("[C") \n\
    <Key>Left: string(0x1b) string("[D") \n\
        ..... etc....

The problem is that the settings for the numeric keypad somehow
get changed in Xved. I.e. they transmit different characters
from those transmitted in VED. In particular in Xved the
8,2,4,6 keys transmit the very same characters as the Up,Down,
Left,Right arrow keys, though not in ordinary VED.

Using "xev" shows that the keys have the right keysyms, e.g.
KP_8, KP_2, etc.

Is it possible that Xved somehow  temporarily changes the keysyms
associated with the keys? REF XVED says

| The first thing  the Key event  handler does  is to look  for any  entry
| corresponding to the keysym of the key in the "keyMapTable" of both  the
| "currentWindow" and  the  "defaultWindow".  Since these  are  the  first
| tables consulted for key  mappings, they can be  used to override  other
| key translations.

Unfortunately it nowhere tells you where to find this keyMapTable, and
using "grep" I could not find any other Xved file that mentioned it.

Is it an X system file? Is it buried somewhere in the Poplog tree? Am
I supposed to go and read X documentation before I try to use Xved?
And should it really override the user's own .Xdefaults settings? Not
according to this bit of REF XVED:

| By default, in XVed, the  keyboard sends escape sequences for  non-ascii
| keys based upon  their X  "KeySym". This means  that it  is possible  to
| determine  what  escape  sequence  a   logical  keyname  will  send   by
| translating that  name first  into  a keysym  and  then into  an  escape
| sequence.

Worse, two of the keypad keys (7 and 1) are labelled "Home" and "End".
"xev" shows that they are clearly set up with different keysyms from
Home and End. And yet when we run Xved on HP Xterminals we get them
behaving like Home and End, rather than like KP_7 and KP_1. Why??

This does not happen in ordinary VED.

The problems of using Xved are slowly driving me towards making the
switch to the unmentionable ....

Cheers.
Aaron