I’m not sure I follow you, there.

Try something like this:
Current (!CurrentPage) Prev (CurrentPage) Focus NoWarp
It doesn’t rely on anything silly such as states – bind to FvwmEvent with new_{page,desk} as needed.
– Thomas Adam
That doesn’t look like it would remember the last window focused on a given page. It looks like it would just choose the next window and set it to be focused, which might just grab whatever window is under the cursor (using sloppy focus policy) where I would want it to return focus to the last window on that page that had focus before I left that page.
The solution appears to be removing the second line from the function which was the actual culprit that stated when nothing was state 2 on the current page, then choose the prev and focus & warp to it…