Subject: FVWM: Finally moved to 2.2, can't figure out some changes

From: [email-masked] (David S. Goldberg)
Date: 20 May 1999 13:16:19 -0400

I'm not prepared to call these bug reports just yet (well, the
FvwmConsole thing is a feature request); most likely I'm missing
something in the man page or the FAQ (both of which I've read).
Here's the issues I've run into that I can't find a fix for.  To head
off one expected answer, yes I did eliminate the old MODULEPATH and
have verified (via truss) that the 2.2 modules are the ones being
called for.  If it matters, I'm running on Solaris 2.5.1 and built
fvwm2 with the openwin libraries.  I also included xpm, readline and
rplay support.  No compilation errors occurred.

1: I have a function that tries to warp to a given window if it
exists, if it doesn't it execs the desired program/runs the desired
module and warps to that.  Here's the definition:

AddToFunc run-then-warp "I" $1 $2 $3 $4 $5 $6 $7 $8 $9
+ "I" Wait $0
+ "I" Next ($0 CirculateHit) myfocus 50 50 Iconify -1

AddToFunc warp-or-run "I" Next ($0 CirculateHit) myfocus 50 50 Iconify -1
+ "I" Next ($0) myfocus 50 50 Iconify -1
+ "I" None ($0 CirculateHit) run-then-warp $0 $1 $2 $3 $4 $5 $6 $7 $8 $9

Then I have in a menu definition:

+ "&FvwmConsole" warp-or-run FvwmConsole Module FvwmConsole

But when I try to do this I get the following error:

xterm:  bad command line option "$3"
[xterm usage message deleted]

Unlike 2.0.46, which didn't pass additional function args if they
didn't exist, 2.2 seems to put in the $# stuff.  Is this a bug or am I 
just missing something?

2: FlipFocus doesn't work the way I expect.  I have the following:

AddToFunc myfocus "I" $2 $3 $4 $5 $6 $7 $8 $9
+ "I" WarpToWindow $0 $1
+ "I" Focus

AddToFunc togglewindow "I" FlipFocus
+ "I" Prev (!iconic CurrentPage) myfocus 0 0 Nop

And bind togglewindow to Alt-TAB.  Under 2.0.46 that caused Alt-TAB to
switch between only the top two windows.  Under 2.2 it switches
amongst all the windows on the current page.  I'm clearly missing
something but I've tried replacing the Prev with Current and Next and
Adding a Current to the first line.  All to no avail.  How to get the
old behavior (other than downgrading :-)?

3: My FvwmForms no longer work.  Near as I can tell my configs conform 
to the man pages, but when I try to start it I get the following:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  1 (X_CreateWindow)
  Value in failed request:  0x0
  Serial number of failed request:  31
  Current serial number in output stream:  41

4: (feature request, I'll try to come up with a patch later today) My
home directory is in AFS space which means that I can't have FIFOs etc
in there.  For FvwmCommand, I can specify the -f option to provide for
an alternate path for the FIFO.  I need to be able to do the same for
FvwmConsole, which is hardwired to $HOME.  I realize I can try
wrapping FvwmConsole with a shell script that sets HOME and execs
FvwmConsole, but that seems suboptimal.  Unless there's a way to set
an envar in .fvwm2rc that I've missed.

Thanks for any help,
-- 
Dave Goldberg
Post: The Mitre Corporation\MS B325\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: [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].

---

From: Brad Giaccio <[email-masked]>
Date: Thu, 20 May 1999 13:38:42 -0400

> an envar in .fvwm2rc that I've missed.

Actually in the man page should have
     SetEnv varname stringvalue
          Set an environment variable to a new value, similar  to
          shell's export or setenv command.  The variable and its
          value are inherited by processes  started  directly  by
          fvwm2.   This  can  be especially useful in conjunction
          with the FvwmM4 module; e.g.   "SetEnv  height  HEIGHT"
          will  make  the  FvwmM4-set variable "HEIGHT" usable by
          processes started by fvwm2 as the environment  variable
          "$height".   If  stringvalue  includes  whitespace, you
          should enclose it in quotes.

not sure if this will do what you want for FvwmConsole but it will let
you set an environment variable.

Brad
 
-- 
--- There are two kinds of knowledge, you either know the answer or
			you know where to find it
		      -Kane, Johnson, and anonymous
--
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: [email-masked] (David S. Goldberg)
Date: 20 May 1999 14:18:58 -0400

> Actually in the man page should have SetEnv [...]

> not sure if this will do what you want for FvwmConsole but it will
> let you set an environment variable.

Damn.  That's what I get for printing out the manual rather than
reading it online and being able to C-s it.  This solved two of my
problems.  I defined the following:

AddToFunc doFvwmConsole "I" SetEnv {HOME} /tmp/.dsg
+ "I" FvwmConsole
+ "I" SetEnv {HOME} HOME

(You can see I use FvwmM4 with {} specified for quote chars) Which
does the right thing with respect to running FvwmConsole and as a side
effect by changing my warp-or-run calls from 

"warp-or-run FvwmConsole Module FvwmConsole" to

"warp-or-run FvwmConsole doFvwmConsole

I no longer have the problem with $3 being passed to xterm as an
argument.  I still think that might be a problem for other things
though I haven't run into them yet.

On another note, now that I've got FvwmConsole working I've been able
to debug a bit.  It seems that my FvwmForms are working after all.  It
was my trying to get at it via calls to warp-or-run.  For now I've
just made explict calls to FvwmForm.  I'm guessing it's some sort of
quoting problem.

Thanks!

---

From: [email-masked] (David S. Goldberg)
Date: 20 May 1999 14:18:58 -0400

Thanks!

---

From: [email-masked] (David S. Goldberg)
Date: 20 May 1999 14:26:54 -0400

I apologize for my reply to Brad being duplicated.  His message had a
Reply-To field in it that I didn't notice.  For some reason pgnus'
wide-reply function decided to send both to that *and* to the default
list address I have set up for the group.  I've never seen that happen
before.  I don't have broken-reply-to set for the group since it's
administered properly.  Perhaps I should do that just in case :-)
-- 
Dave Goldberg (G022)
[email-masked]
MS B325
Bedford x3887
--
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: [email-masked] (David S. Goldberg)
Date: 20 May 1999 14:38:19 -0400

So I've now got it working pretty much as I want.  I've figured out
flipfocus by searching for it in the man page beyond its own
definition.  The example of it being used with windowlist led me to
redefine togglewindow as

AddToFunc togglewindow "I" Prev (!iconic CurrentPage) FlipFocus
+ "I" Current (!iconic CurrentPage) Raise

and I now have the behavior I want.

That leaves the problem with empty arguments being passed (maybe
that's a bug?) and one other minor nit I noticed when I did a restart
via FvwmCommand:

[FVWM][Done]: <<ERROR>> Call of 'fvwm2
' failed!!!! (restarting 'fvwm2' instead)

Somewhere along the line I thought I'd seen that one fixed, but I
guess not.

The only thing still bugging me is why warp-or-run can't seem to
properly run FvwmForm.

---

From: [email-masked] (David S. Goldberg)
Date: 20 May 1999 16:20:41 -0400

My problem with warp-or-run et al is related to the empty function
arguments.  If FvwmForm gets called as

FvwmForm MyQuitVerify $3 $4 etc etc

it dies on startup.

Thanks,

---

From: Dan Espen <[email-masked]>
Date: Thu, 20 May 1999 16:36:21 -0400

> FvwmForm MyQuitVerify $3 $4 etc etc

It should.  It must be started:

"Module FvwmForm MyQuitVerify".

--
Dan Espen
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854                     Phone: (732) 699-5570
--
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: [email-masked] (David S. Goldberg)
Date: 20 May 1999 16:47:07 -0400

> "Module FvwmForm MyQuitVerify".

No amount of quoting helps.  Here's a trace having put some Echo's
into the functions:

In FvwmConsole I try 

warp-or-run MyQuitVerify FvwmForm MyQuitVerify or
warp-or-run MyQuitVerify "FvwmForm MyQuitVerify" or
warp-or-run MyQuitVerify 'FvwmForm MyQuitVerify'

All three result in

[FVWM][Echo]:  Next (MyQuitVerify CirculateHit) myfocus 50 50 Iconify -1
[FVWM][Echo]:  None (MyQuitVerify CirculateHit) run-then-warp MyQuitVerify FvwmForm MyQuitVerify $2 $3 $4 $5 $6 $7 $8 $9
[FVWM][Echo]:  run-then-warp MyQuitVerify FvwmForm MyQuitVerify $2 $3 $4 $5 $6 $7 $8
[FVWM][Echo]:  Wait MyQuitVerify
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  1 (X_CreateWindow)
  Value in failed request:  0x0
  Serial number of failed request:  31
  Current serial number in output stream:  41
        
with the only difference being whether $2 or $3 shows up as the first
$ arg in the call to run-then-warp.  In 2.0.46, the extraneous $ args
were evaluated to nothing and didn't show up in such a trace (and the
function worked).
-- 
Dave Goldberg
Post: The Mitre Corporation\MS B325\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: [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].

---

From: Dan Espen <[email-masked]>
Date: Thu, 20 May 1999 20:15:32 -0400

> No amount of quoting helps.  Here's a trace having put some Echo's

Its not the quoting that I was trying to convey.
I didn't see in your problem report where you used the word
"Module".  You can't just issue the command:

FvwmForm MyQuitVerify

you have to use the command

Module FvwmForm MyQuitVerify

If I'm being dumb, and I missed it, let us know.  Eventually one of us
WILL get to the bottom of this.

> [FVWM][Echo]:  None (MyQuitVerify CirculateHit) run-then-warp MyQuitVerify Fv
> wmForm MyQuitVerify $2 $3 $4 $5 $6 $7 $8 $9

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 21 May 1999 12:33:27 +0200

> Module FvwmForm MyQuitVerify

Why? 'Module' shouldn't be necessary if there isn't some builtin or
complex function with the same name.

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [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].

---

From: Dan Espen <[email-masked]>
Date: Fri, 21 May 1999 07:49:27 -0400

> complex function with the same name.

My mistake.  I THOUGHT is was necessary in order to get the arguments
to the module set up right, but a little test shows thats not true.

I guess I/we are going to have to dig a little deeper...

---

From: [email-masked] (David S. Goldberg)
Date: 21 May 1999 09:33:09 -0400

The problem is almost certainly the empty arguments being passed to
the exec of the FvwmForm module.  I trussed my fvwm2 with the follow
option and I see at the execve line:

4754:   fork()          (returning as child ...)        = 2405
4754:   close(23)                                       = 0
4754:   close(24)                                       = 0
4754:   execve("/blackbird/local/openwin/libexec/fvwm/2.2/FvwmForm", 0xEFFF8AB8, 0xEFFFF398)  argc = 14

argc should certainly not be 14.  I'm passing FvwmForm one argument,
the name of the form.  fvwm2 passes it an addition 6 if I remember
correctly.  If I call FvwmForm MyXcmd without the wrapper function
argc shows up as 7 as expected.  Since I don't want to waste bandwidth
on the list, if anyone wants the truss outputs, I'll be happy to email
them.  Hmm.  Better yet, I've put them on my web page:

<URL:http://world.std.com/~dsg/fvwmform-via-wrapper.txt>
<URL:http://world.std.com/~dsg/fvwmform-native.txt>
-- 
Dave Goldberg
Post: The Mitre Corporation\MS B325\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: [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].

---

From: Dan Espen <[email-masked]>
Date: Fri, 21 May 1999 10:03:18 -0400

> <URL:http://world.std.com/~dsg/fvwmform-native.txt>

I'm convinced.  I see the problem as far back as 2.1.4.  (Thats as far
back as I can go at the moment.)  This simple test demonstrates the
problem:

