home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume2 / awm / patch8 next >
Encoding:
Internet Message Format  |  1993-04-28  |  54.5 KB

  1. From: mikew@wyse.wyse.com (Mike Wexler)
  2. Newsgroups: comp.sources.x
  3. Subject: v02i007:  Ardent Window Manager, Patch8
  4. Message-ID: <1800@wyse.wyse.com>
  5. Date: 26 Oct 88 22:37:24 GMT
  6. Approved: mikew@wyse.com
  7.  
  8. Submitted-by: meepmeep!jkh@unido ( Jordan K. Hubbard )
  9. Posting-number: Volume 2, Issue 7
  10. Archive-name: awm/patch8
  11.  
  12.  
  13.  
  14. ---- patch 08 ----
  15. /*
  16.  * CHANGES:
  17.  *
  18.  * Many many annoying bugs fixed. Windows that start up iconic no longer
  19.  * leave artifacts. Gadgets offsets are now handled properly (broken
  20.  * by last patch). Pixmap icons can now have labels as well (ala twm).
  21.  * Some sysV/BSD compatibility changes made. Support for WM_STATE added
  22.  * if your server supports XA_WM_STATE. Compile awm with -DWM_STATE to
  23.  * enable this.
  24.  *
  25.  * UPDATED:
  26.  *
  27.  * Cursors.c
  28.  * Error.c
  29.  * Gadget.c
  30.  * GetButton.c
  31.  * Iconify.c
  32.  * Icons.c
  33.  * Menu.c
  34.  * Titlebar.c
  35.  * awm.c
  36.  * awm.h
  37.  * awm.man
  38.  * exp_path.c
  39.  * globals.c
  40.  * gram.y
  41.  * support.c
  42.  *
  43.  */
  44.  
  45. diff -c awm.dst/Cursors.c awm/Cursors.c
  46. *** awm.dst/Cursors.c    Fri Oct 14 14:56:26 1988
  47. --- awm/Cursors.c    Tue Oct 25 11:07:08 1988
  48. ***************
  49. *** 2,8 ****
  50.   
  51.   
  52.   #ifndef lint
  53. ! static char *rcsid_StoreCursors_c = "$Header: Cursors.c,v 1.1 88/06/15 15:21:52 jkh Exp $";
  54.   #endif    lint
  55.   
  56.   #include "X11/copyright.h"
  57. --- 2,8 ----
  58.   
  59.   
  60.   #ifndef lint
  61. ! static char *rcsid_StoreCursors_c = "$Header: Cursors.c,v 1.2 88/10/25 15:21:52 jkh Exp $";
  62.   #endif    lint
  63.   
  64.   #include "X11/copyright.h"
  65. ***************
  66. *** 57,62 ****
  67. --- 57,63 ----
  68.    * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  69.    * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
  70.    *        Convert to X11
  71. +  * 1.2 -- Gumby cursor added (This was a major revision).
  72.    */
  73.   
  74.   #ifndef lint
  75. ***************
  76. *** 127,132 ****
  77. --- 128,141 ----
  78.       TargetCursor = XCreateFontCursor(dpy, XC_circle);    
  79.       if (TargetCursor == FAILURE) {
  80.       Error("StoreCursors -> Unable to store TargetCursor.");
  81. +     }
  82. +     /*
  83. +      * Gumby cursor used in icons if icon is not a typein icon
  84. +      * (otherwise use textcursor
  85. +      */
  86. +     GumbyCursor = XCreateFontCursor(dpy, XC_gumby);    
  87. +     if (GumbyCursor == FAILURE) {
  88. +     Error("StoreCursors -> Unable to store GumbyCursor.");
  89.       }
  90.       Leave(0)
  91.   }
  92. diff -c awm.dst/Error.c awm/Error.c
  93. *** awm.dst/Error.c    Fri Oct 14 14:56:26 1988
  94. --- awm/Error.c    Tue Oct 25 11:06:36 1988
  95. ***************
  96. *** 2,15 ****
  97.   
  98.   
  99.   #ifndef lint
  100. ! static char *rcsid_Error_c = "$Header: Error.c,v 1.2 88/07/24 01:58:56 jkh Exp $";
  101.   #endif    lint
  102.   
  103. ! #if defined(vax)
  104.   #include <sys/file.h>
  105.   #else
  106.   #include <fcntl.h>
  107. ! #endif /* vax */
  108.   
  109.   #include <signal.h>
  110.   #include "X11/copyright.h"
  111. --- 2,15 ----
  112.   
  113.   
  114.   #ifndef lint
  115. ! static char *rcsid_Error_c = "$Header: Error.c,v 1.3 88/10/25 01:58:56 jkh Exp $";
  116.   #endif    lint
  117.   
  118. ! #if defined(BSD)
  119.   #include <sys/file.h>
  120.   #else
  121.   #include <fcntl.h>
  122. ! #endif /* BSD */
  123.   
  124.   #include <signal.h>
  125.   #include "X11/copyright.h"
  126. ***************
  127. *** 62,67 ****
  128. --- 62,68 ----
  129.    * MODIFICATION HISTORY
  130.    *
  131.    * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  132. +  * 1.3 -- Cleanup. Fixed bug.
  133.    */
  134.   
  135.   #ifndef lint
  136. diff -c awm.dst/FocusChng.c awm/FocusChng.c
  137. *** awm.dst/FocusChng.c    Fri Oct 14 14:56:45 1988
  138. --- awm/FocusChng.c    Mon Oct 17 13:02:44 1988
  139. ***************
  140. *** 41,47 ****
  141.   
  142.   #include "awm.h"
  143.   
  144. ! #if defined(sun) || defined(ibm032) || defined(titan) || defined(vax)
  145.   #include <sys/time.h>
  146.   #else
  147.   #include <time.h>
  148. --- 41,47 ----
  149.   
  150.   #include "awm.h"
  151.   
  152. ! #if defined(BSD)
  153.   #include <sys/time.h>
  154.   #else
  155.   #include <time.h>
  156. ***************
  157. *** 82,87 ****
  158. --- 82,90 ----
  159.              if (XCheckTypedWindowEvent(dpy, w, LeaveNotify, &event))
  160.               if (event.xcrossing.detail != NotifyInferior)
  161.                Leave(FALSE)
  162. +            /*
  163. +         * Install a colormap, if necessary.
  164. +         */
  165.              if (InstallColormap) {
  166.               XWindowAttributes xwa;
  167.   
  168. ***************
  169. *** 88,93 ****
  170. --- 91,103 ----
  171.               XGetWindowAttributes(dpy, w, &xwa);
  172.               XInstallColormap(dpy, xwa.colormap);
  173.              }
  174. +            /*
  175. +         * If Autoraise is set, raise that puppy..
  176. +         */
  177. +            if  (Autoraise && (awi->attrs & AT_RAISE))
  178. +             XRaiseWindow(dpy, (awi->frame) ? awi->frame : awi->client);
  179.              if (!FocusSetByUser && FocusWindow != awi->client &&
  180.              (awi->attrs & AT_INPUT)) {
  181.               if (FrameFocus) {
  182. ***************
  183. *** 104,115 ****
  184.              FocusWindow = awi->client;
  185.              FocusSetByWM = FALSE;
  186.         }
  187. -       /*
  188. -        * If Autoraise is set, raise that puppy..
  189. -        */
  190. -       if (Autoraise && (awi->attrs & AT_RAISE))
  191. -            XRaiseWindow(dpy, (awi->frame) ? awi->frame : awi->client);
  192.         LightsOn(awi);
  193.        }
  194.        Leave(FALSE)
  195. --- 114,119 ----
  196. diff -c awm.dst/Gadget.c awm/Gadget.c
  197. *** awm.dst/Gadget.c    Fri Oct 14 14:56:47 1988
  198. --- awm/Gadget.c    Tue Oct 25 18:13:39 1988
  199. ***************
  200. *** 2,8 ****
  201.   
  202.   
  203.   #ifndef lint
  204. ! static char *rcsid_Gadget_c = "$Header: Gadget.c,v 1.3 88/07/23 17:26:00 jkh Exp $";
  205.   #endif  lint
  206.   
  207.   #include "X11/copyright.h"
  208. --- 2,8 ----
  209.   
  210.   
  211.   #ifndef lint
  212. ! static char *rcsid_Gadget_c = "$Header: Gadget.c,v 1.4 88/07/23 17:26:00 jkh Exp $";
  213.   #endif  lint
  214.   
  215.   #include "X11/copyright.h"
  216. ***************
  217. *** 35,40 ****
  218. --- 35,41 ----
  219.    *  GadgetBorders used in placement calculations, initial
  220.    *  gadget positions calculated correcly. (Chris Thewalt fixes).
  221.    * 1.3 -- Color handling changed to deal with multiple colormaps.
  222. +  * 1.4 -- Fixed really silly bug with gadget offset.
  223.    *
  224.    */
  225.   
  226. ***************
  227. *** 128,137 ****
  228.         if (gdec->gravity != NoGadgetGravity)
  229.              dir = gdec->gravity;
  230.         ny = xwa.height - gdec->high;
  231. !       if (ny <= 0) {
  232. !            ny = 0;
  233.                  gdec->high = xwa.height;
  234. -           }
  235.         else
  236.              ny = (ny / 2) - 1;
  237.         if (ny < 0)
  238. --- 129,136 ----
  239.         if (gdec->gravity != NoGadgetGravity)
  240.              dir = gdec->gravity;
  241.         ny = xwa.height - gdec->high;
  242. !       if (ny <= 0)
  243.                  gdec->high = xwa.height;
  244.         else
  245.              ny = (ny / 2) - 1;
  246.         if (ny < 0)
  247. ***************
  248. *** 139,145 ****
  249.         if (dir == LeftGadgetGravity) {
  250.              nx = lx + gdec->offset;
  251.              if (lx != 0) /* not first time through, add pad */
  252. !             nx = lx + GadgetPad;
  253.              if (nx < 0)
  254.               nx = 0;
  255.              lx = nx + gdec->wide;
  256. --- 138,144 ----
  257.         if (dir == LeftGadgetGravity) {
  258.              nx = lx + gdec->offset;
  259.              if (lx != 0) /* not first time through, add pad */
  260. !             nx += GadgetPad;
  261.              if (nx < 0)
  262.               nx = 0;
  263.              lx = nx + gdec->wide;
  264. diff -c awm.dst/GetButton.c awm/GetButton.c
  265. *** awm.dst/GetButton.c    Fri Oct 14 14:56:30 1988
  266. --- awm/GetButton.c    Wed Oct 26 16:40:35 1988
  267. ***************
  268. *** 2,8 ****
  269.   
  270.   
  271.   #ifndef lint
  272. ! static char *rcsid_GetButton_c = "$Header: GetButton.c,v 1.5 88/08/19 15:55:45 jkh Exp $";
  273.   #endif    lint
  274.   
  275.   #include "X11/copyright.h"
  276. --- 2,8 ----
  277.   
  278.   
  279.   #ifndef lint
  280. ! static char *rcsid_GetButton_c = "$Header: GetButton.c,v 1.6 88/10/25 23:55:45 jkh Exp $";
  281.   #endif    lint
  282.   
  283.   #include "X11/copyright.h"
  284. ***************
  285. *** 250,255 ****
  286. --- 250,257 ----
  287.                 Leave(FALSE)
  288.         if (IsIcon(win, FALSE))
  289.             Leave(FALSE)
  290. +           if (!(awi->state & (ST_PLACED | ST_WINDOW)))
  291. +               Leave(FALSE)
  292.             XMapWindow(dpy, awi->frame);
  293.         XMapWindow(dpy, awi->client);
  294.             Leave(FALSE)
  295. ***************
  296. *** 293,307 ****
  297.              break;
  298.   
  299.         case XA_WM_ICON_NAME:
  300. -            /*
  301. -         * Icon was modified by type-in (I still think that's a
  302. -         * gross feature, but some people like it... sigh),
  303. -         * ignore this event.
  304. -         */
  305.              if (Icon_modified == TRUE) {
  306.               Icon_modified = FALSE;    /* reset */
  307.               Leave(FALSE)
  308.              }
  309.              if (awi->icon && awi->own && awi->iconPixmap == IBackPixmap) {
  310.               win = awi->icon;
  311.               status = XGetWindowAttributes(dpy, win, &win_info);
  312. --- 295,312 ----
  313.              break;
  314.   
  315.         case XA_WM_ICON_NAME:
  316.              if (Icon_modified == TRUE) {
  317. +             /*
  318. +              * Icon was modified by type-in (I still think that's a
  319. +              * gross feature, but some people like it... sigh),
  320. +              * ignore this event.
  321. +              */
  322.               Icon_modified = FALSE;    /* reset */
  323.               Leave(FALSE)
  324.              }
  325. +            /*
  326. +         * Icon was modifed in a more civilized fashion.
  327. +         */
  328.              if (awi->icon && awi->own && awi->iconPixmap == IBackPixmap) {
  329.               win = awi->icon;
  330.               status = XGetWindowAttributes(dpy, win, &win_info);
  331. ***************
  332. *** 341,346 ****
  333. --- 346,354 ----
  334.         case XA_WM_NORMAL_HINTS:
  335.         case XA_WM_SIZE_HINTS:
  336.         case XA_WM_ZOOM_HINTS:
  337. + #ifdef WM_STATE
  338. +       case XA_WM_STATE:
  339. + #endif /* WM_STATE */
  340.              break;
  341.   
  342.         default:
  343. ***************
  344. *** 456,462 ****
  345.        /*
  346.         * If kbd_str is a "non-string", then don't do anything.
  347.         */
  348. !      if (nbytes == 0) {
  349.         if (icon_str)
  350.              free(icon_str);
  351.         Leave(FALSE)
  352. --- 464,470 ----
  353.        /*
  354.         * If kbd_str is a "non-string", then don't do anything.
  355.         */
  356. !      if (nbytes == 0 || !kbd_str || !*kbd_str) {
  357.         if (icon_str)
  358.              free(icon_str);
  359.         Leave(FALSE)
  360. ***************
  361. *** 731,736 ****
  362. --- 739,748 ----
  363.        if (!awi)
  364.             Leave(FALSE)
  365.   
  366. +      if (awi->icon == w) {
  367. +       XConfigureWindow(dpy, w, mask, xwc);
  368. +       Leave(TRUE)
  369. +      }
  370.        if (awi->attrs & AT_BORDER) {
  371.         bcv = BContext + 1;
  372.         bch = bcv * 2;
  373. diff -c awm.dst/Iconify.c awm/Iconify.c
  374. *** awm.dst/Iconify.c    Fri Oct 14 14:56:32 1988
  375. --- awm/Iconify.c    Tue Oct 25 11:05:11 1988
  376. ***************
  377. *** 2,8 ****
  378.   
  379.   
  380.   #ifndef lint
  381. ! static char *rcsid_Iconify_c = "$Header: Iconify.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
  382.   #endif  lint
  383.   
  384.   #include "X11/copyright.h"
  385. --- 2,8 ----
  386.   
  387.   
  388.   #ifndef lint
  389. ! static char *rcsid_Iconify_c = "$Header: Iconify.c,v 1.2 88/10/24 15:24:56 jkh Exp $";
  390.   #endif  lint
  391.   
  392.   #include "X11/copyright.h"
  393. ***************
  394. *** 63,68 ****
  395. --- 63,69 ----
  396.    * 003 -- Jordan Hubbard, Ardent Computer.
  397.    *  Many mods to cope with context manager, titled windows. Almost a total
  398.    *  rewrite.
  399. +  * 1.2 -- Support for IconLabels.. (Isaac Salzman). A few fixes (jkh).
  400.    */
  401.   
  402.   #include "awm.h"
  403. ***************
  404. *** 168,178 ****
  405. --- 169,189 ----
  406.              XRemoveFromSaveSet(dpy, awi->client);
  407.         awi->state ^= ST_ICON;
  408.         awi->state |= ST_WINDOW;
  409. + #ifdef WM_STATE
  410. +       awi->wm_state.state=NormalState;
  411. +       XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
  412. +               PropModeReplace,&awi->wm_state,2);
  413. + #endif /* WM_STATE */
  414.        }
  415.        else if (awi->state & ST_WINDOW) {
  416.             XAddToSaveSet(dpy, awi->client);
  417.         awi->state ^= ST_WINDOW;
  418.         awi->state |= ST_ICON;
  419. + #ifdef WM_STATE
  420. +       awi->wm_state.state=IconicState;
  421. +       XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
  422. +               PropModeReplace,&awi->wm_state,2);
  423. + #endif /* WM_STATE */
  424.        }
  425.        else
  426.             fprintf(stderr, "Window state for window %x got munged!\n",
  427. diff -c awm.dst/Icons.c awm/Icons.c
  428. *** awm.dst/Icons.c    Fri Oct 14 14:56:34 1988
  429. --- awm/Icons.c    Wed Oct 26 16:36:50 1988
  430. ***************
  431. *** 2,8 ****
  432.   
  433.   
  434.   #ifndef lint
  435. ! static char *rcsid_Icons_c = "$Header: Icons.c,v 1.3 88/07/23 17:24:56 jkh Exp $";
  436.   #endif  lint
  437.   
  438.   #include "X11/copyright.h"
  439. --- 2,8 ----
  440.   
  441.   
  442.   #ifndef lint
  443. ! static char *rcsid_Icons_c = "$Header: Icons.c,v 1.5 88/10/25 13:00:00 jkh Exp $";
  444.   #endif  lint
  445.   
  446.   #include "X11/copyright.h"
  447. ***************
  448. *** 61,66 ****
  449. --- 61,74 ----
  450.    * vPad and hPad usage corrected (Chris Thewalt fix).
  451.    * Clipping now set on right GC. 
  452.    * 1.3 -- Changed the way icon button events are handled.
  453. +  * 1.4 -- Isaac J. Salzman, RAND Corp.
  454. +  * reworked the way icons are handled - if IconsLabels is set, icons
  455. +  * with pixmaps are labled at bottom & icons w/o pixmaps use a default
  456. +  * pixmap w/a label instead of just a solid bg tile (i.e. twm style),
  457. +  * otherwise old uwm style icons are used (typin and all).
  458. +  * 1.5 -- Modified Isaac's changes to allow wm_option.icon.labels to
  459. +  * work. This allows individual clients/classes to determine their
  460. +  * icon style.  -jkh
  461.    */
  462.    
  463.   #include "awm.h"
  464. ***************
  465. *** 130,136 ****
  466.                         False, XA_STRING, &a_type, &a_form, &len,
  467.                         &after, &name);
  468.         if (status != Success)
  469. !            Leave((char *)NULL)
  470.        }
  471.        if (a_form == 0)    /* we have no bananas */
  472.         Leave((char *)NULL)
  473. --- 138,144 ----
  474.                         False, XA_STRING, &a_type, &a_form, &len,
  475.                         &after, &name);
  476.         if (status != Success)
  477. !            Leave( DEF_NAME ) /* use default name */
  478.        }
  479.        if (a_form == 0)    /* we have no bananas */
  480.         Leave((char *)NULL)
  481. ***************
  482. *** 187,198 ****
  483.         XDeleteContext(dpy, awi->icon, AwmContext);
  484.         if (awi->own) {
  485.              XDestroyWindow(dpy, awi->icon);
  486. !            if (awi->iconPixmap != IBackPixmap)
  487. !             XFreePixmap(dpy, awi->iconPixmap);
  488.         }
  489.         awi->icon = (Drawable)NULL;
  490.         awi->state ^= ST_ICON;
  491.         awi->state |= ST_WINDOW;
  492.        }
  493.        Leave_void
  494.   }
  495. --- 195,213 ----
  496.         XDeleteContext(dpy, awi->icon, AwmContext);
  497.         if (awi->own) {
  498.              XDestroyWindow(dpy, awi->icon);
  499. !            if ((awi->iconPixmap != IBackPixmap) && 
  500. !            (awi->iconPixmap != IDefPixmap))
  501. !            XFreePixmap(dpy, awi->iconPixmap);
  502.         }
  503.         awi->icon = (Drawable)NULL;
  504.         awi->state ^= ST_ICON;
  505.         awi->state |= ST_WINDOW;
  506. + #ifdef WM_STATE
  507. +       awi->wm_state.icon=0;
  508. +       awi->wm_state.state=NormalState;
  509. +       XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
  510. +               PropModeReplace,&awi->wm_state,2);
  511. + #endif /* WM_STATE */
  512.        }
  513.        Leave_void
  514.   }
  515. ***************
  516. *** 216,222 ****
  517.              *icon_w = *icon_h;
  518.        }
  519.        else 
  520. !       *icon_w = *icon_h;
  521.        Leave_void
  522.   }
  523.   
  524. --- 231,237 ----
  525.              *icon_w = *icon_h;
  526.        }
  527.        else 
  528. !       *icon_w = *icon_h = 0; /* set to zilch if bogus name! */
  529.        Leave_void
  530.   }
  531.   
  532. ***************
  533. *** 237,247 ****
  534.        XWMHints *XGetWMHints();
  535.        Pixmap clip = 0;
  536.        Window AddIcon();
  537.   
  538.        Entry("MakeIcon")
  539.   
  540. !      iconValues.background_pixmap = IBackPixmap;
  541. !      mask = (ExposureMask | StructureNotifyMask | KeyPressMask);
  542.        /*
  543.         * Process window manager hints.
  544.         */ 
  545. --- 252,273 ----
  546.        XWMHints *XGetWMHints();
  547.        Pixmap clip = 0;
  548.        Window AddIcon();
  549. +      AwmInfoPtr awi;
  550. +      int junk;
  551.   
  552.        Entry("MakeIcon")
  553.   
  554. !      awi = GetAwmInfo(window);
  555. !      if (awi->attrs & AT_ICONLABEL) {    /* check for iconLables - twm style */
  556. !       iconValues.background_pixmap = IDefPixmap;
  557. !       mask = StructureNotifyMask;
  558. !      }
  559. !      else {                    /* uwm style */
  560. !       iconValues.background_pixmap = IBackPixmap;
  561. !       mask = (ExposureMask | StructureNotifyMask | KeyPressMask);
  562. !      }
  563.        /*
  564.         * Process window manager hints.
  565.         */ 
  566. ***************
  567. *** 248,280 ****
  568.        if (wmhints = XGetWMHints(dpy, window)) {
  569.         if (wmhints->flags & IconWindowHint)
  570.              Leave(AddIcon(window, wmhints->icon_window, FALSE,
  571. !                  (StructureNotifyMask), (Pixmap)NULL))
  572. !       else if (wmhints->flags & IconPixmapHint) {
  573. !            if (wmhints->flags & IconMaskHint)
  574. !             clip = wmhints->icon_mask;
  575. !            iconValues.background_pixmap =
  576. !             MakePixmapFromBitmap(wmhints->icon_pixmap, clip,
  577. !                      &icon_w, &icon_h );
  578. !            if (iconValues.background_pixmap)
  579. !             mask = (StructureNotifyMask);
  580. !            else {
  581. !             iconValues.background_pixmap = IBackPixmap;
  582. !             wmhints->flags &= ~IconPixmapHint;
  583. !             GetDefaultSize(window, &icon_w, &icon_h);
  584. !            }
  585. !       }
  586. !       else GetDefaultSize(window, &icon_w, &icon_h);
  587. !      }
  588. !      else GetDefaultSize(window, &icon_w, &icon_h);
  589.   
  590.        /*
  591. !       * Fix up sizes by padding.
  592.         */
  593. !      if (!wmhints || !(wmhints->flags & (IconPixmapHint|IconWindowHint))) {
  594. !       icon_w += (HIconPad);
  595. !       icon_h += (VIconPad);
  596.        }
  597.   
  598.        /*
  599.         * Set the icon border attributes.
  600.         */ 
  601. --- 274,407 ----
  602.        if (wmhints = XGetWMHints(dpy, window)) {
  603.         if (wmhints->flags & IconWindowHint)
  604.              Leave(AddIcon(window, wmhints->icon_window, FALSE,
  605. !                  (StructureNotifyMask), (Pixmap)NULL));
  606.   
  607. +        if (wmhints->flags & IconPixmapHint) {
  608. +         if (wmhints->flags & IconMaskHint)
  609. +              clip = wmhints->icon_mask;
  610. +         iconValues.background_pixmap =
  611. +              MakePixmapFromBitmap(wmhints->icon_pixmap, clip,
  612. +                       &icon_w, &icon_h );
  613. +         if (iconValues.background_pixmap)
  614. +              mask = (StructureNotifyMask);
  615. +          else {
  616. +               iconValues.background_pixmap = IBackPixmap;
  617. +               wmhints->flags &= ~IconPixmapHint;
  618. +          }
  619. +        }
  620. +      }
  621. +      
  622.        /*
  623. !       * we now have a pixmap of some sort - either a background
  624. !       *  tile or an actual image - get the dimensions...
  625.         */
  626. !      if (!XGetGeometry(dpy, iconValues.background_pixmap,
  627. !                &junk, &junk, &junk,
  628. !                &icon_w, &icon_h, &junk, &junk )) {
  629. !       Warning( "can't get geom of pixmap in MakeIcon" );
  630. !       Leave( NULL );
  631.        }
  632. +      
  633. +      if (awi->attrs & AT_ICONLABEL) {
  634. +       char *s;
  635. +       Pixmap p;
  636. +       int nw, nh, tw, th, hoff, voff;
  637. +        
  638. +        if (s = GetIconName(window)) {
  639. +         nw = icon_w;
  640. +         nh = icon_h;
  641.   
  642. +         /* find out dimensions of text, add padding */
  643. +         tw = XTextWidth(IFontInfo, s, strlen(s)) + HIconPad;
  644. +         th = IFontInfo->ascent + IFontInfo->descent + VIconPad;
  645. +         
  646. +         
  647. +         /* calculate the size including the icon label */
  648. +         if (nw < tw)    /* width >= text width */
  649. +              nw = tw;
  650. +         
  651. +         /* always tack on extra for the label height */
  652. +         nh += th;
  653. +         
  654. +         /* now that we have dimensions, create the pixmap
  655. +            we want to eventually use as the icon window
  656. +            */
  657. +         
  658. +         if (!(p = XCreatePixmap(dpy, RootWindow(dpy, scr), nw, nh,
  659. +                     DefaultDepth(dpy, scr)))) {
  660. +              Warning("can't create pixmap in MakeIcon.");
  661. +              Leave( NULL )
  662. +         }
  663. +         /* calculate horizontal offset of pixmap (center it!) */
  664. +         if (hoff = (nw - icon_w))
  665. +              hoff = (hoff+1)/2;
  666. +         
  667. +         /* if the label goes at the top, push the thing to the bottom
  668. +          * otherwise leave it at the top
  669. +              */
  670. +         
  671. +         voff = ILabelTop ? (th - (VIconPad+1)/2) : (VIconPad+1)/2;
  672. +         
  673. +         XCopyArea(dpy, iconValues.background_pixmap, p,
  674. +               IconGC, 0, 0, icon_w, icon_h, 
  675. +               hoff, voff);
  676. +         
  677. +         /* now that we have a centered pixmap draw
  678. +          * some text on it....
  679. +          */
  680. +         
  681. +         if (hoff = (nw - tw))
  682. +              hoff = (hoff+1)/2;
  683. +         else
  684. +              hoff = (HIconPad ? (HIconPad+1)/2 : 1);
  685. +         
  686. +         /* see if string goes to top or bottom */
  687. +         if (ILabelTop)
  688. +              voff = th - (IFontInfo->descent-((VIconPad+1)/2));
  689. +         else
  690. +              voff = nh-(IFontInfo->descent+((VIconPad+1)/2));
  691. +         
  692. +         XDrawImageString(dpy, p, IconGC, hoff, voff, s, strlen(s));
  693. +         
  694. +         /*
  695. +          * Now free up original pixmap and replace
  696. +          * with this new one.
  697. +          */
  698. +         
  699. +         icon_h = nh;
  700. +         icon_w = nw;
  701. +         
  702. +         if ((iconValues.background_pixmap != IBackPixmap) &&
  703. +             (iconValues.background_pixmap != IDefPixmap))
  704. +              XFreePixmap(dpy, iconValues.background_pixmap);
  705. +         iconValues.background_pixmap = p;
  706. +        }
  707. +      }         
  708. +      else {             /* do it the old way.... */
  709. +       int h, w;
  710. +       
  711. +       if (!wmhints || !(wmhints->flags & IconPixmapHint)) {
  712. +            GetDefaultSize(window, &w, &h);
  713. +             
  714. +            if ((w==0) || (h==0)) { /* no label, use IDefPixmap */
  715. +             iconValues.background_pixmap = IDefPixmap;
  716. +              
  717. +             /* get geom of ipixmap */
  718. +             if (!XGetGeometry(dpy, iconValues.background_pixmap,
  719. +                       &junk, &junk, &junk,
  720. +                       &icon_w, &icon_h, &junk, &junk)) {
  721. +              Warning("can't get geom of pixmap in MakeIcon");
  722. +              Leave(NULL)
  723. +             }
  724. +            }
  725. +            else { /* use small label icon + some padding */
  726. +             icon_h = h+VIconPad;
  727. +             icon_w = w+HIconPad;
  728. +            }
  729. +       }
  730. +      }
  731.        /*
  732.         * Set the icon border attributes.
  733.         */ 
  734. ***************
  735. *** 282,288 ****
  736.         icon_bdr = IBorderWidth;
  737.         iconValues.border_pixel = IBorder;
  738.        }
  739. !  
  740.        if (wmhints && (wmhints->flags & IconPositionHint)) {
  741.         icon_x = wmhints->icon_x;
  742.         icon_y = wmhints->icon_y;
  743. --- 409,417 ----
  744.         icon_bdr = IBorderWidth;
  745.         iconValues.border_pixel = IBorder;
  746.        }
  747. !      /*
  748. !       * Determine icon position....
  749. !       */
  750.        if (wmhints && (wmhints->flags & IconPositionHint)) {
  751.         icon_x = wmhints->icon_x;
  752.         icon_y = wmhints->icon_y;
  753. ***************
  754. *** 310,316 ****
  755.         }
  756.         
  757.        }
  758. !      
  759.        /*
  760.         * Create the icon window.
  761.         */
  762. --- 439,445 ----
  763.         }
  764.         
  765.        }
  766.        /*
  767.         * Create the icon window.
  768.         */
  769. ***************
  770. *** 332,338 ****
  771.                    icon_bdr, 0, CopyFromParent, CopyFromParent,
  772.                    iconValues_mask, &iconValues),
  773.              TRUE, mask, iconValues.background_pixmap))
  774. -       
  775.   }
  776.   
  777.   Window AddIcon(window, icon, own, mask, background)
  778. --- 461,466 ----
  779. ***************
  780. *** 349,357 ****
  781.        if (icon == NULL)
  782.         Leave(NULL)
  783.        /*
  784. !       * Use the text cursor whenever the mouse is in the icon window.
  785.         */
  786. !      XDefineCursor(dpy, icon, TextCursor);
  787.        
  788.        /*
  789.         * Select "key pressed", "window exposure" and "unmap window"
  790. --- 477,490 ----
  791.        if (icon == NULL)
  792.         Leave(NULL)
  793.        /*
  794. !       * Use the text cursor whenever the mouse is in the icon window, if
  795. !       * it's a typein icon, otherwise use gumby....
  796.         */
  797. !      if (background == IBackPixmap)
  798. !      XDefineCursor(dpy, icon, TextCursor);
  799. !      else
  800. !      XDefineCursor(dpy, icon, GumbyCursor);
  801.        
  802.        /*
  803.         * Select "key pressed", "window exposure" and "unmap window"
  804. ***************
  805. *** 363,368 ****
  806. --- 496,506 ----
  807.        awi->icon = icon;
  808.        awi->own = own;
  809.        awi->iconPixmap = background;
  810. + #ifdef WM_STATE
  811. +      awi->wm_state.icon=icon;
  812. +      XChangeProperty(dpy,awi->client,XA_WM_STATE,XA_WM_STATE,32,
  813. +              PropModeReplace,&awi->wm_state,2);
  814. + #endif /* WM_STATE */
  815.        XSaveContext(dpy, icon, AwmContext, awi);
  816.        Leave(icon)
  817.   }
  818. diff -c awm.dst/Makefile awm/Makefile
  819. *** awm.dst/Makefile    Fri Oct 14 14:56:46 1988
  820. --- awm/Makefile    Wed Oct 26 17:29:59 1988
  821. ***************
  822. *** 12,18 ****
  823.   # Ignore this message if you are not using imake.
  824.   #
  825.   
  826. !             TOP = /usr/src/X.V11R2
  827.                AS = as
  828.                CC = cc
  829.               CPP = /lib/cpp
  830. --- 12,19 ----
  831.   # Ignore this message if you are not using imake.
  832.   #
  833.   
  834. !           SHELL = /bin/sh
  835. !             TOP = /usr/graph2/X11.2
  836.                AS = as
  837.                CC = cc
  838.               CPP = /lib/cpp
  839. ***************
  840. *** 29,35 ****
  841.          LINTOPTS = -axz
  842.       LINTLIBFLAG = -C
  843.              MAKE = make
  844. !     STD_DEFINES =
  845.       CDEBUGFLAGS = -g
  846.           DESTDIR = /usr/X11
  847.   
  848. --- 30,36 ----
  849.          LINTOPTS = -axz
  850.       LINTLIBFLAG = -C
  851.              MAKE = make
  852. !     STD_DEFINES = -DPCS -DBSD
  853.       CDEBUGFLAGS = -g
  854.           DESTDIR = /usr/X11
  855.   
  856. ***************
  857. *** 86,92 ****
  858.          LINTXLIB = $(XLIBSRC)/llib-lX11.ln
  859.         LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
  860.           LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
  861. !        INCLUDES = -I$(TOP)
  862.         MACROFILE = Sun.macros
  863.         IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl \
  864.               -I$(NEWTOP)$(IRULESRC) \
  865. --- 87,93 ----
  866.          LINTXLIB = $(XLIBSRC)/llib-lX11.ln
  867.         LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
  868.           LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
  869. !        INCLUDES = -I$(TOP) -I/usr/include/bsd
  870.         MACROFILE = Sun.macros
  871.         IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl \
  872.               -I$(NEWTOP)$(IRULESRC) \
  873. ***************
  874. *** 98,104 ****
  875.         MENU_ARCH = $(MENU_LIB)/rtlmenu.a
  876.        NEATEN_LIB = /grgr/neaten
  877.       NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
  878. !   SYS_LIBRARIES = -ll
  879.         OTHERSRCS = gram.y lex.l
  880.            YFLAGS = -d
  881.            HFILES = awm.h neaten.def.h neaten.ext.h support.h
  882. --- 99,105 ----
  883.         MENU_ARCH = $(MENU_LIB)/rtlmenu.a
  884.        NEATEN_LIB = /grgr/neaten
  885.       NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
  886. !   SYS_LIBRARIES = -ll -lbsd
  887.         OTHERSRCS = gram.y lex.l
  888.            YFLAGS = -d
  889.            HFILES = awm.h neaten.def.h neaten.ext.h support.h
  890. ***************
  891. *** 107,112 ****
  892. --- 108,114 ----
  893.   # you want output (stderr and stdout) to go to the system console.
  894.   #
  895.   
  896. + # Below is just for "make noident", remove it if you've moved XRdBitFD.c
  897.   # Use these macros if you want the RTL Neaten package.
  898.   # Also make sure that NEATEN_LIB points to the right place. See the README
  899.   # file for instructions (though you can just define this and give it a shot).
  900. ***************
  901. *** 122,128 ****
  902.   # To be totally sure, compile it with Xlib.
  903.   #XRDOBJ=XRdBitFD.o
  904.   
  905. - # Below is just for "make noident", remove it if you've moved XRdBitFD.c
  906.   # someplace else.
  907.   XRDSRC=XRdBitFD.c
  908.   
  909. --- 124,129 ----
  910. diff -c awm.dst/Menu.c awm/Menu.c
  911. *** awm.dst/Menu.c    Fri Oct 14 14:56:36 1988
  912. --- awm/Menu.c    Tue Oct 25 11:01:09 1988
  913. ***************
  914. *** 2,8 ****
  915.   
  916.   
  917.   #ifndef lint
  918. ! static char *rcsid_Menu_c = "$Header: Menu.c,v 1.1 88/06/15 15:08:09 jkh Exp $";
  919.   #endif    lint
  920.   
  921.   #include "X11/copyright.h"
  922. --- 2,8 ----
  923.   
  924.   
  925.   #ifndef lint
  926. ! static char *rcsid_Menu_c = "$Header: Menu.c,v 1.2 88/06/15 15:08:09 jkh Exp $";
  927.   #endif    lint
  928.   
  929.   #include "X11/copyright.h"
  930. ***************
  931. *** 36,41 ****
  932. --- 36,42 ----
  933.    *     This file bears little resemblance to its former namesake.
  934.    *    Because of massive changes to support RTL menus, the Menu()
  935.    *      function is now little more than a bootstrap for RTL.
  936. +  * 1.2 -- Select_Window code fixed for icons.
  937.    */
  938.   
  939.   #ifndef lint
  940. ***************
  941. *** 161,167 ****
  942.              target_win = event.xbutton.window;
  943.         XUngrabPointer(dpy, CurrentTime);      /* Done with pointer */
  944.         if (awi = GetAwmInfo(target_win))
  945. !            target_win = (awi->frame) ? awi->frame : awi->client;
  946.         Snatched = FALSE;
  947.         Leave(target_win)
  948.        }
  949. --- 162,169 ----
  950.              target_win = event.xbutton.window;
  951.         XUngrabPointer(dpy, CurrentTime);      /* Done with pointer */
  952.         if (awi = GetAwmInfo(target_win))
  953. !            if (target_win != awi->icon)
  954. !                     target_win = (awi->frame) ? awi->frame : awi->client;
  955.         Snatched = FALSE;
  956.         Leave(target_win)
  957.        }
  958. diff -c awm.dst/Titlebar.c awm/Titlebar.c
  959. *** awm.dst/Titlebar.c    Fri Oct 14 14:57:27 1988
  960. --- awm/Titlebar.c    Wed Oct 26 17:30:53 1988
  961. ***************
  962. *** 318,326 ****
  963.         XGetZoomHints(dpy, awi->client, &sz_hints);
  964.         XSetZoomHints(dpy, foster, &sz_hints);
  965.         class_hints.res_name = class_hints.res_class = (char *)NULL;
  966. !       if (XGetClassHint(dpy, awi->client, &class_hints) == Success)
  967. !            XSetClassHint(dpy, foster, &class_hints);
  968. !       
  969.         XSaveContext(dpy, foster, AwmContext, awi);
  970.        }
  971.        else {
  972. --- 318,327 ----
  973.         XGetZoomHints(dpy, awi->client, &sz_hints);
  974.         XSetZoomHints(dpy, foster, &sz_hints);
  975.         class_hints.res_name = class_hints.res_class = (char *)NULL;
  976. !       if (XGetClassHint(dpy, awi->client, &class_hints) == Success) {
  977. !            if (class_hints.res_name || class_hints.res_class)
  978. !             XSetClassHint(dpy, foster, &class_hints);
  979. !       }
  980.         XSaveContext(dpy, foster, AwmContext, awi);
  981.        }
  982.        else {
  983. diff -c awm.dst/awm.c awm/awm.c
  984. *** awm.dst/awm.c    Fri Oct 14 14:56:22 1988
  985. --- awm/awm.c    Tue Oct 25 11:03:32 1988
  986. ***************
  987. *** 2,8 ****
  988.   
  989.   
  990.   #ifndef lint
  991. ! static char *rcsid_awm_c = "$Header: awm.c,v 1.5 88/08/19 15:55:56 jkh Exp $";
  992.   #endif  lint
  993.   
  994.   #include "X11/copyright.h"
  995. --- 2,8 ----
  996.   
  997.   
  998.   #ifndef lint
  999. ! static char *rcsid_awm_c = "$Header: awm.c,v 1.6 88/10/25 13:00:00 jkh Exp $";
  1000.   #endif  lint
  1001.   
  1002.   #include "X11/copyright.h"
  1003. ***************
  1004. *** 58,63 ****
  1005. --- 58,64 ----
  1006.    *  Western Software Lab. Convert to X11.
  1007.    * 002 -- Jordan Hubbard, U.C. Berkeley. Add title bar context stuff.
  1008.    * 003 -- Jordan Hubbard, Ardent Computer. Added gadgets, border contexts.
  1009. +  * 1.6 -- Various irritating changes. Support for WM_STATE..
  1010.    */
  1011.   
  1012.   #ifndef PCS
  1013. ***************
  1014. *** 64,74 ****
  1015.   #include <sys/time.h>
  1016.   #endif
  1017.   #include <signal.h>
  1018. ! #if defined(vax)
  1019.   #include <sys/file.h>
  1020.   #else
  1021.   #include <fcntl.h>
  1022. ! #endif /* vax */
  1023.   #include <sys/ioctl.h>
  1024.   #include "awm.h"
  1025.   #include "X11/Xutil.h"
  1026. --- 65,75 ----
  1027.   #include <sys/time.h>
  1028.   #endif
  1029.   #include <signal.h>
  1030. ! #if defined(BSD)
  1031.   #include <sys/file.h>
  1032.   #else
  1033.   #include <fcntl.h>
  1034. ! #endif /* BSD */
  1035.   #include <sys/ioctl.h>
  1036.   #include "awm.h"
  1037.   #include "X11/Xutil.h"
  1038. ***************
  1039. *** 382,388 ****
  1040.               XSelectInput(dpy, kiddies[i], event_mask);
  1041.              }
  1042.         }
  1043. !       XFree(kiddies);
  1044.        }
  1045.        /*
  1046.         * Calculate size of the resize pop-up window.
  1047. --- 383,390 ----
  1048.               XSelectInput(dpy, kiddies[i], event_mask);
  1049.              }
  1050.         }
  1051. !       if( *kiddies )
  1052. !           XFree(kiddies);
  1053.        }
  1054.        /*
  1055.         * Calculate size of the resize pop-up window.
  1056. ***************
  1057. *** 399,405 ****
  1058.        PWidth = pop_width + (PBorderWidth << 1);
  1059.        pop_height = PFontInfo->ascent + PFontInfo->descent + (PPadding << 1);
  1060.        PHeight = pop_height + (PBorderWidth << 1);
  1061. !      
  1062.        /*
  1063.         * Create the pop-up window.  Create it at (0, 0) for now.  We will
  1064.         * move it where we want later.
  1065. --- 401,407 ----
  1066.        PWidth = pop_width + (PBorderWidth << 1);
  1067.        pop_height = PFontInfo->ascent + PFontInfo->descent + (PPadding << 1);
  1068.        PHeight = pop_height + (PBorderWidth << 1);
  1069.        /*
  1070.         * Create the pop-up window.  Create it at (0, 0) for now.  We will
  1071.         * move it where we want later.
  1072. ***************
  1073. *** 745,750 ****
  1074. --- 747,754 ----
  1075.        Grid = GetBoolRes("grid", FALSE);
  1076.        InstallColormap = GetBoolRes("installColormap", FALSE);
  1077.        Titles = GetBoolRes("titles", FALSE);
  1078. +      IconLabels = GetBoolRes("icon.labels", FALSE);
  1079. +      ILabelTop = GetBoolRes("icon.labelTop", FALSE);
  1080.        PushDown = GetBoolRes("title.push", FALSE);
  1081.        UseGadgets = GetBoolRes("gadgets", FALSE);
  1082.        Hilite = GetBoolRes("hilite", FALSE);
  1083. ***************
  1084. *** 793,799 ****
  1085.        MBorder = GetColorRes("menu.border", MForeground);
  1086.   
  1087.        /*
  1088. !       * Create and store the grey and solid pixmaps
  1089.         */
  1090.        GrayPixmap = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
  1091.                             gray_bits,
  1092. --- 797,803 ----
  1093.        MBorder = GetColorRes("menu.border", MForeground);
  1094.   
  1095.        /*
  1096. !       * Create and store the grey and solid pixmaps, and default icon pixmap
  1097.         */
  1098.        GrayPixmap = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
  1099.                             gray_bits,
  1100. ***************
  1101. *** 809,814 ****
  1102. --- 813,826 ----
  1103.                              BackColor,
  1104.                              DefaultDepth(dpy, scr));
  1105.   
  1106. +      
  1107. +      IDefPixmap = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
  1108. +                            xlogo32_bits,
  1109. +                            xlogo32_width, xlogo32_height,
  1110. +                            IForeground,
  1111. +                            IBackground,
  1112. +                            DefaultDepth(dpy, scr));
  1113. +  
  1114.        IFontInfo = GetFontRes("icon.font", DEF_ICON_FONT);
  1115.        PFontInfo = GetFontRes("popup.font", DEF_POPUP_FONT);
  1116.        MFontInfo = GetFontRes("menu.font", DEF_MENU_FONT);
  1117. ***************
  1118. *** 815,823 ****
  1119.        MBoldFontInfo = GetFontRes("menu.boldFont", DEF_BOLD_FONT);
  1120.   
  1121.        
  1122. !      IBackPixmap = GetPixmapRes("icon.pixmap", GrayPixmap, IForeground,
  1123.                   IBackground);
  1124. !      
  1125.   #ifdef NEATEN
  1126.        AbsMinWidth = GetIntRes("neaten.absMinWidth", DEFAULT_ABS_MIN);
  1127.        AbsMinHeight = GetIntRes("neaten.absMinHeight", DEFAULT_ABS_MIN);
  1128. --- 827,837 ----
  1129.        MBoldFontInfo = GetFontRes("menu.boldFont", DEF_BOLD_FONT);
  1130.   
  1131.        
  1132. !      IBackPixmap = GetPixmapRes("icon.backpixmap", GrayPixmap, IForeground,
  1133.                   IBackground);
  1134. !      IDefPixmap =  GetPixmapRes("icon.defpixmap", IDefPixmap, IForeground,
  1135. !                 IBackground);
  1136.   #ifdef NEATEN
  1137.        AbsMinWidth = GetIntRes("neaten.absMinWidth", DEFAULT_ABS_MIN);
  1138.        AbsMinHeight = GetIntRes("neaten.absMinHeight", DEFAULT_ABS_MIN);
  1139. ***************
  1140. *** 1057,1062 ****
  1141. --- 1071,1082 ----
  1142.        tmp->back = tmp->bold = tmp->BC_back = tmp->BC_bold =
  1143.         tmp->iconPixmap = (Pixmap)0;
  1144.        tmp->state = ST_WINDOW;
  1145. + #ifdef WM_STATE
  1146. +      tmp->wm_state.icon=0;
  1147. +      tmp->wm_state.state=NormalState;
  1148. +      XChangeProperty(dpy,w,XA_WM_STATE,XA_WM_STATE,32,PropModeReplace,
  1149. +              &tmp->wm_state,2);
  1150. + #endif /* WM_STATE */
  1151.        tmp->winGC = XCreateGC(dpy, w, (unsigned long)0, 0);
  1152.        /*
  1153.         * Determine attribute set by first turning on all attributes
  1154. ***************
  1155. *** 1072,1077 ****
  1156. --- 1092,1099 ----
  1157.         tmp->attrs |= AT_BORDER;
  1158.        if (Autoraise)
  1159.         tmp->attrs |= AT_RAISE;
  1160. +      if (IconLabels)
  1161. +       tmp->attrs |= AT_ICONLABEL;
  1162.        if (wm_hints = XGetWMHints(dpy, w)) {
  1163.         if (wm_hints->input)
  1164.                tmp->attrs |= AT_INPUT;
  1165. ***************
  1166. *** 1091,1096 ****
  1167. --- 1113,1121 ----
  1168.   
  1169.         if (cp = (XGetDefault(dpy, clh.res_class, "wm_option.autoRaise")))
  1170.              tmp->attrs = SetOptFlag(tmp->attrs, AT_RAISE, Pred(cp));
  1171. +       if (cp = (XGetDefault(dpy, clh.res_class, "wm_option.icon.labels")))
  1172. +            tmp->attrs = SetOptFlag(tmp->attrs, AT_ICONLABEL, Pred(cp));
  1173.        }
  1174.        if (clh.res_name) {
  1175.         if (cp = (XGetDefault(dpy, clh.res_name, "wm_option.title")))
  1176. ***************
  1177. *** 1104,1109 ****
  1178. --- 1129,1137 ----
  1179.   
  1180.         if (cp = (XGetDefault(dpy, clh.res_name, "wm_option.autoRaise")))
  1181.              tmp->attrs = SetOptFlag(tmp->attrs, AT_RAISE, Pred(cp));
  1182. +       if (cp = (XGetDefault(dpy, clh.res_name, "wm_option.icon.labels")))
  1183. +            tmp->attrs = SetOptFlag(tmp->attrs, AT_ICONLABEL, Pred(cp));
  1184.        }
  1185.        XSaveContext(dpy, w, AwmContext, tmp);
  1186.        Leave(tmp)
  1187. diff -c awm.dst/awm.h awm/awm.h
  1188. *** awm.dst/awm.h    Fri Oct 14 14:56:54 1988
  1189. --- awm/awm.h    Tue Oct 25 11:04:07 1988
  1190. ***************
  1191. *** 2,8 ****
  1192.   
  1193.   
  1194.   #ifndef lint
  1195. ! static char *rcsid_awm_h = "$Header: awm.h,v 1.2 88/07/23 17:26:00 jkh Exp $";
  1196.   #endif  lint
  1197.   
  1198.   #include "X11/copyright.h"
  1199. --- 2,8 ----
  1200.   
  1201.   
  1202.   #ifndef lint
  1203. ! static char *rcsid_awm_h = "$Header: awm.h,v 1.3 88/10/25 17:01:24 jkh Exp $";
  1204.   #endif  lint
  1205.   
  1206.   #include "X11/copyright.h"
  1207. ***************
  1208. *** 61,66 ****
  1209. --- 61,67 ----
  1210.    *  Western Software Lab, Port to X11
  1211.    * 003 -- Jordan Hubbard, Ardent Computer
  1212.    *  Many additional declarations for awm.
  1213. +  * 1.3 -- Support for WM_STATE (Mike Wexler)
  1214.    */
  1215.    
  1216.   #include <errno.h>
  1217. ***************
  1218. *** 133,138 ****
  1219. --- 134,142 ----
  1220.   #define    DEF_BOLD_FONT        "8x13bold"
  1221.   #endif    DEF_BOLD_FONT
  1222.   #define DEF_MENU_DELTA        20
  1223. + #ifndef DEF_NAME
  1224. + #define DEF_NAME        "NoName" /* for clients w/no name */
  1225. + #endif
  1226.   
  1227.   #define INIT_PTEXT        {'0', '0', '0', 'x', '0', '0', '0'}
  1228.   
  1229. ***************
  1230. *** 183,188 ****
  1231. --- 187,193 ----
  1232.   #define AT_RAISE    0x4
  1233.   #define AT_BORDER    0x8
  1234.   #define AT_INPUT    0x10
  1235. + #define AT_ICONLABEL    0x20
  1236.   
  1237.   /*
  1238.    * Gadgets aren't the sort of embellishments that one uses in quantitity
  1239. ***************
  1240. *** 213,221 ****
  1241. --- 218,241 ----
  1242.   #define solid_height 16
  1243.   extern char solid_bits[];
  1244.    
  1245. + #define xlogo32_width 32
  1246. + #define xlogo32_height 32
  1247. + extern char xlogo32_bits[];
  1248.   /*
  1249.    * All one needs to know about an awm managed window.. (so far...)
  1250.    */
  1251. + #ifdef WM_STATE
  1252. + #define WithdrawState    0
  1253. + #define NormalState    1
  1254. + #define IconicState    3
  1255. + typedef struct {
  1256. +   int state;
  1257. +   Window icon;
  1258. + } WM_STATE;
  1259. + #endif /* WM_STATE */
  1260.   typedef struct _awminfo {
  1261.        Window title, client, frame, icon;    /* Associated windows */
  1262.        Window *gadgets;            /* associated gadgets */
  1263. ***************
  1264. *** 227,232 ****
  1265. --- 247,255 ----
  1266.        int state;                /* The state of the window */
  1267.        int attrs;                /* Window "attributes" */
  1268.        GC winGC;                /* GC at proper depth for window */
  1269. + #ifdef WM_STATE
  1270. +      WM_STATE wm_state;
  1271. + #endif /* WM_STATE */
  1272.   } AwmInfo, *AwmInfoPtr;
  1273.   
  1274.   /*
  1275. ***************
  1276. *** 409,414 ****
  1277. --- 432,438 ----
  1278.   extern Pixmap GrayPixmap;    /* Gray pixmap. */
  1279.   extern Pixmap SolidPixmap;
  1280.   extern Pixmap IBackPixmap;    /* Icon window background pixmap. */
  1281. + extern Pixmap IDefPixmap;    /* Icon pixmap for twm style icons */
  1282.   extern char *BForeground;    /* Border Context (pixmap) foreground pixel */
  1283.   extern char *BBackground;    /* Border Context (pixmap) background pixel */
  1284.   extern char *WBorder;        /* Window border pixel */
  1285. ***************
  1286. *** 440,445 ****
  1287. --- 464,470 ----
  1288.   extern Cursor TargetCursor;    /* Target (select-a-window) cursor. */
  1289.   extern Cursor TitleCursor;    /* Title bar cursor */
  1290.   extern Cursor FrameCursor;    /* Frame cursor */
  1291. + extern Cursor GumbyCursor;    /* Used in icons if not type-in   */
  1292.   extern int GadgetBorder;    /* Width of gadget borders */
  1293.   extern int ScreenWidth;        /* Display screen width. */
  1294.   extern int ScreenHeight;    /* Display screen height. */
  1295. ***************
  1296. *** 496,501 ****
  1297. --- 521,528 ----
  1298.   extern Boolean SaveUnder;    /* Save unders? */
  1299.   extern Boolean Snatched;    /* We're in the middle of an no-highlight/raise op */
  1300.   extern Boolean Titles;        /* Title bars on windows? */
  1301. + extern Boolean IconLabels;    /* Labels on pixmap icons? (twm style) */
  1302. + extern Boolean ILabelTop;    /* label top of icon? */
  1303.   extern Boolean PushDown;    /* Down=TRUE, Up=FALSE */
  1304.   extern Boolean UseGadgets;    /* Gadget boxes in title bars? */
  1305.   extern Boolean Wall;        /* Don't allow windows past edges of screen */
  1306. ***************
  1307. *** 629,631 ****
  1308. --- 656,661 ----
  1309.   extern char *PrimaryIconPlacement;
  1310.   extern char *SecondaryIconPlacement;
  1311.   #endif    NEATEN
  1312. + #ifdef WM_STATE
  1313. + #endif /* WM_STATE */
  1314. diff -c awm.dst/awm.man awm/awm.man
  1315. *** awm.dst/awm.man    Fri Oct 14 14:57:32 1988
  1316. --- awm/awm.man    Mon Oct 24 17:11:39 1988
  1317. ***************
  1318. *** 450,472 ****
  1319.   background.  You cannot include a new line character within a shell
  1320.   command. 
  1321.   .IP "Text strings"
  1322. ! Text strings are placed in the window server's cut buffer.
  1323.   .IP
  1324. ! Strings with a new line character must begin with an 
  1325. ! up arrow (^), which is stripped during the copy operation.  
  1326.   .IP
  1327. ! Strings without a new line must begin with the bar character (|), 
  1328. ! which is stripped during the copy operation.
  1329.   .IP "Booleans"
  1330.   Any boolean variable previously described, e.g., \fBreverse\fP or
  1331.   \fBautoraise\fP.  The current state of a boolean variable in a menu
  1332.   will be indicated with a check mark (a check mark means the boolean is
  1333. ! set to true).
  1334.   .PP
  1335.   SPECIAL NOTE:
  1336.   .PP
  1337.   Menus bound to title bars, gadget boxes or borders cause (where logical)
  1338. ! the selected menu action to occur automatically on the titled window
  1339.   as opposed to having to select a window for the action. However, actions
  1340.   requiring mouse tracking (i.e. move, resize) will usually \fBnot\fP work well
  1341.   in this context. While this limitation will be eliminated in the near future,
  1342. --- 450,475 ----
  1343.   background.  You cannot include a new line character within a shell
  1344.   command. 
  1345.   .IP "Text strings"
  1346. ! Text strings are placed in the window server's cut buffer. The strings
  1347. ! must be preceeded by one of:
  1348.   .IP
  1349. ! A carat (^), which is stripped off, signifies that
  1350. ! the string will automatically be followed by a newline (I.E using '^'
  1351. ! causes one to be added at the end).
  1352.   .IP
  1353. ! A vertical bar (|), also stripped off, signifies the the string
  1354. ! should not end with a newline.
  1355.   .IP "Booleans"
  1356.   Any boolean variable previously described, e.g., \fBreverse\fP or
  1357.   \fBautoraise\fP.  The current state of a boolean variable in a menu
  1358.   will be indicated with a check mark (a check mark means the boolean is
  1359. ! set to true). Note that the boolean is *not* preceeded by "awm." as
  1360. ! it is in the resource database.
  1361.   .PP
  1362.   SPECIAL NOTE:
  1363.   .PP
  1364.   Menus bound to title bars, gadget boxes or borders cause (where logical)
  1365. ! the selected menu action to occur automatically on the client window
  1366.   as opposed to having to select a window for the action. However, actions
  1367.   requiring mouse tracking (i.e. move, resize) will usually \fBnot\fP work well
  1368.   in this context. While this limitation will be eliminated in the near future,
  1369. ***************
  1370. *** 490,504 ****
  1371.   .bp
  1372.   .SH X DEFAULTS
  1373.   .PP
  1374. ! A number of variables that were previously specified in the \fI.uwmrc\fP file
  1375. ! have been moved out of the \fI.awmrc\fP file and are now retrieved from
  1376.   the resource database. When a value cannot be found, a default 
  1377. ! (compiled into \fIawm\fP) is substituted. The resource database is also
  1378. ! now queried to determine whether or not to title a given window. See
  1379. ! the end of this section for details.
  1380.   .PP
  1381.   In the descriptions below, variable names are listed in boldface,
  1382.   their type in parenthesis, and their default value in double quotes.
  1383.   .sp
  1384.   .IP "\fBautoraise\fP (boolean) ``off''"
  1385.   Automatically raise a window to the top when it gains the
  1386. --- 493,511 ----
  1387.   .bp
  1388.   .SH X DEFAULTS
  1389.   .PP
  1390. ! A number of variables that used to be specified in the \fI.uwmrc\fP file (of
  1391. ! \fIuwm\fP, for those familiar with it) are now retrieved from
  1392.   the resource database. When a value cannot be found, a default 
  1393. ! (compiled into \fIawm\fP) is substituted. A much wider range of
  1394. ! options can be specified this way and it is suggested that you
  1395. ! read the following section carefully before bringing up
  1396. ! awm.
  1397.   .PP
  1398.   In the descriptions below, variable names are listed in boldface,
  1399.   their type in parenthesis, and their default value in double quotes.
  1400. + All resources are preceeded by an implied "awm.", as is the standard.
  1401. + I.E. "autoraise" would be specified as: "awm.autoraise: ..." in the
  1402. + resource database.
  1403.   .sp
  1404.   .IP "\fBautoraise\fP (boolean) ``off''"
  1405.   Automatically raise a window to the top when it gains the
  1406. ***************
  1407. *** 609,618 ****
  1408. --- 616,637 ----
  1409.   icons are left alone.\fR
  1410.   .IP "\fBicon.background\fP (string) ``\fBbackground\fP''"
  1411.   Icon (pixmap) background color.
  1412. + .IP "\fBicon.backpixmap\fP (string) ``grey''"
  1413. + Pixmap to display as icon background for text icons.
  1414. + Note that this pixmap is only used for "text" icons, I.E. icons
  1415. + in the \fBuwm\fP style of a line of editable text. This should
  1416. + typically be cross hatch pattern or some similar background weave
  1417. + that will be displayed surrounding the text. For "pictoral" icons,
  1418. + use \fBicon.defpixmap\fP.
  1419. + See also: \fBpath\fP, \fBicon.foreground\fP, \fBicon.background\fP,
  1420. + \fBicon.defpixmap\fP.
  1421.   .IP "\fBicon.border\fP (string) ``\fBicon.foreground\fP''"
  1422.   Color to use for icon borders.
  1423.   .IP "\fBicon.borderWidth\fP (int) ``2''"
  1424.   Width of icon border in pixels.
  1425. + .IP "\fBicon.defpixmap\fP (string) ``xlogo''"
  1426. + For windows that don't specify their own pixmaps, use this image.
  1427. + This is only useful if \fBicon.labels\fP is turned on.
  1428.   .IP "\fBicon.font\fP (string) ``8x13''"
  1429.   Which font to use for icon text.
  1430.   .IP "\fBicon.foreground\fP (string) ``\fBforeground\fP''"
  1431. ***************
  1432. *** 619,624 ****
  1433. --- 638,652 ----
  1434.   Icon (pixmap) foreground color.
  1435.   .IP "\fBicon.hPad\fP (int) ``2''"
  1436.   Number of pixels to pad icon text horizontally.
  1437. + .IP "\fBicon.labels\fP (boolean) ``off''"
  1438. + Specifys that icons should be displayed in the "twm" style. I.E.
  1439. + The icon pixmap (or \fBicon.defpixmap\fP if the window has no icon
  1440. + pixmap) with the icon name displayed underneath (or above, if
  1441. + \fBicon.labelTop\fP is set).
  1442. + .IP "\fBicon.labelTop\fP (boolean) ``off''"
  1443. + Specifys that "labeled" icons should have the text portion displayed
  1444. + on top, rather than the bottom. Only useful if \fBicon.labels\fP is
  1445. + set.
  1446.   .IP "\fBicon.vPad\fP (int) ``2''"
  1447.   Number of pixels to pad icon text vertically.
  1448.   .IP "\fBicon.text.background\fP (string) ``\fBicon.background\fP''"
  1449. ***************
  1450. *** 625,637 ****
  1451.   Background color to use for icon text.
  1452.   .IP "\fBicon.text.foreground\fP (string) ``\fBicon.foreground\fP''"
  1453.   Foreground color to use for icon text.
  1454. - .IP "\fBicon.pixmap\fP (string) ``grey''"
  1455. - Pixmap to display as icon background.
  1456. - Since this pixmap will be used to tile all icons owned
  1457. - by \fIawm\fP, it's probably not a good idea to put application
  1458. - specific pictures in it. More typically, this will be a cross
  1459. - hatch pattern or some similar background weave.
  1460. - See also: \fBpath\fP, \fBicon.foreground\fP, \fBicon.background\fP.
  1461.   .IP "\fBinstallColormap\fP (boolean) ``false''"
  1462.   Install a given window's colormap when the pointer enters it.
  1463.   When the pointer leaves, the default colormap is installed.
  1464. --- 653,658 ----
  1465. ***************
  1466. *** 732,746 ****
  1467.   .IP "\fBpushRelative\fP (boolean) ``on''"
  1468.   When a window is pushed, push 1/\fBpush\fP of the window.
  1469.   If off, move window \fBpush\fP pixels.
  1470. - .IP "\fBpushDown\fP (boolean) ``false''"
  1471. - When adding a title bar or border context to a window, put the border or
  1472. - title bar area at the current x, y position and "push" the window down to
  1473. - make room. For windows with an upper edge at or near the top of the screen,
  1474. - this gives the most asthetically pleasing results. For windows near the
  1475. - bottom, it does not.
  1476. - If set to false, the title bar/border will be added "on top" and the window
  1477. - will not be moved down. Note that the setting of this resource also affects
  1478. - how the window is maniplated during resizes, title removals, etc.
  1479.   .IP "\fBraiseDelay\fP (int) ``100''"
  1480.   Amount of time in milliseconds to wait (while window has focus)
  1481.   before raising. If pointer leaves window before time elapses, raise is not
  1482. --- 753,758 ----
  1483. ***************
  1484. *** 792,797 ****
  1485. --- 804,818 ----
  1486.   defined and \fBhilite\fP is set.
  1487.   .IP "\fBtitle.text.background\fP (string) ``\fBtitle.background\fP''"
  1488.   Background color to use when drawing title bar text.
  1489. + .IP "\fBtitle.push\fP (boolean) ``false''"
  1490. + When adding a title bar or border context to a window, put the border or
  1491. + title bar area at the current x, y position and "push" the window down to
  1492. + make room. For windows with an upper edge at or near the top of the screen,
  1493. + this gives the most asthetically pleasing results. For windows near the
  1494. + bottom, it does not.
  1495. + If set to false, the title bar/border will be added "on top" and the window
  1496. + will not be moved down. Note that the setting of this resource also affects
  1497. + how the window is maniplated during resizes, title removals, etc.
  1498.   .IP "\fBtitle.text.foreground\fP (string) ``\fBtitle.foreground\fP''"
  1499.   Foreground color to use when drawing title bar.
  1500.   .IP "\fBtitles\fP (boolean) ``off''"
  1501. ***************
  1502. *** 827,836 ****
  1503.   .IP "\fIname\fP\fB.wm_option.autoRaise\fP (boolean) "
  1504.   .IP "\fIname\fP\fB.wm_option.borderContext\fP (boolean) "
  1505.   .IP "\fIname\fP\fB.wm_option.gadgets\fP (boolean) "
  1506.   .IP "\fIname\fP\fB.wm_option.title\fP (boolean) "
  1507.   
  1508.   These resources determine whether or not a given application really wants
  1509. ! a title, gadgets, border context area or to be auto-raised.
  1510.   The application's CLASS and NAME (in the WM_CLASS property) are checked
  1511.   against the string supplied for \fIname\fP (for example:
  1512.   Xclock*wm_option.title:  off).
  1513. --- 848,858 ----
  1514.   .IP "\fIname\fP\fB.wm_option.autoRaise\fP (boolean) "
  1515.   .IP "\fIname\fP\fB.wm_option.borderContext\fP (boolean) "
  1516.   .IP "\fIname\fP\fB.wm_option.gadgets\fP (boolean) "
  1517. + .IP "\fIname\fP\fB.wm_option.icon.labels\fP (boolean) "
  1518.   .IP "\fIname\fP\fB.wm_option.title\fP (boolean) "
  1519.   
  1520.   These resources determine whether or not a given application really wants
  1521. ! a title, gadgets, border context area, to be auto-raised etc etc..
  1522.   The application's CLASS and NAME (in the WM_CLASS property) are checked
  1523.   against the string supplied for \fIname\fP (for example:
  1524.   Xclock*wm_option.title:  off).
  1525. diff -c awm.dst/exp_path.c awm/exp_path.c
  1526. *** awm.dst/exp_path.c    Fri Oct 14 14:57:28 1988
  1527. --- awm/exp_path.c    Tue Oct 25 11:05:54 1988
  1528. ***************
  1529. *** 2,8 ****
  1530.   
  1531.   
  1532.   #ifndef lint
  1533. ! static char *rcsid_exp_path_c = "$Header: exp_path.c,v 1.2 88/06/15 15:26:00 jkh Exp $";
  1534.   #endif  lint
  1535.   
  1536.   #include "X11/copyright.h"
  1537. --- 2,8 ----
  1538.   
  1539.   
  1540.   #ifndef lint
  1541. ! static char *rcsid_exp_path_c = "$Header: exp_path.c,v 1.3 88/10/25 15:26:00 jkh Exp $";
  1542.   #endif  lint
  1543.   
  1544.   #include "X11/copyright.h"
  1545. ***************
  1546. *** 31,41 ****
  1547.   #endif
  1548.   #include <pwd.h>
  1549.   #include <stdio.h>
  1550. ! #if defined(vax)
  1551.   #include <sys/file.h>
  1552.   #else
  1553.   #include <fcntl.h>
  1554. ! #endif /* vax */
  1555.   #include "awm.h"
  1556.   
  1557.   /*
  1558. --- 31,41 ----
  1559.   #endif
  1560.   #include <pwd.h>
  1561.   #include <stdio.h>
  1562. ! #if defined(BSD)
  1563.   #include <sys/file.h>
  1564.   #else
  1565.   #include <fcntl.h>
  1566. ! #endif /* BSD */
  1567.   #include "awm.h"
  1568.   
  1569.   /*
  1570. diff -c awm.dst/globals.c awm/globals.c
  1571. *** awm.dst/globals.c    Fri Oct 14 14:56:49 1988
  1572. --- awm/globals.c    Tue Oct 25 11:05:42 1988
  1573. ***************
  1574. *** 2,8 ****
  1575.   
  1576.   
  1577.   #ifndef lint
  1578. ! static char *rcsid_globals_c = "$Header: globals.c,v 1.3 88/07/23 17:26:00 jkh Exp $";
  1579.   #endif  lint
  1580.    
  1581.   #include "X11/copyright.h"
  1582. --- 2,8 ----
  1583.   
  1584.   
  1585.   #ifndef lint
  1586. ! static char *rcsid_globals_c = "$Header: globals.c,v 1.4 88/10/25 17:26:00 jkh Exp $";
  1587.   #endif  lint
  1588.    
  1589.   #include "X11/copyright.h"
  1590. ***************
  1591. *** 60,65 ****
  1592. --- 60,66 ----
  1593.    *  Western Software Lab. April 17, 1987
  1594.    *  Convert to X11
  1595.    * 003 -- Jordan Hubbard, U.C. Berkeley. Misc new vars.
  1596. +  * 1.4 -- Vars added for new icon stuff.
  1597.    */
  1598.    
  1599.   #include "awm.h"
  1600. ***************
  1601. *** 75,80 ****
  1602. --- 76,82 ----
  1603.   Pixmap GrayPixmap;        /* Gray pixmap. */
  1604.   Pixmap SolidPixmap;        /* Solid pixmap */
  1605.   Pixmap IBackPixmap;        /* Icon window background pixmap. */
  1606. + Pixmap IDefPixmap;        /* default icon pixmap for IconLabels */
  1607.   Pixel ForeColor;        /* Generic foreground color */
  1608.   Pixel BackColor;        /* Generic background color */
  1609.   Pixel IBorder;            /* Icon window border color. */
  1610. ***************
  1611. *** 103,108 ****
  1612. --- 105,111 ----
  1613.   Cursor TargetCursor;        /* Target (select-a-window) cursor. */
  1614.   Cursor TitleCursor;        /* Titlebar cursor */
  1615.   Cursor FrameCursor;        /* Border context cursor */
  1616. + Cursor GumbyCursor;        /* Used in icons if not type-in */
  1617.   int GadgetBorder;        /* Width of gadget borders */
  1618.   int ScreenWidth;        /* Display screen width. */
  1619.   int ScreenHeight;        /* Display screen height. */
  1620. ***************
  1621. *** 153,158 ****
  1622. --- 156,163 ----
  1623.   Boolean RootResizeBox;        /* Resize window is placed over sized window? */
  1624.   Boolean ResizeRelative;        /* resizes should be relative to window edge */
  1625.   Boolean Titles;            /* Title bar frob on windows? */
  1626. + Boolean IconLabels;        /* icon labels? */
  1627. + Boolean ILabelTop;        /* icon label on top? */
  1628.   Boolean UseGadgets;        /* Gadget bars on titles? */
  1629.   Boolean FrameFocus;        /* Treat the frame as part of the window? */
  1630.   Boolean Reverse;        /* Reverse video? */
  1631. ***************
  1632. *** 193,198 ****
  1633. --- 198,216 ----
  1634.        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1635.        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  1636.   };
  1637. + char xlogo32_bits[] = {
  1638. +    0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x00, 0xc0, 0xfc, 0x03, 0x00, 0x60,
  1639. +    0xf8, 0x07, 0x00, 0x30, 0xf8, 0x07, 0x00, 0x18, 0xf0, 0x0f, 0x00, 0x0c,
  1640. +    0xe0, 0x1f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x03,
  1641. +    0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00,
  1642. +    0x00, 0xfe, 0x31, 0x00, 0x00, 0xfc, 0x33, 0x00, 0x00, 0xf8, 0x1b, 0x00,
  1643. +    0x00, 0xf0, 0x0d, 0x00, 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x60, 0x1f, 0x00,
  1644. +    0x00, 0xb0, 0x3f, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x98, 0x7f, 0x00,
  1645. +    0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x03, 0xfc, 0x03,
  1646. +    0x80, 0x01, 0xfc, 0x03, 0xc0, 0x00, 0xf8, 0x07, 0xc0, 0x00, 0xf0, 0x0f,
  1647. +    0x60, 0x00, 0xe0, 0x1f, 0x30, 0x00, 0xe0, 0x1f, 0x18, 0x00, 0xc0, 0x3f,
  1648. +    0x0c, 0x00, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff};
  1649.   
  1650.   int scr;
  1651.   Display *dpy;
  1652. diff -c awm.dst/gram.y awm/gram.y
  1653. *** awm.dst/gram.y    Fri Oct 14 14:56:52 1988
  1654. --- awm/gram.y    Tue Oct 25 10:59:25 1988
  1655. ***************
  1656. *** 50,55 ****
  1657. --- 50,56 ----
  1658.    *  Western Software Lab. Convert to X11.
  1659.    * 002 -- Jordan Hubbard, U.C. Berkeley. New keywords. Menu
  1660.    * changes, gadget boxes, title bars, the kitchen sink.
  1661. +  * 1.6 -- Memory leaks fixed.
  1662.    */
  1663.   
  1664.   %{
  1665. ***************
  1666. *** 58,64 ****
  1667.   
  1668.   
  1669.   #ifndef lint
  1670. ! static char *rcsid_gram_y = "$Header: gram.y,v 1.5 88/08/19 15:55:04 jkh Exp $";
  1671.   #endif    lint
  1672.   
  1673.   #include "X11/Xlib.h"
  1674. --- 59,65 ----
  1675.   
  1676.   
  1677.   #ifndef lint
  1678. ! static char *rcsid_gram_y = "$Header: gram.y,v 1.6 88/10/25 15:55:04 jkh Exp $";
  1679.   #endif    lint
  1680.   
  1681.   #include "X11/Xlib.h"
  1682. ***************
  1683. *** 76,81 ****
  1684. --- 77,84 ----
  1685.   #define C_PIXMAP    5    /* IsPixmap */
  1686.   #define C_ACTION    6    /* IsAction */
  1687.    
  1688. + #define GADGET_TOKEN "gadget"
  1689.        static int ki;            /* Keyword index. */
  1690.        static int gadgnum;        /* # of gadget we're initing */
  1691.        static int g_offset;        /* The gadget offset specified */
  1692. ***************
  1693. *** 364,370 ****
  1694.         $$ = keywordlookup(yylval.sval);
  1695.    }
  1696.   |    STRING gadget_subscript {
  1697. !      $$ = keywordlookup("gadget");
  1698.        gadgnum = $2;
  1699.   }
  1700.   ;
  1701. --- 367,381 ----
  1702.         $$ = keywordlookup(yylval.sval);
  1703.    }
  1704.   |    STRING gadget_subscript {
  1705. !      char *ptr;
  1706. !      char *malloc();
  1707. !      ptr = malloc(strlen(GADGET_TOKEN) + 1);
  1708. !      if (ptr == NULL) {
  1709. !        Error("out of space");
  1710. !      }
  1711. !      strcpy(ptr, GADGET_TOKEN);
  1712. !      $$ = keywordlookup(ptr);
  1713.        gadgnum = $2;
  1714.   }
  1715.   ;
  1716. ***************
  1717. *** 406,412 ****
  1718.         yyerror(msg);
  1719.        }
  1720.        else {
  1721. !       $$ = contexprlookup("gadget") | (1 << (BITS_USED + $2));
  1722.        }
  1723.   }
  1724.   ;
  1725. --- 417,431 ----
  1726.         yyerror(msg);
  1727.        }
  1728.        else {
  1729. !          char *ptr;
  1730. !      char *malloc();
  1731. !      ptr = malloc(strlen(GADGET_TOKEN) + 1);
  1732. !      if (ptr == NULL) {
  1733. !        Error("out of space");
  1734. !      }
  1735. !      strcpy(ptr, GADGET_TOKEN);
  1736. !       $$ = contexprlookup(ptr) | (1 << (BITS_USED + $2));
  1737.        }
  1738.   }
  1739.   ;
  1740. ***************
  1741. *** 546,552 ****
  1742.   
  1743.        Entry("LookupColor")
  1744.   
  1745. !      if (!XAllocNamedColor(dpy, cmap, string, &vis_ret, &act_ret)) {
  1746.        sprintf(msg, "Can't allocate color '%s', using default\n", string);
  1747.        yywarn(msg);
  1748.        if (fail)
  1749. --- 565,572 ----
  1750.   
  1751.        Entry("LookupColor")
  1752.   
  1753. !      if (!(string && XParseColor(dpy, cmap, string, &vis_ret, &act_ret) &&
  1754. !     XAllocColor(dpy, cmap, &vis_ret))) {
  1755.        sprintf(msg, "Can't allocate color '%s', using default\n", string);
  1756.        yywarn(msg);
  1757.        if (fail)
  1758. ***************
  1759. *** 572,578 ****
  1760.   
  1761.        if (!string)
  1762.        Leave((Pixel)0)
  1763. !      if (!XAllocNamedColor(dpy, cmap, string, &vis_ret, &act_ret))
  1764.        Leave((Pixel)0)
  1765.        Leave(vis_ret.pixel)
  1766.   }
  1767. --- 592,599 ----
  1768.   
  1769.        if (!string)
  1770.        Leave((Pixel)0)
  1771. !      if (!(string && XParseColor(dpy, cmap, string, &vis_ret) &&
  1772. !     XAllocColor(dpy, cmap, &vis_ret)))
  1773.        Leave((Pixel)0)
  1774.        Leave(vis_ret.pixel)
  1775.   }
  1776. diff -c awm.dst/support.c awm/support.c
  1777. *** awm.dst/support.c    Fri Oct 14 14:57:27 1988
  1778. --- awm/support.c    Tue Oct 25 11:02:29 1988
  1779. ***************
  1780. *** 2,8 ****
  1781.   
  1782.   
  1783.   #ifndef lint
  1784. ! static char *rcsid_support_c = "$Header: support.c,v 1.1 88/06/15 15:26:00 jkh Exp $";
  1785.   #endif  lint
  1786.   
  1787.   #include "X11/copyright.h"
  1788. --- 2,8 ----
  1789.   
  1790.   
  1791.   #ifndef lint
  1792. ! static char *rcsid_support_c = "$Header: support.c,v 1.2 88/10/25 15:26:00 jkh Exp $";
  1793.   #endif  lint
  1794.   
  1795.   #include "X11/copyright.h"
  1796. ***************
  1797. *** 24,35 ****
  1798.    * pertaining to distribution of the software without specific, written
  1799.    * prior permission.
  1800.    *
  1801.    */
  1802.   
  1803.   #include "support.h"
  1804.   #include <stdio.h>
  1805.        
  1806. !      int _rtn_level;
  1807.   int _rtn_trace;
  1808.   
  1809.   static struct func_stack {
  1810. --- 24,39 ----
  1811.    * pertaining to distribution of the software without specific, written
  1812.    * prior permission.
  1813.    *
  1814. +  * REVISION HISTORY:
  1815. +  *
  1816. +  * 1.2 -- Version of strlen() that accepts NULL strings added (#ifdef it
  1817. +  * in if your system needs it).
  1818.    */
  1819.   
  1820.   #include "support.h"
  1821.   #include <stdio.h>
  1822.        
  1823. ! int _rtn_level;
  1824.   int _rtn_trace;
  1825.   
  1826.   static struct func_stack {
  1827. ***************
  1828. *** 90,92 ****
  1829. --- 94,115 ----
  1830.        free(ptr);
  1831.        _rtn_level--;
  1832.   }
  1833. + /*
  1834. +  * Some systems retch when you pass strlen() a NULL pointer.
  1835. +  * Here's a way of getting around it.
  1836. +  */
  1837. + #ifdef hlh
  1838. + strlen(s)
  1839. + char *s;
  1840. + {
  1841. +     int count = 0;
  1842. +     if (s == 0)
  1843. +         return(0);
  1844. +     while (*s++)
  1845. +         count++;
  1846. +     return(count);
  1847. + }
  1848. + #endif /* hlh */
  1849. *** awm.dst/patchlevel.h    Wed Oct 26 15:31:42 1988
  1850. --- awm/patchlevel.h    Wed Oct 26 14:34:45 1988
  1851. ***************
  1852. *** 0 ****
  1853. --- 1,2 ----
  1854. + #define PATCHLEVEL 8
  1855. -- 
  1856. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  1857. Moderator of comp.sources.x
  1858.