[comp.windows.x] awm kit, Part05

jkh@ardent.UUCP (Jordan K. Hubbard) (06/06/88)

#! /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 8)."
# Contents:  Neaten.c Resize.c awm.h
# Wrapped by jkh@ardent on Sun Jun  5 18:56:33 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Neaten.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Neaten.c'\"
else
echo shar: Extracting \"'Neaten.c'\" \(13808 characters\)
sed "s/^X//" >'Neaten.c' <<'END_OF_FILE'
X#include "awm.h"
X     
X#ifdef NEATEN
X     
X#include "X11/Xutil.h"
X#include "X11/cursorfont.h"
X#include "neaten.ext.h"
X
static void GetIconHints();
static void GetName();
extern Boolean IsIcon();
extern int neaten_debug_level;
extern int Fheight;
X
X#define TOP_LEVEL (awi->frame ? awi->frame : awi->client)
X
X/* ARGSUSED */
Boolean Neaten(window, mask, button, x, y)
Window window;                          /* Event window. */
int mask;                               /* Button/key mask. */
int button;   	                        /* Button event detail. */
int x, y;                               /* Event mouse position. */
X{
X     Window junk_window;
X     Window w;
X     Window icon_window;
X     Window stacktop;
X     Window *children;
X     XWindowAttributes attrs;
X     XSizeHints hints;
X     XWindowChanges  wc;
X     Status rstatus;
X     char name[50];
X     int junk;
X     int root_x, root_y;
X     int root_width, root_height;
X     int icon_x, icon_y;
X     int icon_width, icon_height;
X     int icon_border;
X     int window_x, window_y;
X     int window_width, window_height;
X     int rval;
X     int ix;
X     int iconic;
X     int tiled;
X     int adjustment;
X     int priority;
X     int priority_increment;
X     unsigned int nchildren;
X     unsigned int mapped_children = 0;
X     unsigned int opened_children = 0;
X     unsigned int  wcmask;
X     Placement primary;
X     Placement secondary;
X     Boolean is_iconic;
X     Cursor rtlcursor;
X     XFontStruct *font;
X     GC gc;
X     AwmInfoPtr awi;
X
X     Entry("Neaten")
X
X     font = (XFontStruct *) XLoadQueryFont(dpy, "cursor");
X     gc = DefaultGC(dpy, scr);
X     XSetFont(dpy, gc, font->fid);
X     
X     rtlcursor = XCreateFontCursor(dpy, XC_rtl_logo);
X     
X     XGrabPointer(dpy, RootWindow(dpy, scr), FALSE, (unsigned int) 0,
X		  GrabModeAsync, GrabModeAsync,
X		  (Window) None, rtlcursor, CurrentTime);
X     
X     if (AbsMinWidth == 0)
X	  AbsMinWidth = DEFAULT_ABS_MIN;
X     if (AbsMinHeight == 0)
X	  AbsMinHeight = DEFAULT_ABS_MIN;
X     
X     XGetGeometry(dpy, RootWindow(dpy, scr), &junk_window,
X		  &root_x, &root_y,
X		  &root_width, &root_height,
X		  &junk, &junk);
X     
X     Neaten_Initialize(root_width+SEPARATION,
X		       root_height+SEPARATION,
X		       AbsMinWidth, AbsMinHeight);
X     
X     if (strcmp(PrimaryIconPlacement, "Closest") == 0)
X	  primary = Place_Closest;
X     else if (strcmp(PrimaryIconPlacement, "Top") == 0)
X	  primary = Place_Top;
X     else if (strcmp(PrimaryIconPlacement, "Bottom") == 0)
X	  primary = Place_Bottom;
X     else if (strcmp(PrimaryIconPlacement, "Left") == 0)
X	  primary = Place_Left;
X     else if (strcmp(PrimaryIconPlacement, "Right") == 0)
X	  primary = Place_Right;
X     else
X	  primary = Place_Top;
X     
X     if (strcmp(SecondaryIconPlacement, "Closest") == 0)
X	  secondary = Place_Closest;
X     else if (strcmp(SecondaryIconPlacement, "Top") == 0)
X	  secondary = Place_Top;
X     else if (strcmp(SecondaryIconPlacement, "Bottom") == 0)
X	  secondary = Place_Bottom;
X     else if (strcmp(SecondaryIconPlacement, "Left") == 0)
X	  secondary = Place_Left;
X     else if (strcmp(SecondaryIconPlacement, "Right") == 0)
X	  secondary = Place_Right;
X     else if (strcmp(SecondaryIconPlacement, "Center") == 0)
X	  secondary = Place_Center;
X     else
X	  secondary = Place_Left;
X     
X     Neaten_Icon_Placement(primary, secondary);
X     
X     if (XQueryTree(dpy, RootWindow(dpy, scr), &junk_window,
X		    &junk_window, &children, &nchildren))
X     {
X	  for (ix = 0; ix < nchildren; ix++)
X	  {
X	       XGetWindowAttributes(dpy, children[ix], &attrs);	    
X	       
X	       if ((attrs.map_state != IsUnmapped) &&
X		   (attrs.override_redirect == False) &&
X		   (awi = GetAwmInfo(children[ix])))
X	       {
X		    w = children[ix];
X		    if (w != TOP_LEVEL && w != awi->icon)
X			 continue;
X		    mapped_children++;
X		    
X		    is_iconic = IsIcon(w, (Window *) NULL);
X		    
X		    if (is_iconic == TRUE)
X		    {
X			 window_x = window_y =
X			      window_width = window_height = 0;
X			 icon_x = attrs.x;
X			 icon_y = attrs.y;
X			 icon_width = attrs.width;
X			 icon_height = attrs.height;
X			 
X			 adjustment = SEPARATION;
X			 icon_width += adjustment;
X			 icon_height += adjustment;
X		    }
X		    else
X		    {
X			 window_x = attrs.x;
X			 window_y = attrs.y;
X			 window_width = attrs.width;
X			 window_height = attrs.height;
X			 
X			 window_x -= attrs.border_width;
X			 window_y -= attrs.border_width;
X			 
X			 adjustment = (2 * attrs.border_width) + SEPARATION;
X			 window_width += adjustment;
X			 window_height += adjustment;
X			 
X			 GetIconHints(w, &icon_x, &icon_y,
X				      &icon_width, &icon_height, &icon_border);
X			 
X			 icon_x -= icon_border;
X			 icon_y -= icon_border;
X			 icon_width += (2 * icon_border) + SEPARATION;
X			 icon_height += (2 * icon_border) + SEPARATION;
X			 
X			 opened_children++;
X			 stacktop = TOP_LEVEL;
X		    }
X		    
X		    GetName(w, name);
X		    if(neaten_debug_level)
X		    {
X			 printf("%s\ticonic = %s\n",
X				name, (is_iconic ? "TRUE" : "FALSE"));
X			 printf("\ticon: x = %d y = %d width = %d height = %d\n",
X				icon_x, icon_y, icon_width, icon_height);
X			 if (is_iconic != TRUE)
X			      printf("\twindow: x = %d y = %d width = %d height = %d\n",
X				     window_x, window_y, window_width,
X				     window_height);
X		    }
X		    
X		    Neaten_Identify((int) w, is_iconic,
X				    NEATEN_TRUE, NEATEN_FALSE,
X				    window_x, window_y,
X				    window_width, window_height,
X				    NEATEN_TRUE, NEATEN_FALSE,
X				    icon_x, icon_y,
X				    icon_width, icon_height,
X				    (unsigned long) adjustment);
X		    
X		    rstatus = XGetNormalHints(dpy, w, &hints);
X		    if (rstatus != (Status) 0 && is_iconic != TRUE)
X		    {
X			 if (hints.flags & PMinSize)
X			 {
X			      rval = Neaten_Set_Min((int) w,
X						    hints.min_width+adjustment,
X						    hints.min_height+adjustment);
X			      if(neaten_debug_level)
X				   printf("\tmin: width = %d height = %d status = %s\n",
X					  hints.min_width, hints.min_height,
X					  (rval ? "SUCCESS" : "FAILURE"));
X			 }
X			 if (hints.flags & PMaxSize) 
X			 {
X			      rval = Neaten_Set_Max((int) w,
X						    hints.max_width+adjustment,
X						    hints.max_height+adjustment);
X			      if(neaten_debug_level)
X				   printf("\tmax: width = %d height = %d status = %s\n",
X					  hints.max_width, hints.max_height,
X					  (rval ? "SUCCESS" : "FAILURE"));		    
X			 }
X			 if (hints.flags & (USSize | PSize))
X			 {
X			      rval = Neaten_Set_Desired((int) w,
X							hints.width+adjustment,
X							hints.height+adjustment);
X			      if(neaten_debug_level)
X				   printf("\tdes: width = %d height = %d status = %s\n",
X					  hints.width, hints.height,
X					  (rval ? "SUCCESS" : "FAILURE"));		    
X			 }
X			 
X			 /* if no max hints are given, set the max to the
X			    max of the desired and current size 
X			    */
X			 if (!(hints.flags & PMaxSize))
X			 {
X			      int desired_width = hints.width+adjustment;
X			      int desired_height = hints.height+adjustment;
X			      
X			      window_width = ((window_width > desired_width)
X					      ? window_width :
X					      desired_width);
X			      window_height = ((window_height > desired_height) 
X					       ? window_height :
X					       desired_height);
X			      rval = Neaten_Set_Max((int) w,
X						    window_width,
X						    window_height);
X			      if(neaten_debug_level)
X				   printf("\tmax: width = %d height = %d status = %s\n",
X					  window_width-adjustment, window_height-adjustment,
X					  (rval ? "SUCCESS" : "FAILURE"));
X			 }
X		    }
X	       }
X	  }
X	  
X	  if (UsePriorities == TRUE)
X	  {
X	       priority = MIN_PRIORITY;
X	       if (opened_children > 1)
X		    priority_increment = (MAX_PRIORITY - MIN_PRIORITY) /
X			 (opened_children - 1);
X	       for (ix = 0; ix < nchildren; ix++)
X	       {
X		    w = children[ix];
X		    awi = GetAwmInfo(w);
X		    if (!awi)
X			 continue;
X		    if (w != TOP_LEVEL && w != awi->icon)
X			 continue;
X		    is_iconic = IsIcon(w, (Window *) NULL);
X		    
X		    if (is_iconic != TRUE)
X		    {
X			 XGetWindowAttributes(dpy, w, &attrs);	    
X			 if ((attrs.map_state != IsUnmapped) &&
X			     (attrs.override_redirect == False))
X			 {
X			      Neaten_Set_Priorities((int) w, priority, priority);
X			      if (neaten_debug_level)
X			      {
X				   GetName(w, name);
X				   printf("%s: priority = %d\n", name, priority);
X			      }
X			      priority += priority_increment;
X			 }
X		    }
X	       }
X	  }
X	  
X	  if (FixTopOfStack == TRUE)
X	  {
X	       Neaten_Set_Options((int) stacktop, NEATEN_FALSE, NEATEN_TRUE);
X	       if (neaten_debug_level)
X	       {
X		    GetName(stacktop, name);
X		    printf("stacktop = %s\n", name);
X	       }
X	  }
X	  
X	  if(neaten_debug_level)
X	       printf("mapped children = %d\topened_children = %d\n",
X		      mapped_children, opened_children);
X	  
X	  Neaten_Desktop((RetainSize == FALSE), (KeepOpen == FALSE), Fill);
X	  
X	  for (ix = 0; ix < nchildren; ix++)
X	  {
X	       w = children[ix];
X	       awi = GetAwmInfo(w);
X	       if (!awi)
X		    continue;
X	       if (w != TOP_LEVEL && w != awi->icon)
X		    continue;
X	       if (Neaten_Get_Geometry((int) w, &iconic, &tiled,
X				       &window_x, &window_y,
X				       &window_width, &window_height,
X				       &(unsigned long) adjustment) == 0)
X		    continue;
X	       GetName(w, name);
X	       if(neaten_debug_level)
X	       {
X		    printf("%s iconic = %s  tiled = %s\n", name,
X			   (iconic ? "TRUE" : "FALSE"),
X			   (tiled ? "TRUE" : "FALSE"));
X		    printf("   x = %d, y = %d, width = %d, height = %d\n",
X			   window_x, window_y, window_width, window_height);
X	       }
X	       
X	       wc.x = window_x;
X	       wc.y = window_y;
X	       wc.width = window_width;
X	       wc.height = window_height;
X	       wcmask = CWX | CWY | CWWidth | CWHeight;
X	       
X	       if (iconic == NEATEN_TRUE)
X	       {
X		    is_iconic = IsIcon(w, &icon_window);
X		    if (is_iconic == TRUE)
X		    {
X			 wc.width -= adjustment;
X			 wc.height -= adjustment;
X			 
X			 XConfigureWindow(dpy, w, wcmask, &wc);
X			 if(tiled != NEATEN_TRUE)
X			      XRaiseWindow(dpy, w);
X		    }
X		    else
X		    {
X			 /* have to go to the server to get the info, this
X			    could have been avoided if the the variable
X			    adjustment was a pointer to a structure that
X			    contained the information for the icon and the
X			    information for the window.  However, I chose
X			    not to mess with all that memory management
X			    */
X			 GetIconHints(w, &icon_x, &icon_y,
X				      &icon_width, &icon_height, &icon_border);
X			 
X			 wc.x -= icon_border;
X			 wc.y -= icon_border;
X			 wc.width -= (2 * icon_border) + SEPARATION;
X			 wc.height -= (2 * icon_border) + SEPARATION;
X			 
X			 XAddToSaveSet(dpy, w);
X			 XUnmapWindow(dpy, TOP_LEVEL);
X			 XConfigureWindow(icon_window, wcmask, &wc);
X			 XMapWindow(dpy, icon_window);
X			 if (tiled != NEATEN_TRUE)
X			      XRaiseWindow(dpy, icon_window);
X		    }
X	       }
X	       else
X	       {
X		    wc.width -= adjustment;
X		    wc.height -= adjustment;
X		    adjustment -= SEPARATION;
X		    wc.x += adjustment/2;
X		    wc.y += adjustment/2;
X		    /* I think this will be the outer win */
X		    ConfigureWindow(w, wcmask, &wc);
X		    if(tiled != NEATEN_TRUE)
X			 XRaiseWindow(dpy, TOP_LEVEL);
X	       }
X	  }
X	  
X	  if (FixTopOfStack == TRUE)
X	       XRaiseWindow(dpy, stacktop);
X	  
X	  XFree(children);
X     }
X     
X     XBell(dpy, VOLUME_PERCENTAGE(Volume));
X     XUngrabPointer(dpy, CurrentTime);
X     Leave(FALSE)
X}
X
static void
X     GetIconHints(window, x, y, width, height, border)
Window window;
int *x, *y, *width, *height, *border;
X{
X     Window root;
X     XWMHints *wmhints;
X     XWindowAttributes attrs;
X     int junk;
X     
X     *border = *x = *y = 0;
X     /*
X      * Process window manager hints.
X      */ 
X     if (wmhints = XGetWMHints(dpy, window)) 
X     {
X	  if (wmhints->flags&IconWindowHint)
X	  {
X	       XGetWindowAttributes(dpy, wmhints->icon_window, &attrs);
X	       *x = attrs.x;
X	       *y = attrs.y;
X	       *width = attrs.width;
X	       *height = attrs.height;
X	       *border = attrs.border_width;
X	  }
X	  else if (wmhints->flags&IconPixmapHint) 
X	  {
X	       XGetWindowAttributes(dpy, wmhints->icon_pixmap, &attrs);
X	       *width = attrs.width;
X	       *height = attrs.height;
X	  }
X	  else
X	  {
X	       GetDefaultSize(window, width, height);
X	  }
X     }
X     else
X     {
X	  GetDefaultSize(window, width, height);
X     }
X     
X     /*
X      * Fix up sizes by padding.
X      */ 
X     if (!wmhints || !(wmhints->flags&(IconPixmapHint|IconWindowHint))) {
X	  *width += (HIconPad << 1);
X	  *height += (VIconPad << 1);
X     }
X     
X     if (wmhints && (wmhints->flags&IconPositionHint)) {
X	  *x = wmhints->icon_x;
X	  *y = wmhints->icon_y;
X     }
X}
X
static void
X     GetName(w, name)
Window w;
char *name;
X{
X     Status rstatus;
X     char *s = (char *) NULL;
X     
X     
X     rstatus = XFetchName(dpy, w, &s);
X     
X     if (rstatus != (Status) 0 && s != (char *) NULL)
X     {
X	  strcpy(name, s);
X	  XFree(s);
X     }
X     else
X     {
X	  strcpy(name, "UNKNOWN");
X     }
X}
X
void NeatenDebug(window, left, top, width, height, adjustment)
int window;
int left, top;
int width, height;
unsigned long adjustment;
X{
X     Window w = (Window) window;
X     
X     left += (int) ((float)adjustment/2.0);
X     top += (int) ((float)adjustment/2.0);
X     
X     width -= adjustment;
X     height -= adjustment;
X     
X     XMoveResizeWindow(dpy, w, left, top, width, height);
X     XFlush(dpy);
X}
X#else /* NEATEN not installed */
Boolean Neaten(window, mask, button, x, y)
Window window;                          /* Event window. */
int mask;                               /* Button/key mask. */
int button;   	                        /* Button event detail. */
int x, y;                               /* Event mouse position. */
X{
X     fprintf(stderr, "awm: Warning: Neaten package not installed in ");
X     fprintf(stderr, "this version of of awm.\n");
X}
X#endif NEATEN
END_OF_FILE
if test 13808 -ne `wc -c <'Neaten.c'`; then
    echo shar: \"'Neaten.c'\" unpacked with wrong size!
