Restoring the window placement after fullscreen

In Fvwm-Crystal svn, I use the following fullscreen functions (It is other functions to cycle trough the fullscreened windows.):

[code]InfoStoreAdd TmpDirectory “/tmp”

Wrapper function {{{1

State 19 = FS (fullscreen), State 20 = visible

DestroyFunc Fullscreen
AddToFunc Fullscreen

  • I ThisWindow (State 19) Fullscreen-Stop
  • I TestRc (NoMatch) ThisWindow (!State 19) Fullscreen-Start


DestroyFunc Fullscreen-Start
AddToFunc Fullscreen-Start

  • I SetEnv “FSWindowWidth_$[]” “$[w.width]p”
  • I SetEnv “FSWindowHeight_$[]” “$[w.height]p”
  • I SetEnv “FSWindowX_$[]” “$[w.x]p”
  • I SetEnv “FSWindowY_$[]” “$[w.y]p”
  • I WindowStyle !Title, !Borders, Iconifiable, ResizeHintOverride
  • I UpdateStyles
  • I WindowStyle State 19
  • I WindowStyle State 20
  • I Maximize ewmhiwa True 100 100
  • I WindowStyle !Maximizable, FixedSize
  • I UpdateStyles

We need 1 temporary file for restoring the window state after restart

  • I Exec exec touch $[infostore.TmpDirectory]/fullscreen.19.$[].$[page.nx].$[page.ny].tmp

quit fullscreen

DestroyFunc Fullscreen-Stop
AddToFunc Fullscreen-Stop

  • I WindowStyle Title, Borders, Iconifiable, !ResizeHintOverride
  • I WindowStyle Maximizable, !FixedSize
  • I WindowStyle !State 19
  • I WindowStyle !State 20
  • I Test (f $[infostore.TmpDirectory]/fullscreen.19.$[].$[page.nx].$[page.ny].tmp) Exec exec rm -f $[infostore.TmpDirectory]/fullscreen.19.$[].$[page.nx].$[page.ny].tmp
  • I UpdateStyles
  • I Maximize True $[FSWindowWidth_$[]] $[FSWindowHeight_$[]]
  • I PlaceAgain
  • I UnsetEnv “FSWindowWidth_$[]”
  • I UnsetEnv “FSWindowHeight_$[]”
  • I UnsetEnv “FSWindowX_$[]” “$[w.x]p”
  • I UnsetEnv “FSWindowY_$[]” “$[w.y]p”

Key KP_Multiply A M Fullscreen[/code]

This work fine, but only the size of the windows is restored. And I want to restore their initial placement too.

If I replace

[code]+ I Maximize True $[FSWindowWidth_$[]] $[FSWindowHeight_$[]]

  • I PlaceAgain[/code]
+ I ResizeMove $[FSWindowWidth_$[]] $[FSWindowHeight_$[]] $[FSWindowX_$[]] $[FSWindowY_$[]]


[code]+ I Maximize True $[FSWindowWidth_$[]] $[FSWindowHeight_$[]]

  • I Move $[FSWindowX_$[]] $[FSWindowY_$[]][/code]
    (Move with or without ewmhiwa)

The size is correct, but the placement is shifted right and down at each restore from fullscreen. I get the same shift when using $[cw.x]p and $[cw.x]p instead of $[w.x]p or $[w.x]p

Is it something I can do to restore both the size and initial placement of the window?