AddToFunc showit "I" Echo "I got: " $0 $1 $2 $3
showit test

Which produces:

[FVWM][Echo]:  "I got: " test $1 $2 $3

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 21 May 1999 16:17:12 +0200

> [FVWM][Echo]:  "I got: " test $1 $2 $3

What does it show? This is exactly what I would have expected. Am
I missing something?

Bye

Dominik ^_^

---

From: Dan Espen <[email-masked]>
Date: Fri, 21 May 1999 10:44:05 -0400

> What does it show? This is exactly what I would have expected. Am

I think we both are missing something, the actual result of this
test in older fvwm2 releases.  I think it might have been:

[FVWM][Echo]:  "I got: " test

but right now I can't prove that.

I think it would be reasonable for missing arguments to a function
to resolve to nothing rather than the symbolic notation for the
argument.

---

From: [email-masked] (David S. Goldberg)
Date: 21 May 1999 10:53:29 -0400

If you don't specify $1 $2 $3 then they should eval to null rather
than to themselves, in the function call.  That allows (and did allow
in 2.0.46) a function to be written that could take an arbitrary (well 
up to 9) number of arguments.  Because that's not happening, my call
to FvwmForm is being exec'd with additional arguments that are
apparently confusing either FvwmForm itself or some X library function 
it is calling.  Unfortunately truss doesn't work at that high a level
and trying to attach to fvwm with gdb screws up my windowing something 
awful :-)  Hmmm.  Maybe if I run fvwm in an Xnest server and attach to
that.  Hmmm.  I won't have time to do it until next week, but if
nothing else comes up I'll give it a shot then.
-- 
Dave Goldberg
Post: The Mitre Corporation\MS B325\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: [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].