fi
# end of 'Neaten.c'
fi
if test -f 'Resize.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Resize.c'\"
else
echo shar: Extracting \"'Resize.c'\" \(14728 characters\)
sed "s/^X//" >'Resize.c' <<'END_OF_FILE'
X#ifndef lint
X     static char *rcsid_Resize_c = "$Header: Resize.c,v 1.18 87/09/09 12:01:04 swick Exp $";
X#endif	lint
X
X#include "X11/copyright.h"
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 *        Convert to X11
X * 002 -- Jordan Hubbard, U.C. berkeley.
X *	Added alternate placement of resize window, code for title bar
X * 	support.
X */
X
X#ifndef lint
static char *sccsid = "@(#)Resize.c	3.8	1/24/86";
X#endif
X
X#include "awm.h"
X#include "X11/Xutil.h"
X
X#define max(a,b) ( (a) > (b) ? (a) : (b) )
X#define min(a,b) ( (a) > (b) ? (b) : (a) )
X#define makemult(a, b) ((b==1) ? (a) : (((int)((a) / (b))) * (b)) )
X
extern int Fheight;
X
Boolean Resize(window, mask, button, x0, y0)
Window window;                          /* Event window. */
int mask;                               /* Button/key mask. */
int button;                             /* Button event detail. */
int x0, y0;                             /* Event mouse position. */
X{
X     XWindowAttributes client_info;	/* client window info. */
X     XWindowAttributes frame_info;	/* frame window info */
X     int x1, y1;                        /* fixed box corner   */
X     int x2, y2;                        /* moving box corner   */
X     int x, y;
X     int xinc, yinc;
X     int minwidth, minheight;
X     int maxwidth, maxheight;
X     int defwidth, defheight;
X     int ox, oy;			/* which quadrant of window */
X     int pop_x, pop_y;			/* location of pop window */
X     int hsize, vsize;			/* dynamic size */
X     int delta;	
X     int junk_x, junk_y;
X     int ptrmask;			/* pointer status word */
X     int num_vectors;			/* Number of vectors to XDraw. */
X     Window assoc;			/* Window represented by the icon. */
X     Window sub_win;			/* Mouse query sub window. */
X     Window root;			/* Root query window. */
X     XEvent button_event, *b_ev;	/* Button event packet. */
X     XSegment box[MAX_BOX_VECTORS];	/* Box drawing vertex buffer. */
X     XSegment zap[MAX_ZAP_VECTORS];	/* Zap drawing vertex buffer. */
X     Boolean stop;			/* Should the window stop changing? */
X     XSizeHints sizehints;
X     XWindowChanges values;
X     int width_offset, height_offset;	/* to subtract if resize increments */
X     int x_offset, y_offset;		/* add to pointer to get anchor */
X     AwmInfoPtr awi;
X     int (*storegrid_func)();		/* which StoreGrid routine to use */
X     int (*storebox_func)();		/* which StoreBox routing to use */
X     int buttonConfirmEvent;
X
X     Entry("Resize")
X
X     /*
X      * Do nothing if the event window is the root window.
X      */
X     if (window == RootWindow(dpy, scr))
X	  Leave(FALSE)
X
X     /*
X      * Gather info about the event window.
X      */
X     awi = GetAwmInfo(window);
X     if (!awi)
X	  Leave(FALSE)
X     /*
X      * Do not resize an icon window.
X      */
X     if (window == awi->icon)
X	  Leave(FALSE)
X
X     window = awi->client;
X     b_ev = &button_event;
X     buttonConfirmEvent = ButtonRelease;
X
X     status = XGetWindowAttributes(dpy, window, &client_info);
X     if (status == FAILURE)
X	  Leave(FALSE)
X
X     if (awi->frame) { /* we have to compensate */
X	  status = XGetWindowAttributes(dpy, awi->frame, &frame_info);
X	  if (status == FAILURE)
X	       Leave(FALSE)
X          client_info.x = frame_info.x + (BContext ? BContext + 1 : 0);
X	  client_info.y = frame_info.y + Fheight + 2;
X     }
X
X     /*
X      * Clear the vector buffers.
X      */
X     bzero(box, sizeof(box));
X     if (Zap)
X	  bzero(zap, sizeof(zap));
X     storegrid_func = StoreGridBox;
X     storebox_func = StoreBox;
X
X     /*
X      * If we are here then we have a resize operation in progress.
X      */
X     
X     /*
X      * Turn on the resize cursor.
X      */
X     grab_pointer();
X     
X     /*
X      * calculate fixed point (x1, y1) and varying point (x2, y2).
X      */
X     hsize = defwidth = client_info.width;
X     vsize = defheight = client_info.height;
X     x1 = client_info.x;
X     y1 = client_info.y;
X     x2 = x1 + hsize;
X     y2 = y1 + vsize;
X
X     /*
X      * Get the event window resize hint.
X      */
X     sizehints.flags = 0;
X     XGetSizeHints(dpy, window, &sizehints, XA_WM_NORMAL_HINTS); 
X     CheckConsistency(&sizehints);
X
X     /* until there are better WM_HINTS, we'll assume that the client's
X      * minimum width and height are the appropriate offsets to subtract
X      * when resizing with an explicit resize increment.
X      */
X     if ((sizehints.flags & PMinSize) && (sizehints.flags & PResizeInc)) {
X	  width_offset = sizehints.min_width;
X	  height_offset = sizehints.min_height;
X     } else
X	  width_offset = height_offset = 0;
X 
X     /*
X      * decide what resize mode we are in. Always rubberband if window
X      * is too small.
X      */
X     if (client_info.width > 2 && client_info.height > 2) {
X	  ox = ((x0 - client_info.x) * 3) / client_info.width;
X	  oy = ((y0 - client_info.y) * 3) / client_info.height;
X	  if ((ox + oy) & 1) {
X	       if (ox & 1) {
X		    /* fix up size hints so that we will never change width */
X		    sizehints.min_width = sizehints.max_width = client_info.width;
X		    if ((sizehints.flags & PMinSize) == 0) {
X			 sizehints.min_height = 0;
X			 sizehints.flags |= PMinSize;
X		    }
X		    if ((sizehints.flags & PMaxSize) == 0) {
X			 sizehints.max_height = DisplayHeight(dpy, scr);
X			 sizehints.flags |= PMaxSize;
X		    }
X	       }
X	       if (oy & 1) {
X		    /* fix up size hints so that we will never change height */
X		    sizehints.min_height = sizehints.max_height = client_info.height;
X		    if ((sizehints.flags & PMinSize)==0) {
X			 sizehints.min_width = 0;
X			 sizehints.flags |= PMinSize;
X		    }
X		    if ((sizehints.flags & PMaxSize)==0) {
X			 sizehints.max_width = DisplayWidth(dpy, scr);
X			 sizehints.flags |= PMaxSize;
X		    }
X	       }
X	  }
X     }
X     else ox = oy = 2;
X     /* change fixed point to one that shouldn't move */
X     if (oy == 0) { 
X	  y = y1; y1 = y2; y2 = y;
X     }
X     if (ox == 0) { 
X	  x = x1; x1 = x2; x2 = x;
X     }
X     if (sizehints.flags & PMinSize) {
X	  minwidth = sizehints.min_width;
X	  minheight = sizehints.min_height;
X     } else {
X	  minwidth = 0;
X	  minheight = 0;
X     }
X     if (sizehints.flags & PMaxSize) {
X	  maxwidth = max(sizehints.max_width, minwidth);
X	  maxheight = max(sizehints.max_height, minheight);
X     } else {
X	  maxwidth = DisplayWidth(dpy, scr);
X	  maxheight = DisplayHeight(dpy, scr);
X     }
X     if (sizehints.flags & PResizeInc) {
X	  xinc = sizehints.width_inc;
X	  yinc = sizehints.height_inc;
X     } else {
X	  xinc = 1;
X	  yinc = 1;
X     }
X     switch (ox) {
X     case 0:
X	  pop_x = x1 - PWidth;
X	  break;
X     case 1:
X	  pop_x = x1 + (hsize - PWidth) / 2;
X	  break;
X     case 2:
X	  pop_x = x1;
X	  break;
X     }
X     switch (oy) {
X     case 0:
X	  pop_y = y1 - PHeight;
X	  break;
X     case 1:
X	  pop_y = y1 + (vsize - PHeight) / 2;
X	  break;
X     case 2:
X	  pop_y = y1;
X	  break;
X     }
X     /*
X      * Double expose on the target window is too expensive for some reason
X      * or another. Paint the popup window in the upper left hand
X      * corner of the screen if RootResizeBox is FALSE. This is also
X      * more-or-less consistent with the position of the map request popup.
X      */
X     if (RootResizeBox == TRUE)
X	  values.x = values.y = 0;
X     else {
X	  if (pop_x < 0 || pop_x > (DisplayWidth(dpy, scr) - PWidth))
X	       pop_x = 0;
X	  if (pop_y < 0 || pop_y > (DisplayHeight(dpy, scr) - PHeight))
X	       pop_y = 0;
X	  values.x = pop_x;
X	  values.y = pop_y;
X     }
X     values.stack_mode = Above;
X     XConfigureWindow(dpy, Pop, CWX|CWY|CWStackMode, &values);
X     XMapWindow(dpy, Pop);
X     if (Grid) {
X	  num_vectors = (*storegrid_func)(box,
X					  MIN(x1, x2), MIN(y1, y2),
X					  MAX(x1, x2), MAX(y1, y2));
X     }
X     else {
X	  num_vectors = (*storebox_func)(box,
X					 MIN(x1, x2), MIN(y1, y2),
X					 MAX(x1, x2), MAX(y1, y2));
X     }
X
X     /*
X      * If we freeze the server, then we will draw solid
X      * lines instead of flickering ones during resizing.
X      */
X     if (Freeze)
X	  XGrabServer(dpy);
X     /* protect us from ourselves */
X     Snatched = True;
X     /*
X      * Process any pending exposure events before drawing the box.
X      */
X     while (QLength(dpy) > 0) {
X	  XPeekEvent(dpy, b_ev);
X	  if (b_ev->xany.window == RootWindow(dpy, scr))
X	       break;
X	  GetButton(b_ev);
X     }
X     if (ResizeRelative) {
X	  x_offset = x2 - x0;
X	  y_offset = y2 - y0;
X     }
X     else
X	  x_offset = y_offset = 0;
X
X     /*
X      * Now draw the box.
X      */
X     DrawBox();
X     Frozen = window;
X 
X     stop = FALSE;
X     x = -1; y = -1;
X     
X     while (!stop) {
X	  if (x != x2 || y != y2) {
X	       x = x2; y = y2;
X
X	       /*
X		* If we've frozen the server, then erase
X		* the old box.
X		*/
X	       if (Freeze)
X		    DrawBox();
X	       
X	       if (Grid) {
X		    num_vectors = (*storegrid_func)(box,
X						    MIN(x1, x), MIN(y1, y),
X						    MAX(x1, x), MAX(y1, y));
X	       }
X	       else {
X		    num_vectors = (*storebox_func)(box,
X						   MIN(x1, x), MIN(y1, y),
X						   MAX(x1, x), MAX(y1, y));
X	       }
X	       
X	       if (Freeze)
X		    DrawBox();
X	       
X	       {
X		    int Hsize = (hsize - width_offset) / xinc;
X		    int Vsize = (vsize - height_offset) / yinc;
X		    int pos = 4;
X		    PText[0] = (Hsize>99) ? (Hsize / 100 + '0')	  : ' ';
X		    PText[1] = (Hsize>9)  ? ((Hsize / 10) % 10 + '0') : ' ';
X		    PText[2] = Hsize % 10 + '0';
X		    if (Vsize>99) PText[pos++] = Vsize / 100 + '0';
X		    if (Vsize>9)  PText[pos++] = (Vsize / 10) % 10 + '0';
X		    PText[pos++] = Vsize % 10 + '0';
X		    while (pos<7) PText[pos++] = ' ';
X	       }
X	       /*
X		* If the font is not fixed width we have to
X		* clear the window to guarantee that the characters
X		* that were there before are erased.
X		*/
X	       if (!(PFontInfo->per_char))
X		    XClearWindow(dpy, Pop);
X	       XDrawImageString(
X				dpy, Pop, PopGC,
X				PPadding, PPadding+PFontInfo->ascent,
X				PText, PTextSize);
X	  }
X	  if (!Freeze) {
X	       DrawBox();
X	       DrawBox();
X	  }
X
X	  if (XPending(dpy) && !ProcessRequests(box, num_vectors) &&
X	      GetButton(b_ev)) {
X	       if ((b_ev->xany.type != ButtonPress) && 
X		   (b_ev->xany.type != ButtonRelease))
X		    continue; /* spurious menu event... */
X
X	       if (Freeze) {
X		    DrawBox();
X		    Frozen = (Window)0;
X		    XUngrabServer(dpy);
X	       }
X
X	       if (b_ev->xany.type == buttonConfirmEvent &&
X		   b_ev->xbutton.button == button)
X		    stop = TRUE;
X	       else {
X		    XUnmapWindow(dpy, Pop);
X		    ResetCursor(button);
X		    Snatched = False;
X		    ungrab_pointer();
X		    Leave(TRUE)
X	       }
X	  }
X	  else {
X	       XQueryPointer(dpy, RootWindow(dpy, scr), &root, 
X			     &sub_win, &x2, &y2, &junk_x, &junk_y, &ptrmask);
X	       x2 += x_offset;	/* get to anchor point */
X	       y2 += y_offset;
X	  }
X	  hsize = max(min(abs (x2 - x1), maxwidth), minwidth);
X	  hsize = makemult(hsize - minwidth, xinc) + minwidth;
X
X	  vsize = max(min(abs(y2 - y1), maxheight), minheight);
X	  vsize = makemult(vsize - minheight, yinc) + minheight; 
X	  if (sizehints.flags & PAspect) {
X	       if ((hsize * sizehints.max_aspect.y > 
X		    vsize * sizehints.max_aspect.x)) {
X		    delta = makemult((hsize * sizehints.max_aspect.y /
X				      sizehints.max_aspect.x) - vsize, 
X				     yinc);
X		    if ((vsize + delta <= maxheight))
X			 vsize += delta;
X		    else {
X			 delta = makemult(hsize - 
X					  (sizehints.max_aspect.x *
X					   vsize/sizehints.max_aspect.y), 
X					  xinc);
X			 if (hsize - delta >= minwidth)
X			      hsize -= delta; 
X		    }
X	       }  
X	       if (hsize * sizehints.min_aspect.y < vsize *
X		   sizehints.min_aspect.x) {
X		    delta = makemult((sizehints.min_aspect.x * 
X				      vsize/sizehints.min_aspect.y) - hsize, 
X				     xinc);
X		    if (hsize + delta <= maxwidth)
X			 hsize += delta;
X		    else {
X			 delta = makemult(vsize - 
X					  (hsize*sizehints.min_aspect.y /
X					   sizehints.min_aspect.x), 
X					  yinc); 
X			 if (vsize - delta >= minheight)
X				vsize -= delta; 
X		    }
X	       }
X	       
X	  }
X	  if (ox == 0)
X	       x2 = x1 - hsize;
X	  else
X	       x2 = x1 + hsize;
X	  
X	  if (oy == 0)
X	       y2 = y1 - vsize;
X	  else
X	       y2 = y1 + vsize;
X	  
X     }
X     if (x2 < x1) {
X	  x = x1; x1 = x2; x2 = x;
X     }
X     if (y2 < y1) {
X	  y = y1; y1 = y2; y2 = y;
X     }
X     XUnmapWindow(dpy, Pop);
X     if ((x1 !=client_info.x) || (y1 != client_info.y) || 
X	 (hsize != client_info.width) ||
X	 (vsize != client_info.height)) {
X	  XWindowChanges xwc;
X	       
X	  xwc.x = x1;
X	  xwc.y = y1;
X	  xwc.width = hsize;
X	  xwc.height = vsize;
X	  ConfigureWindow(window, CWX | CWY | CWHeight | CWWidth, &xwc);
X     }
X     Snatched = False;
X     ungrab_pointer();
X     Leave(TRUE)
X}
X
CheckConsistency(hints)
XXSizeHints *hints;
X{
X     Entry("CheckConsistency")
X
X     if (hints->min_height < 0)
X	  hints->min_height = 0;
X     if (hints->min_width < 0)
X	  hints->min_width = 0;
X     
X     if (hints->max_height <= 0 || hints->max_width <= 0)
X	  hints->flags &= ~PMaxSize;
X     
X     hints->min_height = min(DisplayHeight(dpy, scr), hints->min_height);
X     hints->min_width =  min(DisplayWidth(dpy, scr),  hints->min_width);
X     
X     hints->max_height = min(DisplayHeight(dpy, scr), hints->max_height);
X     hints->max_width =  min(DisplayWidth(dpy, scr),  hints->max_width);
X     
X     if ((hints->flags & PMinSize) && (hints->flags & PMaxSize) && 
X	 ((hints->min_height > hints->max_height) ||
X	  (hints->min_width > hints->max_width)))
X	  hints->flags &= ~(PMinSize|PMaxSize);
X     
X     if ((hints->flags & PAspect) && 
X	 (hints->min_aspect.x * hints->max_aspect.y > 
X	  hints->max_aspect.x * hints->min_aspect.y))
X	  hints->flags &= ~(PAspect);
X     Leave_void
X}
END_OF_FILE
if test 14728 -ne `wc -c <'Resize.c'`; then
    echo shar: \"'Resize.c'\" unpacked with wrong size!
