Subject: FVWM: Strange problems with xterm and fvwm2

From: Vikas Agnihotri <[email-masked]>
Date: Thu, 9 Jul 1998 11:02:05 -0400

Using Fvwm2.0.46 on a RH5.1 system.

Here is my xterm VT100 translation:

XTerm.VT100.translations: #override \
     !Ctrl<Key>Right:  		string(0x1b) string("Oc")     \n\
     None<Key>Right:       	string(0x1b) string("OC")     \n\
[sniped for brevity. I have similar translations for the other Special
keys].

when I initially startup fvwm and type (Ctrl-V, <Right>), I do get the^[OC,
as per above. Also, when I startup Vim, the mouse works fine.

Now, here is a snippet from my .fvwm2rc
Key Right       A       S2      Scroll +100 +0

i.e. NumLock+Shift+Right-arrow should pan right by one page. I did this
because I use the numeric keypad often and so I always keep the NumLock LED
on.
[nsipped for brevity again. I have similar scroll commands for Up, down,
and left keys]

This also works fine.  I am able o pan the viewport just fine.

But, after doing even a single pan via above, for some reason, my xterm
translations are screwed up!

In other words, after I do a Pan-right, and do Ctrl-V, Right in a xterm, I
get ^[[C instead of ^[OC as before! Same for all the other special keys
(left, right, up, down, pageup, pagdown)

And get  this: Even the mouse clicks are now ignored. I launch Vim in a
xterm and click and nothing happens!

I exit from my X sessio, go back to the XDM login screen and login again,
and everything works fine up until the point where I do a Shift-Right to
Scroll my pager. After that things  are messed up. Note that a simple
'Restart' doesnt fix things. I need to exit out completely.

Needless to say, this is very aggravating. It is  rendering all my xterm
based applications quite useless. Mutt, slrn, etc. 

Thank you for any help.

Vikas
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dan Espen <[email-masked]>
Date: Sun, 12 Jul 1998 00:23:35 -0400

> based applications quite useless. Mutt, slrn, etc. 

I think if you check again whats going on
you will find that the curses based application (Vim) is the
cause of the problem with ^[OC changing to ^[[C.
I don't see how fvwm would be involved.

I am not saying Vim is at fault.
When I have seen this in the past, the TERMINFO had an initialization
sequence that changed what keys emit, and the reset (un-initialization)
sequence didn't undo the change.

I don't follow the part about the mouse, if you are talking about
mouse clicks in the xterm window that Vim reads, it is probably
the same terminfo problem.

--
Dan Espen                                Phone: (732) 699-5570
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Klaus Neumann <[email-masked]>
Date: Sun, 12 Jul 1998 19:30:09 +0200 (MEST)

Hi,

Did anyone consider porting the afterstep module "Animate" to fvwm2?
I know, this wouldn't match fvwm's basic policy to use as little system
resources as possible, but on the other hand, nobody is forced to activate it
if he/she doesn't want to. ;-)

Cheers,

Klaus  

----*Linux - the better choice*------
Klaus Neumann, cognitive scientist
E-mail: [email-masked]
Motala / Sweden,  12-Jul-98 at  18:54:31
------------------------------
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Vikas Agnihotri <[email-masked]>
Date: Mon, 13 Jul 1998 10:02:59 -0400

On Sun, Jul 12, 1998 at 12:23:35AM -0400, Dan Espen wrote:

> I think if you check again whats going on you will find that the curses
> based application (Vim) is the cause of the problem with ^[OC changing to
> ^[[C.  I don't see how fvwm would be involved.

No. You misunderstand.

1. I fire up my X session which starts up fvwm2
2. I launch a xterm with my desired VT100 translations.
3. In my shell, (ksh), I press CtrlV, Right
   I get ^[OC which is what I have in my VT100 translations.
4. I have the following line in my .fvwm2rc to iconify any window
   Key F8 A N2 Iconify -1
5. Using this, I press F8 to minimize the xterm
6. I click on the xterm icon in the winlist to de-iconify it
7. I do step (3) again.
   
   This time, I get ^[[C instead of ^[OC

Note that vim, slrn, mutt, etc are not even invoked during all this.

So, what I am saying is that, using keyboard-based accelerator keys to do
_anything_ in Fvwm somehow screws up things. The above is empirical
evidence. I dont know enough about Fvwm internals to figure out why it is
happening, but happening it is.

> I am not saying Vim is at fault.  When I have seen this in the past, the
> TERMINFO had an initialization sequence that changed what keys emit, and
> the reset (un-initialization) sequence didn't undo the change.

I dont understand. Mind elaborating? Note that as I point out above, Vim
doesnt even come into the picture for things to get screwed up.

> the same terminfo problem.

Yes, I am referring to mouse clicks in a xterm that Vim reads. Indeed, it
does sound like a terminfo problem, but I doubt Vim has anything to do with
it. I cant understand why the keycodes that my keys/mouse sends out would
be changed by any application, though! 

Thanks for your help. Hope we can get to the bottom of this.

Vikas

---

From: Pete Forman <[email-masked]>
Date: Mon, 13 Jul 1998 16:16:31 +0100

The cursor arrow keys can generate a prefix of ^[O (escape capital-O,
aka SS3) or ^[[ (escape left-bracket, aka CSI).  Which prefix is used
may be set by one of the DEC Private Mode sequences.

    ^[[?1h   sets the SS3 prefix.
    ^[[?1l   resets to the CSI prefix.

One of these codes is often called when something like vi is started.
On my platform the xterm terminfo entry includes

    smcup=\E[?7l\E[?1l\E(B\E=

Try doing

    echo '\033[?1h'

after you deiconify and see whether you get your preferred prefix
back.  Alternatively try the menu on ctrl-MS2 in xterm to toggle the
Application Cursor Keys.

After that it will be a matter of searching through fvwm,
xterm, vim, etc. to see what is resetting the prefix.  Turning on
logging on the xterm may help as all escape sequences are recorded
literally.  This may not be an option as since X11R5 you need to
explicitly enable the logging feature when compiling xterm.

Sorry if this seems unclear.  The notes I made on this matter are 8
years old.  See also appcursor and friends in the xterm man page and
the Xterm Control Sequences document in X11.
-- 
Pete Forman
Western Geophysical
[email-masked]
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Vikas Agnihotri <[email-masked]>
Date: Mon, 13 Jul 1998 12:56:39 -0400

> may be set by one of the DEC Private Mode sequences.

All this is fascinating, but quite irrelevant.  As I said, I have
explicitly re-mapped what the various cursor keys and
Home,End,PageUp,PageDown keys produce in a xterm via my VT100*translations
resource.

I happened to choose ^[O totally at random. I didnt know it happens to be a
existing prefix (with its own name at that!)

All this is working fine with xterm, vim, slrn, mutt, etc when I am NOT
using fvwm2 as my window manager.

This is why I am convinced that this is a fvwm2 thingie. 

Consider:
1. xterm --- fine
2. vim   --- fine
3  slrn  --- fine
4. Use a 'Key' command from .fvwm2rc
5. Things break.

Is this not clear? Me thinks Fvwm2 is "resetting the prefix".

Thanks,
Vikas

---

From: Pete Forman <[email-masked]>
Date: Tue, 14 Jul 1998 09:59:09 +0100

Vikas Agnihotri writes:
 > All this is working fine with xterm, vim, slrn, mutt, etc when I am
 > NOT using fvwm2 as my window manager.
 > 
   ... 
 > Is this not clear? Me thinks Fvwm2 is "resetting the prefix".

One point that I was trying to put across is that this ought
controlled by the xterm.  It is receiving an event when a key is
pressed and is responsible for translating that into an action.  The
influence of other programs such as a wm is limited to setting options 
in xterm which alter its behaviour.  (Actually programs such as
xmodmap can alter the event that clients receive but it does not seem
relevant here.)

The vanilla xterm (i.e. without any *translations) generates one of
two actions depending on whether the state is SS3 or CSI.  My
hypothesis is that the translations only apply in one of the states.

If you can confirm this by using the vtmenu on ctrl-MS2 to toggle the
Application Cursor Keys, then it will be a matter of chasing through
to find out how fvwm is causing xterm's state to toggle.

Some other questions:

    Is there a problem when iconifying with the mouse rather than F8?
    Is there a problem if the xterm is started with -iconic?
    Do other window managers behave the same?

---

From: Vikas Agnihotri <[email-masked]>
Date: Tue, 14 Jul 1998 10:40:26 -0400

> pressed and is responsible for translating that into an action.

Thats what I thought too. 

>     Is there a problem when iconifying with the mouse rather than F8?
No.

>     Is there a problem if the xterm is started with -iconic?
Well, when I de-iconify it and F8 to iconify it again, the problem appears.

>     Do other window managers behave the same?
No.

Aaaargh! Just hit me. I think I have too "strict" a set of translations.
Gotta relax them some.

I have the following as part of the VT100 translation table:

Frankly, I dont completely understand this. I think what this is saying is:

1. When the Ctrl modifier ONLY and the <Right> key is pressed, send ^[Oc
2. When the <Right> key and NO modifiers are pressed, send ^[OC

My Fvwm2 command is
Key F8 A N2 Iconify 1
which says
"when the F8 key is pressed anywhere and either no modifiers or Modifier2
(NumLock in my case) are active, iconify the window"

The reason I gave the Key command as I did is that I frequently have the
Numlock key pressed since I use the numeric keypad. So, I wanted the
Iconify to work if either No modifiers **or** the numLock was active.
Actually, I dont really care about the other modifiers also. So, I guess I
need to give 'A' for 'any modifier', right? (instead of N2).

So, when the NumLock is active, my VT100 translation table has no entry for
<Right> and hence it defaults to ^[[C.

Questions:

How do I specify the translation line to say what the 'Key' line says i.e. 

 (None OR NumLock) + <Key> Right: .......

more generally, what is the syntax for this translation line? Where can I
read more about this? I read all the man pages, but they dont talk about
the syntax for this line.

Surprisingly, the mouse is still screwed up. Consider:

o Turn off NumLock
o vim 
o <F1> for help
o Click somewhere and the cursor moves there. Fine.
o Turn on NumLock
o Mouse clicks no longer move the cursor!

Thanks for staying with me, Pete.

Vikas