---

From: Dan Espen <[email-masked]>
Date: Fri, 21 May 1999 11:03:14 -0400

> nothing else comes up I'll give it a shot then.

I don't think thats necessary, FvwmForm checks is arg count.  If there
are too many args, its  not going to run correctly.   In the 2.2  time
frame,  if the arg  count  isn't 7 (including  the 6  from fvwm2), its
going to ignore the  form name (MyQuitVerify),  leading to creating  a
bad window.

My guess is, we are going to fix this by making the extra args go away
like they apparently did in the past.

---

From: Brad Giaccio <[email-masked]>
Date: Fri, 21 May 1999 11:29:06 -0400

> What does it show? This is exactly what I would have expected. Am

I would have expected to see 
[FVWM][Echo]:  "I got: " test

since $1 $2 and $3 are all empty strings

The problem is in functions.c:expand 

the problem is that I ddin't acount for quite enough cases the last
time I patcehd this function.  What needs to be done is to distinguish
between creating a function and actually expanding args when it is being
executed.  This patch works for me in all places where I use $args could
someone else apply it and commit it if it works for them too.

Brad

Changelog entry:
1999-05-17  Brad Giaccio  <[email-masked]>

    * fvwm/functions.c (expand): a fix for not leaving $arg on a line 
      to be executed if there is no value for $arg.

