Subject: FVWM: Window parameters and current window

From: An Thi-Nguyen Le <[email-masked]>
Date: Thu, 26 Apr 2001 10:01:36 -0500

Version: 2.3.31

I've read the manpage on command expansion; I want to write something 
like 

    Function CenterWindow
    + I PipeRead 'echo Current Move $(($[vp.width]/2 - $[w.width]/2)) \
                                    $(($[vp.height]/2 - $[w.height]/2))'

However, I don't know how to associate a window with the command.  
This merely tries to execute 

   echo Current Move $(( 1280/2 - $[w.width] )) $(( 960/2 - $[w.height]/2 ))

*even* if there *is* a current window (e.g., a window that is focused, 
not iconified, raised, etc.)

The example in the manpage also doesn't work, and suffers from the 
same problem (if it is a problem):

    AddToFunc PrintDeskNumber
    + I Echo $$d $[page.nx] $c

will only print something like 

    1 0 $c

again, even if there is a current window (focused, not iconified, raised, etc).

What am I getting wrong?

-- 
An Thi-Nguyen Le
|The more they over-think the plumbing the easier it is to stop up the drain.
--
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: Thu, 26 Apr 2001 18:43:49 +0200

> not iconified, raised, etc.)

This depends very much on how you call this function:

 - If called from a mouse or key binding on a window it will have
   a window:

     mouse 3 T a CenterWindow
     key f3 T a CenterWindow
     # click on window title with button 3 to activate (or press f3)

 - If called from a mouse or key binding without a window it will
   not have an associated window:

     mouse 3 R a CenterWindow
     key f3 R a CenterWindow

 - If Invoked from a Read or PipeRead command it will have a window
   if the PipeRead/Read command had one. Thus,

     mouse 3 T a PipeRead "echo CenterWindow"

   will work, but

     mouse 3 R a PipeRead "echo CenterWindow"

   will not.

 - If called from FvwmConsole or FvwmConsole or most other modules
   it will *not* have a window.

     FvwmCommand "CenterWindow"
     FvwmCommand "PipeRead 'echo CenterWindow'"
     
   Will not work.

 - If called from FvwmEvent it depends on the *FvwmEventPassId
   option.

In your command line, the "Current" is inside the piperead.  Thus,
$[w.width] and $[w.height] are not defined when the shell is
called.  Therefore, the calculation can not be executed.  You have
to put "Current" before the PipeRead command:

  + I Current Piperead "echo Move \
      $(( $[vp.width]/2-$[w.width]/2 ))p \
      $(( $[vp.height]/2-$[w.height]/2 ))p"

You also have to add a 'p' at the end of the numbers to tell fvwm
to use pixels as the scale for movement.

> again, even if there is a current window (focused, not iconified, raised, etc).

Right, the example is incorrect.

Bye

Dominik ^_^  ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
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].