[comp.sources.x] v03i024: Ardent Window Manager, Patchlevel 9, Part08/12

mikew@wyse.wyse.com (Mike Wexler) (02/21/89)

Submitted-by: kmw@ardent (Ken Wallich)  
Posting-number: Volume 3, Issue 24
Archive-name: awm2/part08

#! /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 8 (of 12)."
# Contents:  CHANGES Gadget.c GridBox.c Makefile Move.c
#   bitmaps/titlehilite.bm menus/menu.def.h
# Wrapped by mikew@wyse on Fri Feb 17 10:50:29 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'CHANGES'\"
else
echo shar: Extracting \"'CHANGES'\" \(9162 characters\)
sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
XThis file last changed: 8/17/88
X
XThe most recent changes to awm include:
X
XInvalid free() removed from gram.y.
XTransient window placement fixed.
XSignal handling done correctly for system V.
X
XPrevious changes to awm:
X
XChanges as of 7/2/88:
X
XBorder/title context rationalized, you may now have border contexts without
Xntitle 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
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_FILE
if test 9162 -ne `wc -c <'CHANGES'`; then
    echo shar: \"'CHANGES'\" unpacked with wrong size!
fi
# end of 'CHANGES'
fi
if test -f 'Gadget.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Gadget.c'\"
else
echo shar: Extracting \"'Gadget.c'\" \(9031 characters\)
sed "s/^X//" >'Gadget.c' <<'END_OF_FILE'
X
X
X
X#ifndef lint
Xstatic char *rcsid_Gadget_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Gadget.c,v 1.2 89/02/07 20:04:53 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 * 1.4 -- Fixed really silly bug with gadget offset.
X *
X */
X
X#include "awm.h"
X
X#include "X11/Xutil.h"
X
Xextern XContext AwmContext;
Xvoid PaintGadgets();
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, (caddr_t *) &awi)) {
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     }
X     Leave((AwmInfoPtr)NULL)
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     Boolean change = FALSE;
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_void
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	  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               gdec->high = xwa.height;
X	  else
X	       ny = (ny / 2) - 1;
X	  if (ny < 0)
X	       ny = 0;
X	  if (dir == LeftGadgetGravity) {
X	       nx = lx + gdec->offset;
X	       if (lx != 0) /* not first time through, add pad */
X		    nx += 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#ifndef RAINBOW
X                         pix = GrayPixmap;
X#else
X                         pix = awi->grayPixmap;
X#endif
X		    }
X		    XSetWindowBackgroundPixmap(dpy, tmp, pix);
X		    XFreePixmap(dpy, pix);
X	       }
X	       XMapWindow(dpy, tmp);
X	       XSaveContext(dpy, tmp, AwmContext, (caddr_t) 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     if (Gadgets[n])
X	  free(Gadgets[n]);
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	  Gadgets[i] = 0;
X     }
X     NumGadgets = 0;
X     if (Gadgets) {
X	  free(Gadgets);
X	  Gadgets = 0;
X     }
X}
X     
Xvoid 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
Xvoid 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, (char *) gdec->name, strlen(gdec->name));
X	  }
X     }
X     Leave_void
X}
END_OF_FILE
if test 9031 -ne `wc -c <'Gadget.c'`; then
    echo shar: \"'Gadget.c'\" unpacked with wrong size!
fi
# end of 'Gadget.c'
fi
if test -f 'GridBox.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'GridBox.c'\"
else
echo shar: Extracting \"'GridBox.c'\" \(7884 characters\)
sed "s/^X//" >'GridBox.c' <<'END_OF_FILE'
X
X
X
X#ifndef lint
Xstatic char *rcsid_StoreGridBox_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/GridBox.c,v 1.1 89/01/23 15:34:22 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_FILE
if test 7884 -ne `wc -c <'GridBox.c'`; then
    echo shar: \"'GridBox.c'\" unpacked with wrong size!
fi
# end of 'GridBox.c'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(9394 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# X Window System Makefile generated from template file Imake.tmpl
X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $
X#
X# Do not change the body of the imake template file.  Server-specific
X# parameters may be set in the appropriate .macros file; site-specific
X# parameters (but shared by all servers) may be set in site.def.  If you
X# make any changes, you'll need to rebuild the makefiles using
X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in
X# the top level directory.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit Sun.macros to change
X
X# platform:  $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $
X# operating system:   SunOS 3.4
X
XBOOTSTRAPCFLAGS =
X             AS = as
X             CC = cc
X            CPP = /lib/cpp
X             LD = ld
X           LINT = lint
X        INSTALL = install
X           TAGS = ctags
X             RM = rm -f
X             MV = mv
X             LN = ln -s
X         RANLIB = ranlib
XRANLIBINSTFLAGS = -t
X             AR = ar clq
X             LS = ls
X       LINTOPTS = -xz
X    LINTLIBFLAG = -C
X           MAKE = make
XSTD_CPP_DEFINES =
X    STD_DEFINES =
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $
X
X###########################################################################
X# definitions common to all Makefiles - do not edit
X
X          SHELL =  /bin/sh
X
X        DESTDIR = /global
X      USRLIBDIR = $(DESTDIR)/lib
X         BINDIR = $(DESTDIR)/bin/X11
X         INCDIR = $(DESTDIR)/include
X         ADMDIR = $(DESTDIR)/usr/adm
X         LIBDIR = $(USRLIBDIR)/X11
X     LINTLIBDIR = $(USRLIBDIR)/lint
X        FONTDIR = $(LIBDIR)/fonts
X       XINITDIR = $(LIBDIR)/xinit
X         XDMDIR = $(LIBDIR)/xdm
X         UWMDIR = $(LIBDIR)/uwm
X         AWMDIR = $(LIBDIR)/awm
X         TWMDIR = $(LIBDIR)/twm
X          DTDIR = $(LIBDIR)/dt
X        MANPATH = /usr/man
X  MANSOURCEPATH = $(MANPATH)/man
X         MANDIR = $(MANSOURCEPATH)n
X      LIBMANDIR = $(MANSOURCEPATH)n3
X    XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X   INSTBINFLAGS = -m 0755
X   INSTUIDFLAGS = -m 4755
X   INSTLIBFLAGS = -m 0664
X   INSTINCFLAGS = -m 0444
X   INSTMANFLAGS = -m 0444
X   INSTAPPFLAGS = -m 0444
X  INSTKMEMFLAGS = -m 4755
X        FCFLAGS = -t
X    CDEBUGFLAGS = -O
X
X        PATHSEP = /
X         DEPEND = $(BINDIR)/makedepend
X          IMAKE = $(BINDIR)/imake
X            RGB = $(LIBDIR)/rgb
X             FC = $(BINDIR)/bdftosnf
X      MKFONTDIR = $(BINDIR)/mkfontdir
X      MKDIRHIER = $(BINDIR)/mkdirhier.sh
X
X         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
X      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
X        LDFLAGS = $(CDEBUGFLAGS) -L$(USRLIBDIR) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
X
X       IRULESRC = $(LIBDIR)/imake.includes
X
X   EXTENSIONLIB = $(USRLIBDIR)/libext.a
X           XLIB = $(USRLIBDIR)/libX11.a
X         XMULIB = $(USRLIBDIR)/libXmu.a
X        OLDXLIB = $(USRLIBDIR)/liboldX.a
X       XTOOLLIB = $(USRLIBDIR)/libXt.a
X         XAWLIB = $(USRLIBDIR)/libXaw.a
X       LINTXLIB = $(USRLIBDIR)/lint/llib-lX11.ln
X        LINTXMU = $(USRLIBDIR)/lint/llib-lXmu.ln
X      LINTXTOOL = $(USRLIBDIR)/lint/llib-lXt.ln
X        LINTXAW = $(USRLIBDIR)/lint/llib-lXaw.ln
X       INCLUDES = -I$(INCDIR)
X      MACROFILE = Sun.macros
X   ICONFIGFILES = $(IRULESRC)/Imake.tmpl \
X			$(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def
X  IMAKE_DEFINES =
X      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \
X			-s Makefile $(IMAKE_DEFINES)
X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
X			.emacs_* tags TAGS make.log MakeOut
X
X###########################################################################
X# rules:  $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
X       MENU_LIB = menus
X      MENU_ARCH = $(MENU_LIB)/rtlmenu.a
X     NEATEN_LIB = /grgr/neaten
X    NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
X  SYS_LIBRARIES = -ll -lm
X      OTHERSRCS = gram.y lex.l
X         YFLAGS = -d
X         HFILES = awm.h neaten.def.h neaten.ext.h support.h
X
X# The following defines can be added to the approprate DEFINES macro
X# (see below) to enable additional features.
X#
X# -DCONSOLE if you want output (stderr and stdout) to go to the system console.
X#
X# -DWMSTATE if you want the XA_WM_STATE atom to reflect the state of each
X#     top-level window (I.E. iconified, not iconified, etc).
X#
X# -DRAINBOW if you want to be able to specify border colors on a client or
X#     class basis.
X#
X# -DLOCKSCR if for some reason you want a lockscreen function built into
X#     the window manager. Could be just as easily done by invoking a program,
X#     but some like to put all their eggs in one basket.
X
X# Use these macros if you want the RTL Neaten package.
X# Also make sure that NEATEN_LIB points to the right place. See the README
X# file for instructions (though you can just define this and give it a shot).
X#       DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\" -DNEATEN
X#       LOCAL_LIBRARIES = $(NEATEN_ARCH) $(MENU_ARCH) $(XMULIB) $(XLIB)
X
X# Use these macros if you don't want the RTL Neaten package.
X        DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\" -DWMSTATE -DLOCKSCR
X        LOCAL_LIBRARIES = $(MENU_ARCH) $(XMULIB) $(XLIB)
X        LINTLIBS = $(LINTXLIB)
X
XSRCS=	globals.c Beep.c Bindings.c CircleDown.c CircleUp.c\
X	Cursors.c Focus.c GetButton.c  GridBox.c Iconify.c Icons.c Lower.c\
X	Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
X	Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
X	StoreZap.c XError.c awm.c FocusChng.c Titlebar.c errHndlr.c \
X	Grab.c menu_sup.c Gadget.c support.c exp_path.c Neaten.c \
X	lockscreen.c Lock.c
X
XOBJS=	gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
X	Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
X	Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
X	Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
X	StoreZap.o XError.o awm.o FocusChng.o Titlebar.o errHndlr.o \
X	Grab.o menu_sup.o Gadget.o support.o exp_path.o Neaten.o \
X	lockscreen.o Lock.o
X
X PROGRAM = awm
X
Xall:: awm
X
Xawm: $(OBJS) $(LOCAL_LIBRARIES)
X	$(RM) $@
X	$(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) $(PROGRAM)
X	$(MAKE) $(MFLAGS) $(PROGRAM)
X
Xinstall:: awm
X	$(INSTALL) -c $(INSTALLFLAGS) awm $(BINDIR)
X
Xinstall.man:: awm.man
X	$(INSTALL) -c $(INSTMANFLAGS) awm.man $(MANDIR)/awm.n
X
Xdepend:: $(DEPEND)
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
X
X$(DEPEND):
X	@echo "making $@"; \
X	cd $(DEPENDSRC); $(MAKE)
X
Xclean::
X	$(RM) $(PROGRAM)
X
Xlint:
X	$(LINT) $(LINTFLAGS) $(SRCS) gram.c lex.c $(LINTLIBS)
Xlint1:
X	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
Xinstall:: system.awmrc
X	$(INSTALL) -c $(INSTALLFLAGS) system.awmrc  $(AWMDIR)
X
X$(MENU_ARCH)::
X	@echo Making menu package...
X	@(cd $(MENU_LIB); make CC=$(CC) CFLAGS="$(CFLAGS)")
X	@echo done.
X
X$(NEATEN_ARCH)::
X	cp Makefile.rtl $(NEATEN_LIB)/Makefile
X	@echo Making Neaten package
X	@(cd $(NEATEN_LIB); make -f Makefile)
X	@echo done.
X
Xclean::
X	@echo Cleaning menus...
X	@(cd $(MENU_LIB); make clean)
X	@echo done.
X	rm -f y.tab.h
X
Xnoident::
X	@echo Removing ident lines from awm...
X	@for i in $(SRCS) $(OTHERSRCS) $(HFILES); do \
X	sed -e '/#ident/D' < $$i > /tmp/x.$$i && \
X	mv /tmp/x.$$i $$i ; \
X	done
X	@(cd $(MENU_LIB); make noident)
X	@echo done.
X
X###########################################################################
X# Imake.tmpl common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
XMakefile:: Imakefile \
X	$(IRULESRC)/Imake.tmpl \
X	$(IRULESRC)/Imake.rules \
X	$(IRULESRC)/site.def \
X	$(IRULESRC)/$(MACROFILE)
X	-@if [ -f Makefile ]; then \
X	echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP)
X
X$(IMAKE):
X	@echo "making $@"; \
X	cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install done"
X
Xinstall.man::
X	@echo "install.man done"
X
XMakefiles::
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 9394 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'Move.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Move.c'\"
else
echo shar: Extracting \"'Move.c'\" \(8666 characters\)
sed "s/^X//" >'Move.c' <<'END_OF_FILE'
X
X
X
X#ifndef lint
Xstatic char *rcsid_Move_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Move.c,v 1.2 89/02/07 21:22: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 * 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
X/*ARGSUSED*/
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     unsigned 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     extern void ungrab_pointer();
X     extern void grab_pointer();
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, None)) {
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 + 3) / 5) * 5;
X		    uly = ((uly + 2) / 4) * 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_FILE
if test 8666 -ne `wc -c <'Move.c'`; then
    echo shar: \"'Move.c'\" unpacked with wrong size!
