v02i007: Ardent Window Manager, Patch8

Mike Wexler mikew at wyse.wyse.com
Thu Oct 27 08:37:24 AEST 1988


Submitted-by: meepmeep!jkh at unido ( Jordan K. Hubbard )
Posting-number: Volume 2, Issue 7
Archive-name: awm/patch8



---- patch 08 ----
/*
 * CHANGES:
 *
 * Many many annoying bugs fixed. Windows that start up iconic no longer
 * leave artifacts. Gadgets offsets are now handled properly (broken
 * by last patch). Pixmap icons can now have labels as well (ala twm).
 * Some sysV/BSD compatibility changes made. Support for WM_STATE added
 * if your server supports XA_WM_STATE. Compile awm with -DWM_STATE to
 * enable this.
 *
 * UPDATED:
 *
 * Cursors.c
 * Error.c
 * Gadget.c
 * GetButton.c
 * Iconify.c
 * Icons.c
 * Menu.c
 * Titlebar.c
 * awm.c
 * awm.h
 * awm.man
 * exp_path.c
 * globals.c
 * gram.y
 * support.c
 *
 */

diff -c awm.dst/Cursors.c awm/Cursors.c
*** awm.dst/Cursors.c	Fri Oct 14 14:56:26 1988
--- awm/Cursors.c	Tue Oct 25 11:07:08 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_StoreCursors_c = "$Header: Cursors.c,v 1.1 88/06/15 15:21:52 jkh Exp $";
  #endif	lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_StoreCursors_c = "$Header: Cursors.c,v 1.2 88/10/25 15:21:52 jkh Exp $";
  #endif	lint
  
  #include "X11/copyright.h"
***************
*** 57,62 ****
--- 57,63 ----
   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
   *        Convert to X11
+  * 1.2 -- Gumby cursor added (This was a major revision).
   */
  
  #ifndef lint
***************
*** 127,132 ****
--- 128,141 ----
      TargetCursor = XCreateFontCursor(dpy, XC_circle);	
      if (TargetCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store TargetCursor.");
+     }
+     /*
+      * Gumby cursor used in icons if icon is not a typein icon
+      * (otherwise use textcursor
+      */
+     GumbyCursor = XCreateFontCursor(dpy, XC_gumby);	
+     if (GumbyCursor == FAILURE) {
+ 	Error("StoreCursors -> Unable to store GumbyCursor.");
      }
      Leave(0)
  }
diff -c awm.dst/Error.c awm/Error.c
*** awm.dst/Error.c	Fri Oct 14 14:56:26 1988
--- awm/Error.c	Tue Oct 25 11:06:36 1988
***************
*** 2,15 ****
  
  
  #ifndef lint
! static char *rcsid_Error_c = "$Header: Error.c,v 1.2 88/07/24 01:58:56 jkh Exp $";
  #endif	lint
  
! #if defined(vax)
  #include <sys/file.h>
  #else
  #include <fcntl.h>
! #endif /* vax */
  
  #include <signal.h>
  #include "X11/copyright.h"
--- 2,15 ----
  
  
  #ifndef lint
! static char *rcsid_Error_c = "$Header: Error.c,v 1.3 88/10/25 01:58:56 jkh Exp $";
  #endif	lint
  
! #if defined(BSD)
  #include <sys/file.h>
  #else
  #include <fcntl.h>
! #endif /* BSD */
  
  #include <signal.h>
  #include "X11/copyright.h"
***************
*** 62,67 ****
--- 62,68 ----
   * MODIFICATION HISTORY
   *
   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
+  * 1.3 -- Cleanup. Fixed bug.
   */
  
  #ifndef lint
diff -c awm.dst/FocusChng.c awm/FocusChng.c
*** awm.dst/FocusChng.c	Fri Oct 14 14:56:45 1988
--- awm/FocusChng.c	Mon Oct 17 13:02:44 1988
***************
*** 41,47 ****
  
  #include "awm.h"
  
! #if defined(sun) || defined(ibm032) || defined(titan) || defined(vax)
  #include <sys/time.h>
  #else
  #include <time.h>
--- 41,47 ----
  
  #include "awm.h"
  
! #if defined(BSD)
  #include <sys/time.h>
  #else
  #include <time.h>
***************
*** 82,87 ****
--- 82,90 ----
  	       if (XCheckTypedWindowEvent(dpy, w, LeaveNotify, &event))
  		    if (event.xcrossing.detail != NotifyInferior)
  			 Leave(FALSE)
+ 	       /*
+ 		* Install a colormap, if necessary.
+ 		*/
  	       if (InstallColormap) {
  		    XWindowAttributes xwa;
  
***************
*** 88,93 ****
--- 91,103 ----
  		    XGetWindowAttributes(dpy, w, &xwa);
  		    XInstallColormap(dpy, xwa.colormap);
  	       }
+ 
+ 	       /*
+ 		* If Autoraise is set, raise that puppy..
+ 		*/
+ 	       if  (Autoraise && (awi->attrs & AT_RAISE))
+ 		    XRaiseWindow(dpy, (awi->frame) ? awi->frame : awi->client);
+ 
  	       if (!FocusSetByUser && FocusWindow != awi->client &&
  		   (awi->attrs & AT_INPUT)) {
  		    if (FrameFocus) {
***************
*** 104,115 ****
  	       FocusWindow = awi->client;
  	       FocusSetByWM = FALSE;
  	  }
- 
- 	  /*
- 	   * If Autoraise is set, raise that puppy..
- 	   */
- 	  if (Autoraise && (awi->attrs & AT_RAISE))
- 	       XRaiseWindow(dpy, (awi->frame) ? awi->frame : awi->client);
  	  LightsOn(awi);
       }
       Leave(FALSE)
--- 114,119 ----
diff -c awm.dst/Gadget.c awm/Gadget.c
*** awm.dst/Gadget.c	Fri Oct 14 14:56:47 1988
--- awm/Gadget.c	Tue Oct 25 18:13:39 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_Gadget_c = "$Header: Gadget.c,v 1.3 88/07/23 17:26:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_Gadget_c = "$Header: Gadget.c,v 1.4 88/07/23 17:26:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
***************
*** 35,40 ****
--- 35,41 ----
   *  GadgetBorders used in placement calculations, initial
   *  gadget positions calculated correcly. (Chris Thewalt fixes).
   * 1.3 -- Color handling changed to deal with multiple colormaps.
+  * 1.4 -- Fixed really silly bug with gadget offset.
   *
   */
  
***************
*** 128,137 ****
  	  if (gdec->gravity != NoGadgetGravity)
  	       dir = gdec->gravity;
  	  ny = xwa.height - gdec->high;
! 	  if (ny <= 0) {
! 	       ny = 0;
                 gdec->high = xwa.height;
-           }
  	  else
  	       ny = (ny / 2) - 1;
  	  if (ny < 0)
--- 129,136 ----
  	  if (gdec->gravity != NoGadgetGravity)
  	       dir = gdec->gravity;
  	  ny = xwa.height - gdec->high;
! 	  if (ny <= 0)
                 gdec->high = xwa.height;
  	  else
  	       ny = (ny / 2) - 1;
  	  if (ny < 0)
