FVWMEvent question

if I want to use the FVWMEvent::leave_window handler, does it get called every time a window is “left”, while keeping the $[w.name] variable with the value of the window that was just left?

e.g. – if I leave window Foo, and have the following code:

FVWMEvent *: leave_window FuncHandleLeaveWindow

AddToFunc FuncHandleLeaveWindow
+ I PipeRead `[ $[w.name] == "Foo" ] && FuncLeaveFoo`

The above function will call FuncLeaveFoo everytime I leave a Foo, correct? The w.name variable doesn’t get overwritten by the new window name until this function has been ‘handled’ right?

  • Skender

Yes.

That’s right – the $[w.name] variable references the window that has received the leave_window event initially.

– Thomas Adam

Will this leave_window event be called if focus changes to a new window? Or is there something else that sends the leave_window event?

I am moving from (Foo) to a new window (Boo) via:

+ I Raise
+ I Focus
+ I WarpToWindow

Will this type of thing send a ‘leave_window’ event to Foo, and a Focus change to Boo?

The code that you commented on doesn’t seem to be working…

  • Skender

A leaveEvent is generally triggered when the pointer leaves a window. This is different from a change in focus (more about this later.)

In this case it will, yes – for two reasons. One, you’ve actually told it to focus (that in itself will generate a focus event), and secondly, the WarpToWindow directive shifts the pointer – hence you’ll get a leave_window event.

Oh, I know that. Here’s what you had:

The problem with the above is that you aren’t echo’ing anything back to FVWM to interpret. The whole reason for using PipeRead is so that the shell can evaluate a condition, and return something back to FVWM. In fact, what you’ve written will work, if you insert an echo statement:

AddToFunc FuncHandleLeaveWindow
+ I PipeRead `[ $[w.name] == "Foo" ] && echo FuncLeaveFoo` 

Of course, you’ll find yourself in a battle if you do this with your pointer. (Hint: You might be able to avoid this via the ‘PointerWindow’ command.) The question is perhaps more one of “how” do you plan on going from one window to the other? If it is via a key-binding, then doing something like:

PointerWindow (name_of_window) All (currentdesk,some_other_name) FlipFocus

… With the above, the FlipFocus will cause an enter_window event, and a focus_event. Adding ‘NoWarp’ to the end of that will just cause a focus_event — an interesting little tidbit for you.

HTH,

– Thomas Adam