fi
# end of 'Move.c'
fi
if test -f 'bitmaps/titlehilite.bm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'bitmaps/titlehilite.bm'\"
else
echo shar: Extracting \"'bitmaps/titlehilite.bm'\" \(290 characters\)
sed "s/^X//" >'bitmaps/titlehilite.bm' <<'END_OF_FILE'
X#define titlebold_width 16
X#define titlebold_height 16
Xstatic char titlebold_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
X   0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
X   0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00};
END_OF_FILE
if test 290 -ne `wc -c <'bitmaps/titlehilite.bm'`; then
    echo shar: \"'bitmaps/titlehilite.bm'\" unpacked with wrong size!
fi
# end of 'bitmaps/titlehilite.bm'
fi
if test -f 'menus/menu.def.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'menus/menu.def.h'\"
else
echo shar: Extracting \"'menus/menu.def.h'\" \(6570 characters\)
sed "s/^X//" >'menus/menu.def.h' <<'END_OF_FILE'
X
X/*
X#ifndef lint
Xstatic char sccs_id[] = "@(#)menu.define.h	2.1 12/16/87  Siemens Corporate Research and Support, Inc.";
X#endif
X*/
X
X
X/*
X  RTL Menu Package Version 1.0
X  by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
X
X  menu.h: macros for menu package
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
XCopyright 1987 by
X	Siemens Corporate Research and Support, Inc., Princeton, New Jersey
X
XPermission to use, copy, modify, and distribute this software
Xand its documentation for any purpose and without fee is
Xhereby granted, provided that the above copyright notice
Xappear in all copies and that both that copyright notice and
Xthis permission notice appear in supporting documentation, and
Xthat the name of Siemens not be used in advertising or
Xpublicity pertaining to distribution of the software without
Xspecific, written prior permission.  Siemens makes no
Xrepresentations about the suitability of this software for any
Xpurpose.  It is provided "as is" without express or implied
Xwarranty.
X
X*/
X#ifndef MENU_DEF_INCLUDE
X#define MENU_DEF_INCLUDE
X
X/* Menu data structure access macros */
X
X#define MenuWidth(menu) (menu)->menuWidth
X#define MenuHeight(menu) (menu)->menuHeight
X#define MenuOldWidth(menu) (menu)->menuOldWidth
X#define MenuOldHeight(menu) (menu)->menuOldHeight
X#define MenuItemWidth(menu) (menu)->menuItemWidth
X#define MenuFlags(menu) (menu)->menuFlags
X#define MenuMaxTextWidth(menu) (menu)->menuMaxTextWidth
X#define MenuBorderWidth(menu) MBorderWidth
X#define MenuOldBorderWidth(menu) (menu)->menuOldBorderWidth
X#define MenuItemPad(menu) MPad
X#define MenuDisplay(menu) (menu)->display
X#define MenuScreen(menu) (menu)->screen
X#define MenuWindow(menu) (menu)->menuWindow
X#define MenuCursor(menu) (menu)->menuCursor
X#define MenuSavedPixmap(menu) (menu)->savedPixmap
X#define MenuSavedImage(menu) ((menu)->savedImage)
X#define MenuSavedImageX(menu) (menu)->menuSavedImageX
X#define MenuSavedImageY(menu) (menu)->menuSavedImageY
X#define MenuItems(menu) (menu)->menuItems
X#define MenuFontInfo(menu) (menu)->menuFontInfo
X#define MenuNormalGC(menu) (menu)->normalGC
X#define MenuInvertGC(menu) (menu)->invertGC
X#define MenuGreyGC(menu) (menu)->greyGC
X#define MenuGreyPixmap(menu) (menu)->greyPixmap
X#define MenuCheckmarkPixmap(menu) (menu)->checkmarkPixmap
X#define MenuArrowPixmap(menu) (menu)->arrowPixmap
X#define MenuInitialItemText(menu) (menu)->menuInitialItemText
X#define MenuItemHighlighted(menu) (menu)->highlightedItem
X#define MenuNested(menu) (menu)->menuNested
X#define MenuX(menu) (menu)->menuX
X#define MenuY(menu) (menu)->menuY
X#define MenuParent(menu) (menu)->parentMenu
X#define MenuDelta(menu) MDelta
X#define MenuOptions(menu) (menu)->menuOptions
X#define NULLMENU ((Menu *) NULL)
X
X/* Menu predicates */
X
X#define MenuIsNull(menu) (menu == NULLMENU)
X#define MenuIsDisplayed(menu) (menu->menuFlags & menuMapped)
X#define MenuHasInitialItem(menu) (menu->menuInitialItemText != (char *) NULL)
X
X/* Menu modifiers */
X
X#define SetHighlightItem(menu, item) (menu->highlightedItem = item)
X#define ResetHighlightItem(menu) (menu->highlightedItem = NULLITEM)
X#define	SetMenuEventHandler(menu,f)	menu->menuEventHandler = f
X#define SetMenuFlag(menu, flag)     MenuFlags(menu) |= flag
X#define ResetMenuFlag(menu,flag)    MenuFlags(menu) &= ~flag
X#define TestMenuFlag(menu,flag)     (MenuFlags(menu) & flag)
X#define TestOptionFlag(menu,option) (MenuOptions(menu) & option)
X
X/* Item data structure access macros */
X
X#define ItemFlags(item) (item)->itemFlags
X#define ItemText(item) (item)->itemText
X#define ItemTextLength(item) (item)->itemTextLength
X#define ItemTextWidth(item) (item)->itemTextWidth
X#define ItemNext(item) (item)->nextItem
X#define ItemSubmenu(item) (item)->itemSubmenu
X#define ItemTag(item) (item)->itemTag
X#define ItemGenerator(item) (item)->generator
X#define ItemGeneratorParamPointer(item) (item)->genParamPointer
X#define ItemCheckproc(item) (item)->checkproc
X#define ItemCallback(item) (item)->itemCallback
X#define ItemData(item) (item)->itemData
X#define ItemWindow(item) (item)->itemWindow
X#define ItemMenu(item) (item)->itemMenu
X#define NULLITEM ((MenuItem *) NULL)
X#define ItemGetArrowPosition(item) (item->itemMenu->menuWidth - arrow_width)
X
X/* Item predicates */
X#define ItemIsNull(item) (item == NULLITEM)
X#define ItemIsInitialItem(menu, item) \
X    (MenuInitialItemText(menu) && \
X     (strcmp(MenuInitialItemText(menu), ItemText(item)) == 0))
X#define ItemIsLeaf(item) ((item->itemSubmenu == (Menu *) 0) ? TRUE : FALSE)
X#define ItemIsDisabled(item) (ItemFlags(item) & itemDisabled)
X#define ItemIsDeaf(item) (ItemFlags(item) & itemDeaf)
X
X/* Item modifiers */
X
X#define	CheckItem(menu,item)	SetItemCheck(menu,item,1)
X#define	DisableItem(menu,item)	SetItemDisable(menu,item,1)
X#define	EnableItem(menu,item)	SetItemDisable(menu,item,0)
X#define	UncheckItem(menu,item)	SetItemCheck(menu,item,0)
X#define SetItemFlag(item, flag) ItemFlags(item) |= flag
X#define ResetItemFlag(item,flag) ItemFlags(item) &= ~flag
X#define TestItemFlag(item,flag) (ItemFlags(item) & flag)
X#define MoveItemFlag(item,flag1,flag2) \
X    if (TestItemFlag(item,flag1))\
X        SetItemFlag(item,flag2);\
X    else\
X        ResetItemFlag(item,flag2);\
X    ResetItemFlag(item,flag1);
X
X/* Masks */
X
X#define MenuEventMask (LeaveWindowMask | EnterWindowMask | ButtonReleaseMask)
X#define NormalItemEventMask MenuEventMask
X#define SubmenuItemEventMask (MenuEventMask | PointerMotionMask)
X#define MenuIgnoreMask (unsigned long) 0
X
X/* Magic numbers */
X
X#define	checkMarkWidth		9
X#define	checkMarkHeight		8
X#define	defaultCursorWidth     16
X#define	defaultCursorHeight    16
X#define	defaultCursorX		1
X#define	defaultCursorY		1
X#define	lineSeparatorHeight	9
X
X/* external declarations */
X
Xextern Menu *NewMenu();
Xextern MenuItem *TrackMenu ();
Xextern MenuItem *MenuItemByName (), *Display_Menu(); 
Xextern void InitMenu ();
Xextern void DisposeMenu ();
Xextern void Draw_Menu();
X#endif MENU_DEF_INCLUDE
END_OF_FILE
if test 6570 -ne `wc -c <'menus/menu.def.h'`; then
    echo shar: \"'menus/menu.def.h'\" unpacked with wrong size!
fi
# end of 'menus/menu.def.h'
fi
echo shar: End of archive 8 \(of 12\).
cp /dev/null ark8isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 12 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
Moderator of comp.sources.x