***************
*** 139,145 ****
  	  if (dir == LeftGadgetGravity) {
  	       nx = lx + gdec->offset;
  	       if (lx != 0) /* not first time through, add pad */
! 		    nx = lx + GadgetPad;
  	       if (nx < 0)
  		    nx = 0;
  	       lx = nx + gdec->wide;
--- 138,144 ----
  	  if (dir == LeftGadgetGravity) {
  	       nx = lx + gdec->offset;
  	       if (lx != 0) /* not first time through, add pad */
! 		    nx += GadgetPad;
  	       if (nx < 0)
  		    nx = 0;
  	       lx = nx + gdec->wide;
diff -c awm.dst/GetButton.c awm/GetButton.c
*** awm.dst/GetButton.c	Fri Oct 14 14:56:30 1988
--- awm/GetButton.c	Wed Oct 26 16:40:35 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_GetButton_c = "$Header: GetButton.c,v 1.5 88/08/19 15:55:45 jkh Exp $";
  #endif	lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_GetButton_c = "$Header: GetButton.c,v 1.6 88/10/25 23:55:45 jkh Exp $";
  #endif	lint
  
  #include "X11/copyright.h"
***************
*** 250,255 ****
--- 250,257 ----
                Leave(FALSE)
  	  if (IsIcon(win, FALSE))
  	      Leave(FALSE)
+           if (!(awi->state & (ST_PLACED | ST_WINDOW)))
+               Leave(FALSE)
            XMapWindow(dpy, awi->frame);
  	  XMapWindow(dpy, awi->client);
            Leave(FALSE)
***************
*** 293,307 ****
  	       break;
  
  	  case XA_WM_ICON_NAME:
- 	       /*
- 		* Icon was modified by type-in (I still think that's a
- 		* gross feature, but some people like it... sigh),
- 		* ignore this event.
- 		*/
  	       if (Icon_modified == TRUE) {
  		    Icon_modified = FALSE;	/* reset */
  		    Leave(FALSE)
  	       }
  	       if (awi->icon && awi->own && awi->iconPixmap == IBackPixmap) {
  		    win = awi->icon;
  		    status = XGetWindowAttributes(dpy, win, &win_info);
--- 295,312 ----
  	       break;
  
  	  case XA_WM_ICON_NAME:
  	       if (Icon_modified == TRUE) {
+ 		    /*
+ 		     * Icon was modified by type-in (I still think that's a
+ 		     * gross feature, but some people like it... sigh),
+ 		     * ignore this event.
+ 		     */
  		    Icon_modified = FALSE;	/* reset */
  		    Leave(FALSE)
  	       }
+ 	       /*
+ 		* Icon was modifed in a more civilized fashion.
+ 		*/
  	       if (awi->icon && awi->own && awi->iconPixmap == IBackPixmap) {
  		    win = awi->icon;
  		    status = XGetWindowAttributes(dpy, win, &win_info);
***************
*** 341,346 ****
--- 346,354 ----
  	  case XA_WM_NORMAL_HINTS:
  	  case XA_WM_SIZE_HINTS:
  	  case XA_WM_ZOOM_HINTS:
+ #ifdef WM_STATE
+ 	  case XA_WM_STATE:
+ #endif /* WM_STATE */
  	       break;
  
  	  default:
***************
*** 456,462 ****
       /*
        * If kbd_str is a "non-string", then don't do anything.
        */
!      if (nbytes == 0) {
  	  if (icon_str)
  	       free(icon_str);
  	  Leave(FALSE)
--- 464,470 ----
       /*
        * If kbd_str is a "non-string", then don't do anything.
        */
!      if (nbytes == 0 || !kbd_str || !*kbd_str) {
  	  if (icon_str)
  	       free(icon_str);
  	  Leave(FALSE)
***************
*** 731,736 ****
--- 739,748 ----
       if (!awi)
            Leave(FALSE)
  
+      if (awi->icon == w) {
+ 	  XConfigureWindow(dpy, w, mask, xwc);
+ 	  Leave(TRUE)
+      }
       if (awi->attrs & AT_BORDER) {
  	  bcv = BContext + 1;
  	  bch = bcv * 2;
diff -c awm.dst/Iconify.c awm/Iconify.c
*** awm.dst/Iconify.c	Fri Oct 14 14:56:32 1988
--- awm/Iconify.c	Tue Oct 25 11:05:11 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_Iconify_c = "$Header: Iconify.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_Iconify_c = "$Header: Iconify.c,v 1.2 88/10/24 15:24:56 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
***************
*** 63,68 ****
--- 63,69 ----
   * 003 -- Jordan Hubbard, Ardent Computer.
   *  Many mods to cope with context manager, titled windows. Almost a total
   *  rewrite.
+  * 1.2 -- Support for IconLabels.. (Isaac Salzman). A few fixes (jkh).
   */
  
  #include "awm.h"
***************
*** 168,178 ****
--- 169,189 ----
  	       XRemoveFromSaveSet(dpy, awi->client);
  	  awi->state ^= ST_ICON;
  	  awi->state |= ST_WINDOW;
+ #ifdef WM_STATE
+ 	  awi->wm_state.state=NormalState;
+ 	  XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
+ 			  PropModeReplace,&awi->wm_state,2);
+ #endif /* WM_STATE */
       }
       else if (awi->state & ST_WINDOW) {
            XAddToSaveSet(dpy, awi->client);
  	  awi->state ^= ST_WINDOW;
  	  awi->state |= ST_ICON;
+ #ifdef WM_STATE
+ 	  awi->wm_state.state=IconicState;
+ 	  XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
+ 			  PropModeReplace,&awi->wm_state,2);
+ #endif /* WM_STATE */
       }
       else
            fprintf(stderr, "Window state for window %x got munged!\n",
diff -c awm.dst/Icons.c awm/Icons.c
*** awm.dst/Icons.c	Fri Oct 14 14:56:34 1988
--- awm/Icons.c	Wed Oct 26 16:36:50 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_Icons_c = "$Header: Icons.c,v 1.3 88/07/23 17:24:56 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_Icons_c = "$Header: Icons.c,v 1.5 88/10/25 13:00:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
***************
*** 61,66 ****
--- 61,74 ----
   * vPad and hPad usage corrected (Chris Thewalt fix).
   * Clipping now set on right GC. 
   * 1.3 -- Changed the way icon button events are handled.
+  * 1.4 -- Isaac J. Salzman, RAND Corp.
+  * reworked the way icons are handled - if IconsLabels is set, icons
+  * with pixmaps are labled at bottom & icons w/o pixmaps use a default
+  * pixmap w/a label instead of just a solid bg tile (i.e. twm style),
+  * otherwise old uwm style icons are used (typin and all).
+  * 1.5 -- Modified Isaac's changes to allow wm_option.icon.labels to
+  * work. This allows individual clients/classes to determine their
+  * icon style.  -jkh
   */
   
  #include "awm.h"
***************
*** 130,136 ****
  				      False, XA_STRING, &a_type, &a_form, &len,
  				      &after, &name);
  	  if (status != Success)
! 	       Leave((char *)NULL)
       }
       if (a_form == 0)	/* we have no bananas */
  	  Leave((char *)NULL)
--- 138,144 ----
  				      False, XA_STRING, &a_type, &a_form, &len,
  				      &after, &name);
  	  if (status != Success)
! 	       Leave( DEF_NAME ) /* use default name */
       }
       if (a_form == 0)	/* we have no bananas */
  	  Leave((char *)NULL)
***************
*** 187,198 ****
  	  XDeleteContext(dpy, awi->icon, AwmContext);
  	  if (awi->own) {
  	       XDestroyWindow(dpy, awi->icon);
! 	       if (awi->iconPixmap != IBackPixmap)
! 		    XFreePixmap(dpy, awi->iconPixmap);
  	  }
  	  awi->icon = (Drawable)NULL;
  	  awi->state ^= ST_ICON;
  	  awi->state |= ST_WINDOW;
       }
       Leave_void
  }
--- 195,213 ----
  	  XDeleteContext(dpy, awi->icon, AwmContext);
  	  if (awi->own) {
  	       XDestroyWindow(dpy, awi->icon);
! 	       if ((awi->iconPixmap != IBackPixmap) && 
! 		   (awi->iconPixmap != IDefPixmap))
! 		   XFreePixmap(dpy, awi->iconPixmap);
  	  }
  	  awi->icon = (Drawable)NULL;
  	  awi->state ^= ST_ICON;
  	  awi->state |= ST_WINDOW;
+ #ifdef WM_STATE
+ 	  awi->wm_state.icon=0;
+ 	  awi->wm_state.state=NormalState;
+ 	  XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
+ 			  PropModeReplace,&awi->wm_state,2);
+ #endif /* WM_STATE */
       }
       Leave_void
  }
***************
*** 216,222 ****
  	       *icon_w = *icon_h;
       }
       else 
! 	  *icon_w = *icon_h;
       Leave_void
  }
  
--- 231,237 ----
  	       *icon_w = *icon_h;
       }
       else 
! 	  *icon_w = *icon_h = 0; /* set to zilch if bogus name! */
       Leave_void
  }
  
***************
*** 237,247 ****
       XWMHints *XGetWMHints();
       Pixmap clip = 0;
       Window AddIcon();
  
       Entry("MakeIcon")
  
