Subject: FVWM: maximize and fullscreen

From: Greg BOGNAR <[email-masked]>
Date: Tue, 12 Oct 2004 00:37:42 +0200 (CEST)

Hello,

I have just upgraded to 2.5.11, and I would like to write a nice
window menu.  And I also want to be able to maximize windows to "real"
fullscreen modes.

A while back, I found a function like this in a posting:

DestroyFunc FullScreen
AddToFunc FullScreen
   + I ThisWindow (Maximized) WindowStyle Title, Borders
   + I TestRc (!Match) WindowStyle !Title, !Borders
   + I TestRc (!Match) Raise
   + I TestRc (!Match) UpdateStyles
   + I Maximize 100 100

But I have problems with the menu:

AddToMenu WindowMenu
   + DynamicPopupAction Function WindowMenuFunc
DestroyFunc WindowMenuFunc
AddToFunc WindowMenuFunc
   + I DestroyMenu recreate WindowMenu
   + I AddToMenu WindowMenu
   + I Current (Maximized) + "Unmaximize" Maximize false
   + I Current (!Maximized) + "Maximize..." Maximize -60p 100 
   + I Current (??) + "Unfullscreen" FullScreen
   + I Current (!??) + "Fullscreen" FullScreen

What I'd like to have is this:
- an unmaximized, "unfullscreened" window can be maximized and also 
  "fullscreened", and the menu should say "Maximize" and "Fullscreen";
- a maximized, unfullscreen window can be unmaximized and also
  fullscreened, and the menu should say so;
- a fullscreen window can be unfullscreened but it cannot be maximized
  or unmaximized, only returned to its former (maximized or
  unmaximized) state (I don't want to end up with unmaximized windows
  without title and borders, but will this function do this?), and the
  menu should grey out the (Un)Maximize item (is there a way to do
  that?) or it should disappear altogether.

I guessed that I have to define some State for the FullScreen function
(hence the ?? and !??), and then I could perhaps do something like
this:

   + I Current (Maximized, !??) + "Unmaximize" Maximize false
   + I Current (!Maximized) + "Maximize..." Maximize -60p 100 
   + I Current (??) + "Unfullscreen" UnFullScreen
   + I Current (!??) + "Fullscreen" FullScreen

The manpage, however, doesn't say a lot about defining and using
states, and I have not been able to find examples.  Is this the right
way to go at all?  Also, should there be separate FullScreen /
UnFullScreen functions instead of this one?  Any ideas would be
appreciated.

Thanks,
Greg

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 12 Oct 2004 11:58:21 +0200

> (hence the ?? and !??), and then I could perhaps do something like

Exactly.  Use this version of the FS functions:

  DestroyFunc FullScreenToggle
  AddToFunc FullScreenToggle
  + I ThisWindow (State 23) FullScreenOff
  + I TestRc (!Match) FullScreenOn

  DestroyFunc FullScreenOn
  AddToFunc FullScreenOn
  + I WindowStyle !Title, !Borders
  + I Raise
  + I UpdateStyles
  + I Maximize on 100 100
  + I State 23 on

  DestroyFunc FullScreenOff
  AddToFunc FullScreenOff
  + I WindowStyle Title, Borders
  + I Maximize off
  + I State 23 off

And

  + I Current (Maximized, !State 23) + "Unmaximize" Maximize false
  + I Current (!Maximized) + "Maximize..." Maximize -60p 100 
  + I Current (State 23) + "Unfullscreen" UnFullScreen
  + I Current (!State 23) + "Fullscreen" FullScreen

But you need to upgrade to 2.5.12 to make it work.  There is a bug
in 2.5.11 (it erases the state when WindowStyle is called).

> way to go at all?

> Also, should there be separate FullScreen / UnFullScreen
> functions instead of this one?

I think so.  TestRc should mainly be used with the break command,
not to code different types of behaviour into one functions.  It's
too easy to get it all wrong.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]

---

From: Greg BOGNAR <[email-masked]>
Date: Mon, 18 Oct 2004 01:34:34 +0200 (CEST)

> in 2.5.11 (it erases the state when WindowStyle is called).

Thank you, it works -- and it works in 2.5.11 for me; I do not 
experience the bug.

Cheers,
Greg