[comp.windows.x] uwm patches. This is shar file 2 of 3

jkh@COGSCI.BERKELEY.EDU (Jordan K. Hubbard) (12/13/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# uwm.patches.1
# This is archive 2 of 3. Apply with patch -p
#
echo x - uwm.patches.1
sed 's/^	//' > "uwm.patches.1" << '//E*O*F uwm.patches.1//'
	*** uwm.new/Bindings.c	Mon Dec  7 00:59:27 1987
	--- uwm.new/Bindings.c	Sat Dec 12 09:52:26 1987
	***************
	*** 48,55
	   */
	  
	  char *DefaultBindings[] = {
	! "resetbindings;resetvariables;resetmenus;noautoselect;delta=5;freeze",
	! "grid;zap;pushabsolute;push=1;hiconpad=5;viconpad=5;hmenupad=3;vmenupad=0",
	  "iconfont=fixed;menufont=fixed;resizefont=fixed;volume=0",
	  "f.newiconify=m:w|i:delta l",
	  "f.raise=m:w|i:delta l",
	
	--- 48,56 -----
	   */
	  
	  char *DefaultBindings[] = {
	! "resetbindings;resetvariables;resetmenus;noautoselect;noautoraise;title",
	! "rootresizebox;delta=5;freeze;grid;zap",
	! "pushabsolute;push=1;hiconpad=5;viconpad=5;hmenupad=3;vmenupad=0",
	  "iconfont=fixed;menufont=fixed;resizefont=fixed;volume=0",
	  "f.newiconify=m:w|i:delta l",
	  "f.raise=m:w|i:delta l",
	*** uwm.new/GetButton.c	Mon Dec  7 00:59:31 1987
	--- uwm.new/GetButton.c	Sat Dec 12 19:05:30 1987
	***************
	*** 41,46
	   * 002 -- L. Guarino Reid, DEC Ultrix Engineering Group
	   *	  April 16, 1987
	   *	  Convert to X11
	   */
	  
	  #ifndef lint
	
	--- 41,48 -----
	   * 002 -- L. Guarino Reid, DEC Ultrix Engineering Group
	   *	  April 16, 1987
	   *	  Convert to X11
	+  * 003 -- J. Hubbard, U.C. Berkeley.
	+  *    December 3, 1987.
	   */
	  
	  #ifndef lint
	***************
	*** 59,64
	  #include <X11/Xatom.h>
	  
	  #define ICONSTR	(icon_str ? icon_str : "")
	  
	  Bool GetButton(button_event)
	      XEvent *button_event;	/* Button event packet. */
	
	--- 61,68 -----
	  #include <X11/Xatom.h>
	  
	  #define ICONSTR	(icon_str ? icon_str : "")
	+ /* Amount of padding between text in a title bar and the edge of the bar */
	+ #define PAD	1
	  
	  Bool GetButton(b_ev)
	      XEvent *b_ev;	/* Button event packet. */
	***************
	*** 60,67
	  
	  #define ICONSTR	(icon_str ? icon_str : "")
	  
	! Bool GetButton(button_event)
	!     XEvent *button_event;	/* Button event packet. */
	  {
	  #define STRLEN 50
	      XKeyPressedEvent *kp_event;	/* Key pressed event. */
	
	--- 64,71 -----
	  /* Amount of padding between text in a title bar and the edge of the bar */
	  #define PAD	1
	  
	! Bool GetButton(b_ev)
	!     XEvent *b_ev;	/* Button event packet. */
	  {
	  #define STRLEN 50
	      XKeyPressedEvent *kp_event;	/* Key pressed event. */
	***************
	*** 79,84
	      char kbd_str[STRLEN];              /* Keyboard string. */
	      int nbytes;                 /* Keyboard string length. */
	      int i;                      /* Iteration counter. */
	  
	  
	      /*
	
	--- 83,91 -----
	      char kbd_str[STRLEN];              /* Keyboard string. */
	      int nbytes;                 /* Keyboard string length. */
	      int i;                      /* Iteration counter. */
	+ 	extern int Fheight;		/* the height of a title bar */
	+ 	Window win;				/* scratch */
	+ 	TitleData *dat;			/* ditto */
	  
	  
	      /*
	***************
	*** 85,91
	       * Get next event from input queue and store it in the event packet
	       * passed to GetButton.
	       */
	!     XNextEvent(dpy, button_event);
	  
	      /*
	       * The event occured on the root window, check for substructure
	
	--- 92,98 -----
	       * Get next event from input queue and store it in the event packet
	       * passed to GetButton.
	       */
	!     XNextEvent(dpy, b_ev);
	  
	      /*
	       * The event occured on the root window, check for substructure
	***************
	*** 91,97
	       * The event occured on the root window, check for substructure
	       * changes. Otherwise, it must be a mouse button event. 
	       */
	!     if (((XAnyEvent *)button_event)->window == RootWindow(dpy, scr)) {
	  
	  	switch (button_event->type) {
	  
	
	--- 98,104 -----
	       * The event occured on the root window, check for substructure
	       * changes. Otherwise, it must be a mouse button event. 
	       */
	!     if (b_ev->xany.window == RootWindow(dpy, scr)) {
	  
	  		switch (b_ev->type) {
	  			case CreateNotify:
	***************
	*** 93,99
	       */
	      if (((XAnyEvent *)button_event)->window == RootWindow(dpy, scr)) {
	  
	! 	switch (button_event->type) {
	  
	  	  case CreateNotify:
	  	  case UnmapNotify:
	
	--- 100,115 -----
	       */
	      if (b_ev->xany.window == RootWindow(dpy, scr)) {
	  
	! 		switch (b_ev->type) {
	! 			case CreateNotify:
	! 			case UnmapNotify:
	! 			case ReparentNotify:
	! 			case ConfigureNotify:
	! 			case GravityNotify:
	! 			case MapNotify:
	! 			case MappingNotify:
	! 			case CirculateNotify:
	! 				return(FALSE);
	  
	  			case MapRequest: 
	  				CheckMap(b_ev->xmap.window);
	***************
	*** 95,112
	  
	  	switch (button_event->type) {
	  
	! 	  case CreateNotify:
	! 	  case UnmapNotify:
	! 	  case ReparentNotify:
	! 	  case ConfigureNotify:
	! 	  case GravityNotify:
	! 	  case MapNotify:
	! 	  case MappingNotify:
	! 	  case CirculateNotify: return(FALSE);
	! 	  	
	! 	  case MapRequest: 
	! 	        CheckMap(((XMapEvent *)button_event)->window);
	! 		return(FALSE);
	  
	  	  case ConfigureRequest: 
	  	        Configure((XConfigureEvent *)button_event);
	
	--- 111,119 -----
	  			case CirculateNotify:
	  				return(FALSE);
	  
	! 			case MapRequest: 
	! 				CheckMap(b_ev->xmap.window);
	! 				return(FALSE);
	  
	  			case ConfigureRequest: 
	  				Configure((XConfigureEvent *)b_ev);
	***************
	*** 108,116
	  	        CheckMap(((XMapEvent *)button_event)->window);
	  		return(FALSE);
	  
	! 	  case ConfigureRequest: 
	! 	        Configure((XConfigureEvent *)button_event);
	! 		return(FALSE);
	  
	  	  case CirculateRequest: 
	  	        Circulate((XCirculateEvent *)button_event);
	
	--- 115,123 -----
	  				CheckMap(b_ev->xmap.window);
	  				return(FALSE);
	  
	! 			case ConfigureRequest: 
	! 				Configure((XConfigureEvent *)b_ev);
	! 				return(FALSE);
	  
	  			case CirculateRequest: 
	  				Circulate((XCirculateEvent *)b_ev);
	***************
	*** 112,120
	  	        Configure((XConfigureEvent *)button_event);
	  		return(FALSE);
	  
	! 	  case CirculateRequest: 
	! 	        Circulate((XCirculateEvent *)button_event);
	! 		return(FALSE);
	  
	  	  case DestroyNotify: 
	  	        RemoveIcon(((XDestroyWindowEvent *)button_event)->window);
	
	--- 119,127 -----
	  				Configure((XConfigureEvent *)b_ev);
	  				return(FALSE);
	  
	! 			case CirculateRequest: 
	! 				Circulate((XCirculateEvent *)b_ev);
	! 				return(FALSE);
	  
	  			case DestroyNotify: 
	  				RemoveIcon(b_ev->xdestroywindow.window);
	***************
	*** 116,124
	  	        Circulate((XCirculateEvent *)button_event);
	  		return(FALSE);
	  
	! 	  case DestroyNotify: 
	! 	        RemoveIcon(((XDestroyWindowEvent *)button_event)->window);
	! 		return(FALSE);
	  
	  	  case FocusIn: 
	  		if (((XFocusInEvent *)button_event)->detail
	
	--- 123,131 -----
	  				Circulate((XCirculateEvent *)b_ev);
	  				return(FALSE);
	  
	! 			case DestroyNotify: 
	! 				RemoveIcon(b_ev->xdestroywindow.window);
	! 				return(FALSE);
	  
	  			case FocusIn: 
	  				if (b_ev->xfocus.detail == NotifyPointerRoot) {
	***************
	*** 120,134
	  	        RemoveIcon(((XDestroyWindowEvent *)button_event)->window);
	  		return(FALSE);
	  
	! 	  case FocusIn: 
	! 		if (((XFocusInEvent *)button_event)->detail
	! 		    == NotifyPointerRoot) {
	!     	            if (FocusSetByUser) {
	!        	                XSetInputFocus(dpy, PointerRoot, None, CurrentTime);
	!                         FocusSetByUser = FALSE;
	! 		    }
	! 		}
	! 		return (FALSE);
	  
	            case FocusOut:
	  		if (((XFocusOutEvent *)button_event)->detail
	
	--- 127,141 -----
	  				RemoveIcon(b_ev->xdestroywindow.window);
	  				return(FALSE);
	  
	! 			case FocusIn: 
	! 				if (b_ev->xfocus.detail == NotifyPointerRoot) {
	! 					if (FocusSetByUser) {
	! 						XSetInputFocus(dpy, PointerRoot, None,
	! 						  CurrentTime);
	! 						FocusSetByUser = FALSE;
	! 					}
	! 				}
	! 				return (FALSE);
	  
	  			case FocusOut:
	  				if (b_ev->xfocus.detail == NotifyPointerRoot) {
	***************
	*** 130,143
	  		}
	  		return (FALSE);
	  
	!           case FocusOut:
	! 		if (((XFocusOutEvent *)button_event)->detail
	! 		    == NotifyPointerRoot) {
	!                     if (!FocusSetByUser) {
	!    	                XSetInputFocus(dpy, PointerRoot, None, CurrentTime);
	! 		    }
	! 		}
	! 		return (FALSE);
	  
	  	  case ButtonPress:
	  	  case ButtonRelease:
	
	--- 137,149 -----
	  				}
	  				return (FALSE);
	  
	! 			case FocusOut:
	! 				if (b_ev->xfocus.detail == NotifyPointerRoot) {
	! 					if (FocusSetByUser == FALSE)
	! 						XSetInputFocus(dpy, PointerRoot, None,
	! 						  CurrentTime);
	! 				}
	! 				return (FALSE);
	  
	  			case ButtonPress:
	  			case ButtonRelease:
	***************
	*** 139,147
	  		}
	  		return (FALSE);
	  
	! 	  case ButtonPress:
	! 	  case ButtonRelease:
	! 		return(TRUE);
	  
	  	  default: 
	  	    printf("uwm internal error: unexpected event on Root Window\n");
	
	--- 145,153 -----
	  				}
	  				return (FALSE);
	  
	! 			case ButtonPress:
	! 			case ButtonRelease:
	! 			return(TRUE);
	  
	  	  		default: 
	  				printf("uwm internal error: unexpected event on Root Window\n");
	***************
	*** 143,152
	  	  case ButtonRelease:
	  		return(TRUE);
	  
	! 	  default: 
	! 	    printf("uwm internal error: unexpected event on Root Window\n");
	! 	    return(FALSE); 
	! 	}
	      }
	  
	      /*
	
	--- 149,158 -----
	  			case ButtonRelease:
	  			return(TRUE);
	  
	! 	  		default: 
	! 				printf("uwm internal error: unexpected event on Root Window\n");
	! 				return(FALSE); 
	! 		}
	      }
	  
	      /*
	***************
	*** 153,167
	       * If the event type is EnterWindow, LeaveWindow, or MouseMoved,
	       * we are processing a menu. 
	       * If the event type is ButtonPress or ButtonRelease,
	!      * we have a button event.      */
	!     switch (button_event->type) {
	!        case EnterNotify:
	!        case LeaveNotify: 
	!        case MotionNotify: 
	!        case ButtonPress: 
	!        case ButtonRelease: 
	! 	return(TRUE); 
	!        default: break;
	      }
	  
	      /*
	
	--- 159,227 -----
	       * If the event type is EnterWindow, LeaveWindow, or MouseMoved,
	       * we are processing a menu. 
	       * If the event type is ButtonPress or ButtonRelease,
	!      * we have a button event.
	! 	 * If it's an expose, then we may have exposed a title bar.
	! 	 * If it's a Notify, we've probably frobbed a titled window.
	! 	 */
	! 	
	! 	win = b_ev->xany.window;
	! 
	! 	switch (b_ev->type) {
	! 
	! 		case EnterNotify:
	! 			HandleFocusIn(b_ev);
	! 			return(FALSE);
	! 
	! 		case LeaveNotify: 
	! 			HandleFocusOut(b_ev);
	! 			return(FALSE);
	! 
	! 		case ConfigureRequest:
	! 			if ((dat = GetTitleInfo(win)) != NULL) {
	! 				ConfigureTitle(dat, b_ev->xconfigure.x,
	! 				  b_ev->xconfigure.y - (Fheight + 2),
	! 				  b_ev->xconfigure.width, b_ev->xconfigure.height);
	! 			}
	! 			return(FALSE);
	! 
	! 		case MapNotify:
	! 		case MapRequest:
	! 			break;
	! 
	! 		case DestroyNotify:
	! 			if ((dat = GetTitleInfo(win)) != NULL) {
	! 				DestroyTitle(dat, True);
	! 				return(FALSE);
	! 			}
	! 			break;
	! 
	! 		case UnmapNotify:
	! 			if ((dat = GetTitleInfo(win)) != NULL) {
	! 				XUnmapWindow(dpy, dat->parent);
	! 				return(FALSE);
	! 			}
	! 			break;
	! 
	! 		case MotionNotify: 
	! 		case ButtonPress: 
	! 		case ButtonRelease: 
	! 			return(TRUE); 
	! 
	! 		case Expose:
	! 			if ((dat = GetTitleInfo(win)) != NULL && dat->title == win) {
	! 				if (b_ev->xexpose.count == 0) {
	! 					while (Eventp(dat->title, Expose, True));
	! 					PaintTitle(dat);
	! 				}
	! 				return(FALSE);
	! 			}
	! 			break;
	! 
	! 		default:
	! 			/* fprintf(stderr, "non root event type: %d window %x (%d, %d)\n",
	! 			  b_ev->type, b_ev->xbutton.window,
	! 			  b_ev->xbutton.x, b_ev->xbutton.y); */
	! 			break;
	      }
	  
	      /*
	***************
	*** 165,172
	      }
	  
	      /*
	!      * Ok, if the event is not on the root window it must be an event on
	!      * one of the icons owned by uwm.
	       */
	      icon = ((XAnyEvent *)button_event)->window;
	  
	
	--- 225,232 -----
	      }
	  
	      /*
	!      * Ok, if the event is not on the root window and it's not a title bar,
	! 	 * it must be an event on one of the icons owned by uwm.
	       */
	      icon = b_ev->xany.window;
	  
	***************
	*** 168,174
	       * Ok, if the event is not on the root window it must be an event on
	       * one of the icons owned by uwm.
	       */
	!     icon = ((XAnyEvent *)button_event)->window;
	  
	      /*
	       * Find out current information about the icon window.
	
	--- 228,234 -----
	       * Ok, if the event is not on the root window and it's not a title bar,
	  	 * it must be an event on one of the icons owned by uwm.
	       */
	!     icon = b_ev->xany.window;
	  
	      /*
	       * Find out current information about the icon window.
	***************
	*** 180,192
	       * If the event is an UnmapWindow event or a ConfigureNotify event,
	       * then return FALSE.
	       */
	!     if (button_event->type == MapNotify || 
	!         button_event->type == UnmapNotify ||
	!         button_event->type == CreateNotify ||
	!         button_event->type == ReparentNotify ||
	!         button_event->type == GravityNotify ||
	!         button_event->type == CirculateNotify ||
	!         button_event->type == ConfigureNotify)
	          return(FALSE);
	  
	      /*
	
	--- 240,252 -----
	       * If the event is an UnmapWindow event or a ConfigureNotify event,
	       * then return FALSE.
	       */
	!     if (b_ev->type == MapNotify || 
	!         b_ev->type == UnmapNotify ||
	!         b_ev->type == CreateNotify ||
	!         b_ev->type == ReparentNotify ||
	!         b_ev->type == GravityNotify ||
	!         b_ev->type == CirculateNotify ||
	!         b_ev->type == ConfigureNotify)
	          return(FALSE);
	  
	      /*
	***************
	*** 208,214
	       * is not of zero length, simply repaint the text in the icon window
	       * and return FALSE.
	       */
	!     if (button_event->type == Expose && (!Freeze || Frozen == 0)) {
	          if (icon_info.width != 
	  	  XTextWidth(IFontInfo, ICONSTR, strlen(ICONSTR))+(HIconPad << 1)) {
	  	  XResizeWindow(dpy, icon, 
	
	--- 268,274 -----
	       * is not of zero length, simply repaint the text in the icon window
	       * and return FALSE.
	       */
	!     if (b_ev->type == Expose && (!Freeze || Frozen == 0)) {
	          if (icon_info.width != 
	  	  XTextWidth(IFontInfo, ICONSTR, strlen(ICONSTR))+(HIconPad << 1)) {
	  	  XResizeWindow(dpy, icon, 
	***************
	*** 231,237
	      /*
	       * If we have gotten this far event can only be a key pressed event.
	       */
	!     kp_event = (XKeyPressedEvent *) button_event;
	  
	      /* 
	       * We convert the key pressed event to ascii.
	
	--- 291,297 -----
	      /*
	       * If we have gotten this far event can only be a key pressed event.
	       */
	!     kp_event = (XKeyPressedEvent *) b_ev;
	  
	      /* 
	       * We convert the key pressed event to ascii.
	***************
	*** 356,361
	      Bool configureit = False;
	      Window jW;
	      int border_width, j;
	  
	      /*
	       * Gather info about the event window.
	
	--- 416,422 -----
	      Bool configureit = False;
	      Window jW;
	      int border_width, j;
	+ 	TitleData *dat = 0;
	  
	      /*
	       * Gather info about the event window.
	***************
	*** 364,370
	      /* if it's a transient window, we won't rubber-band
	       * note that this call always sets transient_for.
	       */
	!     if (XGetTransientForHint( dpy, window, &transient_for )) {
	          XGetGeometry( dpy, window, &jW, &x, &y, &w, &h, &border_width, &j );
	      }
	      else {
	
	--- 425,431 -----
	      /* if it's a transient window, we won't rubber-band
	       * note that this call always sets transient_for.
	       */
	!     if (XGetTransientForHint( dpy, window, &transient_for ))
	          XGetGeometry( dpy, window, &jW, &x, &y, &w, &h, &border_width, &j );
	      else {
	  		if ((wmhints = XGetWMHints(dpy, window))) {
	***************
	*** 366,372
	       */
	      if (XGetTransientForHint( dpy, window, &transient_for )) {
	          XGetGeometry( dpy, window, &jW, &x, &y, &w, &h, &border_width, &j );
	-     }
	      else {
	  	if ((wmhints = XGetWMHints(dpy, window)) &&
	  	    (wmhints->flags&StateHint) &&
	
	--- 427,432 -----
	       */
	      if (XGetTransientForHint( dpy, window, &transient_for ))
	          XGetGeometry( dpy, window, &jW, &x, &y, &w, &h, &border_width, &j );
	      else {
	  		if ((wmhints = XGetWMHints(dpy, window))) {
	  			if ((wmhints->flags&StateHint) &&
	***************
	*** 368,381
	          XGetGeometry( dpy, window, &jW, &x, &y, &w, &h, &border_width, &j );
	      }
	      else {
	! 	if ((wmhints = XGetWMHints(dpy, window)) &&
	! 	    (wmhints->flags&StateHint) &&
	! 	    (wmhints->initial_state == IconicState)) {
	! 	    /* window will remain created size -- no rubberbanding */
	! 	    /* note that Iconify only uses its first argument */
	! 	    Iconify(window, 0, 0, 0, 0);
	! 	    return;
	! 	}
	  
	  	sizehints.flags = 0; 
	  
	
	--- 428,457 -----
	      if (XGetTransientForHint( dpy, window, &transient_for ))
	          XGetGeometry( dpy, window, &jW, &x, &y, &w, &h, &border_width, &j );
	      else {
	! 		if ((wmhints = XGetWMHints(dpy, window))) {
	! 			if ((wmhints->flags&StateHint) &&
	! 	      	  (wmhints->initial_state == IconicState))
	! 			{
	! 	    	 	/* window will remain created size -- no rubberbanding */
	! 	     		/* note that Iconify only uses its first argument */
	! 				XFree(wmhints);
	! 	    		Iconify(window, 0, 0, 0, 0);
	! 	    		return;
	! 			}
	! 			XFree(wmhints);
	! 		}
	! 		if (Titles) {
	! 			if ((dat = GetTitleInfo(window)) == NULL) {
	! 				AddTitle(window, False);
	! 				dat = GetTitleInfo(window);
	! 				if (!dat)
	! 					Error("uwm: Can't get info for new title!");
	! 			}
	! 			else {
	! 				window = dat->parent;
	! 			}
	! 		}
	! 		sizehints.flags = 0; 
	  
	      	XGetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS);
	  		CheckConsistency(&sizehints);
	***************
	*** 377,383
	  	    return;
	  	}
	  
	! 	sizehints.flags = 0; 
	  
	          XGetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS);
	  	CheckConsistency(&sizehints);
	
	--- 453,464 -----
	  		}
	  		sizehints.flags = 0; 
	  
	!     	XGetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS);
	! 		CheckConsistency(&sizehints);
	! 		AskUser(dpy, scr, window, &x, &y, &w, &h, &sizehints);
	! 		if (x != sizehints.x || y != sizehints.y || w != sizehints.width ||
	! 		  h != sizehints.height)
	! 			configureit = True;
	  
	  		sizehints.flags |= (USPosition | USSize);
	  		sizehints.x = x;
	***************
	*** 379,390
	  
	  	sizehints.flags = 0; 
	  
	!         XGetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS);
	! 	CheckConsistency(&sizehints);
	! 	AskUser(dpy, scr, window, &x, &y, &w, &h, &sizehints);
	! 	if (x != sizehints.x || y != sizehints.y ||
	! 	    w != sizehints.width || h != sizehints.height)
	! 	  configureit = True;
	  
	  	sizehints.flags |= (USPosition | USSize);
	  	sizehints.x = x;
	
	--- 460,474 -----
	  		  h != sizehints.height)
	  			configureit = True;
	  
	! 		sizehints.flags |= (USPosition | USSize);
	! 		sizehints.x = x;
	! 		sizehints.y = y;
	! 		sizehints.width = w;
	! 		sizehints.height = h;
	! 		XSetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS);
	! 		if (dat)
	! 			XSetSizeHints(dpy, dat->parent, &sizehints, XA_WM_NORMAL_HINTS);
	! 	}
	  
	  	if (x < 0 || y < 0) {
	  		if (transient_for == None) /* need the border width */
	***************
	*** 386,398
	  	    w != sizehints.width || h != sizehints.height)
	  	  configureit = True;
	  
	! 	sizehints.flags |= (USPosition | USSize);
	! 	sizehints.x = x;
	! 	sizehints.y = y;
	! 	sizehints.width = w;
	! 	sizehints.height = h;
	! 	XSetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS);
	!     }
	  
	      if (x<0 || y<0) {
	        if (transient_for == None) /* need the border width */
	
	--- 470,478 -----
	  			XSetSizeHints(dpy, dat->parent, &sizehints, XA_WM_NORMAL_HINTS);
	  	}
	  
	! 	if (x < 0 || y < 0) {
	! 		if (transient_for == None) /* need the border width */
	! 			XGetGeometry(dpy, window, &jW, &j, &j, &j, &j, &border_width, &j);
	  
	        if (x<0) x += DisplayWidth(dpy, scr) - w - (border_width<<1);
	        if (y<0) y += DisplayHeight(dpy, scr) - h - (border_width<<1);
	***************
	*** 394,403
	  	XSetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS);
	      }
	  
	-     if (x<0 || y<0) {
	-       if (transient_for == None) /* need the border width */
	- 	  XGetGeometry( dpy, window, &jW, &j, &j, &j, &j, &border_width, &j );
	- 
	        if (x<0) x += DisplayWidth(dpy, scr) - w - (border_width<<1);
	        if (y<0) y += DisplayHeight(dpy, scr) - h - (border_width<<1);
	  
	
	--- 474,479 -----
	  		if (transient_for == None) /* need the border width */
	  			XGetGeometry(dpy, window, &jW, &j, &j, &j, &j, &border_width, &j);
	  
	        if (x<0) x += DisplayWidth(dpy, scr) - w - (border_width<<1);
	        if (y<0) y += DisplayHeight(dpy, scr) - h - (border_width<<1);
	  
	***************
	*** 403,413
	  
	        configureit = True;
	      }
	! 
	!     if (configureit)
	!       XMoveResizeWindow(dpy, window, x, y, w, h);
	! 
	!     XMapRaised(dpy, window);
	  }
	  
	  Configure(event)
	
	--- 479,495 -----
	  
	        configureit = True;
	      }
	!     if (configureit) {
	! 		if (dat != NULL)
	! 			ConfigureTitle(dat, x, y, w, h);
	! 		else
	! 			XMoveResizeWindow(dpy, window, x, y, w, h);
	! 	}
	! 	if (!dat)
	!     	XMapRaised(dpy, window);
	! 	else
	! 		XMapRaised(dpy, dat->parent);
	! 	XSelectInput(dpy, window, (EnterWindowMask | LeaveWindowMask));
	  }
	  
	  Configure(event)
	***************
	*** 413,427
	  Configure(event)
	  XConfigureRequestEvent *event;
	  {
	!   XWindowChanges values;
	!   
	!   values.x = event->x;
	!   values.y = event->y;
	!   values.width = event->width;
	!   values.height = event->height;
	!   values.border_width = event->border_width;
	!   values.stack_mode = event->detail;
	!   values.sibling = event->above;
	  
	    XConfigureWindow(event->display, event->window, event->value_mask, &values);
	  }
	
	--- 495,502 -----
	  Configure(event)
	  XConfigureRequestEvent *event;
	  {
	! 	XWindowChanges values;
	! 	TitleData *dat;
	  
	  	values.x = event->x;
	  	values.y = event->y;
	***************
	*** 423,429
	    values.stack_mode = event->detail;
	    values.sibling = event->above;
	  
	!   XConfigureWindow(event->display, event->window, event->value_mask, &values);
	  }
	  
	  Circulate(event)
	
	--- 498,512 -----
	  	XWindowChanges values;
	  	TitleData *dat;
	  
	! 	values.x = event->x;
	! 	values.y = event->y;
	! 	values.width = event->width;
	! 	values.height = event->height;
	! 	values.border_width = event->border_width;
	! 	values.stack_mode = event->detail;
	! 	values.sibling = event->above;
	! 
	! 	XConfigureWindow(event->display, event->window, event->value_mask, &values);
	  }
	  
	  Circulate(event)
	***************
	*** 434,437
	    else
	     XLowerWindow(event->display, event->window);
	  }
	- 
	
	--- 517,519 -----
	    else
	     XLowerWindow(event->display, event->window);
	  }
	*** uwm.new/Imakefile	Mon Dec  7 00:59:32 1987
	--- uwm.new/Imakefile	Sat Dec 12 19:23:34 1987
	***************
	*** 1,4
	! LOCAL_LIBRARIES = $(XLIB)
	    SYS_LIBRARIES = -ll
	  OTHERSRCS = gram.y lex.l
	  YFLAGS = -d
	
	--- 1,4 -----
	! LOCAL_LIBRARIES = $(XLIB) $(XRM)
	    SYS_LIBRARIES = -ll
	  OTHERSRCS = gram.y lex.l
	  YFLAGS = -d
	***************
	*** 7,13
	  	Cursors.c Focus.c GetButton.c  GridBox.c Iconify.c Icons.c Lower.c\
	  	Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
	  	Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
	! 	StoreZap.c XError.c uwm.c
	  
	  OBJS=	gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	
	--- 7,13 -----
	  	Cursors.c Focus.c GetButton.c  GridBox.c Iconify.c Icons.c Lower.c\
	  	Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
	  	Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
	! 	StoreZap.c XError.c uwm.c FocusChange.c TitleBar.c
	  
	  OBJS=	gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	***************
	*** 13,19
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	  	Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
	  	Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
	! 	StoreZap.o XError.o uwm.o
	  
	  ComplexProgramTarget(uwm)
	  
	
	--- 13,19 -----
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	  	Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
	  	Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
	! 	StoreZap.o XError.o uwm.o FocusChange.o TitleBar.o
	  
	  ComplexProgramTarget(uwm)
	  
	*** uwm.new/Makefile	Mon Dec  7 00:59:33 1987
	--- uwm.new/Makefile	Sat Dec 12 19:23:49 1987
	***************
	*** 5,11
	  # Ignore this message if you are not using imake.
	  #
	  
	!             TOP = ./../..
	               AS = as
	               CC = cc
	              CPP = /lib/cpp
	
	--- 5,11 -----
	  # Ignore this message if you are not using imake.
	  #
	  
	!             TOP = /usr/src/X.V11R1
	               AS = as
	               CC = cc
	              CPP = /lib/cpp
	***************
	*** 67,73
	           RM_CMD = rm -f *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
	  			tags TAGS make.log
	  
	! LOCAL_LIBRARIES = $(XLIB)
	    SYS_LIBRARIES = -ll
	  OTHERSRCS = gram.y lex.l
	  YFLAGS = -d
	
	--- 67,73 -----
	           RM_CMD = rm -f *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
	  			tags TAGS make.log
	  
	! LOCAL_LIBRARIES = $(XLIB) $(XRM)
	    SYS_LIBRARIES = -ll
	  OTHERSRCS = gram.y lex.l
	  YFLAGS = -d
	***************
	*** 76,82
	  	Cursors.c Focus.c GetButton.c  GridBox.c Iconify.c Icons.c Lower.c\
	  	Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
	  	Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
	! 	StoreZap.c XError.c uwm.c
	  
	  OBJS=	gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	
	--- 76,82 -----
	  	Cursors.c Focus.c GetButton.c  GridBox.c Iconify.c Icons.c Lower.c\
	  	Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
	  	Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
	! 	StoreZap.c XError.c uwm.c FocusChange.c TitleBar.c
	  
	  OBJS=	gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	***************
	*** 82,88
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	  	Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
	  	Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
	! 	StoreZap.o XError.o uwm.o
	  
	          PROGRAM = uwm
	  
	
	--- 82,88 -----
	  	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
	  	Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
	  	Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
	! 	StoreZap.o XError.o uwm.o FocusChange.o TitleBar.o
	  
	          PROGRAM = uwm
	  
	***************
	*** 132,223
	  
	  Makefiles::
	  
	- # DO NOT DELETE
	- 
	- globals.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- globals.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- globals.o: /usr/include/sys/types.h ./../../X11/X.h
	- Beep.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Beep.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Beep.o: /usr/include/sys/types.h ./../../X11/X.h
	- Bindings.o: ./../../X11/copyright.h
	- CircleDown.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- CircleDown.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- CircleDown.o: /usr/include/sys/types.h ./../../X11/X.h
	- CircleUp.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- CircleUp.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- CircleUp.o: /usr/include/sys/types.h ./../../X11/X.h
	- Cursors.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Cursors.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Cursors.o: /usr/include/sys/types.h ./../../X11/X.h ./../../X11/cursorfont.h
	- Focus.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Focus.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Focus.o: /usr/include/sys/types.h ./../../X11/X.h
	- GetButton.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- GetButton.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- GetButton.o: /usr/include/sys/types.h ./../../X11/X.h ./../../X11/Xutil.h
	- GetButton.o: ./../../X11/Xatom.h
	- GridBox.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- GridBox.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- GridBox.o: /usr/include/sys/types.h ./../../X11/X.h
	- Iconify.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Iconify.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Iconify.o: /usr/include/sys/types.h ./../../X11/X.h
	- Icons.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Icons.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Icons.o: /usr/include/sys/types.h ./../../X11/X.h ./../../X11/Xutil.h
	- Icons.o: ./../../X11/Xatom.h
	- Lower.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Lower.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Lower.o: /usr/include/sys/types.h ./../../X11/X.h
	- Menu.o: ./../../X11/copyright.h /usr/include/signal.h uwm.h
	- Menu.o: /usr/include/errno.h /usr/include/stdio.h /usr/include/strings.h
	- Menu.o: ./../../X11/Xlib.h /usr/include/sys/types.h ./../../X11/X.h
	- Move.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Move.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Move.o: /usr/include/sys/types.h ./../../X11/X.h
	- MoveOpaque.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- MoveOpaque.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- MoveOpaque.o: /usr/include/sys/types.h ./../../X11/X.h
	- NewIconify.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- NewIconify.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- NewIconify.o: /usr/include/sys/types.h ./../../X11/X.h
	- Pause.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Pause.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Pause.o: /usr/include/sys/types.h ./../../X11/X.h
	- Push.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Push.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Push.o: /usr/include/sys/types.h ./../../X11/X.h
	- Error.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Error.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Error.o: /usr/include/sys/types.h ./../../X11/X.h
	- Raise.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Raise.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Raise.o: /usr/include/sys/types.h ./../../X11/X.h
	- Refresh.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Refresh.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Refresh.o: /usr/include/sys/types.h ./../../X11/X.h
	- Resize.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Resize.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Resize.o: /usr/include/sys/types.h ./../../X11/X.h ./../../X11/Xutil.h
	- Resize.o: ./../../X11/Xatom.h
	- Restart.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- Restart.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- Restart.o: /usr/include/sys/types.h ./../../X11/X.h
	- RubberBand.o: ./../../X11/copyright.h /usr/include/stdio.h
	- RubberBand.o: /usr/include/strings.h ./../../X11/Xlib.h
	- RubberBand.o: /usr/include/sys/types.h ./../../X11/X.h ./../../X11/Xutil.h
	- RubberBand.o: ./../../X11/cursorfont.h uwm.h /usr/include/errno.h
	- StoreBox.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- StoreBox.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- StoreBox.o: /usr/include/sys/types.h ./../../X11/X.h
	- StoreZap.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- StoreZap.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- StoreZap.o: /usr/include/sys/types.h ./../../X11/X.h
	- XError.o: ./../../X11/copyright.h uwm.h /usr/include/errno.h
	- XError.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- XError.o: /usr/include/sys/types.h ./../../X11/X.h
	- uwm.o: ./../../X11/copyright.h /usr/include/sys/time.h
	- uwm.o: /usr/include/sys/time.h uwm.h /usr/include/errno.h
	- uwm.o: /usr/include/stdio.h /usr/include/strings.h ./../../X11/Xlib.h
	- uwm.o: /usr/include/sys/types.h ./../../X11/X.h /usr/include/fcntl.h
	
	--- 132,134 -----
	  
	  Makefiles::
	  
	*** uwm.new/Menu.c	Mon Dec  7 00:59:33 1987
	--- uwm.new/Menu.c	Sat Dec 12 09:52:38 1987
	***************
	*** 93,98
	  	return(status);
	  }
	  
	  Bool Menu(window, mask, button, x, y, menu)
	  Window window;				/* Event window. */
	  int mask;				/* Button/key mask. */
	
	--- 93,105 -----
	  	return(status);
	  }
	  
	+ /*
	+  * Hack variable to prevent autoraise of neighboring windows during menu op.
	+  * Set in MapMenu and UnmapMenu. Also used by GetButton to prevent autoraise
	+  * during configure/map ops.
	+  */
	+ Bool Snatched;
	+ 
	  Bool Menu(window, mask, button, x, y, menu)
	  Window window;				/* Event window. */
	  int mask;				/* Button/key mask. */
	***************
	*** 317,322
	  		             return(func_stat);
	  		             break;
	  
	  		         default:
	   		            Error("Menu -> Internal type error.");
	  		     }
	
	--- 324,334 -----
	  		             return(func_stat);
	  		             break;
	  
	+ 				 case IsVar:
	+ 					*(ml->text) = *ml->aux;
	+ 					UnmapMenu(menu);
	+ 					break;
	+ 
	  		         default:
	   		            Error("Menu -> Internal type error.");
	  		     }
	***************
	*** 461,466
	       * Map the window and draw the text items.
	       */
	      XMapWindow(dpy, w);
	      DisplayLine(w, 0, menu->width, menu->iheight, menu->name,
	                  menu->bg.pixel, menu->fg.pixel, 0);
	  
	
	--- 473,479 -----
	       * Map the window and draw the text items.
	       */
	      XMapWindow(dpy, w);
	+ 	Snatched = True;
	      DisplayLine(w, 0, menu->width, menu->iheight, menu->name,
	                  menu->bg.pixel, menu->fg.pixel, 0);
	  
	***************
	*** 501,506
	       * Unmap and flush.
	       */
	      XUnmapWindow(dpy, menu->w);
	      XFlush(dpy);
	  }
	  
	
	--- 514,520 -----
	       * Unmap and flush.
	       */
	      XUnmapWindow(dpy, menu->w);
	+ 	Snatched = False;
	      XFlush(dpy);
	  }
	  
	*** uwm.new/Resize.c	Mon Dec  7 00:59:36 1987
	--- uwm.new/Resize.c	Sat Dec 12 18:48:50 1987
	***************
	*** 1,5
	  #ifndef lint
	! static char *rcsid_Resize_c = "$Header: Resize.c,v 1.18 87/09/09 12:01:04 swick Exp $";
	  #endif	lint
	  
	  #include <X11/copyright.h>
	
	--- 1,5 -----
	  #ifndef lint
	!      static char *rcsid_Resize_c = "$Header: Resize.c,v 1.18 87/09/09 12:01:04 swick Exp $";
	  #endif	lint
	  
	  #include <X11/copyright.h>
	***************
	*** 35,40
	   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
	   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
	   *        Convert to X11
	   */
	  
	  #ifndef lint
	
	--- 35,43 -----
	   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
	   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
	   *        Convert to X11
	+  * 002 -- Jordan Hubbard, U.C. berkeley.
	+  *		  Added alternate placement of resize window, code for title bar
	+  * 		  support.
	   */
	  
	  #ifndef lint
	***************
	*** 49,54
	  #define min(a,b) ( (a) > (b) ? (b) : (a) )
	  #define makemult(a, b) ((b==1) ? (a) : (((int)((a) / (b))) * (b)) )
	  
	  Bool Resize(window, mask, button, x0, y0)
	  Window window;                          /* Event window. */
	  int mask;                               /* Button/key mask. */
	
	--- 52,59 -----
	  #define min(a,b) ( (a) > (b) ? (b) : (a) )
	  #define makemult(a, b) ((b==1) ? (a) : (((int)((a) / (b))) * (b)) )
	  
	+ extern Bool Snatched;
	+ 
	  Bool Resize(window, mask, button, x0, y0)
	  Window window;                          /* Event window. */
	  int mask;                               /* Button/key mask. */
	***************
	*** 55,85
	  int button;                             /* Button event detail. */
	  int x0, y0;                             /* Event mouse position. */
	  {
	!     XWindowAttributes window_info;	/* Event window info. */
	!     int x1, y1;                         /* fixed box corner   */
	!     int x2, y2;                         /* moving box corner   */
	!     int x, y;
	!     int xinc, yinc;
	!     int minwidth, minheight;
	!     int maxwidth, maxheight;
	!     int defwidth, defheight;
	!     int ox, oy;				/* which quadrant of window */
	!     int pop_x, pop_y;			/* location of pop window */
	!     int hsize, vsize;			/* dynamic size */
	!     int delta;				
	!     int root_x, root_y;			/* root window coordinates */
	!     int ptrmask;			/* pointer status word */
	!     int num_vectors;			/* Number of vectors to XDraw. */
	!     Window assoc;			/* Window represented by the icon. */
	!     Window sub_win;			/* Mouse query sub window. */
	!     Window root;			/* Root query window. */
	!     XEvent button_event;		/* Button event packet. */
	!     XSegment box[MAX_BOX_VECTORS];	/* Box drawing vertex buffer. */
	!     XSegment zap[MAX_ZAP_VECTORS];	/* Zap drawing vertex buffer. */
	!     Bool stop;				/* Should the window stop changing? */
	!     XSizeHints sizehints;
	!     XWindowChanges values;
	!     int width_offset, height_offset;	/* to subtract if resize increments */
	  
	      /*
	       * Do nothing if the event window is the root window.
	
	--- 60,136 -----
	  int button;                             /* Button event detail. */
	  int x0, y0;                             /* Event mouse position. */
	  {
	!      XWindowAttributes window_info;	/* Event window info. */
	!      int x1, y1;                         /* fixed box corner   */
	!      int x2, y2;                         /* moving box corner   */
	!      int x, y;
	! 	 int dx;
	!      int xinc, yinc;
	!      int minwidth, minheight;
	!      int maxwidth, maxheight;
	!      int defwidth, defheight;
	!      int ox, oy;				/* which quadrant of window */
	!      int pop_x, pop_y;			/* location of pop window */
	!      int hsize, vsize;			/* dynamic size */
	!      int delta;				
	!      int root_x, root_y;			/* root window coordinates */
	!      int ptrmask;			/* pointer status word */
	!      int num_vectors;			/* Number of vectors to XDraw. */
	!      Window assoc;			/* Window represented by the icon. */
	!      Window sub_win;			/* Mouse query sub window. */
	!      Window root;			/* Root query window. */
	!      XEvent button_event;		/* Button event packet. */
	!      XSegment box[MAX_BOX_VECTORS];	/* Box drawing vertex buffer. */
	!      XSegment zap[MAX_ZAP_VECTORS];	/* Zap drawing vertex buffer. */
	!      Bool stop;				/* Should the window stop changing? */
	!      XSizeHints sizehints;
	!      XWindowChanges values;
	!      int width_offset, height_offset;	/* to subtract if resize increments */
	!      TitleData *dat;
	!      
	!      /*
	!       * Do nothing if the event window is the root window.
	!       */
	!      if (window == RootWindow(dpy, scr))
	! 	  return(FALSE);
	!      
	!      /*
	!       * Gather info about the event window.
	!       */
	!      status = XGetWindowAttributes(dpy, window, &window_info);
	!      if (status == FAILURE) return(FALSE);
	!      
	!      /*
	!       * Do not resize an icon window (NULL for assoc means don't create too). 
	!       */
	!      if (IsIcon(window, x, y, FALSE, NULL))
	! 	  return(FALSE);
	!      
	!      /*
	!       * Clear the vector buffers.
	!       */
	!      bzero(box, sizeof(box));
	!      if (Zap) bzero(zap, sizeof(zap));
	!      
	!      /*
	!       * If we are here then we have a resize operation in progress.
	!       */
	!      
	!      /*
	!       * Turn on the resize cursor.
	!       */
	!      XChangeActivePointerGrab(dpy, EVENTMASK, ArrowCrossCursor, CurrentTime);
	!      
	!      /*
	!       * calculate fixed point (x1, y1) and varying point (x2, y2).
	!       */
	!      
	!      hsize = defwidth = window_info.width; 
	!      vsize = defheight = window_info.height;
	!      x1 = window_info.x;
	!      y1 = window_info.y;
	! 	 if ((dat = GetTitleInfo(window)) != NULL) { /* compensate for title bar */
	! 		XWindowAttributes xwa;
	  
	  		XGetWindowAttributes(dpy, dat->title, &xwa);
	  		dx = xwa.height + 2;
	***************
	*** 81,382
	      XWindowChanges values;
	      int width_offset, height_offset;	/* to subtract if resize increments */
	  
	!     /*
	!      * Do nothing if the event window is the root window.
	!      */
	!     if (window == RootWindow(dpy, scr))
	!         return(FALSE);
	! 
	!     /*
	!      * Gather info about the event window.
	!      */
	!     status = XGetWindowAttributes(dpy, window, &window_info);
	!     if (status == FAILURE) return(FALSE);
	! 
	!     /*
	!      * Do not resize an icon window (NULL for assoc means don't create too). 
	!      */
	!     if (IsIcon(window, x, y, FALSE, NULL))
	!         return(FALSE);
	! 
	!     /*
	!      * Clear the vector buffers.
	!      */
	!     bzero(box, sizeof(box));
	!     if (Zap) bzero(zap, sizeof(zap));
	! 
	!     /*
	!      * If we are here then we have a resize operation in progress.
	!      */
	! 
	!     /*
	!      * Turn on the resize cursor.
	!      */
	!     XChangeActivePointerGrab(dpy, EVENTMASK, ArrowCrossCursor, CurrentTime);
	! 
	!     /*
	!      * calculate fixed point (x1, y1) and varying point (x2, y2).
	!      */
	! 
	!     hsize = defwidth = window_info.width; 
	!     vsize = defheight = window_info.height;
	!     x1 = window_info.x;
	!     y1 = window_info.y;
	!     x2 = x1 + hsize;
	!     y2 = y1 + vsize;
	! 
	!     /*
	!      * Get the event window resize hint.
	!      */
	!     sizehints.flags = 0;
	!     XGetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS); 
	!     CheckConsistency(&sizehints);
	! 
	!     /* until there are better WM_HINTS, we'll assume that the client's
	!      * minimum width and height are the appropriate offsets to subtract
	!      * when resizing with an explicit resize increment.
	!      */
	!     if (sizehints.flags&PMinSize && sizehints.flags&PResizeInc) {
	!         width_offset = sizehints.min_width;
	!         height_offset = sizehints.min_height;
	!     } else
	!         width_offset = height_offset = 0;
	! 
	!     /*
	!      * decide what resize mode we are in. Always rubberband if window
	!      * is too small.
	!      */
	!     if (window_info.width > 2 && window_info.height > 2) {
	!       ox = ((x0 - window_info.x) * 3) / window_info.width;
	!       oy = ((y0 - window_info.y) * 3) / window_info.height;
	!       if ((ox + oy) & 1) {
	! 	if (ox & 1) {
	! 	    /* fix up size hints so that we will never change width */
	! 	    sizehints.min_width = sizehints.max_width = window_info.width;
	! 	    if ((sizehints.flags&PMinSize) == 0) {
	! 	      sizehints.min_height = 0;
	! 	      sizehints.flags |= PMinSize;
	! 	    }
	! 	    if ((sizehints.flags&PMaxSize) == 0) {
	! 	      sizehints.max_height = DisplayHeight(dpy, scr);
	! 	      sizehints.flags |= PMaxSize;
	! 	    }
	! 	}
	! 	if (oy & 1) {
	! 	    /* fix up size hints so that we will never change height */
	! 	    sizehints.min_height = sizehints.max_height = window_info.height;
	! 	    if ((sizehints.flags&PMinSize)==0) {
	! 	      sizehints.min_width = 0;
	! 	      sizehints.flags |= PMinSize;
	! 	    }
	! 	    if ((sizehints.flags&PMaxSize)==0) {
	! 	      sizehints.max_width = DisplayWidth(dpy, scr);
	! 	      sizehints.flags |= PMaxSize;
	! 	    }
	! 	}
	!       }
	!     }
	!     else ox = oy = 2;
	! 
	!     /* change fixed point to one that shouldn't move */
	!     if (oy == 0) { 
	! 	y = y1; y1 = y2; y2 = y;
	!     }
	!     if (ox == 0) { 
	! 	x = x1; x1 = x2; x2 = x;
	!     }
	! 
	! 
	!     if (sizehints.flags&PMinSize) {
	!         minwidth = sizehints.min_width;
	!         minheight = sizehints.min_height;
	!     } else {
	!         minwidth = 0;
	!         minheight = 0;
	!     }
	!     if (sizehints.flags&PMaxSize) {
	!         maxwidth = max(sizehints.max_width, minwidth);
	!         maxheight = max(sizehints.max_height, minheight);
	!     } else {
	!         maxwidth = DisplayWidth(dpy, scr);
	!         maxheight = DisplayHeight(dpy, scr);
	!     }
	!     if (sizehints.flags&PResizeInc) {
	!         xinc = sizehints.width_inc;
	!         yinc = sizehints.height_inc;
	!     } else {
	!         xinc = 1;
	!         yinc = 1;
	!     }
	! 
	!     switch (ox) {
	!         case 0: pop_x = x1 - PWidth; break;
	!         case 1: pop_x = x1 + (hsize-PWidth)/2; break;
	!         case 2: pop_x = x1; break;
	!     }
	!     switch (oy) {
	!         case 0: pop_y = y1 - PHeight; break;
	!         case 1: pop_y = y1 + (vsize-PHeight)/2; break;
	!         case 2: pop_y = y1; break;
	!      }
	!     values.x = pop_x;
	!     values.y = pop_y;
	!     values.stack_mode = Above;
	!     XConfigureWindow(dpy, Pop, CWX|CWY|CWStackMode, &values);
	!     XMapWindow(dpy, Pop);
	! 
	!     if (Grid) {
	!     	num_vectors = StoreGridBox(
	! 	    box,
	! 	    MIN(x1, x2), MIN(y1, y2),
	! 	    MAX(x1, x2), MAX(y1, y2)
	! 	);
	!     }
	!     else {
	!     	num_vectors = StoreBox(
	! 	    box,
	! 	    MIN(x1, x2), MIN(y1, y2),
	! 	    MAX(x1, x2), MAX(y1, y2)
	! 	);
	!     }
	! 
	!     /*
	!      * If we freeze the server, then we will draw solid
	!      * lines instead of flickering ones during resizing.
	!      */
	!     if (Freeze) XGrabServer(dpy);
	! 
	!     /*
	!      * Process any pending exposure events before drawing the box.
	!      */
	!     while (QLength(dpy) > 0) {
	!         XPeekEvent(dpy, &button_event);
	!         if (((XAnyEvent *)&button_event)->window == RootWindow(dpy, scr))
	!             break;
	!         GetButton(&button_event);
	!     }
	! 
	!     /*
	!      * Now draw the box.
	!      */
	!     DrawBox();
	!     Frozen = window;
	! 
	!     stop = FALSE;
	!     x = -1; y = -1;
	! 
	!     while (!stop) {
	! 	if (x != x2 || y != y2) {
	! 	
	! 	    x = x2; y = y2;
	! 	    
	!             /*
	!              * If we've frozen the server, then erase
	!              * the old box.
	!              */
	!             if (Freeze)
	!                 DrawBox();
	! 
	! 	    if (Grid) {
	! 	    	num_vectors = StoreGridBox(
	! 		    box,
	! 		    MIN(x1, x), MIN(y1, y),
	! 		    MAX(x1, x), MAX(y1, y)
	! 		);
	! 	    }
	! 	    else {
	! 	    	num_vectors = StoreBox(
	! 		    box,
	! 		    MIN(x1, x), MIN(y1, y),
	! 		    MAX(x1, x), MAX(y1, y)
	! 		);
	! 	    }
	! 
	!             if (Freeze)
	!                 DrawBox();
	! 
	! 	    {
	! 	        int Hsize = (hsize - width_offset) / xinc;
	! 		int Vsize = (vsize - height_offset) / yinc;
	! 		int pos = 4;
	! 
	! 		PText[0] = (Hsize>99) ? (Hsize / 100 + '0')	  : ' ';
	! 		PText[1] = (Hsize>9)  ? ((Hsize / 10) % 10 + '0') : ' ';
	! 		PText[2] = Hsize % 10 + '0';
	! 		if (Vsize>99) PText[pos++] = Vsize / 100 + '0';
	! 		if (Vsize>9)  PText[pos++] = (Vsize / 10) % 10 + '0';
	! 		PText[pos++] = Vsize % 10 + '0';
	! 		while (pos<7) PText[pos++] = ' ';
	! 	    }
	! 
	! 	    /*
	! 	     * If the font is not fixed width we have to
	! 	     * clear the window to guarantee that the characters
	! 	     * that were there before are erased.
	! 	     */
	! 	    if (!(PFontInfo->per_char)) XClearWindow(dpy, Pop);
	! 	    XDrawImageString(
	! 	        dpy, Pop, PopGC,
	! 	        PPadding, PPadding+PFontInfo->ascent,
	! 	        PText, PTextSize);
	! 	}
	! 
	!         if (!Freeze) {
	!             DrawBox();
	!             DrawBox();
	!         }
	! 
	! 	if (XPending(dpy) && GetButton(&button_event)) {
	! 
	!             if ((button_event.type != ButtonPress) && 
	! 	        (button_event.type != ButtonRelease)) {
	!                 continue; /* spurious menu event... */
	!             }
	! 
	!             if (Freeze) {
	!                 DrawBox();
	!                 Frozen = (Window)0;
	!                 XUngrabServer(dpy);
	!             }
	! 
	! 	    if ((button_event.type == ButtonRelease) &&
	!                 (((XButtonReleasedEvent *)&button_event)->button == button)){
	! 		x2 = ((XButtonReleasedEvent *)&button_event)->x;
	! 		y2 = ((XButtonReleasedEvent *)&button_event)->y;
	! 		stop = TRUE;
	! 	    }
	! 	    else {
	! 		XUnmapWindow(dpy, Pop);
	! 		ResetCursor(button);
	! 		return(TRUE);
	! 	    }
	! 	}
	! 	else {
	! 	    XQueryPointer(dpy, RootWindow(dpy, scr), &root, 
	! 	    		&sub_win, &root_x, &root_y, &x2, &y2, &ptrmask);
	! 	}
	! 
	! 
	! 	hsize = max(min(abs (x2 - x1), maxwidth), minwidth);
	! 	hsize = makemult(hsize-minwidth, xinc)+minwidth;
	!  
	! 	vsize = max(min(abs(y2 - y1), maxheight), minheight);
	! 	vsize = makemult(vsize-minheight, yinc)+minheight; 
	! 
	! 	if (sizehints.flags & PAspect) {
	!             if ((hsize * sizehints.max_aspect.y > 
	! 	          vsize * sizehints.max_aspect.x)) {
	! 	       delta = makemult( 
	! 			 (hsize*sizehints.max_aspect.y /
	! 		         sizehints.max_aspect.x)
	! 			  - vsize, 
	! 		       yinc); 
	! 	       if ((vsize+delta <= maxheight))  vsize += delta;
	! 	       else {
	! 	         delta = makemult(hsize - 
	! 		     (sizehints.max_aspect.x * vsize/sizehints.max_aspect.y), 
	! 		     xinc);
	! 		 if (hsize-delta >= minwidth) hsize -= delta; 
	  	       }
	              }  
	              if (hsize * sizehints.min_aspect.y < vsize * 
	
	--- 132,316 -----
	  	 if ((dat = GetTitleInfo(window)) != NULL) { /* compensate for title bar */
	  		XWindowAttributes xwa;
	  
	! 		XGetWindowAttributes(dpy, dat->title, &xwa);
	! 		dx = xwa.height + 2;
	! 		y1 += dx;
	! 	 }
	! 	 else
	! 		dx = 0;
	!      x2 = x1 + hsize;
	!      y2 = y1 + vsize;
	! 	 y2 -= dx;
	!      /*
	!       * Get the event window resize hint.
	!       */
	!      sizehints.flags = 0;
	!      XGetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS); 
	!      CheckConsistency(&sizehints);
	!      
	!      /* until there are better WM_HINTS, we'll assume that the client's
	!       * minimum width and height are the appropriate offsets to subtract
	!       * when resizing with an explicit resize increment.
	!       */
	!      if (sizehints.flags&PMinSize && sizehints.flags&PResizeInc) {
	! 	  width_offset = sizehints.min_width;
	! 	  height_offset = sizehints.min_height;
	!      } else
	! 	  width_offset = height_offset = 0;
	!      
	!      /*
	!       * decide what resize mode we are in. Always rubberband if window
	!       * is too small.
	!       */
	!      if (window_info.width > 2 && window_info.height > 2) {
	! 	  ox = ((x0 - window_info.x) * 3) / window_info.width;
	! 	  oy = ((y0 - window_info.y) * 3) / window_info.height;
	! 	  if ((ox + oy) & 1) {
	! 	       if (ox & 1) {
	! 		    /* fix up size hints so that we will never change width */
	! 		    sizehints.min_width = sizehints.max_width = window_info.width;
	! 		    if ((sizehints.flags&PMinSize) == 0) {
	! 			 sizehints.min_height = 0;
	! 			 sizehints.flags |= PMinSize;
	! 		    }
	! 		    if ((sizehints.flags&PMaxSize) == 0) {
	! 			 sizehints.max_height = DisplayHeight(dpy, scr);
	! 			 sizehints.flags |= PMaxSize;
	! 		    }
	! 	       }
	! 	       if (oy & 1) {
	! 		    /* fix up size hints so that we will never change height */
	! 		    sizehints.min_height = sizehints.max_height = window_info.height;
	! 		    if ((sizehints.flags&PMinSize)==0) {
	! 			 sizehints.min_width = 0;
	! 			 sizehints.flags |= PMinSize;
	! 		    }
	! 		    if ((sizehints.flags&PMaxSize)==0) {
	! 			 sizehints.max_width = DisplayWidth(dpy, scr);
	! 			 sizehints.flags |= PMaxSize;
	! 		    }
	! 	       }
	! 	  }
	!      }
	!      else ox = oy = 2;
	!      
	!      /* change fixed point to one that shouldn't move */
	!      if (oy == 0) { 
	! 	  y = y1; y1 = y2; y2 = y;
	!      }
	!      if (ox == 0) { 
	! 	  x = x1; x1 = x2; x2 = x;
	!      }
	!      
	!      
	!      if (sizehints.flags&PMinSize) {
	! 	  minwidth = sizehints.min_width;
	! 	  minheight = sizehints.min_height;
	!      } else {
	! 	  minwidth = 0;
	! 	  minheight = 0;
	!      }
	!      if (sizehints.flags&PMaxSize) {
	! 	  maxwidth = max(sizehints.max_width, minwidth);
	! 	  maxheight = max(sizehints.max_height, minheight);
	!      } else {
	! 	  maxwidth = DisplayWidth(dpy, scr);
	! 	  maxheight = DisplayHeight(dpy, scr);
	!      }
	!      if (sizehints.flags&PResizeInc) {
	! 	  xinc = sizehints.width_inc;
	! 	  yinc = sizehints.height_inc;
	!      } else {
	! 	  xinc = 1;
	! 	  yinc = 1;
	!      }
	!      
	!      switch (ox) {
	!      case 0: pop_x = x1 - PWidth; break;
	!      case 1: pop_x = x1 + (hsize-PWidth)/2; break;
	!      case 2: pop_x = x1; break;
	!      }
	!      switch (oy) {
	!      case 0: pop_y = y1 - PHeight; break;
	!      case 1: pop_y = y1 + (vsize-PHeight)/2; break;
	!      case 2: pop_y = y1; break;
	!      }
	!      /*
	!       * Double expose on the target window is too expensive for some reason
	!       * or another. Paint the popup window in the upper left hand
	!       * corner of the screen if ResizeObscure is FALSE. Consistent with the map
	!       * request popup.
	!       */
	!      if (RootResizeBox == TRUE)
	! 	  values.x = values.y = 0;
	!      else {
	! 	  values.x = pop_x;
	! 	  values.y = pop_y;
	!      }
	!      values.stack_mode = Above;
	!      XConfigureWindow(dpy, Pop, CWX|CWY|CWStackMode, &values);
	!      XMapWindow(dpy, Pop);
	!      
	!      if (Grid) {
	! 	  num_vectors = StoreGridBox(
	! 				     box,
	! 				     MIN(x1, x2), MIN(y1, y2),
	! 				     MAX(x1, x2), MAX(y1, y2)
	! 				     );
	!      }
	!      else {
	! 	  num_vectors = StoreBox(
	! 				 box,
	! 				 MIN(x1, x2), MIN(y1, y2),
	! 				 MAX(x1, x2), MAX(y1, y2)
	! 				 );
	!      }
	!      
	!      /*
	!       * If we freeze the server, then we will draw solid
	!       * lines instead of flickering ones during resizing.
	!       */
	!      if (Freeze)
	! 	  XGrabServer(dpy);
	!      /* protect us from ourselves */
	!      Snatched = True;
	!      /*
	!       * Process any pending exposure events before drawing the box.
	!       */
	!      while (QLength(dpy) > 0) {
	! 	  XPeekEvent(dpy, &button_event);
	! 	  if (((XAnyEvent *)&button_event)->window == RootWindow(dpy, scr))
	! 	       break;
	! 	  GetButton(&button_event);
	!      }
	!      
	!      /*
	!       * Now draw the box.
	!       */
	!      DrawBox();
	!      Frozen = window;
	!      
	!      stop = FALSE;
	!      x = -1; y = -1;
	!      
	!      while (!stop) {
	! 	  if (x != x2 || y != y2) {
	! 	       
	! 	       x = x2; y = y2;
	! 	       
	! 	       /*
	! 		* If we've frozen the server, then erase
	! 		* the old box.
	! 		*/
	! 	       if (Freeze)
	! 		    DrawBox();
	! 	       
	! 	       if (Grid) {
	! 		    num_vectors = StoreGridBox(
	! 					       box,
	! 					       MIN(x1, x), MIN(y1, y),
	! 					       MAX(x1, x), MAX(y1, y)
	! 					       );
	  	       }
	  	       else {
	  		    num_vectors = StoreBox(
	***************
	*** 378,391
	  		     xinc);
	  		 if (hsize-delta >= minwidth) hsize -= delta; 
	  	       }
	-             }  
	-             if (hsize * sizehints.min_aspect.y < vsize * 
	- 		    sizehints.min_aspect.x) {
	- 	       delta = makemult( 
	- 		        (sizehints.min_aspect.x * 
	- 			  vsize/sizehints.min_aspect.y) - hsize, 
	- 	 	        xinc);
	- 	       if (hsize+delta <= maxwidth) hsize += delta;
	  	       else {
	  	         delta = makemult(
	  		       vsize - 
	
	--- 312,317 -----
	  					       MAX(x1, x), MAX(y1, y)
	  					       );
	  	       }
	  	       else {
	  		    num_vectors = StoreBox(
	  					   box,
	***************
	*** 387,398
	  	 	        xinc);
	  	       if (hsize+delta <= maxwidth) hsize += delta;
	  	       else {
	! 	         delta = makemult(
	! 		       vsize - 
	! 		         (hsize*sizehints.min_aspect.y /
	! 			 sizehints.min_aspect.x), 
	! 		       yinc); 
	! 	         if ((vsize-delta >= minheight))  vsize -= delta; 
	  	       }
	  	    }
	   		  
	
	--- 313,323 -----
	  					       );
	  	       }
	  	       else {
	! 		    num_vectors = StoreBox(
	! 					   box,
	! 					   MIN(x1, x), MIN(y1, y),
	! 					   MAX(x1, x), MAX(y1, y)
	! 					   );
	  	       }
	  	       
	  	       if (Freeze)
	***************
	*** 394,425
	  		       yinc); 
	  	         if ((vsize-delta >= minheight))  vsize -= delta; 
	  	       }
	! 	    }
	!  		  
	!       }
	!       if (ox == 0)
	!  	x2 = x1 - hsize;
	!       else
	! 	x2 = x1 + hsize;
	! 
	!       if (oy == 0)
	! 	y2 = y1 - vsize;
	!       else
	!     	y2 = y1 + vsize;
	! 	    
	!     }
	!     if (x2 < x1) {
	!        x = x1; x1 = x2; x2 = x;
	!     }
	!     if (y2 < y1) {
	!         y = y1; y1 = y2; y2 = y;
	!     }
	!     XUnmapWindow(dpy, Pop);
	!     if ((x1!=window_info.x) || (y1 != window_info.y) || 
	!         (hsize != window_info.width) ||
	!         (vsize != window_info.height))
	!         XMoveResizeWindow(dpy, window, x1, y1, hsize, vsize);
	!     return(TRUE);
	  }
	  
	  CheckConsistency(hints)
	
	--- 319,460 -----
	  					   MAX(x1, x), MAX(y1, y)
	  					   );
	  	       }
	! 	       
	! 	       if (Freeze)
	! 		    DrawBox();
	! 	       
	! 	  {
	! 	       int Hsize = (hsize - width_offset) / xinc;
	! 	       int Vsize = (vsize - height_offset) / yinc;
	! 	       int pos = 4;
	! 	       PText[0] = (Hsize>99) ? (Hsize / 100 + '0')	  : ' ';
	! 	       PText[1] = (Hsize>9)  ? ((Hsize / 10) % 10 + '0') : ' ';
	! 	       PText[2] = Hsize % 10 + '0';
	! 	       if (Vsize>99) PText[pos++] = Vsize / 100 + '0';
	! 	       if (Vsize>9)  PText[pos++] = (Vsize / 10) % 10 + '0';
	! 	       PText[pos++] = Vsize % 10 + '0';
	! 	       while (pos<7) PText[pos++] = ' ';
	! 	  }
	! 	       
	! 	       /*
	! 		* If the font is not fixed width we have to
	! 		* clear the window to guarantee that the characters
	! 		* that were there before are erased.
	! 		*/
	! 	       if (!(PFontInfo->per_char)) XClearWindow(dpy, Pop);
	! 	       XDrawImageString(
	! 				dpy, Pop, PopGC,
	! 				PPadding, PPadding+PFontInfo->ascent,
	! 				PText, PTextSize);
	! 	  }
	! 	  
	! 	  if (!Freeze) {
	! 	       DrawBox();
	! 	       DrawBox();
	! 	  }
	! 	  
	! 	  if (XPending(dpy) && GetButton(&button_event)) {
	! 	       
	! 	       if ((button_event.type != ButtonPress) && 
	! 		   (button_event.type != ButtonRelease)) {
	! 		    continue; /* spurious menu event... */
	! 	       }
	! 
	! 	       if (Freeze) {
	! 		    DrawBox();
	! 		    Frozen = (Window)0;
	! 		    XUngrabServer(dpy);
	! 	       }
	! 	       
	! 	       if ((button_event.type == ButtonRelease) &&
	! 		   (((XButtonReleasedEvent *)&button_event)->button == button)){
	! 		    x2 = ((XButtonReleasedEvent *)&button_event)->x;
	! 		    y2 = ((XButtonReleasedEvent *)&button_event)->y;
	! 		    stop = TRUE;
	! 	       }
	! 	       else {
	! 		    XUnmapWindow(dpy, Pop);
	! 		    ResetCursor(button);
	! 		    Snatched = False;
	! 		    return(TRUE);
	! 	       }
	! 	  }
	! 	  else {
	! 	       XQueryPointer(dpy, RootWindow(dpy, scr), &root, 
	! 			     &sub_win, &root_x, &root_y, &x2, &y2, &ptrmask);
	! 	  }
	! 	  
	! 	  
	! 	  hsize = max(min(abs (x2 - x1), maxwidth), minwidth);
	! 	  hsize = makemult(hsize-minwidth, xinc)+minwidth;
	! 	  
	! 	  vsize = max(min(abs(y2 - y1), maxheight), minheight);
	! 	  vsize = makemult(vsize-minheight, yinc)+minheight; 
	! 	  
	! 	  if (sizehints.flags & PAspect) {
	! 	       if ((hsize * sizehints.max_aspect.y > 
	! 		    vsize * sizehints.max_aspect.x)) {
	! 		    delta = makemult( 
	! 				     (hsize*sizehints.max_aspect.y /
	! 				      sizehints.max_aspect.x)
	! 				     - vsize, 
	! 				     yinc); 
	! 		    if ((vsize+delta <= maxheight))  vsize += delta;
	! 		    else {
	! 			 delta = makemult(hsize - 
	! 					  (sizehints.max_aspect.x * vsize/sizehints.max_aspect.y), 
	! 					  xinc);
	! 			 if (hsize-delta >= minwidth) hsize -= delta; 
	! 		    }
	! 	       }  
	! 	       if (hsize * sizehints.min_aspect.y < vsize * 
	! 		   sizehints.min_aspect.x) {
	! 		    delta = makemult( 
	! 				     (sizehints.min_aspect.x * 
	! 				      vsize/sizehints.min_aspect.y) - hsize, 
	! 				     xinc);
	! 		    if (hsize+delta <= maxwidth) hsize += delta;
	! 		    else {
	! 			 delta = makemult(
	! 					  vsize - 
	! 					  (hsize*sizehints.min_aspect.y /
	! 					   sizehints.min_aspect.x), 
	! 					  yinc); 
	! 			 if ((vsize-delta >= minheight))  vsize -= delta; 
	! 		    }
	! 	       }
	! 	       
	! 	  }
	! 	  if (ox == 0)
	! 	       x2 = x1 - hsize;
	! 	  else
	! 	       x2 = x1 + hsize;
	! 	  
	! 	  if (oy == 0)
	! 	       y2 = y1 - vsize;
	! 	  else
	! 	       y2 = y1 + vsize;
	! 	  
	!      }
	!      if (x2 < x1) {
	! 	  x = x1; x1 = x2; x2 = x;
	!      }
	!      if (y2 < y1) {
	! 	  y = y1; y1 = y2; y2 = y;
	!      }
	!      XUnmapWindow(dpy, Pop);
	!      if ((x1!=window_info.x) || (y1 != window_info.y) || 
	! 	 (hsize != window_info.width) ||
	! 	 (vsize != window_info.height)) {
	! 	  TitleData *dat;
	! 	  
	! 	  if ((dat = GetTitleInfo(window)) != NULL)
	! 	       ConfigureTitle(dat, x1, y1 - dx, hsize, vsize);
	! 	  else
	! 	       XMoveResizeWindow(dpy, window, x1, y1, hsize, vsize);
	!      }
	!      Snatched = False;
	!      return(TRUE);
	  }
	  
	  CheckConsistency(hints)
	***************
	*** 425,449
	  CheckConsistency(hints)
	  XSizeHints *hints;
	  {
	!   if (hints->min_height < 0) hints->min_height = 0;
	!   if (hints->min_width < 0)  hints->min_width = 0;
	! 
	!   if (hints->max_height <= 0 || hints->max_width <= 0)
	!       hints->flags &= ~PMaxSize;
	! 
	!   hints->min_height = min(DisplayHeight(dpy, scr), hints->min_height);
	!   hints->min_width =  min(DisplayWidth(dpy, scr),  hints->min_width);
	! 
	!   hints->max_height = min(DisplayHeight(dpy, scr), hints->max_height);
	!   hints->max_width =  min(DisplayWidth(dpy, scr),  hints->max_width);
	! 
	!   if ((hints->flags&PMinSize) && (hints->flags&PMaxSize) && 
	!    ((hints->min_height > hints->max_height) ||
	!     (hints->min_width > hints->max_width)))
	! 	hints->flags &= ~(PMinSize|PMaxSize);
	! 
	!   if ((hints->flags&PAspect) && 
	!    (hints->min_aspect.x * hints->max_aspect.y > 
	!      hints->max_aspect.x * hints->min_aspect.y))
	! 	hints->flags &= ~(PAspect);
	  }
	
	--- 460,484 -----
	  CheckConsistency(hints)
	  XSizeHints *hints;
	  {
	!      if (hints->min_height < 0) hints->min_height = 0;
	!      if (hints->min_width < 0)  hints->min_width = 0;
	!      
	!      if (hints->max_height <= 0 || hints->max_width <= 0)
	! 	  hints->flags &= ~PMaxSize;
	!      
	!      hints->min_height = min(DisplayHeight(dpy, scr), hints->min_height);
	!      hints->min_width =  min(DisplayWidth(dpy, scr),  hints->min_width);
	!      
	!      hints->max_height = min(DisplayHeight(dpy, scr), hints->max_height);
	!      hints->max_width =  min(DisplayWidth(dpy, scr),  hints->max_width);
	!      
	!      if ((hints->flags&PMinSize) && (hints->flags&PMaxSize) && 
	! 	 ((hints->min_height > hints->max_height) ||
	! 	  (hints->min_width > hints->max_width)))
	! 	  hints->flags &= ~(PMinSize|PMaxSize);
	!      
	!      if ((hints->flags&PAspect) && 
	! 	 (hints->min_aspect.x * hints->max_aspect.y > 
	! 	  hints->max_aspect.x * hints->min_aspect.y))
	! 	  hints->flags &= ~(PAspect);
	  }
	*** uwm.new/Restart.c	Mon Dec  7 00:59:37 1987
	--- uwm.new/Restart.c	Sat Dec 12 09:53:40 1987
	***************
	*** 29,34
	   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
	   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
	      Western Software Lab. Convert to X11.
	   */
	  
	  #ifndef lint
	
	--- 29,35 -----
	   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
	   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
	      Western Software Lab. Convert to X11.
	+  * 002 -- Jordan Hubbard, U.C. Berkeley. Titlebar cleanup code.
	   */
	  
	  #ifndef lint
	***************
	*** 51,56
	      XBell(dpy, VOLUME_PERCENTAGE(Volume));
	      XBell(dpy, VOLUME_PERCENTAGE(Volume));
	      XFlush(dpy);
	      execvp(*Argv, Argv, Environ);
	      fprintf(stderr, "uwm: Restart failed!\n");
	  }
	
	--- 52,58 -----
	      XBell(dpy, VOLUME_PERCENTAGE(Volume));
	      XBell(dpy, VOLUME_PERCENTAGE(Volume));
	      XFlush(dpy);
	+ 	Cleanup();
	      execvp(*Argv, Argv, Environ);
	      fprintf(stderr, "uwm: Restart failed!\n");
	  }
	***************
	*** 61,65
	  int button;                           /* Button event detail. */
	  int x, y;                               /* Event mouse position. */
	  {
	!     exit(0);
	  }
	
	--- 63,102 -----
	  int button;                           /* Button event detail. */
	  int x, y;                               /* Event mouse position. */
	  {
	!      Cleanup();
	!      exit(0);
	! }
	! 
	! DestroyWindow(window, mask, button, x, y)
	! Window window;
	! int mask;
	! int x, y;
	! {
	!      if (window == RootWindow(dpy, scr))
	! 	  return(FALSE);
	!      XDestroyWindow(dpy, window);
	!      return(TRUE);
	! }
	! 
	! /*
	!  * Put any necessary cleanup code here, it will be invoked when uwm exits
	!  * or restarts. Currently just checks for title bar resources.
	!  */
	! Cleanup()
	! {
	! 	Window junk, *windows;
	! 	int nwins;
	! 
	! 	if (XQueryTree(dpy, DefaultRootWindow(dpy), &junk, &junk, &windows, &nwins)
	! 	  != BadWindow) {
	! 		unsigned int i;
	! 
	! 		for (i = 0; i < nwins; i++) {
	! 			TitleData *data;
	! 
	! 			if ((data = GetTitleInfo(windows[i])) != NULL)
	! 				DestroyTitle(data, False);
	! 		}
	! 		XFree(windows);
	! 	}
	  }
	*** uwm.new/globals.c	Mon Dec  7 00:59:40 1987
	--- uwm.new/globals.c	Sat Dec 12 09:53:42 1987
	***************
	*** 35,40
	   * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group 
	   *  Western Software Lab. April 17, 1987
	   *  Convert to X11
	   */
	   
	  #ifndef lint
	
	--- 35,41 -----
	   * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group 
	   *  Western Software Lab. April 17, 1987
	   *  Convert to X11
	+  * 003 -- Jordan Hubbard, U.C. Berkeley. Misc new vars.
	   */
	   
	  #ifndef lint
	***************
	*** 52,57
	  XFontStruct *IFontInfo;		/* Icon text font information. */
	  XFontStruct *PFontInfo;		/* Pop-up text font information. */
	  XFontStruct *MFontInfo;		/* Menu text font information. */
	  Pixmap GrayPixmap;		/* Gray pixmap. */
	  Pixel IBorder;			/* Icon window border pixmap. */
	  Pixmap IBackground;		/* Icon window background pixmap. */
	
	--- 53,60 -----
	  XFontStruct *IFontInfo;		/* Icon text font information. */
	  XFontStruct *PFontInfo;		/* Pop-up text font information. */
	  XFontStruct *MFontInfo;		/* Menu text font information. */
	+ XFontStruct *TFontInfo;		/* Title text font information. */
	+ XFontStruct *TFontBoldInfo;	/* Title text (bold) font information. */
	  Pixmap GrayPixmap;		/* Gray pixmap. */
	  Pixel IBorder;			/* Icon window border pixmap. */
	  Pixmap IBackground;		/* Icon window background pixmap. */
	***************
	*** 91,96
	  int VMenuPad;			/* Menu vertical padding. */
	  int MaxColors;			/* Maximum number of colors to use. */
	  int Pushval = 5;		/* Number of pixels to push window by. */
	  int Volume;			/* Audible alarm volume. */
	  int status;			/* Routine return status. */
	  int Maxfd;			/* Maximum file descriptors for select(2). */
	
	--- 94,100 -----
	  int VMenuPad;			/* Menu vertical padding. */
	  int MaxColors;			/* Maximum number of colors to use. */
	  int Pushval = 5;		/* Number of pixels to push window by. */
	+ int RaiseDelay;			/* Number of milliseconds delay before autoraise */
	  int Volume;			/* Audible alarm volume. */
	  int status;			/* Routine return status. */
	  int Maxfd;			/* Maximum file descriptors for select(2). */
	***************
	*** 103,108
	  Binding *Blist;			/* Button/key binding list. */
	   
	  Bool Autoselect;		/* Warp mouse to default menu selection? */
	  Bool Freeze;			/* Freeze server during move/resize? */
	  Bool Grid;			/* Should the m/r box contain a 9 seg. grid. */
	  Bool NWindow;           	 /* Normalize windows? */
	
	--- 107,113 -----
	  Binding *Blist;			/* Button/key binding list. */
	   
	  Bool Autoselect;		/* Warp mouse to default menu selection? */
	+ Bool Autoraise;			/* Raise window on input focus? */
	  Bool Freeze;			/* Freeze server during move/resize? */
	  Bool Grid;			/* Should the m/r box contain a 9 seg. grid. */
	  Bool Hilite;			/* Should we highlight window borders on focus? */
	***************
	*** 105,110
	  Bool Autoselect;		/* Warp mouse to default menu selection? */
	  Bool Freeze;			/* Freeze server during move/resize? */
	  Bool Grid;			/* Should the m/r box contain a 9 seg. grid. */
	  Bool NWindow;           	 /* Normalize windows? */
	  Bool NIcon;             	 /* Normalize icons? */
	  Bool Push;			/* Relative=TRUE, Absolute=FALSE. */
	
	--- 110,116 -----
	  Bool Autoraise;			/* Raise window on input focus? */
	  Bool Freeze;			/* Freeze server during move/resize? */
	  Bool Grid;			/* Should the m/r box contain a 9 seg. grid. */
	+ Bool Hilite;			/* Should we highlight window borders on focus? */
	  Bool NWindow;           	 /* Normalize windows? */
	  Bool NIcon;             	 /* Normalize icons? */
	  Bool Push;			/* Relative=TRUE, Absolute=FALSE. */
	***************
	*** 108,113
	  Bool NWindow;           	 /* Normalize windows? */
	  Bool NIcon;             	 /* Normalize icons? */
	  Bool Push;			/* Relative=TRUE, Absolute=FALSE. */
	  Bool Reverse;			/* Reverse video? */
	  Bool Zap;			/* Should the the zap effect be used. */
	  Bool WarpOnRaise;               /* Warp to upper right corner on raise. */
	
	--- 114,121 -----
	  Bool NWindow;           	 /* Normalize windows? */
	  Bool NIcon;             	 /* Normalize icons? */
	  Bool Push;			/* Relative=TRUE, Absolute=FALSE. */
	+ Bool RootResizeBox;		/* Resize window is placed over sized window? */
	+ Bool Titles;			/* Title bar frob on windows? */
	  Bool Reverse;			/* Reverse video? */
	  Bool Zap;			/* Should the the zap effect be used. */
	  Bool WarpOnRaise;               /* Warp to upper right corner on raise. */
	***************
	*** 124,129
	  char IFontName[NAME_LEN];	/* Icon font name. */
	  char PFontName[NAME_LEN];	/* Pop-up font name. */
	  char MFontName[NAME_LEN];	/* Menu font name. */
	  char **Argv;			/* Pointer to command line parameters. */
	  char **Environ;			/* Pointer to environment. */
	  
	
	--- 132,139 -----
	  char IFontName[NAME_LEN];	/* Icon font name. */
	  char PFontName[NAME_LEN];	/* Pop-up font name. */
	  char MFontName[NAME_LEN];	/* Menu font name. */
	+ char TFontName[NAME_LEN];	/* Title font name. */
	+ char TFontBoldName[NAME_LEN];	/* Bold Title font name. */
	  char **Argv;			/* Pointer to command line parameters. */
	  char **Environ;			/* Pointer to environment. */
	  
	***************
	*** 134,139
	   * Keyword lookup table for parser.
	   */
	  Keyword KeywordTable[] = {
	      { "autoselect",	IsBoolTrue,	&Autoselect,0,0,0 },
	      { "delay",		IsNumeric,	0,&Delay,0,0 },
	      { "delta",		IsNumeric,	0,&Delta,0,0 },
	
	--- 144,151 -----
	   * Keyword lookup table for parser.
	   */
	  Keyword KeywordTable[] = {
	+     { "autoraise",	IsBoolTrue,	&Autoraise,0,0,0 },
	+     { "raisedelay",	IsNumeric,	0,&RaiseDelay,0,0 },
	      { "autoselect",	IsBoolTrue,	&Autoselect,0,0,0 },
	      { "delay",		IsNumeric,	0,&Delay,0,0 },
	      { "delta",		IsNumeric,	0,&Delta,0,0 },
	***************
	*** 138,143
	      { "delay",		IsNumeric,	0,&Delay,0,0 },
	      { "delta",		IsNumeric,	0,&Delta,0,0 },
	      { "freeze",		IsBoolTrue,	&Freeze,0,0,0 },
	      { "iconfont",	IsString,	0,0,IFontName,0 },
	      { "f.beep",		IsQuitFunction,	0,0,0,Beep },
	      { "f.circledown",	IsQuitFunction,	0,0,0,CircleDown },
	
	--- 150,156 -----
	      { "delay",		IsNumeric,	0,&Delay,0,0 },
	      { "delta",		IsNumeric,	0,&Delta,0,0 },
	      { "freeze",		IsBoolTrue,	&Freeze,0,0,0 },
	+     { "hilite",		IsBoolTrue,	&Hilite,0,0,0 },
	      { "iconfont",	IsString,	0,0,IFontName,0 },
	      { "rootresizebox",	IsBoolTrue,	&RootResizeBox,0,0,0 },
	      { "title",		IsBoolTrue,	&Titles,0,0,0 },
	***************
	*** 139,144
	      { "delta",		IsNumeric,	0,&Delta,0,0 },
	      { "freeze",		IsBoolTrue,	&Freeze,0,0,0 },
	      { "iconfont",	IsString,	0,0,IFontName,0 },
	      { "f.beep",		IsQuitFunction,	0,0,0,Beep },
	      { "f.circledown",	IsQuitFunction,	0,0,0,CircleDown },
	      { "f.circleup",	IsQuitFunction,	0,0,0,CircleUp },
	
	--- 152,161 -----
	      { "freeze",		IsBoolTrue,	&Freeze,0,0,0 },
	      { "hilite",		IsBoolTrue,	&Hilite,0,0,0 },
	      { "iconfont",	IsString,	0,0,IFontName,0 },
	+     { "rootresizebox",	IsBoolTrue,	&RootResizeBox,0,0,0 },
	+     { "title",		IsBoolTrue,	&Titles,0,0,0 },
	+     { "titlefont",	IsString,	0,0,TFontName,0 },
	+     { "titlebold",	IsString,	0,0,TFontBoldName,0 },
	      { "f.beep",		IsQuitFunction,	0,0,0,Beep },
	      { "f.circledown",	IsQuitFunction,	0,0,0,CircleDown },
	      { "f.circleup",	IsQuitFunction,	0,0,0,CircleUp },
	***************
	*** 161,166
	      { "f.refresh",	IsQuitFunction,	0,0,0,Refresh },
	      { "f.resize",	IsDownFunction,	0,0,0,Resize },
	      { "f.restart",	IsQuitFunction,	0,0,0,Restart },
	      { "grid",		IsBoolTrue,	&Grid,0,0,0 },
	      { "hiconpad",	IsNumeric,	0,&HIconPad,0,0 },
	      { "hmenupad",	IsNumeric,	0,&HMenuPad,0,0 },
	
	--- 178,186 -----
	      { "f.refresh",	IsQuitFunction,	0,0,0,Refresh },
	      { "f.resize",	IsDownFunction,	0,0,0,Resize },
	      { "f.restart",	IsQuitFunction,	0,0,0,Restart },
	+     { "f.destroy",      IsDownFunction, 0,0,0,DestroyWindow },
	+     { "f.title",        IsFunction,     0,0,0,FAddTitle },
	+     { "f.notitle",      IsFunction,     0,0,0,FDestroyTitle },
	      { "grid",		IsBoolTrue,	&Grid,0,0,0 },
	      { "hiconpad",	IsNumeric,	0,&HIconPad,0,0 },
	      { "hmenupad",	IsNumeric,	0,&HMenuPad,0,0 },
	***************
	*** 167,172
	      { "maxcolors",	IsNumeric,	0,&MaxColors,0,0 },
	      { "menu",		IsMenu,		0,0,0,0 },
	      { "menufont",	IsString,	0,0,MFontName,0 },
	      { "noautoselect",	IsBoolFalse,	&Autoselect,0,0,0 },
	      { "nofreeze",	IsBoolFalse,	&Freeze,0,0,0 },
	      { "nogrid",		IsBoolFalse,	&Grid,0,0,0 },
	
	--- 187,193 -----
	      { "maxcolors",	IsNumeric,	0,&MaxColors,0,0 },
	      { "menu",		IsMenu,		0,0,0,0 },
	      { "menufont",	IsString,	0,0,MFontName,0 },
	+     { "noautoraise",	IsBoolFalse,	&Autoraise,0,0,0 },
	      { "noautoselect",	IsBoolFalse,	&Autoselect,0,0,0 },
	      { "nofreeze",	IsBoolFalse,	&Freeze,0,0,0 },
	      { "nogrid",		IsBoolFalse,	&Grid,0,0,0 },
	***************
	*** 170,175
	      { "noautoselect",	IsBoolFalse,	&Autoselect,0,0,0 },
	      { "nofreeze",	IsBoolFalse,	&Freeze,0,0,0 },
	      { "nogrid",		IsBoolFalse,	&Grid,0,0,0 },
	      { "nonormali",	IsBoolFalse,	&NIcon,0,0,0 },
	      { "nonormalw",	IsBoolFalse,	&NWindow,0,0,0 },
	      { "noreverse",	IsBoolFalse,	&Reverse,0,0,0 },
	
	--- 191,197 -----
	      { "noautoselect",	IsBoolFalse,	&Autoselect,0,0,0 },
	      { "nofreeze",	IsBoolFalse,	&Freeze,0,0,0 },
	      { "nogrid",		IsBoolFalse,	&Grid,0,0,0 },
	+     { "nohilite",	IsBoolFalse,	&Hilite,0,0,0 },
	      { "nonormali",	IsBoolFalse,	&NIcon,0,0,0 },
	      { "nonormalw",	IsBoolFalse,	&NWindow,0,0,0 },
	      { "norootresizebox",IsBoolFalse,	&RootResizeBox,0,0,0 },
	***************
	*** 172,177
	      { "nogrid",		IsBoolFalse,	&Grid,0,0,0 },
	      { "nonormali",	IsBoolFalse,	&NIcon,0,0,0 },
	      { "nonormalw",	IsBoolFalse,	&NWindow,0,0,0 },
	      { "noreverse",	IsBoolFalse,	&Reverse,0,0,0 },
	      { "normali",	IsBoolTrue,	&NIcon,0,0,0 },
	      { "normalw",	IsBoolTrue,	&NWindow,0,0,0 },
	
	--- 194,200 -----
	      { "nohilite",	IsBoolFalse,	&Hilite,0,0,0 },
	      { "nonormali",	IsBoolFalse,	&NIcon,0,0,0 },
	      { "nonormalw",	IsBoolFalse,	&NWindow,0,0,0 },
	+     { "norootresizebox",IsBoolFalse,	&RootResizeBox,0,0,0 },
	      { "noreverse",	IsBoolFalse,	&Reverse,0,0,0 },
	      { "normali",	IsBoolTrue,	&NIcon,0,0,0 },
	      { "normalw",	IsBoolTrue,	&NWindow,0,0,0 },
	***************
	*** 175,180
	      { "noreverse",	IsBoolFalse,	&Reverse,0,0,0 },
	      { "normali",	IsBoolTrue,	&NIcon,0,0,0 },
	      { "normalw",	IsBoolTrue,	&NWindow,0,0,0 },
	      { "nowarpdi",	IsBoolFalse,	&WarpOnDeIconify,0,0,0 },
	      { "nowarpi",	IsBoolFalse,	&WarpOnIconify,0,0,0 },
	      { "nowarpr",	IsBoolFalse,	&WarpOnRaise,0,0,0 },
	
	--- 198,204 -----
	      { "noreverse",	IsBoolFalse,	&Reverse,0,0,0 },
	      { "normali",	IsBoolTrue,	&NIcon,0,0,0 },
	      { "normalw",	IsBoolTrue,	&NWindow,0,0,0 },
	+     { "notitle",	IsBoolFalse,	&Titles,0,0,0 },
	      { "nowarpdi",	IsBoolFalse,	&WarpOnDeIconify,0,0,0 },
	      { "nowarpi",	IsBoolFalse,	&WarpOnIconify,0,0,0 },
	      { "nowarpr",	IsBoolFalse,	&WarpOnRaise,0,0,0 },
	***************
	*** 222,227
	      { "r", ROOT },
	      { "window", WINDOW },
	      { "w", WINDOW },
	      { NULL, NULL }
	  };
	   
	
	--- 246,253 -----
	      { "r", ROOT },
	      { "window", WINDOW },
	      { "w", WINDOW },
	+     { "t", TITLE },
	+     { "title", TITLE },
	      { NULL, NULL }
	  };
	   
	*** uwm.new/gram.y	Mon Dec  7 00:59:41 1987
	--- uwm.new/gram.y	Sat Dec 12 09:53:46 1987
	***************
	*** 31,36
	   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
	   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
	   *  Western Software Lab. Convert to X11.
	   */
	  
	  %{
	
	--- 31,38 -----
	   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
	   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
	   *  Western Software Lab. Convert to X11.
	+  * 002 -- Jordan Hubbard, U.C. Berkeley. New keywords. Menu
	+  * changes.
	   */
	  
	  %{
	***************
	*** 58,63
	  static MenuLine *ml_ptr;		/* Temporary menu line pointer. */
	  static char *hcolors[4];		/* Color values used in menu hdrs. */
	  static char *mcolors[2];		/* Color values used in menus. */
	  MenuLink *menu_link;			/* Temporary menu link pointer. */
	  
	  char *calloc();
	
	--- 60,67 -----
	  static MenuLine *ml_ptr;		/* Temporary menu line pointer. */
	  static char *hcolors[4];		/* Color values used in menu hdrs. */
	  static char *mcolors[2];		/* Color values used in menus. */
	+ static Bool true = TRUE;		/* hack */
	+ static Bool false = FALSE;		/* ditto */
	  MenuLink *menu_link;			/* Temporary menu link pointer. */
	  
	  char *calloc();
	***************
	*** 233,239
	  	;
	  
	  contexpr:	/* empty */
	! 			{ $$ = ROOT | WINDOW | ICON; }
	  	|	contmask
	  			{ $$ = $1; }
	  	|	contmask '|' contmask
	
	--- 237,243 -----
	  	;
	  
	  contexpr:	/* empty */
	! 			{ $$ = ROOT | WINDOW | ICON | TITLE; }
	  	|	contmask
	  			{ $$ = $1; }
	  	|	contmask '|' contmask
	***************
	*** 308,313
	  			    if ((ki != -1) &&
	  			        (KeywordTable[ki].type != IsFunction) &&
	  			        (KeywordTable[ki].type != IsQuitFunction) &&
	  			        (KeywordTable[ki].type != IsDownFunction)) {
	  			        sprintf(msg,
	  			                "menu action \"%s\" not a function",
	
	--- 312,319 -----
	  			    if ((ki != -1) &&
	  			        (KeywordTable[ki].type != IsFunction) &&
	  			        (KeywordTable[ki].type != IsQuitFunction) &&
	+ 			        (KeywordTable[ki].type != IsBoolTrue) &&
	+ 			        (KeywordTable[ki].type != IsBoolFalse) &&
	  			        (KeywordTable[ki].type != IsDownFunction)) {
	  			        sprintf(msg,
	  			                "menu action \"%s\" not a function or variable",
	***************
	*** 310,316
	  			        (KeywordTable[ki].type != IsQuitFunction) &&
	  			        (KeywordTable[ki].type != IsDownFunction)) {
	  			        sprintf(msg,
	! 			                "menu action \"%s\" not a function",
	  				        KeywordTable[ki].name);
	  			        yyerror(msg);
	  			    }
	
	--- 316,322 -----
	  			        (KeywordTable[ki].type != IsBoolFalse) &&
	  			        (KeywordTable[ki].type != IsDownFunction)) {
	  			        sprintf(msg,
	! 			                "menu action \"%s\" not a function or variable",
	  				        KeywordTable[ki].name);
	  			        yyerror(msg);
	  			    }
	***************
	*** 317,323
	  			    ml_ptr = AllocMenuLine();
	  			    if (KeywordTable[ki].type == IsQuitFunction)
	  			        ml_ptr->type = IsImmFunction;
	! 			    else ml_ptr->type = IsUwmFunction;
	  			    ml_ptr->func = KeywordTable[ki].fptr;
	  			    $$ = ml_ptr;
	  			}
	
	--- 323,345 -----
	  			    ml_ptr = AllocMenuLine();
	  			    if (KeywordTable[ki].type == IsQuitFunction)
	  			        ml_ptr->type = IsImmFunction;
	! 				/*
	! 				 * The following is a KLUDGE. It uses variables that were
	! 				 * intended for other purposes but happen to be going where
	! 				 * we want to go. The code is intended to add the dubiously
	! 				 * useful option of setting boolean uwm variables from menus.
	! 				 */
	! 			    else if (KeywordTable[ki].type == IsBoolTrue ||
	! 				  KeywordTable[ki].type == IsBoolFalse) {
	! 					ml_ptr->type = IsVar;
	! 					ml_ptr->text = (char *)KeywordTable[ki].bptr;
	! 					if (KeywordTable[ki].type == IsBoolTrue)
	! 						ml_ptr->aux = (char *)&true;
	! 					else
	! 						ml_ptr->aux = (char *)&false;
	! 				}
	! 				else
	! 					ml_ptr->type = IsUwmFunction;
	  			    ml_ptr->func = KeywordTable[ki].fptr;
	  			    $$ = ml_ptr;
	  			}
	***************
	*** 338,344
	  			}
	  	|	'!' strings
	  			{
	! 			    $$ = StashMenuLine(IsShellCommand, $2);
	  			}
	  	|	'^' strings
	  			{
	
	--- 360,366 -----
	  			}
	  	|	'!' strings
	  			{
	! 			    $$ = StashMenuLine(IsShellCommand, $2, 0);
	  			}
	  	|	'^' strings
	  			{
	***************
	*** 342,348
	  			}
	  	|	'^' strings
	  			{
	! 			    $$ = StashMenuLine(IsTextNL, $2);
	  			}
	  	|	'|' strings
	  			{
	
	--- 364,370 -----
	  			}
	  	|	'^' strings
	  			{
	! 			    $$ = StashMenuLine(IsTextNL, $2, 0);
	  			}
	  	|	'|' strings
	  			{
	***************
	*** 346,352
	  			}
	  	|	'|' strings
	  			{
	! 			    $$ = StashMenuLine(IsText, $2);
	  			}
	  	;
	  
	
	--- 368,374 -----
	  			}
	  	|	'|' strings
	  			{
	! 			    $$ = StashMenuLine(IsText, $2, 0);
	  			}
	  	;
	  
	***************
	*** 563,569
	  bindtofunc(index, mask, context, name)
	  int index;		/* Index into keyword table. */
	  int mask;		/* Button/key/modifier mask. */
	! int context;		/* ROOT, WINDOW, or ICON. */
	  char *name;		/* Menu, if needed. */
	  {
	      if (context & ROOT)
	
	--- 585,591 -----
	  bindtofunc(index, mask, context, name)
	  int index;		/* Index into keyword table. */
	  int mask;		/* Button/key/modifier mask. */
	! int context;		/* ROOT, WINDOW, TITLE or ICON. */
	  char *name;		/* Menu, if needed. */
	  {
	      if (context & ROOT)
	***************
	*** 572,577
	          setbinding(ICON, index, mask, name);
	      if (context & WINDOW)
	          setbinding(WINDOW, index, mask, name);
	  }
	  
	  /*
	
	--- 594,601 -----
	          setbinding(ICON, index, mask, name);
	      if (context & WINDOW)
	          setbinding(WINDOW, index, mask, name);
	+     if (context & TITLE)
	+         setbinding(TITLE, index, mask, name);
	  }
	  
	  /*
	***************
	*** 687,693
	   * Stash the data in a menu line.
	   */
	  MenuLine *
	! StashMenuLine(type, string)
	  int type;
	  char *string;
	  {
	
	--- 711,717 -----
	   * Stash the data in a menu line.
	   */
	  MenuLine *
	! StashMenuLine(type, string, aux)
	  int type;
	  char *string, *aux;
	  {
	***************
	*** 689,695
	  MenuLine *
	  StashMenuLine(type, string)
	  int type;
	! char *string;
	  {
	      MenuLine *ptr;
	  
	
	--- 713,719 -----
	  MenuLine *
	  StashMenuLine(type, string, aux)
	  int type;
	! char *string, *aux;
	  {
	      MenuLine *ptr;
	  
	***************
	*** 696,701
	      ptr = AllocMenuLine();
	      ptr->type = type;
	      ptr->text = string;
	      return(ptr);
	  }
	  
	
	--- 720,726 -----
	      ptr = AllocMenuLine();
	      ptr->type = type;
	      ptr->text = string;
	+ 	ptr->aux = aux;
	      return(ptr);
	  }
	  
//E*O*F uwm.patches.1//

exit 0