Problem about Focus

 Style * MouseFocus
#Style * ClickToFocus

 AddToFunc PrevOrNext
 + I Current ($$0) Prev (AcceptsFocus) FlipFocus
 + I TestRc (NoMatch) Next ($$0) FlipFocus

 Key V A 4 PrevOrNext gvim
 Key L A 4 PrevOrNext leafpad
 Key U A 4 PrevOrNext urxvt

Focus on leafpad, press “mod4+L” twice, I hope to focus on the very last focused window the first time , then focus back on leafpad.

Using above config, I find “MouseFocus” works while “ClickToFocus” doesn’t.

To make it clear, following are my tests:

  1. leafpad, urxvt and gvim on the same desk
    Both “MouseFocus” and “ClickToFocus” work well.

  2. leafpad and urxvt on desk1; gvim on desk2
    Follow these steps:
    goto desk2; focus on gvim; move mouse to somewhere it won’t cover any of the three window;
    press “mod4+L”; press “mod4+U”; press “mod4+V”.
    Then the internal order of windows should be: [gvim–>urxvt–>leafpad].

Now press “mod4+L” twice: I wish focus on leafpad first, then focus back on gvim.
As I’ve said, “MouseFocus” works while “ClickToFocus” doesn’t.

(Use “ClickToFocus”, the second time press “mod4+L” will focus on urxvt other than gvim.
That is ,the first time press “mod4+L”, window order changed to [leafpad–>urxvt–>gvim]
other than [leafpad–>gvim–>urxvt] )

Personally I prefer the ClickToFocus style, I wish to find a solution to fix this problem.

Thank in advance.

Style * FPSortWindowlistByFocus

– Thomas Adam

This makes no difference.

Now I’m sure my problem is aroused by desk changing.
Assuming that current window list as follow:
gvim (desk1)
urxvt (desk0)
leafpad (desk0)
firefox (desk0)

Now ‘FlipFocus’ on leafpad
Using “ClickToFocus” new_desk event prints:
urxvt (desk0)
gvim (desk1)
leafpad (desk0)
firefox (desk0)

then focus_change event prints:
leafpad (desk0)
urxvt (desk0)
gvim (desk1)
firefox (desk0)

That is, window list has already been altered before focusing, by desk changing.
And I don’t know why.

This makes no difference.
[/code]

Sure it does.

Put your entire .fvwm2rc file somewhere for me to look at.

– Thomas Adam

Yeah, I checked again ,you’re right.
But still desk changing will alter window list, which makes the exact previous info
got lost.

Everytime I debug a function, I use a new config file under a testing user.
So here’s everything in my .fvwm/config

 EdgeScroll 0 0
 DesktopSize 1x2
 ColorSet 3  fg  Blue, bg Cyan
 ColorSet 4  fg Black, bg Lavender

 Style * ClickToFocus
 Style * FPSortWindowlistByFocus
#Style * FPReleaseFocus
 Style "*" ColorSet 4
 Style "*" HilightColorSet 3
 Style "*" HilightBorderColorSet 4
 
 Key V A 4 PrevOrNext gvim
 Key L A 4 PrevOrNext leafpad
 Key U A 4 PrevOrNext urxvt
 Key 1 A 4 GotoDesk 0 0
 Key 2 A 4 GotoDesk 0 1
 Key 3 A 4 GotoDesk 0 2
 Key 4 A 4 GotoDesk 0 3
 Key Grave A 4 GotoPage wrapy 0 1p
 Key O A 4 Exec exec gmrun
 Key R A 4 Restart
 Key P A 4 All (AcceptsFocus) Echo $$$[w.name]


 AddToFunc PrevOrNext
 + I Current ($$0) Prev (AcceptsFocus) FlipFocus
 + I TestRc (NoMatch) Next ($$0) FlipFocus

 DestroyFunc StartFunction
 AddToFunc   StartFunction
 + I Module FvwmEvent

 DestroyFunc DebugInfo
 AddToFunc   DebugInfo
 + I PipeRead "echo Echo `date +%H:%M:%S`-\\> '$$[*]'"
 + I All (AcceptsFocus) Echo $$$[w.name]

 DestroyFunc HandleNewDesk
 AddToFunc   HandleNewDesk
 + I DebugInfo NewDesk


 DestroyFunc HandleFocusChange
 AddToFunc   HandleFocusChange
 + I DebugInfo FocusChange

 DestroyModuleConfig FvwmEvent:*
 *FvwmEvent: Cmd
 *FvwmEvent: new_desk HandleNewDesk
 *FvwmEvent: focus_change HandleFocusChange

If I use “Style * MouseFocus”, desk changing doesn’t alter window list,which is desired.

By the way, I’ve tested under both 2.6.3 and 2.6.5.
Please check about this when you’re free.
Thanks a lot.