[comp.windows.x] Shift-Key + Funktion-Key under xterm

koe@kivax.UUCP (011.2 Koehler) (03/21/91)

Hello,

I have the following problem under xterm.
The function keys (F1, F2,...) or f.e. the cursor keys have
the same key-codes as
these keys in combination with Shift_L.

fe. Cursor-Right   Shift_L Cursor-Right

od -x

Cursor_Right         1b5b  
Shift_L Cursor_Right 1b5b  

Is it possible to assign a different key-code to Shift_L Cursor_Right.

(Background : we have an application program, which uses the keys as
              followed:

              Cursor-Right:   1 character right
              Shift_L Cursor_Right: go to end of line
)

Any help would be appreciate

Thanks

Diana


------------------------------------------------------------------------

Diana Koehler                     Tel.:   +49 7721 867034
Digital Kienzle Computersysteme
Abt. 011.2                        e-mail: koe@kivax.UUCP
Postfach 1640                             ..!mcsun!unido!kivax!koe
D-7730 VS-Villingen                       ..!uunet!unido!kivax!koe

gildea@expo.lcs.mit.EDU (Stephen Gildea) (03/21/91)

    Is it possible to assign a different key-code to Shift_L Cursor_Right.
    
    (Background : we have an application program, which uses the keys as
                  followed:
    
                  Cursor-Right:   1 character right
                  Shift_L Cursor_Right: go to end of line
    )


You don't want to do this with key-codes and xmodmap, as (I'm
guessing) you are trying.  Instead use a translation table for your
application.  The translation table syntax is rich and allows you to
specify different actions depending on the state of modifier keys
(such as Shift).  If your application runs under xterm, write a table
for xterm that translates key combinations into the character
sequences your program needs to see by using xterm's "string" action.

For example:

myapp*Translations: #override\
   <Shift>Right:    forward-char() \n\
   <Key>Right:      end-of-line() \n


 < Stephen
   MIT X Consortium

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (03/22/91)

> I have the following problem under xterm.
> The function keys (F1, F2,...) or f.e. the cursor keys have the same
> key-codes as these keys in combination with Shift_L.

> fe. Cursor-Right   Shift_L Cursor-Right

> Is it possible to assign a different key-code to Shift_L
> Cursor_Right.

(Questions normally end with `?' rather than `.'....)

No; it doesn't make sense.  KeyCodes identify the particular key on the
keyboard which was pressed or released, and that key is the
cursor-right key in both cases.  The way to tell that the shift key is
down is to look at the modifier bits in the event.

Since you say you're using xterm, you can probably do what you want
with the translations mechanism.  I am not sure how to specify shifted
cursor-right, but here's the example from the FAQ to give some idea
what it's all about:

	xterm*VT100.Translations: #override \
		<Key>F1: string("setenv DISPLAY unix:0")

					der Mouse

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