!      iconValues.background_pixmap = IBackPixmap;
!      mask = (ExposureMask | StructureNotifyMask | KeyPressMask);
       /*
        * Process window manager hints.
        */ 
--- 252,273 ----
       XWMHints *XGetWMHints();
       Pixmap clip = 0;
       Window AddIcon();
+      AwmInfoPtr awi;
+      int junk;
  
       Entry("MakeIcon")
  
!      awi = GetAwmInfo(window);
! 
!      if (awi->attrs & AT_ICONLABEL) {	/* check for iconLables - twm style */
! 	  iconValues.background_pixmap = IDefPixmap;
! 	  mask = StructureNotifyMask;
!      }
!      else {			        /* uwm style */
! 	  iconValues.background_pixmap = IBackPixmap;
! 	  mask = (ExposureMask | StructureNotifyMask | KeyPressMask);
!      }
! 
       /*
        * Process window manager hints.
        */ 
***************
*** 248,280 ****
       if (wmhints = XGetWMHints(dpy, window)) {
  	  if (wmhints->flags & IconWindowHint)
  	       Leave(AddIcon(window, wmhints->icon_window, FALSE,
! 			     (StructureNotifyMask), (Pixmap)NULL))
! 	  else if (wmhints->flags & IconPixmapHint) {
! 	       if (wmhints->flags & IconMaskHint)
! 		    clip = wmhints->icon_mask;
! 	       iconValues.background_pixmap =
! 		    MakePixmapFromBitmap(wmhints->icon_pixmap, clip,
! 					 &icon_w, &icon_h );
! 	       if (iconValues.background_pixmap)
! 		    mask = (StructureNotifyMask);
! 	       else {
! 		    iconValues.background_pixmap = IBackPixmap;
! 		    wmhints->flags &= ~IconPixmapHint;
! 		    GetDefaultSize(window, &icon_w, &icon_h);
! 	       }
! 	  }
! 	  else GetDefaultSize(window, &icon_w, &icon_h);
!      }
!      else GetDefaultSize(window, &icon_w, &icon_h);
  
       /*
!       * Fix up sizes by padding.
        */
!      if (!wmhints || !(wmhints->flags & (IconPixmapHint|IconWindowHint))) {
! 	  icon_w += (HIconPad);
! 	  icon_h += (VIconPad);
       }
  
       /*
        * Set the icon border attributes.
        */ 
--- 274,407 ----
       if (wmhints = XGetWMHints(dpy, window)) {
  	  if (wmhints->flags & IconWindowHint)
  	       Leave(AddIcon(window, wmhints->icon_window, FALSE,
! 			     (StructureNotifyMask), (Pixmap)NULL));
  
+ 	   if (wmhints->flags & IconPixmapHint) {
+ 		if (wmhints->flags & IconMaskHint)
+ 		     clip = wmhints->icon_mask;
+ 		iconValues.background_pixmap =
+ 		     MakePixmapFromBitmap(wmhints->icon_pixmap, clip,
+ 					  &icon_w, &icon_h );
+ 		if (iconValues.background_pixmap)
+ 		     mask = (StructureNotifyMask);
+ 		 else {
+ 		      iconValues.background_pixmap = IBackPixmap;
+ 		      wmhints->flags &= ~IconPixmapHint;
+ 		 }
+ 	   }
+      }
+      
       /*
!       * we now have a pixmap of some sort - either a background
!       *  tile or an actual image - get the dimensions...
        */
! 
!      if (!XGetGeometry(dpy, iconValues.background_pixmap,
! 		       &junk, &junk, &junk,
! 		       &icon_w, &icon_h, &junk, &junk )) {
! 	  Warning( "can't get geom of pixmap in MakeIcon" );
! 	  Leave( NULL );
       }
+      
+      if (awi->attrs & AT_ICONLABEL) {
+ 	  char *s;
+ 	  Pixmap p;
+ 	  int nw, nh, tw, th, hoff, voff;
+ 	   
+ 	   if (s = GetIconName(window)) {
+ 		nw = icon_w;
+ 		nh = icon_h;
  
+ 		/* find out dimensions of text, add padding */
+ 		tw = XTextWidth(IFontInfo, s, strlen(s)) + HIconPad;
+ 		th = IFontInfo->ascent + IFontInfo->descent + VIconPad;
+ 		
+ 		
+ 		/* calculate the size including the icon label */
+ 		if (nw < tw)	/* width >= text width */
+ 		     nw = tw;
+ 		
+ 		/* always tack on extra for the label height */
+ 		nh += th;
+ 		
+ 		/* now that we have dimensions, create the pixmap
+ 		   we want to eventually use as the icon window
+ 		   */
+ 		
+ 		if (!(p = XCreatePixmap(dpy, RootWindow(dpy, scr), nw, nh,
+ 					DefaultDepth(dpy, scr)))) {
+ 		     Warning("can't create pixmap in MakeIcon.");
+ 		     Leave( NULL )
+ 		}
+ 
+ 		/* calculate horizontal offset of pixmap (center it!) */
+ 		if (hoff = (nw - icon_w))
+ 		     hoff = (hoff+1)/2;
+ 		
+ 		/* if the label goes at the top, push the thing to the bottom
+ 		 * otherwise leave it at the top
+ 	         */
+ 		
+ 		voff = ILabelTop ? (th - (VIconPad+1)/2) : (VIconPad+1)/2;
+ 		
+ 		XCopyArea(dpy, iconValues.background_pixmap, p,
+ 			  IconGC, 0, 0, icon_w, icon_h, 
+ 			  hoff, voff);
+ 		
+ 		/* now that we have a centered pixmap draw
+ 		 * some text on it....
+ 		 */
+ 		
+ 		if (hoff = (nw - tw))
+ 		     hoff = (hoff+1)/2;
+ 		else
+ 		     hoff = (HIconPad ? (HIconPad+1)/2 : 1);
+ 		
+ 		/* see if string goes to top or bottom */
+ 		if (ILabelTop)
+ 		     voff = th - (IFontInfo->descent-((VIconPad+1)/2));
+ 		else
+ 		     voff = nh-(IFontInfo->descent+((VIconPad+1)/2));
+ 		
+ 		XDrawImageString(dpy, p, IconGC, hoff, voff, s, strlen(s));
+ 		
+ 		/*
+ 		 * Now free up original pixmap and replace
+ 		 * with this new one.
+ 		 */
+ 		
+ 		icon_h = nh;
+ 		icon_w = nw;
+ 		
+ 		if ((iconValues.background_pixmap != IBackPixmap) &&
+ 		    (iconValues.background_pixmap != IDefPixmap))
+ 		     XFreePixmap(dpy, iconValues.background_pixmap);
+ 		iconValues.background_pixmap = p;
+ 	   }
+      }		 
+      else {	 		/* do it the old way.... */
+ 	  int h, w;
+ 	  
+ 	  if (!wmhints || !(wmhints->flags & IconPixmapHint)) {
+ 	       GetDefaultSize(window, &w, &h);
+ 		    
+ 	       if ((w==0) || (h==0)) { /* no label, use IDefPixmap */
+ 		    iconValues.background_pixmap = IDefPixmap;
+ 			 
+ 		    /* get geom of ipixmap */
+ 		    if (!XGetGeometry(dpy, iconValues.background_pixmap,
+ 				      &junk, &junk, &junk,
+ 				      &icon_w, &icon_h, &junk, &junk)) {
+ 			 Warning("can't get geom of pixmap in MakeIcon");
+ 			 Leave(NULL)
+ 		    }
+ 	       }
+ 	       else { /* use small label icon + some padding */
+ 		    icon_h = h+VIconPad;
+ 		    icon_w = w+HIconPad;
+ 	       }
+ 	  }
+      }
       /*
        * Set the icon border attributes.
        */ 
***************
*** 282,288 ****
  	  icon_bdr = IBorderWidth;
  	  iconValues.border_pixel = IBorder;
       }
!  
       if (wmhints && (wmhints->flags & IconPositionHint)) {
  	  icon_x = wmhints->icon_x;
  	  icon_y = wmhints->icon_y;
--- 409,417 ----
  	  icon_bdr = IBorderWidth;
  	  iconValues.border_pixel = IBorder;
       }
