On 06/03/2008, for.register for.register <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 6, 2008 at 3:18 PM, Thomas Adam <[EMAIL PROTECTED]> wrote:
>  >
>  > On 06/03/2008, for.register for.register <[EMAIL PROTECTED]> wrote:
>  >  > Hi,
>  >  >  I am a newbie, so always have questions. Thanks for your help. :-)
>  >  >
>  >  >  I want to add  button 8 on title bar, and  want press it to make the
>  >  >  window always on top and press again to cancel always on top. How
>  >  >  can I do that. I have read fvwm manual, and can not find any solution.
>  >  >
>  >  >  Thanks.
>  >
>  >  DestroyFunc SomeLayerFunc
>  >  AddToFunc    SomeLayerFunc
>  >  + I ThisWindow (Layer 6) Layer
>  >  + I TestRc (NoMatch) Layer 0 6
>  >
>  >  Mouse 0 8 ... SomeLayerFunc
>  >
>  >  -- Thomas Adam
>  >
>
>
> Thank you Thomas, that works perfect. I will spend some to
>  study above configuration.

It will work, assuming your applications are put in the default layer
(Layer 4) but if any of them start up in a different layer (via a
Style line for instance) then the above function will toggle between
that layer, and layer 6.  This may or may not be sufficient for your
needs - and probably in those cases where you might have explicitly
asked for a known window to be in specific layer, toggling back to
that is going to be what you wanted.

If you want it explaining though:

+ I ThisWindow (Layer 6) Layer

This line looks at the referenced window and if the window is at layer
6 (i.e., staysontop) then the window is put into its default layerr
(presumably 4 -- see comment above).

+ I TestRc (NoMatch) Layer 0 6

Otherwise, we can assume the window wants to be on top.  The TestRc
command simply looks at the outcome of the last command ran in the
function.  So if the test on ThisWindow (Layer 6)... failed, the
"Layer 06" command is run, making the window on top.

I often get asked why I don't use Current in place of ThisWindow.  The
answer is simple:  I use this function from FvwmEvent, where it's not
guaranteed the window in question will have focus.

It's a really popular question at the moment; I've probably answered
it about six times this month.

-- Thomas Adam

Reply via email to