How to check if the mouse has left a window?

I’m doing some autohiding (I read the FAQ) like this:

AddToFunc autohide_1
+ I ThisWindow ($0) WindowShade off
+ I TestRc (!1) All ($0, !shaded ) WindowShade  $1     

AddToFunc autohide_2
+ I ThisWindow (!$0)  All ($0, !shaded) WindowShade $1

AddToFunc enter_handler
+ I autohide_1 FvwmButtons S
+ I autohide_2 FvwmPager E

autohide_1 works normally: FvwmButtons unshades when you move the mouse over it and shades when you leave the window. autohide_2 should only shade the window (FvwmPager) when I leave it. The unshading is done manually by clicking the windowframe (it already works).

Q: How do I test if the mouse pointer has left the FvwmPager window (ie. the pointer is on the root window or on some other window). Now it doesn’t recognize if the pointer is on root window. Somehow I should combine ThisWindow and TestRc but I have no idea how.

You can use FvwmEvent using “leave_window” as in:

DestroyModuleConfig FE:*
*FE: Cmd Echo
*FE: leave_window “Left window…”

Module FvwmEvent[/code]

Or you can use FvwmAuto with its -mleave option.

Does that help?

– Thomas Adam

Yes, I was already using FvwmAuto and just noticed it has [LeaveCommand] so I did this:

[code]AddToFunc autoshow

  • I ThisWindow ($0) WindowShade off

AddToFunc autohide

  • I All ($0, !shaded) WindowShade $1

AddToFunc enter_handler

  • I autoshow FvwmButtons S

AddToFunc leave_handler

  • I autohide FvwmPager E
  • I autohide FvwmButtons S[/code]

So now it works. But it seems that there is no conditional way to accomplish this? I mean something like this:


  • I ThisWindow ($0) NULL
  • I TestRc (!1) All ($0, !shaded ) WindowShade $1 [/code]

NULL means do nothing…just to preserve the value returned by ThisWindow. Basically I’d like to do something like this:


  • I Test (ThisWindow ($0) != 1) All ($0, !shaded ) WindowShade $1 [/code]

See the “Nop” command, and the “KeepRc” command.

– Thomas Adam

Thank you! This is exactly what I meant.