!      /*
!       * Determine icon position....
!       */
       if (wmhints && (wmhints->flags & IconPositionHint)) {
  	  icon_x = wmhints->icon_x;
  	  icon_y = wmhints->icon_y;
***************
*** 310,316 ****
  	  }
  	  
       }
!      
       /*
        * Create the icon window.
        */
--- 439,445 ----
  	  }
  	  
       }
! 
       /*
        * Create the icon window.
        */
***************
*** 332,338 ****
  				 icon_bdr, 0, CopyFromParent, CopyFromParent,
  				 iconValues_mask, &iconValues),
  		   TRUE, mask, iconValues.background_pixmap))
- 	  
  }
  
  Window AddIcon(window, icon, own, mask, background)
--- 461,466 ----
***************
*** 349,357 ****
       if (icon == NULL)
  	  Leave(NULL)
       /*
!       * Use the text cursor whenever the mouse is in the icon window.
        */
!      XDefineCursor(dpy, icon, TextCursor);
       
       /*
        * Select "key pressed", "window exposure" and "unmap window"
--- 477,490 ----
       if (icon == NULL)
  	  Leave(NULL)
       /*
!       * Use the text cursor whenever the mouse is in the icon window, if
!       * it's a typein icon, otherwise use gumby....
        */
! 
!      if (background == IBackPixmap)
! 	 XDefineCursor(dpy, icon, TextCursor);
!      else
! 	 XDefineCursor(dpy, icon, GumbyCursor);
       
       /*
        * Select "key pressed", "window exposure" and "unmap window"
***************
*** 363,368 ****
--- 496,506 ----
       awi->icon = icon;
       awi->own = own;
       awi->iconPixmap = background;
+ #ifdef WM_STATE
+      awi->wm_state.icon=icon;
+      XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
+ 		     PropModeReplace,&awi->wm_state,2);
+ #endif /* WM_STATE */
       XSaveContext(dpy, icon, AwmContext, awi);
       Leave(icon)
  }
diff -c awm.dst/Makefile awm/Makefile
*** awm.dst/Makefile	Fri Oct 14 14:56:46 1988
--- awm/Makefile	Wed Oct 26 17:29:59 1988
***************
*** 12,18 ****
  # Ignore this message if you are not using imake.
  #
  
!             TOP = /usr/src/X.V11R2
               AS = as
               CC = cc
              CPP = /lib/cpp
--- 12,19 ----
  # Ignore this message if you are not using imake.
  #
  
!           SHELL = /bin/sh
!             TOP = /usr/graph2/X11.2
               AS = as
               CC = cc
              CPP = /lib/cpp
***************
*** 29,35 ****
         LINTOPTS = -axz
      LINTLIBFLAG = -C
             MAKE = make
!     STD_DEFINES =
      CDEBUGFLAGS = -g
          DESTDIR = /usr/X11
  
--- 30,36 ----
         LINTOPTS = -axz
      LINTLIBFLAG = -C
             MAKE = make
!     STD_DEFINES = -DPCS -DBSD
      CDEBUGFLAGS = -g
          DESTDIR = /usr/X11
  
***************
*** 86,92 ****
         LINTXLIB = $(XLIBSRC)/llib-lX11.ln
        LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
          LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
!        INCLUDES = -I$(TOP)
        MACROFILE = Sun.macros
        IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl \
  			-I$(NEWTOP)$(IRULESRC) \
--- 87,93 ----
         LINTXLIB = $(XLIBSRC)/llib-lX11.ln
        LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
          LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
!        INCLUDES = -I$(TOP) -I/usr/include/bsd
        MACROFILE = Sun.macros
        IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl \
  			-I$(NEWTOP)$(IRULESRC) \
***************
*** 98,104 ****
        MENU_ARCH = $(MENU_LIB)/rtlmenu.a
       NEATEN_LIB = /grgr/neaten
      NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
!   SYS_LIBRARIES = -ll
        OTHERSRCS = gram.y lex.l
           YFLAGS = -d
           HFILES = awm.h neaten.def.h neaten.ext.h support.h
--- 99,105 ----
        MENU_ARCH = $(MENU_LIB)/rtlmenu.a
       NEATEN_LIB = /grgr/neaten
      NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
!   SYS_LIBRARIES = -ll -lbsd
        OTHERSRCS = gram.y lex.l
           YFLAGS = -d
           HFILES = awm.h neaten.def.h neaten.ext.h support.h
***************
*** 107,112 ****
--- 108,114 ----
  # you want output (stderr and stdout) to go to the system console.
  #
  
+ # Below is just for "make noident", remove it if you've moved XRdBitFD.c
  # Use these macros if you want the RTL Neaten package.
  # Also make sure that NEATEN_LIB points to the right place. See the README
  # file for instructions (though you can just define this and give it a shot).
***************
*** 122,128 ****
  # To be totally sure, compile it with Xlib.
  #XRDOBJ=XRdBitFD.o
  
- # Below is just for "make noident", remove it if you've moved XRdBitFD.c
  # someplace else.
  XRDSRC=XRdBitFD.c
  
--- 124,129 ----
diff -c awm.dst/Menu.c awm/Menu.c
*** awm.dst/Menu.c	Fri Oct 14 14:56:36 1988
--- awm/Menu.c	Tue Oct 25 11:01:09 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_Menu_c = "$Header: Menu.c,v 1.1 88/06/15 15:08:09 jkh Exp $";
  #endif	lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_Menu_c = "$Header: Menu.c,v 1.2 88/06/15 15:08:09 jkh Exp $";
  #endif	lint
  
  #include "X11/copyright.h"
***************
*** 36,41 ****
--- 36,42 ----
   * 	This file bears little resemblance to its former namesake.
   *	Because of massive changes to support RTL menus, the Menu()
   *      function is now little more than a bootstrap for RTL.
+  * 1.2 -- Select_Window code fixed for icons.
   */
  
  #ifndef lint
***************
*** 161,167 ****
  	       target_win = event.xbutton.window;
  	  XUngrabPointer(dpy, CurrentTime);      /* Done with pointer */
  	  if (awi = GetAwmInfo(target_win))
! 	       target_win = (awi->frame) ? awi->frame : awi->client;
  	  Snatched = FALSE;
  	  Leave(target_win)
       }
--- 162,169 ----
  	       target_win = event.xbutton.window;
  	  XUngrabPointer(dpy, CurrentTime);      /* Done with pointer */
  	  if (awi = GetAwmInfo(target_win))
! 	       if (target_win != awi->icon)
! 	       	     target_win = (awi->frame) ? awi->frame : awi->client;
  	  Snatched = FALSE;
  	  Leave(target_win)
       }
diff -c awm.dst/Titlebar.c awm/Titlebar.c
*** awm.dst/Titlebar.c	Fri Oct 14 14:57:27 1988
--- awm/Titlebar.c	Wed Oct 26 17:30:53 1988
***************
*** 318,326 ****
  	  XGetZoomHints(dpy, awi->client, &sz_hints);
  	  XSetZoomHints(dpy, foster, &sz_hints);
  	  class_hints.res_name = class_hints.res_class = (char *)NULL;
