FVWM: Monster patch for fvwm 2.0.43

From: Grant McDorman <grant_at_isgtec.com>
Date: Wed, 11 Sep 1996 10:50:28 -0400 (EDT)

-----BEGIN PGP SIGNED MESSAGE-----

The attached patch contains all of the changes/patches I've made to fvwm
2.0.43. (I'm sending this since I'm not sure I sent in all of the changes
before).

The changes in this patch:
   * FvwmButtons
      parse.c Change to parse old-style SwallowModule command (tested)
      FvwmButtons.c Change to remove XLib calls from signal handler (part
                    tested)
   * FvwmConsole
      FCtest.c Fixes to prevent memory corruption (tested)
   
   * fvwm
      placement.c Change to allow RandomPlacement for transient windows
                    (dialogs) (tested)
      fvwm.c Change to remove X calls from the X fatal I/O error
                    handler (needs to be tested on Digital Unix)

Grant McDorman <grant_at_isgtec.com>
                                ISG Technologies, Inc.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQBVAwUBMjbTmkDmya2cFZ8ZAQHh8AH/R9u7YBa+qtvZwM8XOZs8jGNkFy3Sa7QB
5xw3C0zhS9jPpU6T11JoMcsCrIPBFhBOBETmTg0HBKlnOv/gOrDcJw==
=vcbp
-----END PGP SIGNATURE-----


*** fvwm-2.0.43/modules/FvwmButtons/parse.c.orig Thu Jun 27 10:46:22 1996
--- fvwm-2.0.43/modules/FvwmButtons/parse.c Tue Jul 9 13:07:27 1996
***************
*** 670,675 ****
--- 670,679 ----
            exit(1);
          }
        s+=7;
+ if (mystrncasecmp(s,"module",6)==0)
+ {
+ s+=6;
+ }
        b->hangon=seekright(&s);
        b->flags|=(b_Swallow|b_Hangon);
        b->swallow|=1;
*** fvwm-2.0.43/modules/FvwmButtons/FvwmButtons.c.orig Thu Jun 27 10:45:30 1996
--- fvwm-2.0.43/modules/FvwmButtons/FvwmButtons.c Wed Sep 11 10:31:58 1996
***************
*** 27,32 ****
--- 27,33 ----
  #include <string.h>
  #include <sys/wait.h>
  #include <sys/time.h>
+ #include <sys/stat.h>
  #if defined ___AIX || defined _AIX || defined __QNX__ || defined ___AIXV3 || d
efined AIXV3 || defined _SEQUENT_
  #include <sys/select.h>
  #endif
***************
*** 75,80 ****
--- 76,82 ----
  /* ------------------------------ prototypes ------------------------------- *
/
  
  void DeadPipe(int nonsense);
+ void CleanUp(void);
  void SetButtonSize(button_info*,int,int);
  /* main */
  void Loop(void);
***************
*** 123,128 ****
--- 125,132 ----
  GC NormalGC;
  int Width,Height;
  
+ int running = 1;
+
  int x= -30000,y= -30000,w= -1,h= -1,gravity = NorthWestGravity;
  int new_desk = 0;
  int ready = 0;
