Subject: FVWM: Window menu entries depending on window state

From: [email-masked]
Date: Fri, 16 Jul 2004 16:50:17 -0300

Hi.

I want to have entries in the window menu for toggling
some aspects of the window like shading. I want this entry
to be named accodingly to the actual state of the window.
For instance, if the window is shaded, the menu entry
shuld be "Shade", otherwise "Unshade".

To solve this I am using dynamic menus, as can be seen
in the attached file containing relavant parts of the
configuration.

This works with the title button 1, which is the window
menu button. But it fails with the icons in the
FvwmIconMan module. In this case the menu entries are
not always named correctly, picking the wrong state
(for instance, showing Deiconify instead of Iconify).

Any hints on how to solve this problem?

Romildo

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 19 Jul 2004 10:30:18 +0200

> Any hints on how to solve this problem?

The "Current" command works on the currently focused window.  But
when you call the function from FvwmIconMan, the window you click
on may not be focused.  Use "ThisWindow" instead of "Current".

> # A dynamic popup menu for the window operations
> # Some entries depend on the window state
> 
> AddToMenu WindowMenu "Window" Title
> + DynamicPopupAction Function WindowMenuF
> 
> DestroyFunc WindowMenuF
> AddToFunc WindowMenuF
> + I DestroyMenu recreate WindowMenu
> + I AddToMenu WindowMenu "Window" Title
> + I + "&Move"			Move
> + I + "&Resize"			Resize
> + I + "R&aise"			Raise
> + I + "&Lower"			Lower

> + I Current (Iconic) + "De&iconify"	Iconify
> + I Current (!Iconic) + "&Iconify"	Iconify
> + I Current (Sticky) + "Un&stick"	Stick
> + I Current (!Sticky) + "&Stick"	Stick
> + I Current (Shaded) + "Un&shade"	WindowShade
> + I Current (!Shaded) + "&Shade"	WindowShade
> + I Current (Maximized) + "Unma&ximize"	Maximize layer grow grow
> + I Current (!Maximized) + "Ma&ximize"	Maximize layer grow grow
> + I Current (!Maximized) + "Maximize &Vertical"	Maximize layer 0 grow
> + I Current (!Maximized) + "Maximize &Horizontal"	Maximize layer grow 0
     ^^^^^^^^^

+ I ThisWindow ...

> + I + ""			Nop
> + I + "Move to &Desk"		Popup MoveToDeskMenu
> + I + "Title Position"		PopUp TitlePosMenu
> + I + ""			Nop
> + I + "Identify"		Module FvwmIdent
> + I + "ScrollBar"		Module FvwmScroll 2 2
> + I + "Print"			PrintFunction
> + I + "Print Reverse"		PrintReverseFunction
> + I + ""			Nop
> + I + "&Delete"			Delete
> + I + "&Close"			Close
> + I + "Destroy"			Destroy
> 
> # This one works
> Mouse 1		1	A	Menu WindowMenu Nop
> 
> # This one does not work for some entries
> *FvwmIconMan: Action Mouse 3 N \
>   sendcommand 'Menu WindowMenu Rectangle +$[left]+$[top] 0 -100m'

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]

---

From: Marcus Lundblad <[email-masked]>
Date: Tue, 20 Jul 2004 17:33:06 +0200 (CEST)

> >   sendcommand 'Menu WindowMenu Rectangle +$[left]+$[top] 0 -100m'

Actually, I was thinking about implementing some way of embedding
conditions into menu commands.
I think it was up for discussion a while ago. But I'm not quite clear
about exactly how it should work, and I guess it's quite a big thing, so
it would probably need some discussions on how to (and if) to implement
it.

And right now I've been quite busy with other things and haven't had too
much time for FVWM lately.
I still have some work to do to clean up all the places where modules try
to see how much of a string fits within a certain amount of pixels by
iterating 1 byte at a time (not working on multi-byte locales)

//Marcus

--
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].