! 	  if (XGetClassHint(dpy, awi->client, &class_hints) == Success)
! 	       XSetClassHint(dpy, foster, &class_hints);
! 	  
  	  XSaveContext(dpy, foster, AwmContext, awi);
       }
       else {
--- 318,327 ----
  	  XGetZoomHints(dpy, awi->client, &sz_hints);
  	  XSetZoomHints(dpy, foster, &sz_hints);
  	  class_hints.res_name = class_hints.res_class = (char *)NULL;
! 	  if (XGetClassHint(dpy, awi->client, &class_hints) == Success) {
! 	       if (class_hints.res_name || class_hints.res_class)
! 		    XSetClassHint(dpy, foster, &class_hints);
! 	  }
  	  XSaveContext(dpy, foster, AwmContext, awi);
       }
       else {
diff -c awm.dst/awm.c awm/awm.c
*** awm.dst/awm.c	Fri Oct 14 14:56:22 1988
--- awm/awm.c	Tue Oct 25 11:03:32 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_awm_c = "$Header: awm.c,v 1.5 88/08/19 15:55:56 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_awm_c = "$Header: awm.c,v 1.6 88/10/25 13:00:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
***************
*** 58,63 ****
--- 58,64 ----
   *  Western Software Lab. Convert to X11.
   * 002 -- Jordan Hubbard, U.C. Berkeley. Add title bar context stuff.
   * 003 -- Jordan Hubbard, Ardent Computer. Added gadgets, border contexts.
+  * 1.6 -- Various irritating changes. Support for WM_STATE..
   */
  
  #ifndef PCS
***************
*** 64,74 ****
  #include <sys/time.h>
  #endif
  #include <signal.h>
! #if defined(vax)
  #include <sys/file.h>
  #else
  #include <fcntl.h>
! #endif /* vax */
  #include <sys/ioctl.h>
  #include "awm.h"
  #include "X11/Xutil.h"
--- 65,75 ----
  #include <sys/time.h>
  #endif
  #include <signal.h>
! #if defined(BSD)
  #include <sys/file.h>
  #else
  #include <fcntl.h>
! #endif /* BSD */
  #include <sys/ioctl.h>
  #include "awm.h"
  #include "X11/Xutil.h"
***************
*** 382,388 ****
  		    XSelectInput(dpy, kiddies[i], event_mask);
  	       }
  	  }
! 	  XFree(kiddies);
       }
       /*
        * Calculate size of the resize pop-up window.
--- 383,390 ----
  		    XSelectInput(dpy, kiddies[i], event_mask);
  	       }
  	  }
! 	  if( *kiddies )
! 	      XFree(kiddies);
       }
       /*
        * Calculate size of the resize pop-up window.
***************
*** 399,405 ****
       PWidth = pop_width + (PBorderWidth << 1);
       pop_height = PFontInfo->ascent + PFontInfo->descent + (PPadding << 1);
       PHeight = pop_height + (PBorderWidth << 1);
!      
       /*
        * Create the pop-up window.  Create it at (0, 0) for now.  We will
        * move it where we want later.
--- 401,407 ----
       PWidth = pop_width + (PBorderWidth << 1);
       pop_height = PFontInfo->ascent + PFontInfo->descent + (PPadding << 1);
       PHeight = pop_height + (PBorderWidth << 1);
! 
       /*
        * Create the pop-up window.  Create it at (0, 0) for now.  We will
        * move it where we want later.
***************
*** 745,750 ****
--- 747,754 ----
       Grid = GetBoolRes("grid", FALSE);
       InstallColormap = GetBoolRes("installColormap", FALSE);
       Titles = GetBoolRes("titles", FALSE);
+      IconLabels = GetBoolRes("icon.labels", FALSE);
+      ILabelTop = GetBoolRes("icon.labelTop", FALSE);
       PushDown = GetBoolRes("title.push", FALSE);
       UseGadgets = GetBoolRes("gadgets", FALSE);
       Hilite = GetBoolRes("hilite", FALSE);
***************
*** 793,799 ****
       MBorder = GetColorRes("menu.border", MForeground);
  
       /*
!       * Create and store the grey and solid pixmaps
        */
       GrayPixmap = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
  					      gray_bits,
--- 797,803 ----
       MBorder = GetColorRes("menu.border", MForeground);
  
       /*
!       * Create and store the grey and solid pixmaps, and default icon pixmap
        */
       GrayPixmap = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
  					      gray_bits,
***************
*** 809,814 ****
--- 813,826 ----
  					       BackColor,
  					       DefaultDepth(dpy, scr));
  
+      
+      IDefPixmap = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
+ 					       xlogo32_bits,
+ 					       xlogo32_width, xlogo32_height,
+ 					       IForeground,
+ 					       IBackground,
+ 					       DefaultDepth(dpy, scr));
+  
       IFontInfo = GetFontRes("icon.font", DEF_ICON_FONT);
       PFontInfo = GetFontRes("popup.font", DEF_POPUP_FONT);
       MFontInfo = GetFontRes("menu.font", DEF_MENU_FONT);
***************
*** 815,823 ****
       MBoldFontInfo = GetFontRes("menu.boldFont", DEF_BOLD_FONT);
  
       
!      IBackPixmap = GetPixmapRes("icon.pixmap", GrayPixmap, IForeground,
  				IBackground);
!      
  #ifdef NEATEN
       AbsMinWidth = GetIntRes("neaten.absMinWidth", DEFAULT_ABS_MIN);
       AbsMinHeight = GetIntRes("neaten.absMinHeight", DEFAULT_ABS_MIN);
--- 827,837 ----
       MBoldFontInfo = GetFontRes("menu.boldFont", DEF_BOLD_FONT);
  
       
!      IBackPixmap = GetPixmapRes("icon.backpixmap", GrayPixmap, IForeground,
  				IBackground);
!      IDefPixmap =  GetPixmapRes("icon.defpixmap", IDefPixmap, IForeground,
! 				IBackground);
! 
  #ifdef NEATEN
       AbsMinWidth = GetIntRes("neaten.absMinWidth", DEFAULT_ABS_MIN);
       AbsMinHeight = GetIntRes("neaten.absMinHeight", DEFAULT_ABS_MIN);
***************
*** 1057,1062 ****
--- 1071,1082 ----
       tmp->back = tmp->bold = tmp->BC_back = tmp->BC_bold =
  	  tmp->iconPixmap = (Pixmap)0;
       tmp->state = ST_WINDOW;
+ #ifdef WM_STATE
+      tmp->wm_state.icon=0;
+      tmp->wm_state.state=NormalState;
+      XChangeProperty(dpy,w,XA_WM_STATE,XA_WM_STATE,32,PropModeReplace,
+ 		     &tmp->wm_state,2);
+ #endif /* WM_STATE */
       tmp->winGC = XCreateGC(dpy, w, (unsigned long)0, 0);
       /*
        * Determine attribute set by first turning on all attributes
***************
*** 1072,1077 ****
--- 1092,1099 ----
  	  tmp->attrs |= AT_BORDER;
       if (Autoraise)
  	  tmp->attrs |= AT_RAISE;
+      if (IconLabels)
+ 	  tmp->attrs |= AT_ICONLABEL;
       if (wm_hints = XGetWMHints(dpy, w)) {
  	  if (wm_hints->input)
       		tmp->attrs |= AT_INPUT;
***************
*** 1091,1096 ****
--- 1113,1121 ----
  
  	  if (cp = (XGetDefault(dpy, clh.res_class, "wm_option.autoRaise")))
  	       tmp->attrs = SetOptFlag(tmp->attrs, AT_RAISE, Pred(cp));
+ 
+ 	  if (cp = (XGetDefault(dpy, clh.res_class, "wm_option.icon.labels")))
+ 	       tmp->attrs = SetOptFlag(tmp->attrs, AT_ICONLABEL, Pred(cp));
       }
       if (clh.res_name) {
  	  if (cp = (XGetDefault(dpy, clh.res_name, "wm_option.title")))
***************
*** 1104,1109 ****
--- 1129,1137 ----
  
  	  if (cp = (XGetDefault(dpy, clh.res_name, "wm_option.autoRaise")))
  	       tmp->attrs = SetOptFlag(tmp->attrs, AT_RAISE, Pred(cp));
+ 
+ 	  if (cp = (XGetDefault(dpy, clh.res_name, "wm_option.icon.labels")))
+ 	       tmp->attrs = SetOptFlag(tmp->attrs, AT_ICONLABEL, Pred(cp));
       }
       XSaveContext(dpy, w, AwmContext, tmp);
       Leave(tmp)
diff -c awm.dst/awm.h awm/awm.h
*** awm.dst/awm.h	Fri Oct 14 14:56:54 1988
--- awm/awm.h	Tue Oct 25 11:04:07 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_awm_h = "$Header: awm.h,v 1.2 88/07/23 17:26:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_awm_h = "$Header: awm.h,v 1.3 88/10/25 17:01:24 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
***************
*** 61,66 ****
--- 61,67 ----
   *  Western Software Lab, Port to X11
   * 003 -- Jordan Hubbard, Ardent Computer
   *  Many additional declarations for awm.
+  * 1.3 -- Support for WM_STATE (Mike Wexler)
   */
   
  #include <errno.h>
***************
*** 133,138 ****
--- 134,142 ----
  #define	DEF_BOLD_FONT		"8x13bold"
  #endif	DEF_BOLD_FONT
  #define DEF_MENU_DELTA		20
+ #ifndef DEF_NAME
+ #define DEF_NAME		"NoName" /* for clients w/no name */
+ #endif
  
  #define INIT_PTEXT		{'0', '0', '0', 'x', '0', '0', '0'}
  
***************
*** 183,188 ****
--- 187,193 ----
  #define AT_RAISE	0x4
  #define AT_BORDER	0x8
  #define AT_INPUT	0x10
+ #define AT_ICONLABEL	0x20
  
  /*
   * Gadgets aren't the sort of embellishments that one uses in quantitity
***************
*** 213,221 ****
--- 218,241 ----
  #define solid_height 16
  extern char solid_bits[];
   
+ #define xlogo32_width 32
+ #define xlogo32_height 32
+ extern char xlogo32_bits[];
+ 
  /*
   * All one needs to know about an awm managed window.. (so far...)
   */
+ #ifdef WM_STATE
+ #define WithdrawState	0
+ #define NormalState	1
+ #define IconicState	3
+ 
+ typedef struct {
+   int state;
+   Window icon;
+ } WM_STATE;
+ 
+ #endif /* WM_STATE */
  typedef struct _awminfo {
       Window title, client, frame, icon;	/* Associated windows */
       Window *gadgets;			/* associated gadgets */
***************
*** 227,232 ****
--- 247,255 ----
       int state;				/* The state of the window */
       int attrs;				/* Window "attributes" */
       GC winGC;				/* GC at proper depth for window */
+ #ifdef WM_STATE
+      WM_STATE wm_state;
+ #endif /* WM_STATE */
  } AwmInfo, *AwmInfoPtr;
  
  /*
***************
*** 409,414 ****
--- 432,438 ----
  extern Pixmap GrayPixmap;	/* Gray pixmap. */
  extern Pixmap SolidPixmap;
  extern Pixmap IBackPixmap;	/* Icon window background pixmap. */
+ extern Pixmap IDefPixmap;	/* Icon pixmap for twm style icons */
  extern char *BForeground;	/* Border Context (pixmap) foreground pixel */
  extern char *BBackground;	/* Border Context (pixmap) background pixel */
  extern char *WBorder;		/* Window border pixel */
***************
*** 440,445 ****
--- 464,470 ----
  extern Cursor TargetCursor;	/* Target (select-a-window) cursor. */
  extern Cursor TitleCursor;	/* Title bar cursor */
  extern Cursor FrameCursor;	/* Frame cursor */
+ extern Cursor GumbyCursor;	/* Used in icons if not type-in   */
  extern int GadgetBorder;	/* Width of gadget borders */
  extern int ScreenWidth;		/* Display screen width. */
  extern int ScreenHeight;	/* Display screen height. */
***************
*** 496,501 ****
--- 521,528 ----
  extern Boolean SaveUnder;	/* Save unders? */
  extern Boolean Snatched;	/* We're in the middle of an no-highlight/raise op */
  extern Boolean Titles;		/* Title bars on windows? */
+ extern Boolean IconLabels;	/* Labels on pixmap icons? (twm style) */
+ extern Boolean ILabelTop;	/* label top of icon? */
  extern Boolean PushDown;	/* Down=TRUE, Up=FALSE */
  extern Boolean UseGadgets;	/* Gadget boxes in title bars? */
  extern Boolean Wall;		/* Don't allow windows past edges of screen */
***************
*** 629,631 ****
--- 656,661 ----
  extern char *PrimaryIconPlacement;
  extern char *SecondaryIconPlacement;
  #endif	NEATEN
+ #ifdef WM_STATE
+ 
+ #endif /* WM_STATE */
diff -c awm.dst/awm.man awm/awm.man
*** awm.dst/awm.man	Fri Oct 14 14:57:32 1988
--- awm/awm.man	Mon Oct 24 17:11:39 1988
***************
*** 450,472 ****
  background.  You cannot include a new line character within a shell
  command. 
  .IP "Text strings"
! Text strings are placed in the window server's cut buffer.
  .IP
! Strings with a new line character must begin with an 
! up arrow (^), which is stripped during the copy operation.  
  .IP
! Strings without a new line must begin with the bar character (|), 
! which is stripped during the copy operation.
  .IP "Booleans"
  Any boolean variable previously described, e.g., \fBreverse\fP or
  \fBautoraise\fP.  The current state of a boolean variable in a menu
  will be indicated with a check mark (a check mark means the boolean is
! set to true).
  .PP
  SPECIAL NOTE:
  .PP
  Menus bound to title bars, gadget boxes or borders cause (where logical)
! the selected menu action to occur automatically on the titled window
  as opposed to having to select a window for the action. However, actions
  requiring mouse tracking (i.e. move, resize) will usually \fBnot\fP work well
  in this context. While this limitation will be eliminated in the near future,
--- 450,475 ----
  background.  You cannot include a new line character within a shell
  command. 
  .IP "Text strings"
! Text strings are placed in the window server's cut buffer. The strings
! must be preceeded by one of:
  .IP
! A carat (^), which is stripped off, signifies that
! the string will automatically be followed by a newline (I.E using '^'
! causes one to be added at the end).
  .IP
! A vertical bar (|), also stripped off, signifies the the string
! should not end with a newline.
  .IP "Booleans"
  Any boolean variable previously described, e.g., \fBreverse\fP or
  \fBautoraise\fP.  The current state of a boolean variable in a menu
  will be indicated with a check mark (a check mark means the boolean is
! set to true). Note that the boolean is *not* preceeded by "awm." as
! it is in the resource database.
  .PP
  SPECIAL NOTE:
  .PP
  Menus bound to title bars, gadget boxes or borders cause (where logical)
! the selected menu action to occur automatically on the client window
  as opposed to having to select a window for the action. However, actions
  requiring mouse tracking (i.e. move, resize) will usually \fBnot\fP work well
  in this context. While this limitation will be eliminated in the near future,
***************
*** 490,504 ****
  .bp
  .SH X DEFAULTS
  .PP
! A number of variables that were previously specified in the \fI.uwmrc\fP file
! have been moved out of the \fI.awmrc\fP file and are now retrieved from
  the resource database. When a value cannot be found, a default 
! (compiled into \fIawm\fP) is substituted. The resource database is also
! now queried to determine whether or not to title a given window. See
! the end of this section for details.
  .PP
  In the descriptions below, variable names are listed in boldface,
  their type in parenthesis, and their default value in double quotes.
  .sp
  .IP "\fBautoraise\fP (boolean) ``off''"
  Automatically raise a window to the top when it gains the
--- 493,511 ----
  .bp
  .SH X DEFAULTS
  .PP
! A number of variables that used to be specified in the \fI.uwmrc\fP file (of
! \fIuwm\fP, for those familiar with it) are now retrieved from
  the resource database. When a value cannot be found, a default 
! (compiled into \fIawm\fP) is substituted. A much wider range of
! options can be specified this way and it is suggested that you
! read the following section carefully before bringing up
! awm.
  .PP
  In the descriptions below, variable names are listed in boldface,
  their type in parenthesis, and their default value in double quotes.
+ All resources are preceeded by an implied "awm.", as is the standard.
+ I.E. "autoraise" would be specified as: "awm.autoraise: ..." in the
+ resource database.
  .sp
  .IP "\fBautoraise\fP (boolean) ``off''"
  Automatically raise a window to the top when it gains the
***************
*** 609,618 ****
--- 616,637 ----
  icons are left alone.\fR
  .IP "\fBicon.background\fP (string) ``\fBbackground\fP''"
  Icon (pixmap) background color.
