[comp.sources.x] v00i006: Ardent Window Manager

mikew@wyse.wyse.com (Mike Wexler) (08/10/88)

Submitted-by: jkh@ardent (Jordan Hubbard)
Posting-number: Volume 0, Issue 6
Archive-name: awm/part05

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 5 (of 13)."
# Contents:  awm/CHANGES awm/Gadget.c awm/GridBox.c awm/Move.c
#   awm/README awm/menus/rtlmenu.c
# Wrapped by mikew@wyse on Mon Aug  8 12:01:43 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f awm/CHANGES -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/CHANGES\"
else
echo shar: Extracting \"awm/CHANGES\" \(9022 characters\)
sed "s/^X//" >awm/CHANGES <<'END_OF_awm/CHANGES'
XThis file last changed: 7/2/88
X
XThe most recent changes to awm include:
X
XBorder/title context rationalized, you may now have border contexts without
Xtitle bars and vice-versa.
X
XThe whole paradigm for adding/removing various decorations has changed.
XFunctions such as f.notitle and f.gadget have been replaced with the
Xtwo functions f.decorate and f.nodecorate for reasons of simplicity.
XIt's now possible to specify on an application-by-application (or class-by
Xclass) basis which "decorations" not to use. See the SPECIAL RESOURCES
Xsection of the man page for more information.
X
XFocus In/Out and Enter/Leave event handling now much more robust and
Xhighlighting occurs when it should.
X
Xf.unfocus added for twm compatibility (not to mention general convenience).
X
XThe window name is now centered correctly in the titlebar (the net result
Xbeing that the titlebar background doesn't creep around the edges the way
Xit used to).
X
Xdef.awmrc/system.awmrc ambiguity finally resolved in favor of system.awmrc.
XThe man page and makefile should now agree on this one.
X
XMany bugs and general nits fixed.
X
XTwo lines of whitespace added after #ident lines to keep patch from
Xincluding them in context information (for those who have removed them).
X
XThings have been sped up a bit.
X
X
XPrevious changes to awm:
X
XVersion numbers set to 1.1 in all files. Subsequent versions of awm will
Xincrement this accordingly (major_release.fix_level).
X
XMenus should now work on color systems.
X
XWeird nit with XGetClassHint() that caused coredumps fixed.
X
XMan page re-written substantially (Thanks to Bill Wohler), the format
Xof the resource descriptions below reflect part of his changes.
X
XNew make rule "noident" added for awm and awm/menus makefile. Doing
Xa "make noident" in the awm directory will remove all #ident lines from
Xawm and the menus. We use #ident at ardent without trouble (and on the
Xsuns), but it seems to choke DEC's compilers. I'm not sure if this
Xis legal ansi anymore or not. In any case, if #ident chokes your compiler,
Xthis will remove it.
X
XNew resources:
X
XFrameFocus (boolean) ``off''
X Specifies whether or not focus changes should be looked for on the
X client window (as they are now) or on the frame.
X In a nutshell, if you set this to "off", the window will be not
X change state (be this highlight or stacking level) until you've
X left the frame (this includes the title bar) entirely. Correspondingly,
X enter highlight/autoraise is also done on the whole frame.
X This resource also has the side-effect of making the focus follow the
X pointer explicitly. Thus typing into titlebars will cause the keyboard input
X to go to the client window as expected.
X 
Xborder.foreground (string) ``foreground''
X Lets you specify the border color for awm's "frame" windows.
X
X
XChanges as of 6/6/88
XNew resources:
X
XwindowName.offset: (int)
X Specifys an offset for the window name, rather than
X centering it.
X
Xtitle.height: (int)
X Allows you to physically set the height of titlebars (in pixels)
X to some value, rather than having it be derived from the size of
X the title font(s).
X
Xgadget.border: (int)
X Allows you to set the width of gadget box borders to some
X value.
X
Xborder.hilite: (boolean)
X Specifies whether or not to change border colors on focus in/out.
X If this is undefined, and hilite is, it is set to the value of
X hilite. Since is was already possible to specify whether or not
X the window name and title background would be affected by focus
X changes, this resource rounds out the list.
X
XFor demonstration purposes are two files "twm.awmrc" and "twm.Xdefaults"
Xthat can be used to make awm look very much like twm. If you want to try
Xthis out, edit twm.Xdefaults so that the awm.path variable points to
X/.../awm/bitmaps and load it into your resource manager.
X
X
XA few more bugs were fixed. Pixmap icons should now stay sane.
XBad gravity specifications should be handled gracefully.
Xcursor glyph gadget boxes should now be the correct size.
XA problem with FocusChange was fixed.
XThe restriction of compiling XRdBitFD only with Xlib has been lifted.
X
XAutoselect now works in submenus. Menu item positioning has been
Ximproved.
X
XChanges as of 6/3/88:
X
XBug fixes/enhancements for first release.
X
XA new context named "border" has been added. When enabled (by giving it a width, see
Xman page), it results in an artificial border area to which actions may be bound.
XSee the man page for information on configuring this.
X
XIt is now possible to bind to "text action" strings in the same manner as functions
Xand menus. Specifically, you may now invoke programs and manipulate the cut buffer
Xdirectly through bindings rather than having to go through menus. See the man
Xpage for a more thorough explanation.
X
XCursors for title bars and border contexts (new) are now definable resources.
X
X"resizeRelative" option from R2 uwm folded in along with uwm bug fixes.
X
XNew title.push option allows you to specify whether you want titles to push windows
Xdown to make room (the default) or be added on top without moving them.
X
XSupport for the RTL Neaten package has been added. See the README file if you
Xwish to compile it in.
X
XTo avoid some confusion, it's now manadatory that you compile XRdBitFD.c into Xlib.
XSeperate compilation is no longer supported. The resulting inconvenience is relatively
Xminor compared to what some people with irregular source trees experienced when trying
Xto compile it as part of awm.
X
XMany bugs have been fixed, most notably a race condition on window mapping,
Xmapping/unmapping of windows, bogus event masks to gadgets, resize weirdness,
Xrubber banding and a number of coordinate botches that resulted from
Xadding frames around things. It's now possible to compile awm with gcc 1.22,
Xthough I don't know about the neaten package.
X
X
XBug fixes to Beta.3
X
XDEF_FONT is now in awm.h where it belongs and GetFontRes() has been
Xmodified to use it.
X
XSome of the default specs in awm.h have been ifdef'd so that you can
Xalso specify them at compile time. Currently, you can do this for the font specs:
X
XNAME			Default value
X----			-------------
XDEF_FONT		"fixed"
XDEF_TITLE_FONT		"vtsingle"
XDEF_ICON_FONT		"8x13"
XDEF_POPUP_FONT		"9x15"
XDEF_GADGET_FONT		"fixed"
XDEF_MENU_FONT		"8x13"
XDEF_BOLD_FONT		"8x13bold"
X
XAnd the name and class of awm:
X
XNAME			"awm"
XCLASS			"Wm"
X
XIt's still suggested that you change them in awm.h when you're configuring
Xawm for your site, but this gives you an additional way of setting them.
X
XChanges for beta release 3.
X
X1. Total rewrite of Iconify.c and NewIconify, problems fixed are iconic
Xstartup, icon/window positioning, icon_mask hints.
X
X2. Each gadget may now have its own font, rather than having to
Xuse a global gadget font (though this is still the default).
XNon-printable characters can also now be specified, allowing you
Xto grab individual glyphs out of fonts and use them in gadgets.
XThe is probably most useful for getting things out of the cursor font.
XSee the man page for details.
XNote: Though much of the necessary code is in place, it still is not
Xpossible to use 16 bit fonts for this purpose. Though I'd love
Xto have gadgets containing Kanji glyphs (a picture is worth a thousand
Xwords, especially in Kanji) and the like, I still don't know enough
Xabout the mechanism to know how and when to use the X*Text*16 routines,
Xor how to store the "string" in such a way that it could be
Xpainted into an 8 bit font as well.
X
X3. Overall structure of the window manager has changed slightly.
XThe code should be easier to read and debug.
X
X4. New "wall" boolean allows you to constrain moves to the edges of
Xthe screen.
X
X5. Some things that should have been getting their colors out of
Xthe resource database now do.
X
X6. Window name and class are now both checked when determing whether
Xor not to title a window.
X
X7. Icons now use save-unders.
X
X8. Certain operations should be faster.
X
X9. The man page has been made more readable and updated somewhat.
X
X
XCHANGES OVER UWM:
X
XThis window manager represents a fairly large departure from uwm
Xin the following ways:
X
X o	There are title bars and gadget boxes that represent fully independent
X	contexts now (I.E. you can bind to them without conflict).
X
X o	Icons now represent a truly independent context.
X
X o	The menus have changed completely to allow walking menus and
X	more flexibility as to contents (pictures or text) of individual panes.
X	The menu interface has also been de-coupled somewhat from awm so
X	that another menu package could be substituted at a
X	later date. When an "official" toolkit menu widget exists, this
X	will probably happen.
X
X o	Boolean variables may be set within menus and are also displayed
X	with a checkmark (depending on whether or not they're set).
X
X o	Some effort is made to use save-unders and/or to minimize expose
X	events due to window manager actions.
X
X o	Autoraise and border highlighting are available on focus.
X
X o	Almost everything has been moved out of the .awmrc file and into
X	the resource database where it belongs.
X
X o	awm now supports a startup file that makes usage from xinit more
X	friendly.
X
X 
END_OF_awm/CHANGES
if test 9022 -ne `wc -c <awm/CHANGES`; then
    echo shar: \"awm/CHANGES\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/Gadget.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/Gadget.c\"
else
echo shar: Extracting \"awm/Gadget.c\" \(8862 characters\)
sed "s/^X//" >awm/Gadget.c <<'END_OF_awm/Gadget.c'
X#ident   "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_Gadget_c = "$Header: Gadget.c,v 1.3 88/07/23 17:26:00 jkh Exp $";
X#endif  lint
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * MODIFICATION HISTORY
X *
X * 001 -- Jortan Hubbard, Ardent Computer.
X * Gadget boxes in title bars.
X * 1.2 -- Jordan Hubbard, Ardent Computer.
X *  GadgetBorders used in placement calculations, initial
X *  gadget positions calculated correcly. (Chris Thewalt fixes).
X * 1.3 -- Color handling changed to deal with multiple colormaps.
X *
X */
X
X#include "awm.h"
X#include "X11/Xutil.h"
X
Xextern XContext AwmContext;
X
XAwmInfoPtr IsGadgetWin(w, gnum)
XWindow w;
Xint *gnum;
X{
X     AwmInfoPtr awi;
X     int i;
X
X     Entry("IsGadgetWin")
X
X     if (!XFindContext(dpy, w, AwmContext, &awi)) {
X	  Window *wp;
X
X          if (!awi->gadgets)
X               Leave((AwmInfoPtr)NULL)
X	  for (i = 0; i < NumGadgets; i++)
X	       if (awi->gadgets[i] == w) {
X                    if (gnum)
X                    *gnum = i;
X	            Leave(awi)
X               }
X          Leave((AwmInfoPtr)NULL)
X     }
X}
X
X/*
X * This routine adds and/or places  gadgets onto a title bar.
X */
Xint PutGadgets(w)
XWindow w;
X{
X     int i, dir;
X     int rx, lx, nx, ny;
X     XWindowAttributes xwa;
X     XSetWindowAttributes swa;
X     Colormap cmap;
X     unsigned long valuemask;
X     GadgetDecl *gdec;
X     AwmInfo *awi;
X     char *cp;
X     Boolean change = FALSE;
X     Binding *bptr;
X     Window tmp;
X
X     Entry("PutGadgets")
X
X     /* are there any gadgets declared? */
X     if (NumGadgets < 1)
X	  Leave_void
X     /* does this window have a title? */
X     if (!(awi = IsTitled(w)))
X	  Leave_void
X
X     if (!(awi->attrs & AT_GADGETS))
X	  Leave_void
X     /* if the window already has gadgets, this is a reshuffle */
X     if (awi->gadgets)
X	  change = TRUE;
X     else
X	  awi->gadgets = (Window *)malloc(sizeof(Window) * NumGadgets + 1);
X     if (!awi->gadgets) {
X	  fprintf(stderr, "PutGadgets: Can't allocate memory for gadgets!\n");
X          Leave(FALSE)
X     }
X     if (XGetWindowAttributes(dpy, awi->title, &xwa) == BadWindow) {
X	  fprintf(stderr, "PutGadgets: Can't get attrs for client window %x\n",
X		  w);
X	  Leave_void
X     }
X     /* define some initial positioning information */
X     dir = RightGadgetGravity;
X     lx = 0;
X     rx = xwa.width;
X     cmap = xwa.colormap;
X     valuemask = CWBackPixel | CWEventMask | CWColormap;
X     swa.event_mask = (ButtonPressMask | ButtonReleaseMask | ExposureMask);
X     swa.colormap = cmap;
X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
X	  XGCValues gcv;
X
X	  gdec = Gadgets[i];
X
X	  /* Does gadget have its own gravity? */
X	  if (gdec->gravity != NoGadgetGravity)
X	       dir = gdec->gravity;
X	  ny = xwa.height - gdec->high;
X	  if (ny <= 0) {
X	       ny = 0;
X               gdec->high = xwa.height;
X          }
X	  else
X	       ny = (ny / 2) - 1;
X	  if (ny < 0)
X	       ny = 0;
X	  if (dir == LeftGadgetGravity) {
X	       nx = lx + gdec->offset + GadgetBorder;
X	       if (lx != 0) /* not first time through, add pad */
X		    nx = lx + GadgetPad;
X	       if (nx < 0)
X		    nx = 0;
X	       lx = nx + gdec->wide;
X               dir = RightGadgetGravity;
X	  }
X	  else if (dir == RightGadgetGravity) {	
X	       nx = rx - gdec->wide - gdec->offset - (2 * GadgetBorder);
X	       if (rx != xwa.width)
X		    nx -= GadgetPad;
X	       rx = nx - GadgetBorder;
X               dir = LeftGadgetGravity;
X	  }
X	  else /* Center Gravity */
X	       nx = ((xwa.width - gdec->wide) / 2) + gdec->offset;
X	  if (change == FALSE || !awi->gadgets[i]) {
X	       swa.background_pixel = GetPixel(gdec->backcolor, cmap);
X	       tmp = awi->gadgets[i] = XCreateWindow(dpy, awi->title, nx, ny,
X						     gdec->wide, gdec->high,
X						     GadgetBorder,
X						     xwa.depth, xwa.class,
X						     xwa.visual, valuemask,
X						     &swa);
X	       if (!tmp) {
X		    fprintf(stderr, "PutGadgets: Can't create gadget #%d\n",
X			    i);
X		    Leave_void
X	       }
X	       if (gdec->data) {
X		    Pixmap pix;
X
X		    pix = XCreatePixmapFromBitmapData(dpy, tmp, gdec->data,
X						      gdec->wide, gdec->high,
X						      GetPixel(gdec->forecolor, cmap),
X						      GetPixel(gdec->backcolor, cmap),
X						      xwa.depth);
X		    if (!pix) {
X			 fprintf(stderr, "PutGadgets: Unable to create pixmap for #%d\n",
X				 i);
X                         fprintf(stderr, "Using grey...\n");
X                         pix = GrayPixmap;
X		    }
X		    XSetWindowBackgroundPixmap(dpy, tmp, pix);
X		    XFreePixmap(dpy, pix);
X	       }
X	       XMapWindow(dpy, tmp);
X	       XSaveContext(dpy, tmp, AwmContext, awi);
X	  }
X	  else
X	       XMoveWindow(dpy, awi->gadgets[i], nx, ny);
X     }
X     if (change == FALSE) /* make sure the window array is null terminated */
X          awi->gadgets[i] = (Window)NULL;
X     PaintGadgets(w);
X     Leave_void
X}
X
Xint FreeGadget(n)
Xint n;
X{
X     Entry("FreeGadget")
X
X     if (Gadgets[n]->data)
X	  XFree(Gadgets[n]->data);
X     if (Gadgets[n]->name)
X	  free(Gadgets[n]->name);
X}
X
Xint CheckGadgets()
X{
X     int i, status = 0;
X
X     Entry("CheckGadgets")
X
X     for (i = 0; i < NumGadgets; i++)
X	  if (!Gadgets[i]) {
X	       fprintf(stderr, "awm: Gadget #%d is not declared!\n",
X		       i);
X	       fprintf(stderr, "All gadgets from 0 to %d must be declared.\n",
X		       NumGadgets - 1);
X	       status = 1;
X	  }
X     Leave(status)
X}
X
XBoolean ResetGadgets()
X{
X     int i;
X
X     Entry("ResetGadgets")
X
X     for (i = 0; i < NumGadgets; i++) {
X	  FreeGadget(i);
X	  free(Gadgets[i]);
X	  Gadgets[i] = 0;
X     }
X     NumGadgets = 0;
X}
X     
Xint DestroyGadgets(w)
XWindow w;
X{
X     int i;
X     AwmInfoPtr awi;
X
X     Entry("DestroyGadgets")
X
X     if (!(awi = IsTitled(w)))
X	  Leave_void
X     if (!awi->gadgets)
X	  Leave_void
X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
X	  XDeleteContext(dpy, awi->gadgets[i], AwmContext);
X	  XDestroyWindow(dpy, awi->gadgets[i]);
X     }
X     free(awi->gadgets);
X     awi->gadgets = 0;
X     Leave_void
X}
X
Xint PaintGadgets(w)
XWindow w;
X{
X     int i, y, x = 0;
X     AwmInfoPtr awi;
X     GadgetDecl *gdec;
X     XWindowAttributes xwa;
X
X     Entry("PaintGadgets")
X
X     if (!(awi = IsTitled(w)))
X	  Leave_void
X     if (!awi->gadgets)
X	  Leave_void
X     XGetWindowAttributes(dpy, awi->client, &xwa);
X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
X	  gdec = Gadgets[i];
X	  if (!gdec->data) {
X	       XGCValues gcv;
X
X	       gcv.font = gdec->fontInfo->fid;
X	       gcv.foreground = GetPixel(gdec->forecolor, xwa.colormap);
X	       gcv.background = GetPixel(gdec->backcolor, xwa.colormap);
X	       XChangeGC(dpy, awi->winGC, (GCFont | GCForeground |
X					   GCBackground), &gcv);
X	       if (strlen(gdec->name) == 1) { /* it's a glyph (we think) */
X		    XFontStruct *real_font;
X		    XCharStruct char_info;
X		    int char_number, index, byte1, byte2;
X
X		    real_font = gdec->fontInfo;
X		    char_number = gdec->name[0];
X		    char_info = real_font->max_bounds;
X		    index = char_number;
X
X		    if (real_font->per_char) {
X			 if (!real_font->min_byte1 && !real_font->max_byte1) {
X			      if (char_number < real_font->min_char_or_byte2 ||
X				  char_number > real_font->max_char_or_byte2)
X				   index = real_font->default_char;
X			      index -= real_font->min_char_or_byte2;
X			 } else {
X			      byte2 = index & 0xff;
X			      byte1 = (index>>8) & 0xff;
X			      if (byte1 < real_font->min_byte1 ||
X				  byte1 > real_font->max_byte1 ||
X				  byte2 < real_font->min_char_or_byte2 ||
X				  byte2 > real_font->max_char_or_byte2) {
X				   byte2 = real_font->default_char & 0xff;
X				   byte1 = (real_font->default_char>>8)&0xff;
X			      }
X			      byte1 -= real_font->min_byte1;
X			      byte2 -= real_font->min_char_or_byte2;
X			      index = byte1 * (real_font->max_char_or_byte2 -
X					       real_font->min_char_or_byte2 + 1) +
X						    byte2;
X			 }
X			 char_info = real_font->per_char[index];
X		    }
X		    x = 1 - GadgetBorder - char_info.lbearing;
X		    y = char_info.ascent;
X	       }
X	       else {
X		    y = (gdec->high + (gdec->fontInfo->max_bounds.ascent -
X				       gdec->fontInfo->max_bounds.descent)) / 2;
X		    x = GadgetBorder;
X	       }
X	       XDrawString(dpy, awi->gadgets[i], awi->winGC, x,
X			   y, gdec->name, strlen(gdec->name));
X	  }
X     }
X     Leave(0)
X}
END_OF_awm/Gadget.c
if test 8862 -ne `wc -c <awm/Gadget.c`; then
    echo shar: \"awm/Gadget.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/GridBox.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/GridBox.c\"
