[comp.windows.x] Help needed with xterm translations

valdis@alchemy.mcs.clarkson.edu (& Kletnieks) (02/01/89)

Scanario:  SUn 3/260, hi-res monitor, SunOS 4.0.1, X11R3 with MIT patches 1-7
and Purdue 2.1 speedups.

Problem:  I have specified a xblat*vt100.Translations string in my .Xresources.
'xrdb' loads it, and the 'xterm -name xblat' seems to pick up the translation.

Problem:  I have "#override <Key>F1:string("something")\n
and that works just peachy.  However, I can't seem to find a way to 
specify something like: "<Shift><Key>F1:string("somethingelse")"

Anybody have any clues/ideas/suggestions?  It's kind of annoying that I can't
seem to specify a 'shift' modifier on any of the 'special' (L1-10, F1-9,
R1-15) keys on the Sun keyboard.

				Valdis Kletnieks
				Sr. Systems Programmer
				Clarkson University

swick@ATHENA.MIT.EDU (Ralph R. Swick) (02/01/89)

>Problem:  I have "#override <Key>F1:string("something")\n
>and that works just peachy.  However, I can't seem to find a way to 
>specify something like: "<Shift><Key>F1:string("somethingelse")"

You probably don't really want this second translation binding; it's
not really legal (I'll have to check the code to see why there was
no message), but there is an almost-reasonable interpretation for it, vis:

"<Shift>" is an abbreviation for the specification "Shift<Key>", thus
the almost-reasonable interpretation is the two-event sequence
"Shift<Key>,<Key>F1".  You should have really gotten an error message
about the missing ",", but the implementation doesn't actually interpret
your specification this way anyway.  You can see the difference by
actually inserting the "," in your version -- I don't claim it's useful :-).

Any of the following will work as you probably expect:

*VT100.translations: #override \
	Shift<Key>F1:string("else") \n\
	<Key>F1:string("something")

*VT100.translations: #override \
	<Shift>F1:string("else") \n\
	<Key>F1:string("something")

*VT100.translations: #override \
	~Shift<Key>F1:string("something") \n\
	Shift<Key>F1:string("else")

*VT100.translations: #override \
	~Shift<Key>F1:string("something") \n\
	<Shift>F1:string("else")

The order in the first two versions is significant; since the event
"<Key>F1" allows any modifier state, it is crucial to first specify
the more specific event.  Since the last two versions explicitly
state the state of the Shift modifier in both bindings, the order
is not significant.

Enjoy!
-R

valdis@SUN.MCS.CLARKSON.EDU (02/01/89)

Ralph -

Many thanks for the explanation.  Chalk this one up to 'pilot error',
I had put the 'Shift<Key>F1' entries AFTER the '<Key>F1', not realizing
it was a 'most specific first' binding.

Out of curiosity, where in the doc (if anyplace) is this all discussed?

					Valdis

swick@ATHENA.MIT.EDU (Ralph R. Swick) (02/01/89)

> where in the doc (if anyplace) is this all discussed?

It's buried in Appendix B of "X Toolkit Intrinsics - C Language Interface".
Sorry; this is really a terrible description to which to have to refer
mortal users, but we've not yet had time to write the "users guide".

The specific statement about "most specific first" actually appears
in the first example (bottom of page 123 in my copy).  It certainly
deserves better treatment :-)

swick@ATHENA.MIT.EDU (Ralph R. Swick) (02/02/89)

FYI, the R3 implementation is interpreting the improper specification
	<Shift><Key>F1:string("somethingelse")
as
	Shift<Key>\<: string("somethingelse")
(or equivalently)
	Shift<Key>less: string("somethingelse")

instead of reporting a syntax error.  This bug will be fixed.