+ .IP "\fBicon.backpixmap\fP (string) ``grey''"
+ Pixmap to display as icon background for text icons.
+ Note that this pixmap is only used for "text" icons, I.E. icons
+ in the \fBuwm\fP style of a line of editable text. This should
+ typically be cross hatch pattern or some similar background weave
+ that will be displayed surrounding the text. For "pictoral" icons,
+ use \fBicon.defpixmap\fP.
+ See also: \fBpath\fP, \fBicon.foreground\fP, \fBicon.background\fP,
+ \fBicon.defpixmap\fP.
  .IP "\fBicon.border\fP (string) ``\fBicon.foreground\fP''"
  Color to use for icon borders.
  .IP "\fBicon.borderWidth\fP (int) ``2''"
  Width of icon border in pixels.
+ .IP "\fBicon.defpixmap\fP (string) ``xlogo''"
+ For windows that don't specify their own pixmaps, use this image.
+ This is only useful if \fBicon.labels\fP is turned on.
  .IP "\fBicon.font\fP (string) ``8x13''"
  Which font to use for icon text.
  .IP "\fBicon.foreground\fP (string) ``\fBforeground\fP''"
***************
*** 619,624 ****
--- 638,652 ----
  Icon (pixmap) foreground color.
  .IP "\fBicon.hPad\fP (int) ``2''"
  Number of pixels to pad icon text horizontally.
+ .IP "\fBicon.labels\fP (boolean) ``off''"
+ Specifys that icons should be displayed in the "twm" style. I.E.
+ The icon pixmap (or \fBicon.defpixmap\fP if the window has no icon
+ pixmap) with the icon name displayed underneath (or above, if
+ \fBicon.labelTop\fP is set).
+ .IP "\fBicon.labelTop\fP (boolean) ``off''"
+ Specifys that "labeled" icons should have the text portion displayed
+ on top, rather than the bottom. Only useful if \fBicon.labels\fP is
+ set.
  .IP "\fBicon.vPad\fP (int) ``2''"
  Number of pixels to pad icon text vertically.
  .IP "\fBicon.text.background\fP (string) ``\fBicon.background\fP''"
***************
*** 625,637 ****
  Background color to use for icon text.
  .IP "\fBicon.text.foreground\fP (string) ``\fBicon.foreground\fP''"
  Foreground color to use for icon text.
- .IP "\fBicon.pixmap\fP (string) ``grey''"
- Pixmap to display as icon background.
- Since this pixmap will be used to tile all icons owned
- by \fIawm\fP, it's probably not a good idea to put application
- specific pictures in it. More typically, this will be a cross
- hatch pattern or some similar background weave.
- See also: \fBpath\fP, \fBicon.foreground\fP, \fBicon.background\fP.
  .IP "\fBinstallColormap\fP (boolean) ``false''"
  Install a given window's colormap when the pointer enters it.
  When the pointer leaves, the default colormap is installed.
--- 653,658 ----
***************
*** 732,746 ****
  .IP "\fBpushRelative\fP (boolean) ``on''"
  When a window is pushed, push 1/\fBpush\fP of the window.
  If off, move window \fBpush\fP pixels.
- .IP "\fBpushDown\fP (boolean) ``false''"
- When adding a title bar or border context to a window, put the border or
- title bar area at the current x, y position and "push" the window down to
- make room. For windows with an upper edge at or near the top of the screen,
- this gives the most asthetically pleasing results. For windows near the
- bottom, it does not.
- If set to false, the title bar/border will be added "on top" and the window
- will not be moved down. Note that the setting of this resource also affects
- how the window is maniplated during resizes, title removals, etc.
  .IP "\fBraiseDelay\fP (int) ``100''"
  Amount of time in milliseconds to wait (while window has focus)
  before raising. If pointer leaves window before time elapses, raise is not
--- 753,758 ----
***************
*** 792,797 ****
--- 804,818 ----
  defined and \fBhilite\fP is set.
  .IP "\fBtitle.text.background\fP (string) ``\fBtitle.background\fP''"
  Background color to use when drawing title bar text.
+ .IP "\fBtitle.push\fP (boolean) ``false''"
+ When adding a title bar or border context to a window, put the border or
+ title bar area at the current x, y position and "push" the window down to
+ make room. For windows with an upper edge at or near the top of the screen,
+ this gives the most asthetically pleasing results. For windows near the
+ bottom, it does not.
+ If set to false, the title bar/border will be added "on top" and the window
+ will not be moved down. Note that the setting of this resource also affects
+ how the window is maniplated during resizes, title removals, etc.
  .IP "\fBtitle.text.foreground\fP (string) ``\fBtitle.foreground\fP''"
  Foreground color to use when drawing title bar.
  .IP "\fBtitles\fP (boolean) ``off''"
***************
*** 827,836 ****
  .IP "\fIname\fP\fB.wm_option.autoRaise\fP (boolean) "
  .IP "\fIname\fP\fB.wm_option.borderContext\fP (boolean) "
  .IP "\fIname\fP\fB.wm_option.gadgets\fP (boolean) "
  .IP "\fIname\fP\fB.wm_option.title\fP (boolean) "
  
  These resources determine whether or not a given application really wants
! a title, gadgets, border context area or to be auto-raised.
  The application's CLASS and NAME (in the WM_CLASS property) are checked
  against the string supplied for \fIname\fP (for example:
  Xclock*wm_option.title:  off).
--- 848,858 ----
  .IP "\fIname\fP\fB.wm_option.autoRaise\fP (boolean) "
  .IP "\fIname\fP\fB.wm_option.borderContext\fP (boolean) "
  .IP "\fIname\fP\fB.wm_option.gadgets\fP (boolean) "
+ .IP "\fIname\fP\fB.wm_option.icon.labels\fP (boolean) "
  .IP "\fIname\fP\fB.wm_option.title\fP (boolean) "
  
  These resources determine whether or not a given application really wants
! a title, gadgets, border context area, to be auto-raised etc etc..
  The application's CLASS and NAME (in the WM_CLASS property) are checked
  against the string supplied for \fIname\fP (for example:
  Xclock*wm_option.title:  off).
diff -c awm.dst/exp_path.c awm/exp_path.c
*** awm.dst/exp_path.c	Fri Oct 14 14:57:28 1988
--- awm/exp_path.c	Tue Oct 25 11:05:54 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_exp_path_c = "$Header: exp_path.c,v 1.2 88/06/15 15:26:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_exp_path_c = "$Header: exp_path.c,v 1.3 88/10/25 15:26:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
***************
*** 31,41 ****
  #endif
  #include <pwd.h>
  #include <stdio.h>
! #if defined(vax)
  #include <sys/file.h>
  #else
  #include <fcntl.h>
! #endif /* vax */
  #include "awm.h"
  
  /*
--- 31,41 ----
  #endif
  #include <pwd.h>
  #include <stdio.h>
! #if defined(BSD)
  #include <sys/file.h>
  #else
  #include <fcntl.h>
! #endif /* BSD */
  #include "awm.h"
  
  /*
diff -c awm.dst/globals.c awm/globals.c
*** awm.dst/globals.c	Fri Oct 14 14:56:49 1988
--- awm/globals.c	Tue Oct 25 11:05:42 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_globals_c = "$Header: globals.c,v 1.3 88/07/23 17:26:00 jkh Exp $";
  #endif  lint
   
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_globals_c = "$Header: globals.c,v 1.4 88/10/25 17:26:00 jkh Exp $";
  #endif  lint
   
  #include "X11/copyright.h"
***************
*** 60,65 ****
--- 60,66 ----
   *  Western Software Lab. April 17, 1987
   *  Convert to X11
   * 003 -- Jordan Hubbard, U.C. Berkeley. Misc new vars.
+  * 1.4 -- Vars added for new icon stuff.
   */
   
  #include "awm.h"
***************
*** 75,80 ****
--- 76,82 ----
  Pixmap GrayPixmap;		/* Gray pixmap. */
  Pixmap SolidPixmap;		/* Solid pixmap */
  Pixmap IBackPixmap;		/* Icon window background pixmap. */
+ Pixmap IDefPixmap;		/* default icon pixmap for IconLabels */
  Pixel ForeColor;		/* Generic foreground color */
  Pixel BackColor;		/* Generic background color */
  Pixel IBorder;			/* Icon window border color. */
***************
*** 103,108 ****
--- 105,111 ----
  Cursor TargetCursor;		/* Target (select-a-window) cursor. */
  Cursor TitleCursor;		/* Titlebar cursor */
  Cursor FrameCursor;		/* Border context cursor */