else
echo shar: Extracting \"awm/GridBox.c\" \(7858 characters\)
sed "s/^X//" >awm/GridBox.c <<'END_OF_awm/GridBox.c'
X#ident   "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_StoreGridBox_c = "$Header: GridBox.c,v 1.1 88/06/15 15:21:55 jkh Exp $";
X#endif	lint
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
X
X
X/*
X * MODIFICATION HISTORY
X *
X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
X *  Western Software Lab. Converted to X11.
X * 002 -- Jordan Hubbard, Ardent Computer.
X *  Changes for titled windows.
X */
X
X#ifndef lint
Xstatic char *sccsid = "@(#)StoreGridBox.c	3.8	1/24/86";
X#endif
X
X/*
X *	StoreGridBox - This subroutine is used by the X Window Manager (xwm)
X *	to store the vertices for the movement resize grid and box in a
X *	vertex list.
X */
X
X#include "awm.h"
X
X/*
X * Store the vertices for the movement resize grid and box in a vertex list.
X */
Xint StoreGridBox(box, ulx, uly, lrx, lry)
Xregister XSegment box[];
Xint ulx;			/* Upper left X coordinate. */
Xint uly;			/* Upper left Y coordinate. */
Xint lrx;			/* Lower right X coordinate. */
Xint lry;			/* Lower right Y coordinate. */
X{
X    register int xthird, ythird;
X    int x1third, y1third;
X    int x2third, y2third;
X
X    Entry("StoreGridBox")
X
X    /*
X     * Xor in.
X     */
X    box[0].x1 = ulx; box[0].y1 = uly;
X    box[0].x2 = lrx; box[0].y2 = uly;
X
X    box[1].x1 = lrx; box[1].y1 = uly;
X    box[1].x2 = lrx; box[1].y2 = lry;
X
X    box[2].x1 = lrx; box[2].y1 = lry;
X    box[2].x2 = ulx; box[2].y2 = lry;
X
X    box[3].x1 = ulx; box[3].y1 = lry;
X    box[3].x2 = ulx; box[3].y2 = uly;
X
X
X    /*
X     * These are the X and Y calculations for the parts of the grid that
X     * are dependent on the division by 3 calculations.
X     */
X
X    /*
X     * Y dimension third.
X     */
X    ythird = (lry - uly) / 3;
X    y1third = uly + ythird;
X    y2third = y1third + ythird;
X   
X    /*
X     * X dimension third.
X     */
X    xthird = (lrx - ulx) / 3;
X    x1third = ulx + xthird;
X    x2third = x1third + xthird;
X
X    box[4].x1 = x1third; box[4].y1 = lry;
X    box[4].x2 = x1third; box[4].y2 = uly;
X
X    box[5].x1 = x2third; box[5].y1 = lry;
X    box[5].x2 = x2third; box[5].y2 = uly;
X
X    box[6].x1 = ulx; box[6].y1 = y1third;
X    box[6].x2 = lrx; box[6].y2 = y1third;
X
X    box[7].x1 = ulx; box[7].y1 = y2third;
X    box[7].x2 = lrx; box[7].y2 = y2third;
X
X    /*
X     * Do not erase if we're freezing the screen.
X     */
X    if (Freeze)
X        Leave(8)
X
X    /*
X     * From here on we're retracing the segments to clear the
X     * grid using GXxor.
X     */
X    box[8].x1 = ulx; box[8].y1 = uly;
X    box[8].x2 = lrx; box[8].y2 = uly;
X
X    box[9].x1 = lrx; box[9].y1 = uly;
X    box[9].x2 = lrx; box[9].y2 = lry;
X
X    box[10].x1 = lrx; box[10].y1 = lry;
X    box[10].x2 = ulx; box[10].y2 = lry;
X
X    box[11].x1 = ulx; box[11].y1 = lry;
X    box[11].x2 = ulx; box[11].y2 = uly;
X
X    box[12].x1 = x1third; box[12].y1 = lry;
X    box[12].x2 = x1third; box[12].y2 = uly;
X
X    box[13].x1 = x2third; box[13].y1 = lry;
X    box[13].x2 = x2third; box[13].y2 = uly;
X
X    box[14].x1 = ulx; box[14].y1 = y1third;
X    box[14].x2 = lrx; box[14].y2 = y1third;
X
X    box[15].x1 = ulx; box[15].y1 = y2third;
X    box[15].x2 = lrx; box[15].y2 = y2third;
X
X
X    /*
X     * Total number of segments is 16.
X     */
X    Leave(16)
X}
X
X/*
X * Store the vertices for the movement resize grid and box in a vertex list.
X * This is just like the routine above, but it adds a line for titled windows.
X */
X
Xint StoreTitleGridBox(box, ulx, uly, lrx, lry)
Xregister XSegment box[];
Xint ulx;			/* Upper left X coordinate. */
Xint uly;			/* Upper left Y coordinate. */
Xint lrx;			/* Lower right X coordinate. */
Xint lry;			/* Lower right Y coordinate. */
X{
X    register int xthird, ythird;
X    int x1third, y1third;
X    int x2third, y2third;
X
X    Entry("StoreTitleGridBox")
X
X    /*
X     * Xor in.
X     */
X    box[0].x1 = ulx; box[0].y1 = uly;
X    box[0].x2 = lrx; box[0].y2 = uly;
X
X    box[1].x1 = ulx; box[1].y1 = uly + titleHeight + 2;
X    box[1].x2 = lrx; box[1].y2 = uly + titleHeight + 2;
X
X    box[2].x1 = lrx; box[2].y1 = uly;
X    box[2].x2 = lrx; box[2].y2 = lry;
X
X    box[3].x1 = lrx; box[3].y1 = lry;
X    box[3].x2 = ulx; box[3].y2 = lry;
X
X    box[4].x1 = ulx; box[4].y1 = lry;
X    box[4].x2 = ulx; box[4].y2 = uly;
X
X
X    /*
X     * These are the X and Y calculations for the parts of the grid that
X     * are dependent on the division by 3 calculations.
X     */
X
X    /*
X     * Y dimension third.
X     */
X    ythird = (lry - uly - titleHeight - 2) / 3;
X    y1third = uly + ythird + titleHeight + 2;
X    y2third = y1third + ythird;
X   
X    /*
X     * X dimension third.
X     */
X    xthird = (lrx - ulx) / 3;
X    x1third = ulx + xthird;
X    x2third = x1third + xthird;
X
X    box[5].x1 = x1third; box[5].y1 = lry;
X    box[5].x2 = x1third; box[5].y2 = uly + titleHeight + 3;
X
X    box[6].x1 = x2third; box[6].y1 = lry;
X    box[6].x2 = x2third; box[6].y2 = uly + titleHeight + 3;
X
X    box[7].x1 = ulx; box[7].y1 = y1third;
X    box[7].x2 = lrx; box[7].y2 = y1third;
X
X    box[8].x1 = ulx; box[8].y1 = y2third;
X    box[8].x2 = lrx; box[8].y2 = y2third;
X
X    /*
X     * Do not erase if we're freezing the screen.
X     */
X    if (Freeze)
X        Leave(9)
X
X    /*
X     * From here on we're retracing the segments to clear the
X     * grid using GXxor.
X     */
X    box[9].x1 = ulx; box[9].y1 = uly;
X    box[9].x2 = lrx; box[9].y2 = uly;
X
X    box[10].x1 = ulx; box[10].y1 = uly + titleHeight + 2;
X    box[10].x2 = lrx; box[10].y2 = uly + titleHeight + 2;
X
X    box[11].x1 = lrx; box[11].y1 = uly;
X    box[11].x2 = lrx; box[11].y2 = lry;
X
X    box[12].x1 = lrx; box[12].y1 = lry;
X    box[12].x2 = ulx; box[12].y2 = lry;
X
X    box[13].x1 = ulx; box[13].y1 = lry;
X    box[13].x2 = ulx; box[13].y2 = uly;
X
X    box[14].x1 = x1third; box[14].y1 = lry;
X    box[14].x2 = x1third; box[14].y2 = uly + titleHeight + 3;
X
X    box[15].x1 = x2third; box[15].y1 = lry;
X    box[15].x2 = x2third; box[15].y2 = uly + titleHeight + 3;
X
X    box[16].x1 = ulx; box[16].y1 = y1third;
X    box[16].x2 = lrx; box[16].y2 = y1third;
X
X    box[17].x1 = ulx; box[17].y1 = y2third;
X    box[17].x2 = lrx; box[17].y2 = y2third;
X
X
X    /*
X     * Total number of segments is 18.
X     */
X    Leave(18)
X}
END_OF_awm/GridBox.c
if test 7858 -ne `wc -c <awm/GridBox.c`; then
    echo shar: \"awm/GridBox.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/Move.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/Move.c\"