***************
*** 170,182 ****
  **/
  void DeadPipe(int whatever)
  {
    button_info *b,*ub=UberButton;
    int button=-1;
  
- signal(SIGPIPE, SIG_IGN);/* Xsync may cause SIGPIPE */
-
    XSync(Dpy,0); /* Wait for thing to settle down a bit */
    XGrabServer(Dpy); /* We don't want interference right now */
    while(NextButton(&ub,&b,&button,0))
      {
        /* delete swallowed windows */
--- 174,217 ----
  **/
  void DeadPipe(int whatever)
  {
+ struct stat buf;
+
+ /*
+ * If a SIGPIPE arrives during this operation, just exit.
+ * - the signal will probably because the server is shutting
+ * down. Attempting to do any further processing is useless
+ * and may in fact, on some platforms, put the process into
+ * a tight loop (if SIGPIPE is ignored).
+ * 22 July 1996 GRM.
+ *
+ * Further investigation: XSync may loop *without* causing a SIGPIPE.
+ * This may be because the connection is dead, or because of the
+ * fact that X operations in signal handlers are discouraged.
+ *
+ * In order to cover all the bases, then, this function will now
+ * set a global flag which will cause the main loop to stop.
+ *
+ * SIGPIPE is reset to DeadPipe, as well.
+ */
+ signal(SIGPIPE, DeadPipe);
+
+ /*
+ * Try to check status of X connection.
+ */
+ if (fstat(XConnectionNumber(Dpy), &buf) == -1)
+ exit(0);
+
+ running = 0;
+ }
+
+ void CleanUp(void)
+ {
    button_info *b,*ub=UberButton;
    int button=-1;
  
    XSync(Dpy,0); /* Wait for thing to settle down a bit */
    XGrabServer(Dpy); /* We don't want interference right now */
+
    while(NextButton(&ub,&b,&button,0))
      {
        /* delete swallowed windows */
***************
*** 506,512 ****
    int ex=10000,ey=10000,ex2=0,ey2=0;
  #endif
  
! while(1)
      {
        if(My_XNextEvent(Dpy,&Event))
          {
--- 541,547 ----
    int ex=10000,ey=10000,ex2=0,ey2=0;
  #endif
  
! while(running)
      {
        if(My_XNextEvent(Dpy,&Event))
          {
***************
*** 733,738 ****
--- 768,774 ----
            }
        }
      }
+ CleanUp();
  }
  
  /**
*** fvwm-2.0.43/modules/FvwmConsole/FCtest.c.orig Mon Feb 26 14:33:04 1996
--- fvwm-2.0.43/modules/FvwmConsole/FCtest.c Wed Jul 10 13:18:06 1996
***************
*** 27,33 ****
  
  void main(int argc, char **argv){
    char *tmp, *s;
! char client[120];
    char **eargv;
    int i,j;
    char *xterm_a[] = {"-title", name,"-name",name, "-e",client,NULL };
--- 27,33 ----
  
  void main(int argc, char **argv){
    char *tmp, *s;
! static char client[120];
    char **eargv;
    int i,j;
    char *xterm_a[] = {"-title", name,"-name",name, "-e",client,NULL };
*** fvwm-2.0.43/modules/FvwmConsole/FvwmConsole.c.orig Tue Feb 27 19:10:41 1996
--- fvwm-2.0.43/modules/FvwmConsole/FvwmConsole.c Wed Jul 10 14:59:04 1996
***************
*** 26,32 ****
  
  void main(int argc, char **argv){
    char *tmp, *s;
! char client[120];
    char **eargv;
    int i,j;
    char *xterm_a[] = {"-title", name,"-name",name, "-e",client,NULL };
--- 26,32 ----
  
  void main(int argc, char **argv){
    char *tmp, *s;
! static char client[120];
    char **eargv;
    int i,j;
    char *xterm_a[] = {"-title", name,"-name",name, "-e",client,NULL };
***************
*** 57,63 ****
          exit(1);
    }
  
! if( ( eargv =(char **)safemalloc((argc-2)*sizeof(char *)) ) == NULL ) {
          ErrMsg( "allocation" );
    }
  
--- 57,64 ----
          exit(1);
    }
  
! #define ENARGS ((argc-FARGS+1)+sizeof(xterm_a)/sizeof(xterm_a[1]))
! if( ( eargv =(char **)safemalloc(ENARGS*sizeof(char *)) ) == NULL ) {
          ErrMsg( "allocation" );
    }
  
*** fvwm-2.0.43/fvwm/placement.c.orig Mon Apr 24 14:14:08 1995
--- fvwm-2.0.43/fvwm/placement.c Tue Jul 9 12:12:31 1996
***************
*** 162,168 ****
     * If RandomPlacement was specified,
     * then place the window in a psuedo-random location
     */
! if (!(tmp_win->flags & TRANSIENT) &&
        !(tmp_win->hints.flags & USPosition) &&
        ((tflag & NO_PPOSITION_FLAG)||
         !(tmp_win->hints.flags & PPosition)) &&
--- 162,168 ----
     * If RandomPlacement was specified,
     * then place the window in a psuedo-random location
     */
! if (!((tmp_win->flags & TRANSIENT) && (tmp_win->hints.flags & PPosition)) &&
        !(tmp_win->hints.flags & USPosition) &&
        ((tflag & NO_PPOSITION_FLAG)||
         !(tmp_win->hints.flags & PPosition)) &&
***************
*** 172,178 ****
          (tmp_win->wmhints->initial_state == IconicState)) )
      {
        /* Get user's window placement, unless RandomPlacement is specified */
 
! if(tflag & RANDOM_PLACE_FLAG)
          {
            if(tflag & SMART_PLACE_FLAG)
              SmartPlacement(tmp_win,tmp_win->frame_width+2*tmp_win->bw,
--- 172,178 ----
          (tmp_win->wmhints->initial_state == IconicState)) )
      {
        /* Get user's window placement, unless RandomPlacement is specified */
 
! if(tflag & RANDOM_PLACE_FLAG || (tmp_win->flags & TRANSIENT))
          {
            if(tflag & SMART_PLACE_FLAG)
              SmartPlacement(tmp_win,tmp_win->frame_width+2*tmp_win->bw,
*** fvwm-2.0.43/fvwm/fvwm.c.orig Thu Jun 27 10:08:08 1996
--- fvwm-2.0.43/fvwm/fvwm.c Wed Sep 11 09:25:16 1996
***************
*** 1146,1152 ****
    /* No action is taken because usually this action is caused by someone
       using "xlogout" to be able to switch between multiple window managers
       */
! Done(0, NULL);
  }
  
  /***********************************************************************
--- 1146,1153 ----
    /* No action is taken because usually this action is caused by someone
       using "xlogout" to be able to switch between multiple window managers
       */
! ClosePipes();
! exit(1);
  }
  
  /***********************************************************************

End of MIME message
--
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 majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Wed Sep 11 1996 - 10:06:53 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST