Subject: Re: FVWM: the "Wait" Function

From: Christopher Wolf <[email-masked]>
Date: Wed, 11 Jun 1997 13:55:10 -0500 (CDT)

On Wed, 11 Jun 1997 [email-masked] wrote:

>Personally speaking I would rewrite the above as follows (only because I like to 
>organize my Next/None combinations like an if-else):
>
>AddToFunc RaiseFocus-Named-Xterm
>+	"I"	Next [$0]	Raise-Focus-Move $1 $2
>+      "I"     None [$0]       Start-Named-Xterm $0 $1 $2
>
>AddToFunc Start-Named-Xterm
>+	"I"	Exec xterm -name $0
>+	"I"	Wait $0
>+	"I"	RaiseFocus-Named-Xterm $0 $1 $2
>
>AddToFunc Raise-Focus-Move
>+	"I"	Iconify -1
>+	"I"	WarpToWindow 50 50
>+	"I"	Raise
>+	"I"	Focus
>+	"I"	AnimatedMove $0p $1p

Tim (and anyone on the discussion list),

A challenge for you.  I took your advice, and (in the interest of full flexibility),
changed the function to the following:

##############################################################################
## If the window is not existing or iconified, call createraisemove
## to bring it up (create/raise) and place it in the correct position
## (move).  Otherwise, just bring it back to the top wherever it is.
##  This way, we only move it when its new or iconified.
##
AddToFunc RaiseFocus-Named-Xterm
+       "I"     Next [$0]               Raise-Named-Xterm $0 $1 $2
+       "I"     None [!iconic $0]       CreateRaiseMove-Named-Xterm $0 $1 $2
 
##
## If the window does not exist, create it and wait for it to appear.
## Then, warp to it, raise it, and move it to where it belongs
##
AddToFunc CreateRaiseMove-Named-Xterm
+       "I"     Exec echo Starting CreateRaiseMove-Named-Xterm
+       "I"     None [$0]       Exec echo Creating $0 at $1 $2
+       "I"     None [$0]       Exec exec xterm -name $0 -title $0 -bg bisque2 -\
fg black \
                       -geometry =81x57+1+1 -sl 6000 -sb -cn -vb -cu -j  \
                       -rw -sk -si &
+       "I"     Exec echo Done Creating, if I did so
+       "I"     Exec echo Waiting on $0
+       "I"     Wait $0
+       "I"     Exec echo Warping
+       "I"     Next [$0]       WarpToWindow 50 50
+       "I"     Exec echo Raising
+       "I"     Next [$0]       Raise
+       "I"     Exec echo Focusing
+       "I"     Next [$0]       Focus
+       "I"     Exec echo Animating
+       "I"     Next [$0]       AnimatedMove $1p $2p
+       "I"     Exec echo Done
 
##
## If the window exists, we get here and just Raise and Focus the window
##
AddToFunc Raise-Named-Xterm
+       "I"     Exec echo Starting Raise-Named-Xterm
+	"I"	Next [$0]	Iconify -1
+       "I"     Exec echo Warping to window
+       "I"     Next [$0]       WarpToWindow 50 50
+       "I"     Exec echo Raising
+       "I"     Next [$0]       Raise
+       "I"     Exec echo Focusing
+       "I"     Next [$0]       Focus
+       "I"     Exec echo Done
##############################################################################

Yes, a bit verbose, but you'll see why.  I also know I am not
guaranteed of the echo's and commands being executed in order.

If I restart, and press the mouse button to activate this with the
call "RaiseFocus-Named-Xterm Left 7 13", I get the following on my
console:

>Starting CreateRaiseMove-Named-Xterm
>Done Creating, if I did so
>Waiting on Left
>Warping
>Raising
>Focusing
>Animating
>Done

[Notice we do not see the message "Creating Left at 7 13"!!]

A window is correctlyt created here.  If I then move the window a bit,
maybe placing it behind something, and then press the button again, I
get (as expected):

>Starting Raise-Named-Xterm
>Warping to window
>Raising
>Focusing
>Done

**BUT ONSCREEN**, something else is happening!  Namely, the window has
an AnimatedMove done to it to move it back to it's home position, even
though this does not happen in the function!

Sometimes, some of those messages do not appear, and the window is not
acted upon by the nearby commands.  i.e. Focusing and Done may not
appear, and the window will not have the cursor in it.

Any ideas on what's going on?

-Wolf

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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].