Index: functions.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/functions.c,v
retrieving revision 1.62
diff -u -B -b -c -r1.62 functions.c
cvs server: conflicting specifications of output style
*** functions.c 1999/05/15 01:54:47     1.62
--- functions.c 1999/05/21 15:24:54
***************
*** 265,274 ****
--- 265,279 ----
  {
    int l,i,l2,n,k,j;
    char *out;
+   int addto = 0; /*special cas if doing addtofunc */
  
    l = strlen(input);
    l2 = l;
  
+   if(strncasecmp(input, "AddToFunc", 9) == 0 || input[0] == '+')
+   {
+     addto = 1;
+   }
    i=0;
    while(i<l)
      {
***************
*** 331,338 ****
                    out[j++] = arguments[n][k];
                  i++;
                }
!             else
                out[j++] = '$';
              break;
            case 'w':
              if(tmp_win)
--- 336,351 ----
                    out[j++] = arguments[n][k];
                  i++;
                }
!             else if (addto == 1) 
!         {
                  out[j++] = '$';
+         }
+           else
+         {
+           i++;
+           if (isspace(input[i+1]))
+             i++; /*eliminates extra white space*/
+         }
              break;
            case 'w':
              if(tmp_win)

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 24 May 1999 14:53:40 +0200

> someone else apply it and commit it if it works for them too.

OK, the patch is applied.

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

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 28 May 1999 12:47:13 -0600

> OK, the patch is applied.

Oops, replies to the wrong message. I think I wanted to say that the
'flickering title bar' patch is applied.

Bye

Dominik ^_^