echen@sword.pyramid.com (Eric Chen) (02/22/91)
Hi: Do you use the Meta( Alt ) key with xterm? I have bothe R3 and R4 xterm on my machine. The R3 xterm output the Meta(Alt) key fine but the R4 xterm ignores it. This is annoying to emac users. I checked the source code of R3 and R4 xterm. The R3 xterm/input.c has codes as: -------------------------------------------------------------- int MetaMode = 1; .... Input (keyboard, screen, event) ... { ... if ((nbytes == 1) && MetaMode && (event->state & Mosk)) unparseputc(033, pty); ... ---------------------------------------------------------------- which is missing from R4 xterm.Why? I add the above code and compile with R4 libraries and the new xterm behaves right. BTW, according to the Key/Button binding in xterm man page( and in the xterm/charproc.c too), all mode-menu popup and select-start() select-extend().. only work when the Meta key is not pressed. But both my R3 and R4 xterm behave the same with or without the Meta key pressed! How about the xterm on your machine??? Please post your experience or comments so I know if it's just the problem of my xterm. Thanks a lot !
mouse@lightning.mcrcim.mcgill.EDU (02/23/91)
> Do you use the Meta( Alt ) key with xterm? No; I use neither the Meta key nor xterm. However, I did just recently have occasion to look at the relevant code. The R4 xterm's Input() (in input.c) contains, among other things, if ((nbytes == 1) && eightbit) { if (screen->eight_bits) *string |= 0x80; /* turn on eighth bit */ else unparseputc (033, pty); /* escape */ } The screen->eight_bits flag comes from the eightBitInput resource, which defaults to True. The eightbit variable is an argument; in misc.c, the calls to Input() in HandleKeyPressed and HanelEightBitKeyPressed are False and True respectively. Now we look at charproc.c. We find static XtActionsRec actionsList[] = { [...] { "insert-seven-bit", HandleKeyPressed }, { "insert-eight-bit", HandleEightBitKeyPressed }, [...] and elsewhere, static char defaultTranslations[] = "\ [...] ~Meta<KeyPress>: insert-seven-bit() \n\ Meta<KeyPress>: insert-eight-bit() \n\ [...] So normally, the Meta key will set the high bit on typed characters. I suspect what's happening is that someone (your pty driver, perhaps?) is stripping the high bit for you, so Meta is ultimately ignored. Try turning eightBitInput off. This should cause Meta-modified keystrokes to be prefixed with an escape character, which appears to be what you want. (For example: xterm -xrm '*eightBitInput: False'.) I just tried this here with the R4 xterm and it appears to work as I have described. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu