Subject: Re: FVWM: Fvwm 2.0.45 and FvwmForm

From: [email-masked] (Thomas Honigmann)
Date: Sat, 22 Mar 1997 00:06:51 +0100

Benoit Champagne <[email-masked]> wrote:

> I just installed the new 2.0.45 version and seems like the FvwmForm does not
> work anymore.  All I have showing up is the window with all widgets' background
> drawn but not managed, cannot select any buttons and not text is showing up.
> All I can do is 'destroy' the window.
> 
> Any clue on what's going on?
> 
> PS: I have tested also the FvwmScript with some scripts (like ScreenSetup) and
> I get the same behavior. So it does not seem to be an FvwmForm problem (???).
> 

> Sorry all, but seems like my fvwm has gotten confused by restarting too many
> time.  I was testing the Title and Button Style and restarted fvwm quite
> often.  I logged out and back in and everything was fine.
> 
> Thank you for your time and sorry again!
> 
> PS: Still fvwm seems to lose its temper when you 'Restart' it too often!? Chuck?

There are actually two problems involved. 
1. FvwmForm and FvmwScript have a hardcoded '32' in the select() call in their
   MainLoop. If fvwm assigns a file descriptor >31 they won't be able to
   detect messages from fvwm and that will lead to the described behavior 
   (not managed, no buttons etc.). This one is easy to fix: use the the 
   result of GetFdWidth() instead of '32' as all the other modules do.
   Attached are patches for FvwmForm.c und FvwmScript.c which do just that.
2. The 'Restart' problem. This one is strange and it'll need someone with
   better knowledge of the internals of fvwm than me to solve. fvwm 2.0.45
   running on a Sparc Station under Solaris (what kind of machine are you
   on, Benoit?) will 'loose' one (or two) file descriptor(s) every time it 
   is restarted. Take a look at the file descriptors fvwm assigns to its 
   modules ('ps' shows the command lines fvwm uses to start modules). 
   With my setup the Pager will get 
   - 14 and 10 when started, 
   - 15/11 after the first restart, 
   - 16/13 (notice 13-11=2!) after the second restart, 
   - 17/14 after the third 
   and from there on it will go up in steps of one (at least I think it does, 
   I didn't actually check every step but eventually it reaches 32 and the 
   problem becomes obvious to me since I'm using a FvwmForm dialog to restart).
   Even stranger is that fvwm compiled from the same source and using the
   same .fvwm2rc running under SunOS 4.1.3 doesn't have this problem. There
   I get 9 and 6 for the pager and that stays the same no matter how often
   I restart. 
   Actually, this bug(?) is not really an important one. AFAIK most OS'es 
   will allow at least 256 file descriptor per process, so after fixing 
   FvwmForm and FvwmScript (hopefully newly written modules will always use 
   GetFdWidth()) one would have to restart more than 200 times to see an
   effect.

Thomas

*** FvwmForm.c~	Tue Jul 23 15:01:25 1996
--- FvwmForm.c	Fri Mar 21 22:05:47 1997
***************
*** 136,141 ****
--- 136,142 ----
  int fd[2]; /* pipe pair */
  int fd_err;
  FILE *fp_err;
+ int fd_width;
  
  Line lines[MAX_LINES];
  int n_lines;
***************
*** 1519,1525 ****
      FD_SET(fd_x, &fds);
  
      XFlush(dpy);
!     if (select(32, &fds, NULL, NULL, NULL) > 0) {
        if (FD_ISSET(fd_in, &fds))
  	ReadFvwm();
        if (FD_ISSET(fd_x, &fds))
--- 1520,1526 ----
      FD_SET(fd_x, &fds);
  
      XFlush(dpy);
!     if (select(fd_width, &fds, NULL, NULL, NULL) > 0) {
        if (FD_ISSET(fd_in, &fds))
  	ReadFvwm();
        if (FD_ISSET(fd_x, &fds))
***************
*** 1587,1592 ****
--- 1588,1594 ----
    root = RootWindow(dpy, screen);
    scr_depth = DefaultDepth(dpy, screen);
    d_cmap = DefaultColormap(dpy, screen);
+   fd_width=GetFdWidth();
  
    ReadConfig();
  
*** FvwmScript.c~	Fri Mar 21 22:50:01 1997
--- FvwmScript.c	Fri Mar 21 22:57:14 1997
***************
*** 30,35 ****
--- 30,36 ----
  int fd[2]; 			/* pipe pair */
  int fd_err;
  int x_fd;			/* fd for X */
+ int fd_width;
  Window ref;
  
  /*void (*TabCom[30]) (int NbArg,long *TabArg);
***************
*** 541,547 ****
  
      XFlush(x11base->display);
      
!     if (select(32, &in_fdset, NULL, NULL, NULL) > 0)
      {
       if (FD_ISSET(x_fd, &in_fdset))
        ReadXServer();
--- 542,548 ----
  
      XFlush(x11base->display);
      
!     if (select(fd_width, &in_fdset, NULL, NULL, NULL) > 0)
      {
       if (FD_ISSET(x_fd, &in_fdset))
        ReadXServer();
***************
*** 597,602 ****
--- 598,604 ----
      fprintf(stderr,"%s requires only the path of the script.\n", ScriptName);
      exit(1);
    }
+  fd_width=GetFdWidth();
  
   ParseOptions();
   
--
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].