Function broken between 2.5.10 and 2.5.12

I’m stumped with this one.

I have a FvwmButtons panel at the bottom of my screen with a swallowed FvwmIconMan. When you click on a window’s button it’s supposed to deiconify, focus, raise, and unshade the window unless it already is all of those things, in which case it’s supposed to iconify. These functions worked fine for me in FVWM version 2.5.10 but with my recent upgrade to 2.5.12 it only works correctly when there’s more than one open window that’s not iconified. When it doesn’t work it appears to iconify the window and immediately deiconify it.

This is the function bound to mouse 1 in FvwmIconMan

[code]DestroyFunc FvwmToggleIconification
AddToFunc FvwmToggleIconification

  • I ThisWindow (!Iconic, Iconifiable, !Shaded, Focused) FvwmIconify true
  • I TestRc (Match) Break
  • I FvwmIconify false
  • I WindowShade false
  • I Focus
  • I Raise[/code]

FvwmIconify is just a wrapper around Iconify that’s supposed to focus the previous window when a window is iconified. Using a plain “Iconfiy” instead of the first call to FvwmIconify in FvwmToggleIconification works (but without the FocusPrev thing I require). The second call to FvwmIconify is interchangeable with a plain Iconify.

[code]DestroyFunc FvwmIconify
AddToFunc FvwmIconify

  • I ThisWindow (!Iconifiable) Break
  • I Iconify $0
  • I FvwmFocusPrev[/code]

FvwmFocusPrev is just this one line

[code]DestroyFunc FvwmFocusPrev
AddToFunc FvwmFocusPrev

  • I Prev (AcceptsFocus, CurrentDesk, CurrentPage, !Iconic) Focus[/code]

Since just using Iconify works, FvwmIconify will also work if I comment out the first and third lines. By commenting out just the first line it still fails to work (as the first line should be irrelevant). And by commenting out just the third line it fails to work regardless of how many windows are open. Why it doesn’t work in this instance is beyond me. If I leave all three lines in and remove the “!Iconic” in FvwmFocusPrev it works for some reason but gives the focus to an iconified window, leading me to believe the problem is here and Prev is choosing a window when none should qualify. However, FvwmFocusPrev works fine with a window button that simply calls FvwmIconify (with no problems in that function either) so it has to be the first call to FvwmIconify in FvwmToggleIconification. Probably. I have no idea; any insight may prevent my head from imploding.

Huh, I guess I’ve managed to stump everyone else too.

Through sheer dumb luck I happened upon the “None” conditional command and managed to test the above theory, and it happens to be the problem. Changing FvwmFocusPrev to this:

[code]DestroyFunc FvwmFocusPrev
AddToFunc FvwmFocusPrev

  • I None (AcceptsFocus, CurrentDesk, CurrentPage, !Iconic) Break
  • I Prev (AcceptsFocus, CurrentDesk, CurrentPage, !Iconic) Focus[/code]
    fixes it, although because of the break this function has to come last in every other function that calls it, which is aggravating but I was able to rewrite the one function in which it was an issue. I thought “Break 1” would work correctly but it didn’t seem to have any effect.

Unless I’m way off with this I think I’ve found a bug. That using “None” works in the above function seems to show that “Prev” is doing something when it should be doing nothing.