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

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

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

#! /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 7 (of 13)."
# Contents:  awm/Neaten.c awm/Resize.c awm/globals.c
# Wrapped by mikew@wyse on Mon Aug  8 12:01:45 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f awm/Neaten.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/Neaten.c\"
else
echo shar: Extracting \"awm/Neaten.c\" \(14785 characters\)
sed "s/^X//" >awm/Neaten.c <<'END_OF_awm/Neaten.c'
X#ident   "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_Neaten_c = "$Header: Neaten.c,v 1.2 88/06/17 15:26:00 jkh Exp $";
X#endif  lint
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * MODIFICATION HISTORY
X *
X * 002 -- Jordan Hubbard, Ardent Computer.
X *  Changes to work with awm, specifically reparented windows.
X */
X
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
Xstatic void GetIconHints();
Xstatic void GetName();
Xextern Boolean IsIcon();
Xextern int neaten_debug_level;
X
X#define TOP_LEVEL (awi->frame ? awi->frame : awi->client)
X
X/* ARGSUSED */
XBoolean Neaten(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     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
Xstatic void
X     GetIconHints(window, x, y, width, height, border)
XWindow window;
Xint *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
Xstatic void
X     GetName(w, name)
XWindow w;
Xchar *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
Xvoid NeatenDebug(window, left, top, width, height, adjustment)
Xint window;
Xint left, top;
Xint width, height;
Xunsigned 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 */
XBoolean Neaten(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     fprintf(stderr, "awm: Warning: Neaten package not installed in ");
X     fprintf(stderr, "this version of of awm.\n");
X}
X#endif NEATEN
END_OF_awm/Neaten.c
if test 14785 -ne `wc -c <awm/Neaten.c`; then
    echo shar: \"awm/Neaten.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/Resize.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/Resize.c\"
else
echo shar: Extracting \"awm/Resize.c\" \(15515 characters\)
sed "s/^X//" >awm/Resize.c <<'END_OF_awm/Resize.c'
X#ident   "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_Resize_c = "$Header: Resize.c,v 1.1 88/06/15 15:01:04 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 *        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#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
XBoolean Resize(window, mask, button, x0, y0)
XWindow window;                          /* Event window. */
Xint mask;                               /* Button/key mask. */
Xint button;                             /* Button event detail. */
Xint 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	  client_info.y = frame_info.y;
X	  client_info.x = frame_info.x;
X	  if (status == FAILURE)
X	       Leave(FALSE)
X	  if (awi->attrs & AT_TITLE)
X	       client_info.y += titleHeight + 2;
X	  if (awi->attrs & AT_BORDER) {
X	       client_info.x += BContext + 1;
X	       if (!(awi->attrs & AT_TITLE))
X		    client_info.y += BContext + 1;
X	  }
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      * 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 =
X			 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 =
X			 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
XCheckConsistency(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_awm/Resize.c
if test 15515 -ne `wc -c <awm/Resize.c`; then
    echo shar: \"awm/Resize.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/globals.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"awm/globals.c\"
else
echo shar: Extracting \"awm/globals.c\" \(13880 characters\)
sed "s/^X//" >awm/globals.c <<'END_OF_awm/globals.c'
X#ident   "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_globals_c = "$Header: globals.c,v 1.3 88/07/23 17:26:00 jkh Exp $";
X#endif  lint
X 
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * 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 * 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. April 17, 1987
X *  Convert to X11
X * 003 -- Jordan Hubbard, U.C. Berkeley. Misc new vars.
X */
X 
X#include "awm.h"
X#include "X11/Xutil.h"
X 
XWindow Pop;			/* Pop up dimension display window. */
XWindow Frozen;			/* Contains window id of "gridded" window. */
XXFontStruct *IFontInfo;		/* Icon text font information. */
XXFontStruct *PFontInfo;		/* Pop-up text font information. */
XXFontStruct *TFontInfo;		/* Title text font information. */
XXFontStruct *TFontBoldInfo;	/* Title text (bold) font information. */
XXFontStruct *GFontInfo;		/* Gadget box text font */
XPixmap GrayPixmap;		/* Gray pixmap. */
XPixmap SolidPixmap;		/* Solid pixmap */
XPixmap IBackPixmap;		/* Icon window background pixmap. */
XPixel ForeColor;		/* Generic foreground color */
XPixel BackColor;		/* Generic background color */
XPixel IBorder;			/* Icon window border color. */
XPixel PBackground;		/* Pop-up Window background color. */
XPixel PForeground;		/* Pop-up Window foregrould color */
XPixel PBorder;			/* Pop-Up Window border color. */
XPixel IBackground;		/* Icon background (for pixmap) color */
XPixel IForeground;		/* Icon foreground (for pixmap) color */
XPixel ITextForeground;		/* Icon text foreground color */
XPixel ITextBackground;		/* Icon text background color */
Xchar *Foreground;		/* foreground color (text) */
Xchar *Background;		/* background color (text) */
Xchar *WBorder;			/* Window border color */
Xchar *BBackground;		/* Border context background color */
Xchar *BForeground;		/* Border context foreground color */
Xchar *TBackground;		/* Titlebar background color */
Xchar *TForeground;		/* Titlebar foreground color */
Xchar *TTextBackground;		/* Titlebar text background color */
Xchar *TTextForeground;		/* Titlebar text foreground color */
XCursor ArrowCrossCursor;	/* Arrow cross cursor. */
XCursor TextCursor;		/* Text cursor used in icon windows. */
XCursor IconCursor;		/* Icon Cursor. */
XCursor LeftButtonCursor;	/* Left button main cursor. */
XCursor MiddleButtonCursor;	/* Middle button main cursor. */
XCursor RightButtonCursor;	/* Right button main cursor. */
XCursor TargetCursor;		/* Target (select-a-window) cursor. */
XCursor TitleCursor;		/* Titlebar cursor */
XCursor FrameCursor;		/* Border context cursor */
Xint GadgetBorder;		/* Width of gadget borders */
Xint ScreenWidth;		/* Display screen width. */
Xint ScreenHeight;		/* Display screen height. */
Xint IBorderWidth;		/* Icon window border width. */
Xint TitleHeight;		/* Height of title bar(s) (in pixels) */
Xint titleHeight;		/* Derived height of title bar(s) in pixels */
Xint gadgetHeight;		/* Height of highest gadget */
Xint NameOffset;			/* Offset for window name */
Xint TitlePad;			/* Padding for titles */
Xint PWidth;			/* Pop-up window width. */
Xint PHeight;			/* Pop-up window height. */
Xint PBorderWidth;		/* Pop-up window border width. */
Xint PPadding;			/* Pop-up window padding. */
Xint Delta;			/* Mouse movement slop. */
Xint HIconPad;			/* Icon horizontal padding. */
Xint VIconPad;			/* Icon vertical padding. */
Xint Pushval;			/* Number of pixels to push window by. */
Xint BContext;			/* Border context area width (in pixels) */
Xint RaiseDelay;			/* Number of milliseconds delay before autoraise */
Xint NumGadgets;			/* Number of gadgets we're using */
Xint GadgetPad;			/* Amount of padding for gadgets */
Xint Volume;			/* Audible alarm volume. */
Xint status;			/* Routine return status. */
Xint Maxfd;			/* Maximum file descriptors for select(2). */
Xint BCursor;			/* Border context cursor */
Xint TCursor;			/* Title context cursor */
XMenuLink *Menus;		/* Linked list of menus. */
XGC  IconGC;			/* graphics context for icon */
XGC  PopGC;			/* graphics context for pop */
XGC  DrawGC;			/* graphics context for drawing */
XBinding *Blist;			/* Button/key binding list. */
X
XXContext AwmContext;		/* Main context for awm */
X
XBoolean Autoselect;		/* Warp mouse to default menu selection? */
XBoolean Autoraise;		/* Raise window on input focus? */
XBoolean Borders;		/* Display border context areas? */
XBoolean ConstrainResize;	/* Don't resize until pointer leaves window */
XBoolean Freeze;			/* Freeze server during move/resize? */
XBoolean Grid;			/* Should the m/r box contain a 9 seg. grid. */
XBoolean ShowName;		/* If True, print window names in titlebars */
XBoolean Hilite;			/* Should we highlight titles on focus? */
XBoolean BorderHilite;		/* Should we highlight borders on focus? */
XBoolean InstallColormap;	/* Should we install colormaps for clients? */
XBoolean NWindow;		/* Normalize windows? */
XBoolean NIcon;			/* Normalize icons? */
XBoolean Push;			/* Relative=TRUE, Absolute=FALSE. */
XBoolean RootResizeBox;		/* Resize window is placed over sized window? */
XBoolean ResizeRelative;		/* resizes should be relative to window edge */
XBoolean Titles;			/* Title bar frob on windows? */
XBoolean UseGadgets;		/* Gadget bars on titles? */
XBoolean FrameFocus;		/* Treat the frame as part of the window? */
XBoolean Reverse;		/* Reverse video? */
XBoolean SaveUnder;		/* Save unders? */
XBoolean PushDown;		/* Down=TRUE, Up=FALSE */
XBoolean Wall;			/* restrict to root window boundries? */
XBoolean WarpOnRaise;		/* Warp to upper right corner on raise. */
XBoolean WarpOnIconify;          /* Warp to icon center on iconify. */
XBoolean WarpOnDeIconify;        /* Warp to upper right corner on de-iconify. */
XBoolean FocusSetByUser;         /* True if f.focus called */
XBoolean FocusSetByWM;		/* True if awm set the focus */
XBoolean Zap;			/* Should the the zap effect be used. */
X 
Xchar PText[7] = INIT_PTEXT;	/* Pop-up window dummy text. */
Xint PTextSize = sizeof(PText);	/* Pop-up window dummy text size. */
X 
Xint Lineno = 1;			/* Line count for parser. */
XBoolean Startup_File_Error = FALSE;/* Startup file error flag. */
Xchar Startup_File[NAME_LEN] = "";/* Startup file name. */
Xchar *TBackPixmapData;		/* Bitmap data file title background */
Xchar *TBoldPixmapData;		/* ditto, except highlighted */
Xchar *BBackPixmapData;		/* Border context background pixmap data */
Xchar *BBoldPixmapData;		/* Border context bold pixmap data */
Xchar *awmPath;			/* Optional pathlist to search for pixmaps */
Xchar **Argv;			/* Pointer to command line parameters. */
Xchar **Environ;			/* Pointer to environment. */
X
Xchar gray_bits[] = {
X     0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X     0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X     0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X     0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa
X};
X
Xchar solid_bits[] = {
X     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
X     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
X     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
X     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
X};
X
Xint scr;
XDisplay *dpy;
X
X#ifdef NEATEN
Xint AbsMinWidth;
Xint AbsMinHeight;
XBoolean RetainSize;
XBoolean KeepOpen;
XBoolean Fill;
XBoolean UsePriorities;
XBoolean FixTopOfStack;
Xchar *PrimaryIconPlacement;
Xchar *SecondaryIconPlacement;
X#endif
X
X/*
X * Keyword lookup table for parser.
X */
XKeyword KeywordTable[] =
X{
X    { "autoselect",	IsBoolean,	&Autoselect, 0 },
X    { "autoraise",	IsBoolean,	&Autoraise, 0 },
X    { "freeze",		IsBoolean,	&Freeze, 0 },
X    { "hilite",		IsBoolean,	&Hilite, 0 },
X    { "rootResizeBox",	IsBoolean,	&RootResizeBox, 0 },
X    { "titles",		IsBoolean,	&Titles, 0 },
X    { "gadgets",	IsBoolean,	&UseGadgets, 0 },
X    { "grid",		IsBoolean,	&Grid, 0 },
X    { "showName",	IsBoolean,	&ShowName, 0,},
X    { "normali",	IsBoolean,	&NIcon, 0 },
X    { "normalw",	IsBoolean,	&NWindow, 0 },
X    { "pushRelative",	IsBoolean,	&Push, 0 },
X    { "reverse",	IsBoolean,	&Reverse, 0 },
X    { "wall",		IsBoolean,	&Wall, 0 },
X    { "frameFocus",	IsBoolean,	&FrameFocus, 0 },
X    { "warpOnIconify",	IsBoolean,	&WarpOnIconify, 0 },
X    { "warpOnDeIconify",IsBoolean,	&WarpOnDeIconify, 0 },
X    { "warpOnRaise",	IsBoolean,	&WarpOnRaise, 0 },
X#ifdef NEATEN
X    { "retainSize",	IsBoolean,	&RetainSize, 0 },
X    { "keepOpen",	IsBoolean,	&KeepOpen, 0 },
X    { "fill",		IsBoolean,	&Fill, 0 },
X    { "usePriorities",	IsBoolean,	&UsePriorities },
X    { "fixTopOfStack",	IsBoolean,	&FixTopOfStack },
X#endif
X    { "zap",		IsBoolean,	&Zap, 0 },
X    { "gadget",		IsGadget,	0, 0 },
X    { "f.beep",		IsImmFunction,	0, Beep },
X    { "f.circledown",	IsImmFunction,	0, CircleDown },
X    { "f.circleup",	IsImmFunction,	0, CircleUp },
X    { "f.continue",	IsImmFunction,	0, Continue },
X    { "f.decorate",	IsFunction,	0, FDecorate },
X    { "f.exit",		IsQuitFunction,	0, Quit },
X    { "f.focus",	IsFunction,	0, Focus },
X    { "f.unfocus",	IsImmFunction,	0, UnFocus },
X    { "f.iconify",	IsFunction,	0, Iconify },
X    { "f.lower",	IsFunction,	0, Lower },
X    { "f.menu",		IsMenuMap,	0, DoMenu },
X    { "f.action",	IsAction,	0, DoAction },
X    { "f.move",		IsDownFunction,	0, Move },
X    { "f.moveopaque",	IsDownFunction,	0, MoveOpaque },
X    { "f.newiconify",	IsDownFunction,	0, NewIconify },
X    { "f.neaten",	IsImmFunction,	0, Neaten },
X    { "f.pause",	IsImmFunction,	0, Pause },
X    { "f.pushdown",	IsFunction,	0, ShoveDown },
X    { "f.pushleft",	IsFunction,	0, ShoveLeft },
X    { "f.pushright",	IsFunction,	0, ShoveRight },
X    { "f.pushup",	IsFunction,	0, ShoveUp },
X    { "f.raise",	IsFunction,	0, Raise },
X    { "f.redraw",	IsDownFunction,	0, Redraw },
X    { "f.refresh",	IsImmFunction,	0, Refresh },
X    { "f.resize",	IsDownFunction,	0, Resize },
X    { "f.restart",	IsQuitFunction,	0, Restart },
X    { "f.destroy",      IsDownFunction, 0, DestroyClient },
X    { "f.nodecorate",   IsFunction,     0, FNoDecorate },
X    { "menu",		IsMenu,		0, 0 },
X    { "resetbindings",	IsParser,	0, ResetBindings },
X    { "resetmenus",	IsParser,	0, ResetMenus },
X    { "resetgadgets",	IsParser,	0, ResetGadgets },
X    { NULL,		NULL,		NULL, NULL }
X};
X 
X/*
X * Key expression table for parser.
X */
XKeyExpr KeyExprTbl[] = {
X    { "ctrl", ControlMask },
X    { "c", ControlMask },
X    { "lock", LockMask },
X    { "l", LockMask },
X    { "meta", Mod1Mask },
X    { "m", Mod1Mask },
X    { "shift", ShiftMask },
X    { "s", ShiftMask },
X    { "mod1", Mod1Mask },
X    { "mod2", Mod2Mask },
X    { "mod3", Mod3Mask },
X    { "mod4", Mod4Mask },
X    { "mod5", Mod5Mask },
X    { NULL, NULL }
X};
X 
X/*
X * Context expression table for parser.
X */
XContExpr ContExprTbl[] = {
X    { "icon", ICON },
X    { "i", ICON },
X    { "root", ROOT },
X    { "r", ROOT },
X    { "window", WINDOW },
X    { "w", WINDOW },
X    { "t", TITLE },
X    { "title", TITLE },
X    { "g", GADGET },
X    { "gadget", GADGET },
X    { "border", BORDER },
X    { "b", BORDER },
X    { NULL, NULL }
X};
X
X/*
X * Gravity expressions for parser.
X */
XGravityExpr GravityExprTbl[] = {
X    { "noGravity", NoGadgetGravity },
X    { "nogravity", NoGadgetGravity },
X    { "NoGravity", NoGadgetGravity },
X    { "leftGravity", LeftGadgetGravity },
X    { "leftgravity", LeftGadgetGravity },
X    { "LeftGravity", LeftGadgetGravity },
X    { "rightGravity", RightGadgetGravity },
X    { "rightgravity", RightGadgetGravity },
X    { "RightGravity", RightGadgetGravity },
X    { "centerGravity", CenterGadgetGravity },
X    { "centerGravity", CenterGadgetGravity },
X    { "CenterGravity", CenterGadgetGravity },
X    { NULL, NULL}
X};
X
X/*
X * Button expression table for parser.
X */
XButtonModifier ButtModTbl[] = {
X    { "left", LeftMask },
X    { "leftbutton", LeftMask },
X    { "l", LeftMask },
X    { "middle", MiddleMask },
X    { "middlebutton", MiddleMask },
X    { "m", MiddleMask },
X    { "right", RightMask },
X    { "rightbutton", RightMask },
X    { "r", RightMask },
X    { "move", DeltaMotion },
X    { "motion", DeltaMotion },
X    { "delta", DeltaMotion },
X    { "boogie", DeltaMotion },
X    { "truckin", DeltaMotion }, /* it's been a silly day... */
X    { "down", ButtonDown },
X    { "d", ButtonDown },
X    { "up", ButtonUp },
X    { "u", ButtonUp },
X    { NULL, NULL }
X};
X 
END_OF_awm/globals.c
if test 13880 -ne `wc -c <awm/globals.c`; then
    echo shar: \"awm/globals.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 7 \(of 13\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 13 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330