fi
# end of 'Resize.c'
fi
if test -f 'awm.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'awm.h'\"
else
echo shar: Extracting \"'awm.h'\" \(19011 characters\)
sed "s/^X//" >'awm.h' <<'END_OF_FILE'
X/* $Header: awm.h,v 1.4 87/08/21 13:31:43 swick Exp $ */
X 
X#include "X11/copyright.h"
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 -- R. Kittell, DEC Storage A/D May 19, 1986
X *  Added global vars for warp options.
X * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
X *  Western Software Lab, Port to X11
X */
X 
X#include <errno.h>
X#include <stdio.h>
X#include <strings.h>
X#include "X11/Xlib.h"
X#include "X11/Intrinsic.h"
X#include "X11/Xatom.h"
X#include "menus/rtlmenu.h"
X#include "support.h"
X 
X#define MIN(x, y)	((x) <= (y) ? (x) : (y))
X#define MAX(x, y)	((x) >= (y) ? (x) : (y))
X#define VOLUME_PERCENTAGE(x)	((x)*14) 
X#define ModMask 0xFF
X#define ButtonMask(b)	(((b)==Button1) ? Button1Mask : \
X			  (((b)==Button2) ? Button2Mask : Button3Mask))
X
X#define DEF_DELTA		1
X#define DEF_FUNC		GXcopy
X#define DEF_ICON_BORDER_WIDTH 	2
X#define DEF_ICON_PAD		4
X#define DEF_POP_BORDER_WIDTH 	2
X#define DEF_POP_PAD		4
X#define DEF_MENU_BORDER_WIDTH 	2
X#define DEF_MENU_PAD		4
X#define DEF_GADGET_PAD		3
X#define DEF_VOLUME		4
X#define DEF_PUSH		5
X#define DEF_BCONTEXT_WIDTH	0
X#define DEF_RAISE_DELAY		100	/* milliseconds */
X#define DEF_MAX_COLORS		0	/* 0 means take as many as we can */
X#ifndef DEF_BCONTEXT_CURSOR
X#define DEF_BCONTEXT_CURSOR	XC_plus
X#endif	DEF_BCONTEXT_CURSOR
X#ifndef	DEF_TITLE_CURSOR
X#define DEF_TITLE_CURSOR	XC_left_ptr
X#endif	DEF_TITLE_CURSOR
X#ifndef	NAME
X#define NAME			"awm"
X#endif	NAME
X#ifndef CLASS
X#define	CLASS			"Wm"
X#endif	CLASS
X#ifndef	DEF_FONT
X#define	DEF_FONT		"fixed"
X#endif	DEF_FONT
X#ifndef	DEF_TITLE_FONT
X#define	DEF_TITLE_FONT		"vtsingle"
X#endif	DEF_TITLE_FONT
X#ifndef	DEF_ICON_FONT
X#define	DEF_ICON_FONT		"8x13"
X#endif	DEF_ICON_FONT
X#ifndef	DEF_POPUP_FONT
X#define	DEF_POPUP_FONT		"9x15"
X#endif	DEF_POPUP_FONT
X#ifndef	DEF_GADGET_FONT
X#define DEF_GADGET_FONT		"fixed"
X#endif	DEF_GADGET_FONT
X#ifndef	DEF_MENU_FONT
X#define	DEF_MENU_FONT		"8x13"
X#endif	DEF_MENU_FONT
X#ifndef	DEF_BOLD_FONT
X#define	DEF_BOLD_FONT		"8x13bold"
X#endif	DEF_BOLD_FONT
X#define DEF_MENU_DELTA		20
X
X#define INIT_PTEXT		{'0', '0', '0', 'x', '0', '0', '0'}
X
X#ifndef TEMPFILE
X#define TEMPFILE		"/tmp/awm.XXXXXX"
X#endif	TEMPFILE
X
X#define CURSOR_WIDTH		16
X#define CURSOR_HEIGHT		16
X 
X#define MAX_ZAP_VECTORS		8
X#define MAX_BOX_VECTORS		20
X 
X#define DRAW_WIDTH		0 	/* use fastest hardware draw */
X#define DRAW_VALUE		0xfd
X#define DRAW_FUNC		GXxor
X#define DRAW_PLANES		1
X
X#define NOCOLOR			-1
X
X/*
X * The first BITS_USED bits of the mask are used to define the most generic
X * types. All other bits are free for storing peripheral information.
X * For now, we use the extra bits to specify which gadget(s) are bound
X * to an action. MAX_GADGETS depends on BITS_USED to determine the maximum
X * number of gadgets possible. If you add a new context type, be sure to
X * increment BITS_USED.
X */
X#define ROOT			0x1
X#define WINDOW			0x2
X#define ICON			0x4
X#define TITLE			0x8
X#define BORDER			0x10
X#define GADGET			0x20
X
X#define BITS_USED		6
X 
X/*
X * Gadgets aren't the sort of embellishments that one uses in quantitity
X * (unless one is designing a truly odd interface), so we keep the information
X * in an array instead of using the usual linked list. MAX_GADGETS is a derived
X * macro (see BITS_USED) that is used to determine the size of the
X * Array.
X *
X */
X#define MAX_GADGETS		((sizeof(int) * 8) - BITS_USED)
X
X#ifndef FAILURE
X#define FAILURE	0
X#endif	FAILURE
X
X#define NAME_LEN		256	/* Maximum length string names */
X#define EVENTMASK		(ButtonPressMask | ButtonReleaseMask)
X
X
X#define DrawBox() XDrawSegments(dpy, RootWindow(dpy, scr),DrawGC,box,num_vectors)
X#define DrawZap() XDrawSegments(dpy, RootWindow(dpy, scr),DrawGC,zap,num_vectors)
X 
X/*
X * All one needs to know about an awm managed window.. (so far...)
X */
typedef struct _awminfo {
X     Window title, client, frame, icon;	/* Associated windows */
X     Window *gadgets;			/* associated gadgets */
X     char *name;			/* The formatted window name */
X     Boolean own;			/* Do we own the icon window? */
X     Boolean placed;			/* Has the window been placed yet? */
X     Pixmap back, bold, iconPixmap;	/* background, bold and icon pix */
X     Pixmap BC_back, BC_bold;		/* BC back and bold pixmaps */
X     unsigned int border_width;		/* original border width */
X     int state;				/* The state of the window */
X     GC winGC;				/* GC at proper depth for window */
X} AwmInfo, *AwmInfoPtr;
X
X/*
X * This whole section has changed substantially. Basically, since all the
X * variables have vanished into the resource manager, the keyword table
X * only needs to keep track of function pointers, boolean pointers and
X * "special" keywords like menu and gagdet. Since some things are still
X * modifiable from menus (only booleans, currently, though this will change),
X * we keep these in the keyword table even though
X * they're no longer directly modifable from the .awmrc
X */
X
X/*
X * Keyword table entry.
X */
typedef struct _keyword {
X     char *name;
X     int type;
X     Boolean *bptr;
X     Boolean (*fptr)();
X} Keyword;
X
X/*
X * Keyword table type entry.
X */
X#define IsFunction	1
X#define IsMenuMap	2
X#define IsMenu		3
X#define IsDownFunction	4
X#define IsParser	5
X#define IsQuitFunction	6
X#define IsGadget	7
X#define IsBoolean	8
X#define IsAction	9
X
X/*
X * Button/key binding type.
X */
typedef struct _binding {
X    struct _binding *next;
X    int context;
X    int mask;
X    int button;
X    Boolean (*func)();
X    char *menuname;
X    RTLMenu menu;
X} Binding;
X 
X/*
X * Key expression type.
X */
typedef struct _keyexpr {
X    char *name;
X    int mask;
X} KeyExpr;
X 
X/*
X * Context expression type.
X */
typedef struct _contexpr {
X    char *name;
X    int mask;
X} ContExpr;
X
X/*
X * Button modifier type.
X */
typedef struct _buttonmodifier {
X    char *name;
X    int mask;
X} ButtonModifier;
X
X/*
X * Gravity expression type.
X */
typedef struct _gravityexpr {
X     char *name;
X     int mask;
X} GravityExpr;
X
X/*
X * Button modifier mask definitions.
X * bits 13 and 14 unused in key masks, according to X.h
X * steal bit 15, since we don't use AnyModifier
X */
X
X#define DeltaMotion	(1<<13)
X#define ButtonUp	(1<<14)
X#define ButtonDown	AnyModifier
X#define ButtonMods	DeltaMotion+ButtonUp+ButtonDown
X
X/* 
X * Button and mask redefinitions, for X11
X */
X#define LeftMask 	Button1Mask
X#define MiddleMask 	Button2Mask
X#define RightMask 	Button3Mask
X#define LeftButton	Button1
X#define MiddleButton	Button2
X#define RightButton	Button3
X
X/*
X * Declaration specific information for gadgets. This defines only gadget
X * types, not the actual gadgets. The pixmap member is only used if a pixmap
X * is being displayed. Gravity and offset are purely optional.
X */
X
X#define NoGadgetGravity		0
X#define LeftGadgetGravity	1
X#define RightGadgetGravity	2
X
typedef struct _gadgetdecl {	/*   Declaration (type) information */
X     unsigned char *name;	/* Either text label or pixmap file name */
X     unsigned char *data;	/* If pixmap file, this is the data from it */
X     unsigned long forecolor;	/* foreground color for pixmap */
X     unsigned long backcolor;	/* background color for pixmap */
X     XFontStruct *fontInfo;	/* font for text */
X     int high, wide;		/* width and height of pixmap or text */
X     int gravity;		/* stick to the left or right? */
X     int offset;		/* offset from previous item */
X} GadgetDecl;
X
X/*
X * MenuInfo data type.
X */
typedef struct _menuinfo {
X    char *name;			/* Name of this menu. */
X    char *pixmapname;		/* Name of label pixmap (opt) */
X    RTLMenu menu;		/* RTL menu handle for destroy */
X    struct _actionline *line;	/* Linked list of menu items. */
X} MenuInfo;
X 
X/*
X * Action Line data type.
X */
typedef struct _actionline {
X    struct _actionline *next;	/* Pointer to next line. */
X    char *name;			/* Name of this line. */
X    char *pixmapname;		/* Name of the backing pixmap (opt) */
X    int type;			/* IsShellCommand, IsText, IsTextNL... */
X    RTLMenuItem item;		/* RTL item handle */
X    char *text;			/* Text string to be acted upon. */
X    Boolean (*func)();		/* Window manager function to be invoked. */
X} ActionLine;
X 
X/*
X * ActionLine->type definitions.
X */
X#define IsShellCommand		1
X#define IsText			2
X#define IsTextNL		3
X#define IsUwmFunction		4
X#define IsMenuFunction		5
X#define IsImmFunction		6	/* Immediate (context-less) function. */
X#define IsVar			7	/* we're setting a boolean variable */
X 
X/*
X * Menu Link data type.  Used by the parser when creating a linked list
X * of menus. 
X */
typedef struct _menulink {
X    struct _menulink *next;	/* Pointer to next MenuLink. */
X    struct _menuinfo *menu;	/* Pointer to the menu in this link. */
X} MenuLink;
X
X/*
X * External variable definitions.
X */
extern int errno;
extern Window Pop;		/* Pop-up dimension display window. */
extern Window Frozen;		/* Contains window id of "gridded" window. */
extern XFontStruct *IFontInfo;	/* Icon text font information. */
extern XFontStruct *PFontInfo;	/* Pop-up text font information. */
extern XFontStruct *TFontInfo;	/* Title text font information. */
extern XFontStruct *TFontBoldInfo;/* Title text (bold) font information. */
extern XFontStruct *GFontInfo; /* Gadget box text font */
extern XFontStruct *MFontInfo;	/* Menu font */
extern XFontStruct *MBoldFontInfo;/* Menu bold font */
extern Pixmap GrayPixmap;	/* Gray pixmap. */
extern Pixmap IBackPixmap;	/* Icon window background pixmap. */
extern Pixel BForeground;	/* Border Context (pixmap) foreground pixel */
extern Pixel BBackground;	/* Border Context (pixmap) background pixel */
extern Pixel ITextForeground;	/* Icon window text forground color. */
extern Pixel ITextBackground;	/* Icon window text background color. */
extern Pixel IForeground;	/* Icon pixmap foreground color */
extern Pixel IBackground;	/* Icon pixmap background color */
extern Pixel IBorder;		/* Icon window border pixel. */
extern Pixel TTextForeground;	/* Title text foreground pixel */
extern Pixel TTextBackground;	/* Title text background pixel */
extern Pixel TForeground;	/* Title (pixmap) foreground pixel */
extern Pixel TBackground;	/* Title (pixmap) background pixel */
extern Pixel PForeground;	/* Pop-up window forground color. */
extern Pixel PBackground;	/* Pop-up window background color. */
extern Pixel PBorder;		/* Pop-Up Window border pixel. */
extern Pixel ForeColor;		/* default foreground color */
extern Pixel BackColor;		/* default background color */
extern Pixel MBorder;		/* Menu border color */
extern Pixel MForeground;	/* Menu foreground color */
extern Pixel MBackground;	/* Menu background color */
extern Cursor ArrowCrossCursor; /* Arrow cross cursor. */
extern Cursor TextCursor;	/* Text cursor used in icon windows. */
extern Cursor IconCursor;	/* Icon Cursor. */
extern Cursor LeftButtonCursor;	/* Left button main cursor. */
extern Cursor MiddleButtonCursor;/* Middle button main cursor. */
extern Cursor RightButtonCursor;/* Right button main cursor. */
extern Cursor TargetCursor;	/* Target (select-a-window) cursor. */
extern int ScreenWidth;		/* Display screen width. */
extern int ScreenHeight;	/* Display screen height. */
extern int IBorderWidth;	/* Icon window border width. */
extern int PWidth;		/* Pop-up window width (including borders). */
extern int PHeight;		/* Pop-up window height (including borders). */
extern int PBorderWidth;	/* Pop-up window border width. */
extern int PPadding;		/* Pop-up window padding. */
extern int Delay;		/* Delay between clicks of double click. */
extern int Delta;		/* Mouse movement slop. */
extern int HIconPad;		/* Icon horizontal padding. */
extern int VIconPad;		/* Icon vertical padding. */
extern int MaxColors;		/* Maximum number of colors to use. */
extern int Pushval;		/* Number of pixels to push window by. */
extern int BContext;		/* Width of border context area in pixels */
extern int RaiseDelay;		/* Delay in milliseconds before autoraising windows */
extern int Volume;		/* Audible alarm volume. */
extern int NumGadgets;		/* Number of gadgets used */
extern int GadgetPad;		/* Padding between gadgets */
extern int status;		/* Routine return status. */
extern int Maxfd;		/* Maximum file descriptors for select(2). */
extern int MPad;		/* menu padding */
extern int MDelta;		/* Menu subitem delta */
extern int MBorderWidth;	/* Menu border width */
extern int MItemBorder;		/* Menu item border width */
extern int BCursor;		/* Border context cursor */
extern int TCursor;		/* Title context cursor */
extern MenuLink *Menus;		/* Linked list of menus. */
extern GC  IconGC;		/* graphics context for icon */
extern GC  PopGC;		/* graphics context for pop */
extern GC  DrawGC;		/* graphics context for zap */
X
extern Boolean Autoraise;	/* Raise window on input focus? */
extern Boolean Autoselect;	/* Warp mouse to default menu selection? */
extern Boolean Freeze;		/* Freeze server during move/resize? */
extern Boolean Grid;		/* Should the m/r box contain a 9 seg. grid. */
extern Boolean Hilite;		/* Should we highlight borders on focus? */
extern Boolean ShowName;	/* Display names in title bars */
extern Boolean NWindow;		/* Normalize windows? */
extern Boolean NIcon;		/* Normalize icons? */
extern Boolean RootResizeBox;	/* Should resize box obscure window? */
extern Boolean Push;		/* Relative=TRUE, Absolute=FALSE. */
extern Boolean ResizeRelative;	/* Relative=TRUE, Absolute=FALSE. */
extern Boolean Reverse;		/* Reverse video? */
extern Boolean SaveUnder;	/* Save unders? */
extern Boolean Snatched;	/* We're in the middle of an no-highlight/raise op */
extern Boolean Titles;		/* Title bars on windows? */
extern Boolean TitlePush;	/* Down=TRUE, Up=FALSE */
extern Boolean UseGadgets;	/* Gadget boxes in title bars? */
extern Boolean Wall;		/* Don't allow windows past edges of screen */
extern Boolean WarpOnRaise;	/* Warp to upper right corner on raise. */
extern Boolean WarpOnIconify;   /* Warp to icon center on iconify. */
extern Boolean WarpOnDeIconify; /* Warp to upper right corner on de-iconify. */
extern Boolean Zap;		/* Should the the zap effect be used. */
extern Boolean FocusSetByUser;  /* True if f.focus called */
X 
extern char PText[];		/* Pop-up window dummy text. */
extern int PTextSize;		/* Pop-up window dummy text size. */
X
extern int Lineno;		/* Line count for parser. */
extern Boolean Startup_File_Error; /* Startup file error flag. */
extern char Startup_File[];	/* Startup file name. */
extern char *IFontName;		/* Icon font name. */
extern char *PFontName;		/* Pop-up font name. */
extern char *TFontName;		/* Title font name. */
extern char *GFontName;		/* Gadget font name */
extern char *TFontBoldName;	/* Bold Title font name. */
extern char *TBackPixmapName;	/* Title pixmap file */
extern char *TBoldPixmapName;	/* Title (highlighted) pixmap file */
extern char *TBackPixmapData;	/* Bitmap data file title background */
extern char *TBoldPixmapData;	/* ditto, except highlighted */
extern char *BBackPixmapData;	/* Border Context area background pixmap data */
extern char *BBoldPixmapData;	/* Border Context bold pixmap data */
extern char *awmPath;		/* Pathlist for pixmap files */
extern char **Argv;		/* Pointer to command line parameters. */
extern char **Environ;		/* Pointer to environment. */
X 
extern char *DefaultBindings[];	/* Default bindings string array. */
extern Keyword KeywordTable[];	/* Keyword lookup table. */
extern Binding *Blist;		/* Button/key bindings list. */
extern KeyExpr KeyExprTbl[];	/* Key expression table. */
extern ContExpr ContExprTbl[];	/* Context expression table. */
extern ButtonModifier ButtModTbl[];/* Button modifier table. */
extern GravityExpr GravityExprTbl[]; /* Gravity expression table. */
X
extern GadgetDecl **Gadgets;	/* Gadgets declared. See gram.y */
extern int scr;
extern Display *dpy;		/* Display info pointer. */
X 
X#ifdef PROFIL
int ptrap();
X#endif
X 
X/*
X * External routine typing.
X */
extern Boolean Beep();
extern Boolean CircleDown();
extern Boolean CircleUp();
extern Boolean Continue();
extern Boolean Focus();
extern Boolean GetButton();
extern Boolean Iconify();
extern Boolean Lower();
extern Boolean DoMenu();
extern Boolean DoAction();
extern Boolean Move();
extern Boolean MoveOpaque();
extern Boolean Neaten();
extern Boolean NewIconify();
extern Boolean Pause();
extern Boolean PushDown();
extern Boolean PushLeft();
extern Boolean PushRight();
extern Boolean PushUp();
extern Boolean Quit();
extern Boolean Raise();
extern Boolean Redraw();
extern Boolean Refresh();
extern Boolean ResetBindings();
extern Boolean ResetMenus();
extern Boolean ResetGadgets();
extern Boolean Resize();
extern Boolean Restart();
extern Boolean FDestroyTitle();
extern Boolean FDestroyGadgets();
extern Boolean FAddTitle();
extern Boolean FPutGadgets();
extern Boolean DestroyClient();
extern int StoreCursors();
extern int StoreBox();
extern int StoreTitleBox();
extern int StoreGridBox();
extern int StoreTitleGridBox();
extern int StoreZap();
extern int Error();
extern int XError();
extern int CreateMenus();
extern Window AddTitle();
extern char *stash();
extern char *GetIconName();
extern char *expand_from_path();
extern char *GetStringRes();
extern unsigned char *expand_metachars();
extern Boolean GetBoolRes();
extern Boolean ConfigureWindow();
extern Pixmap GetPixmapRes();
extern char *GetPixmapDataRes();
extern int GetIntRes();
extern Pixel GetColorRes();
extern XFontStruct *GetFontRes();
extern AwmInfoPtr GetAwmInfo();
extern AwmInfoPtr RegisterWindow();
extern AwmInfoPtr IsTitled();
extern AwmInfoPtr IsGadgetWin();
X
extern void Init_Titles();
extern void DestroyTitle();
extern void PaintTitle();
extern void SetBorderColors();
extern void SetBorderPixmaps();
X
X#ifdef	NEATEN
X#define DEFAULT_ABS_MIN		64
X#define SEPARATION		2
X#define DEF_PRIMARY_PLACEMENT	"Top"
X#define DEF_SECONDARY_PLACEMENT	"Left"
X
extern int AbsMinWidth;
extern int AbsMinHeight;
extern Boolean RetainSize;
extern Boolean KeepOpen;
extern Boolean Fill;
extern Boolean UsePriorities;
extern Boolean FixTopOfStack;
extern char *PrimaryIconPlacement;
extern char *SecondaryIconPlacement;
X#endif	NEATEN
END_OF_FILE
if test 19011 -ne `wc -c <'awm.h'`; then
    echo shar: \"'awm.h'\" unpacked with wrong size!
fi
# end of 'awm.h'
fi
echo shar: End of archive 5 \(of 8\).
cp /dev/null ark5isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 8 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0