+ Cursor GumbyCursor;		/* Used in icons if not type-in */
  int GadgetBorder;		/* Width of gadget borders */
  int ScreenWidth;		/* Display screen width. */
  int ScreenHeight;		/* Display screen height. */
***************
*** 153,158 ****
--- 156,163 ----
  Boolean RootResizeBox;		/* Resize window is placed over sized window? */
  Boolean ResizeRelative;		/* resizes should be relative to window edge */
  Boolean Titles;			/* Title bar frob on windows? */
+ Boolean IconLabels;		/* icon labels? */
+ Boolean ILabelTop;		/* icon label on top? */
  Boolean UseGadgets;		/* Gadget bars on titles? */
  Boolean FrameFocus;		/* Treat the frame as part of the window? */
  Boolean Reverse;		/* Reverse video? */
***************
*** 193,198 ****
--- 198,216 ----
       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  };
+ 
+ char xlogo32_bits[] = {
+    0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x00, 0xc0, 0xfc, 0x03, 0x00, 0x60,
+    0xf8, 0x07, 0x00, 0x30, 0xf8, 0x07, 0x00, 0x18, 0xf0, 0x0f, 0x00, 0x0c,
+    0xe0, 0x1f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x03,
+    0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00,
+    0x00, 0xfe, 0x31, 0x00, 0x00, 0xfc, 0x33, 0x00, 0x00, 0xf8, 0x1b, 0x00,
+    0x00, 0xf0, 0x0d, 0x00, 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x60, 0x1f, 0x00,
+    0x00, 0xb0, 0x3f, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x98, 0x7f, 0x00,
+    0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x03, 0xfc, 0x03,
+    0x80, 0x01, 0xfc, 0x03, 0xc0, 0x00, 0xf8, 0x07, 0xc0, 0x00, 0xf0, 0x0f,
+    0x60, 0x00, 0xe0, 0x1f, 0x30, 0x00, 0xe0, 0x1f, 0x18, 0x00, 0xc0, 0x3f,
+    0x0c, 0x00, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff};
  
  int scr;
  Display *dpy;
diff -c awm.dst/gram.y awm/gram.y
*** awm.dst/gram.y	Fri Oct 14 14:56:52 1988
--- awm/gram.y	Tue Oct 25 10:59:25 1988
***************
*** 50,55 ****
--- 50,56 ----
   *  Western Software Lab. Convert to X11.
   * 002 -- Jordan Hubbard, U.C. Berkeley. New keywords. Menu
   * changes, gadget boxes, title bars, the kitchen sink.
+  * 1.6 -- Memory leaks fixed.
   */
  
  %{
***************
*** 58,64 ****
  
  
  #ifndef lint
! static char *rcsid_gram_y = "$Header: gram.y,v 1.5 88/08/19 15:55:04 jkh Exp $";
  #endif	lint
  
  #include "X11/Xlib.h"
--- 59,65 ----
  
  
  #ifndef lint
! static char *rcsid_gram_y = "$Header: gram.y,v 1.6 88/10/25 15:55:04 jkh Exp $";
  #endif	lint
  
  #include "X11/Xlib.h"
***************
*** 76,81 ****
--- 77,84 ----
  #define C_PIXMAP	5	/* IsPixmap */
  #define C_ACTION	6	/* IsAction */
   
+ #define GADGET_TOKEN "gadget"
+ 
       static int ki;			/* Keyword index. */
       static int gadgnum;		/* # of gadget we're initing */
       static int g_offset;		/* The gadget offset specified */
***************
*** 364,370 ****
        $$ = keywordlookup(yylval.sval);
   }
  |	STRING gadget_subscript {
!      $$ = keywordlookup("gadget");
       gadgnum = $2;
  }
  ;
--- 367,381 ----
        $$ = keywordlookup(yylval.sval);
   }
  |	STRING gadget_subscript {
!      char *ptr;
!      char *malloc();
! 
!      ptr = malloc(strlen(GADGET_TOKEN) + 1);
!      if (ptr == NULL) {
!        Error("out of space");
!      }
!      strcpy(ptr, GADGET_TOKEN);
!      $$ = keywordlookup(ptr);
       gadgnum = $2;
  }
  ;
***************
*** 406,412 ****
  	  yyerror(msg);
       }
       else {
! 	  $$ = contexprlookup("gadget") | (1 << (BITS_USED + $2));
       }
  }
  ;
--- 417,431 ----
  	  yyerror(msg);
       }
       else {
!          char *ptr;
! 	 char *malloc();
! 
! 	 ptr = malloc(strlen(GADGET_TOKEN) + 1);
! 	 if (ptr == NULL) {
! 	   Error("out of space");
! 	 }
! 	 strcpy(ptr, GADGET_TOKEN);
! 	  $$ = contexprlookup(ptr) | (1 << (BITS_USED + $2));
       }
  }
  ;
***************
*** 546,552 ****
  
       Entry("LookupColor")
  
!      if (!XAllocNamedColor(dpy, cmap, string, &vis_ret, &act_ret)) {
  	 sprintf(msg, "Can't allocate color '%s', using default\n", string);
  	 yywarn(msg);
  	 if (fail)
--- 565,572 ----
  
       Entry("LookupColor")
  
!      if (!(string && XParseColor(dpy, cmap, string, &vis_ret, &act_ret) &&
! 	XAllocColor(dpy, cmap, &vis_ret))) {
  	 sprintf(msg, "Can't allocate color '%s', using default\n", string);
  	 yywarn(msg);
  	 if (fail)
***************
*** 572,578 ****
  
       if (!string)
  	 Leave((Pixel)0)
!      if (!XAllocNamedColor(dpy, cmap, string, &vis_ret, &act_ret))
  	 Leave((Pixel)0)
       Leave(vis_ret.pixel)
  }
--- 592,599 ----
  
       if (!string)
  	 Leave((Pixel)0)
!      if (!(string && XParseColor(dpy, cmap, string, &vis_ret) &&
! 	XAllocColor(dpy, cmap, &vis_ret)))
  	 Leave((Pixel)0)
       Leave(vis_ret.pixel)
  }
diff -c awm.dst/support.c awm/support.c
*** awm.dst/support.c	Fri Oct 14 14:57:27 1988
--- awm/support.c	Tue Oct 25 11:02:29 1988
***************
*** 2,8 ****
  
  
  #ifndef lint
! static char *rcsid_support_c = "$Header: support.c,v 1.1 88/06/15 15:26:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
--- 2,8 ----
  
  
  #ifndef lint
! static char *rcsid_support_c = "$Header: support.c,v 1.2 88/10/25 15:26:00 jkh Exp $";
  #endif  lint
  
  #include "X11/copyright.h"
***************
*** 24,35 ****
   * pertaining to distribution of the software without specific, written
   * prior permission.
   *
   */
  
  #include "support.h"
  #include <stdio.h>
       
!      int _rtn_level;
  int _rtn_trace;
  
  static struct func_stack {
--- 24,39 ----
   * pertaining to distribution of the software without specific, written
   * prior permission.
   *
+  * REVISION HISTORY:
+  *
+  * 1.2 -- Version of strlen() that accepts NULL strings added (#ifdef it
+  * in if your system needs it).
   */
  
  #include "support.h"
  #include <stdio.h>
       
! int _rtn_level;
  int _rtn_trace;
  
  static struct func_stack {
***************
*** 90,92 ****
--- 94,115 ----
       free(ptr);
       _rtn_level--;
  }
+ 
+ /*
+  * Some systems retch when you pass strlen() a NULL pointer.
+  * Here's a way of getting around it.
+  */
+ 
+ #ifdef hlh
+ strlen(s)
+ char *s;
+ {
+ 	int count = 0;
+ 
+ 	if (s == 0)
+ 		return(0);
+ 	while (*s++)
+ 		count++;
+ 	return(count);
+ }
+ #endif /* hlh */
*** awm.dst/patchlevel.h	Wed Oct 26 15:31:42 1988
--- awm/patchlevel.h	Wed Oct 26 14:34:45 1988
***************
*** 0 ****
--- 1,2 ----
+ #define PATCHLEVEL 8
+ 
-- 
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
Moderator of comp.sources.x



More information about the Comp.sources.x mailing list