[comp.windows.x] need help to add accented letters to US keyboard

bertrand@cui.unige.ch (IBRAHIM Bertrand) (10/11/90)

Hi,

I am using X11r4 on a Sun 3/80 running SunOS 4.0.3, with a type 4 US keyboard.
I would like to use the Mod1 key (Meta Left key according to Sun terminology) 
combined with the Shift key to generate accented letters with the [ ] ; ' ` , .
and / keys.

I tried to add the following lines to my .keycode.map file:

   keysym bracketleft=bracketleft braceleft egrave udiaeresis
   keysym bracketright=bracketright braceright ecircumflex icircumflex
   keysym semicolon=semicolon colon eacute odiaeresis
   keysym quoteright=quoteright quotedbl agrave acircumflex
   keysym equal=equal plus ediaeresis idiaeresis
   keysym backslash=backslash bar ucircumflex ocircumflex
   keysym quoteleft=quoteleft tilde ugrave

but couldn't get xmodmap to accept that. I also tried:

   keycode 48=equal plus ediaeresis idiaeresis
   ...

but couldn't get the keyboard to generate an accented letter, even though an 
"xmodmap -kp" would show the modified entries, i.e.
 48  0x003d (equal)  0x002b (plus)   0x00eb (ediaeresis)  0x00ef (idiaeresis)
 ...

I was however able to generate accented letters by redefining the "Shift-ed" 
definition of the function keys (F1 to F12) with the following lines in my 
keycode.map file:

   keycode 12=F1 eacute
   keycode 13=F2 egrave
   keycode 14=F10 ocircumflex
   ...

Just in case it could help, here is what the "xmodmap -pm" outputs:

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

   shift       Shift_L (0x6a),  Shift_R (0x75)
   lock        Caps_Lock (0x7e)
   control     Control_L (0x53)
   mod1        Meta_L (0x7f),  Meta_R (0x81)
   mod2
   mod3
   mod4
   mod5

The different documentations (xmodmap, xterm, X, ...) do not give much hint
about defining the keysyms corresponding to key-modifier combinations. Could 
any kind soul point me to the adequate documentation or directly tell me how to 
achieve my goal.

Please respond directly to me. I can post a summary if there is enough interest.

Thanks in advance,

Bertrand Ibrahim
Computer Science department, University of Geneva, Switzerland.
BITNET:        IBRAHIM@CGEUGE51.bitnet
MHS, INTERNET: ibrahim@uni2a.unige.ch
JANET:         ibrahim%uni2a.unige.ch@uk.ac.ean-relay
UUCP:          mcsun!cui!bertrand.uucp or  bertrand@cui.UUCP

mouse@LIGHTNING.MCRCIM.MCGILL.EDU (10/12/90)

> I am using X11r4 on a Sun 3/80 running SunOS 4.0.3, with a type 4 US
> keyboard.  I would like to use the Mod1 key (Meta Left key according
> to Sun terminology) combined with the Shift key to generate accented
> letters with the [ ] ; ' ` , . and / keys.

> I tried to add the following lines to my .keycode.map file:

>    keysym bracketleft=bracketleft braceleft egrave udiaeresis
[...]
> but couldn't get xmodmap to accept that. I also tried:
>    keycode 48=equal plus ediaeresis idiaeresis

> but couldn't get the keyboard to generate an accented letter, even
> though an "xmodmap -kp" would show the modified entries, i.e.
>  48  0x003d (equal)  0x002b (plus)   0x00eb (ediaeresis)  0x00ef (idiaeresis)

> I was however able to generate accented letters by redefining the
> "Shift-ed" definition of the function keys (F1 to F12) with the
> following lines in my keycode.map file:

>    keycode 12=F1 eacute
[...]

The problem is that keysyms after the first two in a key binding do not
have standard interpretations, so you're at the mercy of the client
program.  I seem to recall that there is some sort of de-facto
pseudo-standard that the third keysym is to be used when Mod1 is
active, but I don't think the default XLookupString() does this;
clients must handle it themselves.

Keyboard handling is IMO one of the weakest points of X.  I have been
mulling over some of the possibilities, as have doubtless many others,
but I have nothing concrete to suggest yet.

> Could any kind soul point me to the adequate documentation or
> directly tell me how to achieve my goal.

Toolkit clients generally accept Translation resources to allow you to
bind actions to keys; these actions can, I believe, include things like
inserting a Latin-1 accented character into a Text widget and such
things.  However, the mechanism is seriously flawed.  In particular,
each client must have its Translation resources set up separately;
there is no way to (say) set F9 to generate the string "foo" for all
clients that simply call XLookupString, or to specify that
Mod2-Shift-semicolon is to generate a capital thorn in all clients.

I suspect that the situation is bad enough that the first semi-solution
proposed will rapidly become a de-facto standard, which is part of the
reason I'm holding off proposing any of the various ideas I've had - I
don't feel they're good enough.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (10/12/90)

    The problem is that keysyms after the first two in a key binding do not
    have standard interpretations,

Incorrect.  A standard interpretation was introduced in R4.

    I seem to recall that there is some sort of de-facto
    pseudo-standard that the third keysym is to be used when Mod1 is
    active, but I don't think the default XLookupString() does this;

There is a standard interpretation for a "group" modifier, and the
R4 XLookupString implements it.

    Keyboard handling is IMO one of the weakest points of X.

It could certainly be improved, no question.