[comp.windows.x] Problems using xterm "translations": Shifted and unshifted equal

Steinar.Haug@delab.sintef.no (Steinar Haug) (03/28/91)

I am trying to use the xterm "translations" resource to dynamically
switch between the use of ISO8859-1 character sets (where I want the
'ae' key to insert ISO8859-1 'ae', 0xd7), and ISO646 character sets
(where I want the 'ae' key to insert its 7-bit "equivalent", which is
'{', 0x7b, in the Norwegian variant of ISO646).

My problem is, I cannot get the xterm to distinguish between a shifted
and an unshifted key. So to simplify the task, I tried the following:

XTerm*VT100.Translations: #override \
	<Key>F4: keymap(None)	\n\
	<Key>F5: keymap(extra)

XTerm*VT100.extraKeymap.translations: #override\
	<Key>x:		string("A")	\n\
	Shift<Key>x:	string("B")

I simply want an unshifted x to insert 'A', and a shifted X to insert "B".
The problem is that only the first definition is used by xterm. I always
get 'A', both shifted and unshifted. If I place the line with Shift -> B
first, I always get B in both shifted and unshifted positions. Furthermore,
in either of these cases I get the same character also for ctrl-x!

Can anybody tell me what the translations should look like to do this? Or
is it simply not possible? According to the documentation, it seems that
it should be possible. Oh, btw, I have tried this on both Suns and HPs
here, all running X11R4 at patchlevel 14.

Steinar Haug, system/networks administrator
SINTEF DELAB, University of Trondheim, NORWAY
Email: Steinar.Haug@delab.sintef.no, 
	sthaug@idt.unit.no, steinar@tosca.er.sintef.no

aw@jello.bae.bellcore.com (Andrew Wason) (03/29/91)

In article <1991Mar27.214211*Steinar.Haug@delab.sintef.no>, Steinar.Haug@delab.sintef.no (Steinar Haug) writes:
>XTerm*VT100.extraKeymap.translations: #override\
>	<Key>x:		string("A")	\n\
>	Shift<Key>x:	string("B")
>
>I simply want an unshifted x to insert 'A', and a shifted X to insert "B".
>The problem is that only the first definition is used by xterm. I always
>get 'A', both shifted and unshifted. If I place the line with Shift -> B
>first, I always get B in both shifted and unshifted positions. Furthermore,
>in either of these cases I get the same character also for ctrl-x!

Try:

XTerm*VT100.extraKeymap.translations: #override\
       !Shift<Key>x:   string("B")\n
       None<Key>x:     string("A")

Andrew

_______________________________________________________________________________

Andrew Wason                                       Bell Communications Research
aw@bae.bellcore.com                                Piscataway, NJ
bellcore!bae!aw

chudnall@ccwf.cc.utexas.edu (Christopher Hudnall) (03/29/91)

Notice the use of Shift versus ~Shift (*without* Shift) below to
disambiguate the use of KP_0 versus Insert, which are both on
the same key on the Sun SPARC keyboard.

! xterm characteristics - C. A. North-Keys, 1991
!
XTerm*name:     xterm
XTerm*reverseVideo:     true
XTerm*reverseWrap:  true
XTerm*StringConversionWarnings:on
XTerm*title:        Xterm
XTerm*mouse:        red
XTerm*cursorColor:  green
XTerm*border:       black
XTerm*scrollKey:    true
XTerm*scrollBar:    false
XTerm*c132:             true
XTerm*fontMenu*font1*Label:     Illegible
XTerm*fontMenu*font2*Label:     Small
XTerm*fontMenu*font3*Label:     Smooth
XTerm*fontMenu*font4*Label:     Huge
XTerm*VT100*font1:              nil2
XTerm*VT100*font2:              6x10
XTerm*VT100*font3:              *smooth*
XTerm*VT100*font4:              *sony*24*
XTerm*VT100.Translations:   #override \n\
  ~Shift        <KeyPress> F23:     set-scrollbar(toggle) \n\
  ~Shift        <KeyPress> F27:     scroll-back(100,page) \n\
  ~Shift        <KeyPress> R13:     scroll-forw(100,page) \n\
  ~Shift  Meta  <KeyPress> F29:     scroll-back(1,page) \n\
  ~Shift  Meta  <KeyPress> F35:     scroll-forw(1,page) \n\
  ~Shift        <KeyPress> F29:     scroll-back(1,line) \n\
  ~Shift        <KeyPress> F35:     scroll-forw(1,line) \n\
  ~Shift        <KeyPress> Insert:  insert-selection(PRIMARY, CUT_BUFFER0) \n
   Shift        <KeyPress> KP_0:    string("0") \n\

The SPARC keycaps are:
	F23:Scroll/Lock
	F27:Home         (also 7)
	R13:End          (also 1)
	F29:PgUp         (also 9)
	F35:PgDn         (also 3)

The result of all this is that with Shift on, the right keypad inserts digits
into the xterm, and with Shift off, the keypad controls scrolling.  We like it.

-Christopher Alex.
______________________________________________________________________________
Christopher North-Keys                                    Unix Systems Analyst
erlkonig@gnu.ai.mit.edu                                         Group Talisman
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

mleisher@nmsu.edu (Mark Leisher) (04/03/91)

In article <1991Mar27.214211*Steinar.Haug@delab.sintef.no> Steinar.Haug@delab.sintef.no (Steinar Haug) writes:

   >XTerm*VT100.extraKeymap.translations: #override\
   >        <Key>x:		string("A")	\n\
   >        Shift<Key>x:	string("B")

This works:

   XTerm*VT100.extraKeymap.translations: #override\
           :<Key>x:	string("A")	\n\
           :<Key>X:	string("B")

-----------------------------------------------------------------------------
mleisher@nmsu.edu                      "I laughed.
Mark Leisher                                I cried.
Computing Research Lab                          I fell down.
New Mexico State University                        It changed my life."
Las Cruces, NM                     - Rich [Cowboy Feng's Space Bar and Grille]