else
echo shar: Extracting \"awm/Move.c\" \(8533 characters\)
sed "s/^X//" >awm/Move.c <<'END_OF_awm/Move.c'
X#ident   "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_Move_c = "$Header: Move.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
X#endif	lint
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
X/*
X * MODIFICATION HISTORY
X *
X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group, 
X *	  Western Software Lab. Port to X11
X */
X
X#include "awm.h"
X
XBoolean Move(window, mask, button, x, y)
XWindow window;				/* Event window. */
Xint mask;				/* Button/key mask. */
Xint button;				/* Button event detail. */
Xint x, y;				/* Event mouse position. */
X{
X     register int prev_x;		/* Previous event window X location. */
X     register int prev_y;		/* Previous event window Y location. */
X     XWindowAttributes window_info;	/* Event window information. */
X     int cur_x;				/* Current event window X location. */
X     int cur_y;				/* Current event window Y location. */
X     int root_x;				/* Root window X location. */
X     int root_y;				/* Root window Y location. */
X     int ulx, uly;			/* Event window upper left X and Y. */
X     int lrx, lry;			/* Event window lower right X and Y. */
X     int init_ulx, init_uly;		/* Init window upper left X and Y. */
X     int init_lrx, init_lry;		/* Init window lower right X and Y. */
X     int num_vectors;			/* Number of vectors in box. */
X     int ptrmask;			/* state of ptr when queried */
X     Window sub_window;			/* Query mouse event sub-window. */
X     Window root;			/* Query mouse event root. */
X     AwmInfoPtr awi;
X     XEvent button_event;		/* Button event packet. */
X     XSegment box[MAX_BOX_VECTORS];	/* Box vertex buffer. */
X     XSegment zap[MAX_ZAP_VECTORS];	/* Zap effect verted buffer. */
X     int (*storegrid_func)();		/* Function to use for grid */
X     int (*storebox_func)();		/* Function to use for box */
X     
X     Entry("Move")
X	  
X     /*
X      * Do not try to move the root window.
X      */
X     if (window == RootWindow(dpy, scr))
X	  Leave(FALSE)
X		    
X     /*
X      * Change the cursor.
X      */
X     grab_pointer();
X     /*
X      * Clear the vector buffers.
X      */
X     bzero(box, sizeof(box));
X     if (Zap)
X	  bzero(zap, sizeof(zap));
X     
X     /*
X      * Gather info on the event window.
X      */
X     awi = GetAwmInfo(window);
X     if (!awi)
X	  Leave(FALSE)
X     status = XGetWindowAttributes(dpy, window, &window_info);
X     if (status == FAILURE)
X	  Leave(FALSE)
X
X     if (awi->title && !IsIcon(window, NULL)) {
X	  storegrid_func = StoreTitleGridBox;
X	  storebox_func = StoreTitleBox;
X     }
X     else {
X	  storegrid_func = StoreGridBox;
X	  storebox_func = StoreBox;
X     }
X     /*
X      * Initialize movement variables.
X      */
X     init_ulx = ulx = window_info.x;
X     init_uly = uly = window_info.y;
X     init_lrx = lrx = window_info.x + window_info.width +
X	  (window_info.border_width << 1) - 1;
X     init_lry = lry = window_info.y + window_info.height +
X	  (window_info.border_width << 1) - 1;
X     
X     /*
X      * Store the box.
X      */
X     if (Grid)
X	  num_vectors = (*storegrid_func)(box, ulx, uly, lrx, lry);
X     else
X	  num_vectors = (*storebox_func)(box, ulx, uly, lrx, lry);
X     
X     /*
X      * Initialize the previous location variables.
X      */
X     prev_x = x;
X     prev_y = y;
X     
X     /*
X      * Freeze the server, if requested by the user.
X      * This results in a solid box instead of a flickering one.
X      */
X     if (Freeze)
X	  XGrabServer(dpy);
X     Snatched = True;
X     /*
X      * Process any pending exposure events before drawing the box.
X      */
X     while (QLength(dpy) > 0) {
X	  XPeekEvent(dpy, &button_event);
X	  if (((XAnyEvent *)&button_event)->window == RootWindow(dpy, scr))
X	       break;
X	  GetButton(&button_event);
X     }
X     
X     /*
X      * Now draw the box.
X      */
X     
X     DrawBox();
X     Frozen = window;
X     
X     /*
X      * Main loop.
X      */
X     while (TRUE) {
X	  
X	  /*
X	   * Check to see if we have a change in mouse button status.
X	   * This is how we get out of this "while" loop.
X	   */
X	  if (XPending(dpy) && !ProcessRequests(box, num_vectors) &&
X	      GetButton(&button_event)) {
X	       /*
X		* Process the pending events, this sequence is the only
X		* way out of the loop and the routine.
X		*/
X	       
X	       if ((button_event.type != ButtonPress) && 
X		   (button_event.type != ButtonRelease)) {
X		    continue; /* spurious menu event... */
X	       }
X	       
X	       /*
X		* If we froze the server, then erase the last lines drawn.
X		*/
X	       if (Freeze) {
X		    DrawBox();
X		    Frozen = (Window)0;
X		    XUngrabServer(dpy);
X	       }
X	       
X	       if ((button_event.type == ButtonRelease) &&
X		   (((XButtonReleasedEvent *)&button_event)->button == button)) {
X		    
X		    /*
X		     * The button was released, so move the window.
X		     */
X		    
X		    if (Zap) {
X			 num_vectors = StoreZap(zap,
X						init_ulx, init_uly,
X						init_lrx, init_lry,
X						ulx, uly,
X						lrx, lry);
X			 DrawZap();
X			 DrawZap();
X		    }
X#ifdef titan /* 5x4 alignment */
X		    ulx += (ulx % 5);
X		    uly += (uly % 4);
X#endif /* titan */
X		    if (Wall) {
X			 if (ulx < 0)
X			      ulx = 0;
X			 if (ulx > (ScreenWidth - window_info.width))
X			      ulx = (ScreenWidth - window_info.width);
X			 if (uly < 0)
X			      uly = 0;
X			 if (uly > (ScreenHeight - window_info.height))
X			      uly = (ScreenHeight - window_info.height);
X		    }
X		    XMoveWindow(dpy, window, ulx, uly);
X		    Snatched = False;
X		    ungrab_pointer();
X		    Leave(TRUE)
X	       }
X	       else {
X		    /*
X		     * Some other button event occured, this aborts the
X		     * current operation.
X		     */
X		    
X		    ResetCursor(button);
X		    Snatched = False;
X		    ungrab_pointer();
X		    Leave(TRUE)
X	       }
X	  }
X	  
X	  /*
X	   * Take care of all the little things that have changed.
X	   */
X	  XQueryPointer(dpy, 
X			RootWindow(dpy, scr), &root,  &sub_window,
X			&root_x, &root_y, &cur_x, &cur_y, &ptrmask);
X	  if ((cur_x != prev_x) || (cur_y != prev_y)) {
X	       
X	       /*
X		* If we've frozen the server, then erase the old box first!
X		*/
X	       if (Freeze)
X		    DrawBox();
X	       
X	       /*
X		* Box position has changed.
X		*/
X	       ulx += cur_x - prev_x;
X	       uly += cur_y - prev_y;
X	       lrx += cur_x - prev_x;
X	       lry += cur_y - prev_y;
X	       
X	       /*
X		* Box needs to be restored.
X		*/
X	       if (Grid)
X		    num_vectors = (*storegrid_func)(box, ulx, uly, lrx, lry);
X	       else
X		    num_vectors = (*storebox_func)(box, ulx, uly, lrx, lry);
X	       
X	       
X	       /*
X		* Draw the new box.
X		*/
X	       if (Freeze)
X		    DrawBox();
X	  }
X	  
X	  /* 
X	   * Save old box position.
X	   */
X	  prev_x = cur_x;
X	  prev_y = cur_y;
X	  
X	  /*
X	   * If server is not frozen, then draw the "flicker" box.
X	   */
X	  if (!Freeze) {
X	       DrawBox();
X	       DrawBox();
X	  }
X     }
X}
END_OF_awm/Move.c
if test 8533 -ne `wc -c <awm/Move.c`; then
    echo shar: \"awm/Move.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/README\"
else
echo shar: Extracting \"awm/README\" \(7354 characters\)
sed "s/^X//" >awm/README <<'END_OF_awm/README'
XThis represents the first real release of the Ardent Window Manager (awm).
XIt's being released on the same terms as its predecessor (uwm) with
Xone additional request: Since this window manager is the "official"
Xwindow manager of Ardent Computer, a lot more effort and time will
Xbe expended to ensure that it works reliably. Please try and coordinate
Xfixes and enhancements through Ardent so that all may benefit. There
Xare sure to be some bugs, we'll be here trying to fix them. Send
Xbug reports to the author, or to:
X
X	{decwrl, uunet, hplabs, ucbcad, dlb}!ardent!awm-bugs
X
X
XINSTALLATION:
X
XInstallation should be fairly straightforward. If you're using imake,
Xfirst modify $(TOPDIR)/util/imake.includes/Imake.tmpl to define a macro
Xcalled AWMDIR (look at UWMDIR for an example) which should point to
Xsomeplace where you want to stash the system.awmrc file. If you like,
Xyou can just make UWMDIR and AWMDIR point to the same place since uwm
Xand awm's file names are different and won't conflict with eachother. If
Xyou're using make (and don't want to use imake), modify the definition
Xof AWMDIR in the Makefile instead (sort of the wrong way to do it though).
X
XCertain compilers don't like the #ident lines we use for sccs. If yours
Xdoesn't, do a
X
X	make noident
X
XIn the awm directory to remove all #ident lines from the source code.
X
XThe usual differences between system V and BSD include file structures
Xmay also cause you trouble. In particular, <sys/time.h> may be different.
XIf FocusChng.c doesn't compile correctly on your system, see if the
Xcorrect include file is in /usr/include or /usr/include/sys (the correct
Xone should define a timeval struct). I've also heard that SunOS 4.0
Xfails to compile code that compiles fine on SunOS 3.x. I don't know
Xwhat the symptoms are (since I don't have a 4.0 system around), but
XI've heard that the fix is to include <sys/file.h> in exp_path.c and
Xawm.c.
X
XIf you want awm's output to go to the console device (assumed to be
X/dev/console), define CONSOLE in the I/Makefile (there are appropriate
Xcomments that will show you what to do).
X
XThere's a file named XRdBitFD.c which contains a new Xlib routine called
XXReadBitmapFileData(). Awm uses this routine quite a bit, so you should install
Xit as part of your Xlib before compiling awm. Just move the file named
X"XRdBitFD.c" to lib/X and modify lib/X/Imakefile (or lib/X/Makefile if you
Xdon't use imake) to compile it with the rest of the library.
XIf this is not possible, look in the Imakefile/Makefile for the right
Xdefine to enable compilation with awm rather than the library.
X
XThe reason I wrote this routine was that the only two routines for
Xdealing with (reading in) bitmap files were XReadBitmapFile() and
XXCreatePixmapFromBitmapData().
XXReadBitmapFile() returns a depth one pixmap, with no opportunity
Xto specify either depth or color (evil). XCreatePixmapFromBitmapData()
Xallows this, but assumes that you've already got ahold of the
Xdata somehow. XReadBitmapFileData() takes care of that part.
XIt's my personal feeling that XReadBitmapFile() is about due
Xfor extinction.
X
XIf all this seems confusing, send me mail and I'll try to explain
Xit differently.
X
XSupport for the RTL Neaten package has been added. If you'd like to compile
Xit in, you need to do two things:
X
X  1. Obtain the RTL neaten package somehow. It's too big to bundle with awm,
X     so it's expected that you'll have obtained it by some other means.
X     If you are on a system V system with 14 character file names,
X     you're in for a bit for work. Many of the files in the neaten
X     package have very long names. After you've renamed all of the > 14 char
X     files, you'll want to modify Makefile.rtl (in the awm directory)
X     identically so that the file names match the new ones you've chosen.
X
X  2. The makefile that comes with the neaten package assumes that you want to
X     compile their neatening window manager (nuwm), so you don't want to use
X     that. Awm will automatically use the "Makefile.rtl" makefile to compile
X     the neaten package (see below), as long as it knows where you've put it.
X     Modify awm's Imakefile (or Makefile) to point to the directory
X     where neaten resides (the macro NEATEN_LIB) and uncomment/comment the
X     appropriate macro definition lines.
X
X  3. Do an imake/make. The make will compile all of awm's files and then
X     proceed to make a neaten.a (in the neaten directory) to link against.
X
X
X   If you don't compile awm with Neaten, the function f.neaten can
X   still be bound but it will just print a warning message if invoked.
X
X   Please note that the Neaten package has not been extensively tested with
X   awm and should be considered an experimental "frill" more than anything else.
X   It seems to shuffle icons around ok, though I don't understand some of its
X   window placement logic. If it's useful, use it, if not, don't compile it in.
X
X
XThe rtl menu package in menus (non-optional) has its own Makefile which
Xyou may wish to customize (compiler flags, compiler type, etc), though
Xthe default configuration should produce a working awm binary on your
Xsystem. This whole setup needs to be gone through and redone, but that will
Xhave to wait for another day (or a kind volunteer).
X
X
XFirst time users of awm will probably want to read the manual page carefully
Xand then set about tailoring their .Xdefaults file accordingly. The actual
Xformat of the .awmrc file does not differ substantially from uwm's .uwmrc file,
Xbut since much of the variable declaration stuff has been moved into .Xdefaults,
Xa .uwmrc file will fail miserably if blithly copied into a .awmrc file. It's
Xprobably easier to go from scratch, starting with .Xdefaults.
X
XAfter defaults have been entered (by far the largest task), a careful
Xexamination of your current uwm interface should be done to see what possible
Xbenefits might be derived from title bar, gadget and border contexts.
XYou will most likely be able to eliminate almost all "chorded" buttons and
Xgo to naked buttons on title bars/gadgets/borders. You can now also bind
Xnaked buttons to icons without having the button stolen from applications,
Xso it's usually a win to bind an f.iconify to the icon context if you like the
Xway X10's xterm used to work.
X
XHighlighting is a new feature which does quite a bit more than just tweak
Xborder colors. It will change the title bar text font (and redisplay the text)
Xas well as alternating between two different title bar background pixmaps and
Xor border context pixmaps.
X
XI use a blank pixmap for the regular background (which is the default, I.E.
XI don't declare one) and a pixmap containing 7 horizontal lines for the
XBoldPixmap.  The effect is not unlike a macintosh window. With some careful
Xartistry (and placement) of gadget boxes, one could probably emulate this
Xeven more closely, though I'm not sure why one would want to.
X
XWhen creating gadget box pixmaps, it's suggested that you look at the cursor
Xfont first as there are a lot of suitable glyphs already there.
X
X
XAny and all suggestions are, of course, appreciated. In addition to the
Xawm-bugs address given previously, you may communicate with the author
Xat any of the following addresses:
X
X
X			Author:		Jordan Hubbard
X			Internet:	jkh@violet.berkeley.edu
X			UUCP:		{decwrl, hplabs, uunet}!ardent!jkh
X			U.S. Mail:	Ardent Computer
X					880 Maude
X					Sunnyvale, Ca. 94086
X
X
X				
END_OF_awm/README
if test 7354 -ne `wc -c <awm/README`; then
    echo shar: \"awm/README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/menus/rtlmenu.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/menus/rtlmenu.c\"
else
echo shar: Extracting \"awm/menus/rtlmenu.c\" \(9320 characters\)
sed "s/^X//" >awm/menus/rtlmenu.c <<'END_OF_awm/menus/rtlmenu.c'
X#ident   "%W% %G%"
X
X#ifndef lint
X     static char sccs_id[] = "@(#)rtlmenu.c	2.1 12/16/87  Siemens Corporate Research and Support, Inc.";
X#endif
X
X
X/* 
X  RTL Menu Package Version 1.0
X  by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
X  
X  rtlmenu.c: interface level for menu package
X  */
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X  
X  Copyright 1987 by
X  Siemens Corporate Research and Support, Inc., Princeton, New Jersey
X  
X  Permission to use, copy, modify, and distribute this software
X  and its documentation for any purpose and without fee is
X  hereby granted, provided that the above copyright notice
X  appear in all copies and that both that copyright notice and
X  this permission notice appear in supporting documentation, and
X  that the name of Siemens not be used in advertising or
X  publicity pertaining to distribution of the software without
X  specific, written prior permission.  Siemens makes no
X  representations about the suitability of this software for any
X  purpose.  It is provided "as is" without express or implied
X  warranty.
X  
X  */
X
X#include <stdio.h>
X#include "X11/Xlib.h"
X
X#include "menu.h"
X#include "menu.def.h"
X#include "menu.ext.h"
X#include "rtlmenu.h"
X#include "dbug.h"
X
Xextern Display *dpy;
Xextern int scr;
X
Xstatic RTLPoint menu_pos;
Xstatic int initialized = 0;
X    
Xvoid RTLMenu_Initialize (options_mask)
XMenuOptionsMask options_mask;
X{
X     Entry("RTLMenu_Initialize")
X
X     if (initialized)
X	  return;
X     initialized = 1;
X     InitMenu ("uwm", options_mask);
X     Leave_void
X}
X
X/* ------------------------------------------------------------ */
XRTLMenu RTLMenu_Create()
X{
X     Entry("RTLMenu_Create")
X     /* Create a menu with no name, not in inverse video. */
X     
X     Leave((RTLMenu)NewMenu())
X}
X
X/* ------------------------------------------------------------ */
Xvoid RTLMenu_Destroy( menu )
XRTLMenu menu;
X{
X     Entry("RTLMenu_Destroy")
X     DisposeMenu ((Menu*) menu);
X     Leave_void
X}
X
X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
X
Xpointer RTLMenu_Data( menu, item )
X/*ARGSUSED*/
XRTLMenu menu;
XRTLMenuItem item;
X{
X     Entry("RTLMenu_Data")
X     Leave(ItemData((MenuItem*)item))
X}
X
X/* ------------------------------------------------------------ */
X
XRTLMenu RTLMenu_Get_Submenu( menu, str )
XRTLMenu menu;
Xchar *str;
X{
X     MenuItem *item = MenuItemByName ((Menu*) menu, str);
X 
X     Entry("RTLMenu_Get_Submenu")
X
X     if (!ItemIsNull(item))
X	  Leave((RTLMenu)ItemSubmenu(item))
X     Leave(0)
X}
X
X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
X
X/*ARGSUSED*/
Xstatic void RTLMenu_Client_Send( menu, item )
XRTLMenu menu;
XRTLMenuItem item;
X{
X     Entry("RTLMenu_Client_Send")
X
X     printf ("RTLMenu_Client_Send not yet implemented for X, string = \"%s\"\n",
X	     (char*) item);
X     Leave_void
X}
X
X/* ------------------------------------------------------------ */
X
XRTLMenuItem RTLMenu_Append_String( menu, str, strval )
XRTLMenu menu;
Xchar *str;
Xchar *strval;
X{
X     MenuItem *item = AddMenuItem((Menu*)menu, str);
X 
X     Entry("RTLMenu_Append_String")
X
X     ItemCallback(item) = (Callback)RTLMenu_Client_Send;
X     ItemData(item) = (pointer) strval;
X     Leave((RTLMenuItem)item)
X}
X
X/* ------------------------------------------------------------ */
X
XRTLMenuItem RTLMenu_Append_Callback( menu, backproc )
XRTLMenu menu;
XVoidFunc backproc;
X{
X     MenuItem *item = AddMenuItem((Menu*)menu, "");
X 
X     Entry("RTLMenu_Append_Callback")
X
X     ItemGenerator(item) = (Callback)backproc;
X     
X     Leave((RTLMenuItem)item)
X}
X
X/* ------------------------------------------------------------ */
X
XRTLMenuItem RTLMenu_Append_Call( menu, str, pix, proc, ptrval )
XRTLMenu menu;
Xchar *str;
Xchar *pix;
XVoidFunc proc;
Xpointer ptrval;
X{
X     MenuItem *item = AddMenuItem((Menu*)menu, str, pix);
X     
X     Entry("RTLMenu_Append_Call")
X
X     ItemCallback(item) = proc;
X     ItemData(item) = ptrval;
X     
X     Leave((RTLMenuItem)item)
X}
X
X/* ------------------------------------------------------------ */
X
XRTLMenuItem RTLMenu_Append_Checkback( menu, str, pix, checkproc, proc, ptrval )
XRTLMenu menu;
Xchar *str;   /* Menu string */
Xchar *pix;
Xbool (*checkproc) ();  /* Boolean function called when menu entry
X			  is about to be displayed.  If true, then
X			  the item appears checked; if false, then
X			  it does not */
XVoidFunc proc;  /* function to be called when the item 
X		   is selected */
Xpointer ptrval; /* data associated with this item */
X{
X     MenuItem *item = AddMenuItem((Menu*)menu, str, pix);
X 
X     Entry("RTLMenu_Append_Checkback")
X
X     ItemCallback(item) = proc;
X     ItemData(item) = ptrval;
X     ItemCheckproc(item) =  checkproc;
X     
X     Leave((RTLMenuItem)item)
X}
X/* ------------------------------------------------------------ */
X
XRTLMenuItem RTLMenu_Append_Submenu( menu, str, pix, submenu )
XRTLMenu menu;
Xchar *str;
Xchar *pix;
XRTLMenu submenu;
X{
X     MenuItem *item = AddMenuItem((Menu*)menu, str, pix);
X 
X     Entry("RTLMenu_Append_Submenu")
X
X     ItemSubmenu(item) = (Menu*)submenu;
X     
X     Leave((RTLMenuItem)item)
X}
X
X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
X
Xvoid RTLMenu_Replace_Data_Keyed_String( menu, data, str )
XRTLMenu menu;
Xpointer data;
Xchar *str;
X{
X     MenuItem *item = MenuItemByName((Menu*) menu, str);
X 
X     Entry("RTLMenu_Replace_Keyed_String")
X
X     if (!ItemIsNull(item))
X	  ItemData(item) = data;
X     Leave_void
X} 
X
X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
X
Xvoid RTLMenu_Activate_Entry( menu, item )
XRTLMenu menu;
XRTLMenuItem item;
X{
X     Entry("RTLMenu_Activate_Entry")
X
X     (void)SetItemDisable((Menu*)menu, (MenuItem*)item, FALSE);
X     Leave_void
X}
X
X/* ------------------------------------------------------------ */    
X
Xvoid RTLMenu_Inactivate_Entry( menu, item )
XRTLMenu menu;
XRTLMenuItem item;
X{
X     Entry("RTLMenu_Inactivate_Entry")
X
X     (void)SetItemDisable((Menu*)menu, (MenuItem*)item, TRUE);
X     Leave_void
X}
X
Xvoid RTLMenu_Label_Entry( menu, item )
XRTLMenu menu;
XRTLMenuItem item;
X{
X     Entry("RTLMenu_Label_Entry")
X
X     (void)SetItemDeaf((Menu*)menu, (MenuItem*)item, TRUE);
X     Leave_void
X}
X
X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
X
Xbool RTLMenu_Has_Data( menu, val )
XRTLMenu menu;
Xpointer val;
X{
X     MenuItem *item = MenuItemByData((Menu*)menu, val);
X     Entry("RTLMenu_Has_Data")
X
X     Leave(!ItemIsNull(item))
X}
X
X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
X
Xvoid RTLMenu_Delete_Entries( menu )
XRTLMenu menu;
X{
X     Entry("RTLMenu_Delete_Entries")
X
X     while (DisposeItem((Menu*)menu, MenuItems((Menu*)menu)));
X     Leave_void
X}
X
X/* ------------------------------------------------------------ */
X
Xvoid RTLMenu_Delete_String( menu, str )
XRTLMenu menu;
Xchar *str;
X{
X     MenuItem *item = MenuItemByName((Menu*) menu, str);
X     
X     Entry("RTLMenu_Delete_String");
X
X     if (!ItemIsNull(item))
X	  (void) DisposeItem ((Menu*)menu, item);
X     Leave_void
X}
X
X/* ------------------------------------------------------------ */
X
Xvoid RTLMenu_Delete_Data( menu, val )
XRTLMenu menu;
Xpointer val;
X{
X     MenuItem *item = MenuItemByData((Menu*)menu, val);
X     
X     Entry("RTLMenu_Delete_Data");
X
X     if (!ItemIsNull(item))
X	  (void) DisposeItem((Menu*)menu, item);
X     Leave_void
X}
X
X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
X
X/*ARGSUSED*/
Xvoid RTLMenu_Box( menu )
XRTLMenu menu;
X{
X     /* Commented out */
X}
X
X/* ------------------------------------------------------------ */
X
X/*ARGSUSED*/
Xvoid RTLMenu_Enter( menu, butnum, buttime, base_window, pos )
XRTLMenu menu;
Xint butnum;
XTime buttime;
XWindow base_window;
XRTLPoint pos;
X{
X     MenuItem *selected;
X     
X     Entry("RTLMenu_Enter")
X
X     menu_pos = pos;
X     selected = TrackMenu ((Menu*) menu, menu_pos.x, menu_pos.y,
X			   butnum, base_window, buttime);
X     if (!ItemIsNull(selected))
X	  (ItemCallback(selected)) (menu, selected, base_window);
X     Leave_void
X}
X/* ------------------------------------------------------------ */
X
XRTLPoint RTLMenu_Entry_Pos()
X{
X     Entry("RTLMenu_Entry_Pos")
X     /* menu_pos is a global static that gets set by the call to */
X     /* XQueryPointer that is used by the TrackMenu call.        */
X     
X     Leave(menu_pos)
X}
X
X
Xvoid RTLMenu_Generate_Items(menu, proc)
X/* apply VoidFunc proc to each item in the menu, with       */
X/* arguments menu and menuItem                              */
XRTLMenu menu;
XVoidFunc proc;
X{
X     MenuItem *item;
X     
X     Entry("RTLMenu_Generate_Items")
X
X     for (item = MenuItems((Menu*)menu);
X	  !ItemIsNull(item); item = ItemNext(item))
X     {
X	  (proc)((RTLMenu)menu, (RTLMenuItem)item);
X     }
X     Leave_void
X}
END_OF_awm/menus/rtlmenu.c
if test 9320 -ne `wc -c <awm/menus/rtlmenu.c`; then
    echo shar: \"awm/menus/rtlmenu.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 5 \(of 13\).
cp /dev/null ark5isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 13 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330