[comp.windows.x] Second posting of awm, Part09

jkh@ardent.UUCP (Jordan K. Hubbard) (06/16/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 9 (of 17)."
# Contents:  awm/Titlebar.c awm/globals.c
# Wrapped by jkh@ardent on Thu Jun 16 00:44:16 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'awm/Titlebar.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'awm/Titlebar.c'\"
else
echo shar: Extracting \"'awm/Titlebar.c'\" \(13616 characters\)
sed "s/^X//" >'awm/Titlebar.c' <<'END_OF_FILE'
X#ident   "%W% %G%"
X
X#ifndef lint
static char *rcsid_TitleBar_c = "$Header: TitleBar.c,v 1.1 88/06/15 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, U.C. Berkeley.
X Title bar support routines.
X */
X
X#include "awm.h"
X#include "X11/Xutil.h"
X
static Boolean init_done = False;
int TB_wide, TB_high, TBB_wide, TBB_high, BC_wide, BC_high;
int BCB_wide, BCB_high;
X
extern XContext AwmContext;
X
X#define BLANK_WIDE	16
X#define BLANK_HIGH	16
static char blank_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
X
void Init_Titles()
X{
X     int t_wide, t_high, junk;
X     register char *cp;
X     
X     Entry("Init_Titles")
X
X     TFontInfo = GetFontRes("title.font", DEF_TITLE_FONT);
X     TFontBoldInfo = GetFontRes("title.boldFont", NULL);
X     TBackPixmapData = GetPixmapDataRes("title.pixmap", &TB_wide, &TB_high);
X     TBoldPixmapData = GetPixmapDataRes("title.boldPixmap", &TBB_wide,
X					&TBB_high);
X     BBackPixmapData = GetPixmapDataRes("borderContext.pixmap", &BC_wide,
X					&BC_high);
X     BBoldPixmapData = GetPixmapDataRes("borderContext.boldPixmap", &BCB_wide,
X					&BCB_high);
X     TForeground = GetColorRes("title.foreground", ForeColor);
X     TBackground = GetColorRes("title.background", BackColor);
X     TTextForeground = GetColorRes("title.text.foreground", TForeground);
X     TTextBackground = GetColorRes("title.text.background", TBackground);
X     titleHeight = TFontInfo->max_bounds.ascent +
X	  TFontInfo->max_bounds.descent + (TitlePad * 2);
X     /* we've specified a bold pixmap, but no back pixmap. Use blank. */
X     if (TBoldPixmapData && !TBackPixmapData) {
X	  TBackPixmapData = blank_bits;
X	  TB_wide = BLANK_WIDE;
X	  TB_high = BLANK_HIGH;
X     }
X     /* we've specified a bold BC pixmap, but no back pixmap. Use blank. */
X     if (BBoldPixmapData && !BBackPixmapData) {
X	  BBackPixmapData = blank_bits;
X	  BC_wide = BLANK_WIDE;
X	  BC_high = BLANK_HIGH;
X     }
X     if (TFontBoldInfo) {
X	  int foo;
X	  
X	  foo = TFontBoldInfo->max_bounds.ascent +
X	       TFontBoldInfo->max_bounds.descent + (TitlePad * 2);
X	  if (foo > titleHeight)
X	       titleHeight = foo;
X     }
X     if (titleHeight < gadgetHeight)
X	  titleHeight = gadgetHeight;
X     if (TitleHeight) /* Specified height overrides derived height */
X	  titleHeight = TitleHeight;
X     TitleCursor = XCreateFontCursor(dpy, TCursor);
X     if (BContext) {
X          FrameCursor = XCreateFontCursor(dpy, BCursor);
X          if (!FrameCursor)
X               Error("Init_Titles: Can't get border cursor #%d!\n", BCursor);
X     }
X     if (!TitleCursor)
X	  Error("Init_Titles: Can't get title cursor #%d!\n", TCursor);
X     init_done = True;
X     Leave_void
X}
X
char *GetTitleName(w)
Window w;
X{
X     char *cp = 0, *tmp;
X     
X     Entry("GetTitleName")
X	  
X     if (!XFetchName(dpy, w, &cp) || !cp)
X	  cp = "Untitled Window";
X     tmp = (char *)malloc(strlen(cp) + 3);
X     
X     /*
X      * We add a space on both ends for asthetic effect
X      * (only apparent if we're using inverse video).
X      */
X     tmp[0] = ' ';
X     strcpy(tmp + 1, cp);
X     strcat(tmp, " ");
X     free(cp);
X     Leave(tmp)
X}
X
X/* Function for f.title */
Boolean FAddTitle(w, mask, button, x, y)
Window w;
int mask, button, x, y;
X{
X     Entry("FAddTitle")
X	  
X     if (w == RootWindow(dpy, scr))
X	  Leave(FALSE)
X     XMapWindow(dpy, AddTitle(w));
X     XSync(dpy, FALSE);
X     Leave(TRUE)
X}
X
Window AddTitle(w)
Window w;
X{
X     Window root;
X     int x, y, width, height, bw, depth, status, bch, bcv;
X     Window foster, title;
X     AwmInfoPtr awi;
X     char *icon_name, *cp = 0;
X     char *class_string = 0;
X     char *name = 0, *class;
X     XWMHints *wm_hints;
X     XSizeHints sz_hints;
X     XClassHint class_hints;
X     Binding *bptr;
X     unsigned long valuemask;
X     XWindowAttributes xwa;
X     XSetWindowAttributes swa;
X     XWindowChanges wc;
X     unsigned long form, len, after;
X     Atom a_type;
X
X     Entry("AddTitle")
X
X    /*
X     * First we see if this window even wants a title.
X     */
X     if (IsTitled(w))
X	  Leave((Window)NULL)
X     awi = GetAwmInfo(w);
X     status = XGetWindowProperty(dpy, w, XA_WM_CLASS, 0, 256, False,
X				 XA_STRING, &a_type, &form, &len, &after,
X				 &class_string);
X     if (status == Success && form == 8 && len && class_string && !after) {
X     	  class_string[len] = '\0';
X	  class = class_string;
X	  if (len > strlen(class_string))
X	       name = class_string + strlen(class_string) + 1;
X	  if (name) {
X	       if (cp = XGetDefault(dpy, name, "showTitle"))
X		    if (*cp == 'n' || *cp == 'N' || !strcmp(cp, "off") ||
X			!strcmp(cp, "Off") || !strcmp(cp, "false") ||
X			!strcmp(cp, "False"))
X			 Leave((Window)NULL)
X	  }
X	  if (cp = XGetDefault(dpy, class, "showTitle"))
X	       if (*cp == 'n' || *cp == 'N' || !strcmp(cp, "off") ||
X		   !strcmp(cp, "Off") || !strcmp(cp, "false") ||
X		   !strcmp(cp, "False"))
X		    Leave((Window)NULL)
X     }
X     if (!awi) {
X	  fprintf(stderr, "AddTitle: Window %x is not registered!\n", w);
X	  Leave((Window)NULL)
X     }
X     XAddToSaveSet(dpy, awi->client);
X     if (!init_done)
X	  Init_Titles();
X     XGetGeometry(dpy, (Drawable)awi->client, &root, &x, &y, &width, &height,
X		  &bw, &depth);
X     XGetWindowAttributes(dpy, awi->client, &xwa);
X     valuemask = CWEventMask | CWBorderPixel | CWBackPixel;
X     swa.event_mask = (SubstructureRedirectMask | SubstructureNotifyMask);
X     if (BContext) {
X          swa.event_mask |= (ButtonPressMask | ButtonReleaseMask);
X          bch = (BContext * 2) + 2;
X          bcv = BContext + 1;
X          {
X	       XSetWindowAttributes cswa;
X
X	       cswa.do_not_propagate_mask =
X		    (ButtonPressMask | ButtonReleaseMask);
X	       XChangeWindowAttributes(dpy, awi->client, CWDontPropagate,
X				       &cswa);
X	  }
X
X     }
X     else
X          bch = bcv = 0;
X     if (FrameFocus)
X	  swa.event_mask |= (LeaveWindowMask | EnterWindowMask);
X     swa.background_pixel = TBackground;
X     swa.border_pixel = TForeground;
X     if (TitlePush == FALSE)
X	  y -= (titleHeight + 2); /* put title above, don't push window down */
X     foster = XCreateWindow(dpy, RootWindow(dpy, scr), x, y, width + bch,
X                            height + titleHeight + 2 + bcv,
X			    (bw ? bw : 1), xwa.depth, xwa.class, xwa.visual,
X			    valuemask, &swa);
X     if (!foster)
X	  Error("AddTitle: Can't create foster parent!");
X     if (BBackPixmapData) { /* we have a border context tile */
X	  awi->BC_back = XCreatePixmapFromBitmapData(dpy, foster,
X						     BBackPixmapData,
X						     BC_wide, BC_high,
X						     BForeground,
X						     BBackground, xwa.depth);
X	  if (!awi->BC_back)
X	       Error("AddTitle: Can't create pixmap for border context background");
X	  else
X	       XSetWindowBackgroundPixmap(dpy, foster, awi->BC_back);
X     }
X     if (BBoldPixmapData) { /* we have a bold border context tile */
X	  awi->BC_bold = XCreatePixmapFromBitmapData(dpy, foster,
X						     BBoldPixmapData,
X						     BCB_wide, BCB_high,
X						     BForeground,
X						     BBackground, xwa.depth);
X	  if (!awi->BC_bold)
X	       Error("AddTitle: Can't create bold pixmap for border context background");
X     }
X	  
X     swa.bit_gravity = CenterGravity;
X     swa.event_mask = (ExposureMask | ButtonPressMask | ButtonReleaseMask);
X     valuemask |= CWBitGravity;
X     title = XCreateWindow(dpy, foster, 0, 0, (width - 2) + bch, titleHeight,
X			   1, 0, CopyFromParent, CopyFromParent,
X			   valuemask, &swa);
X     if (!title)
X	  Error("AddTitle: Can't create title bar!");
X     if (TBackPixmapData) {
X	  awi->back = XCreatePixmapFromBitmapData(dpy, title, TBackPixmapData,
X						  TB_wide, TB_high,
X						  TForeground,
X						  TBackground, xwa.depth);
X	  if (!awi->back)
X	       Error("AddTitle: Can't create pixmap for title background");
X	  else
X	       XSetWindowBackgroundPixmap(dpy, title, awi->back);
X     }
X     if (TBoldPixmapData) {
X	  awi->bold = XCreatePixmapFromBitmapData(dpy, title, TBoldPixmapData,
X						  TBB_wide, TBB_high,
X						  TForeground,
X						  TBackground, xwa.depth);
X	  if (!awi->bold)
X	       Error("AddTitle: Can't create pixmap for bold background");
X     }
X     XSetWindowBorderWidth(dpy, awi->client, (BContext) ? 1 : 0);
X     wc.sibling = awi->client;
X     wc.stack_mode = Above;
X     XConfigureWindow(dpy, foster, CWSibling|CWStackMode, &wc);
X     swa.bit_gravity = CenterGravity;
X     XChangeWindowAttributes(dpy, title, CWBitGravity, &swa);
X     XDefineCursor(dpy, title, TitleCursor);
X     XDefineCursor(dpy, foster, FrameCursor);
X     XSelectInput(dpy, title, (ExposureMask | ButtonPressMask |
X		       ButtonReleaseMask));
X     XMapWindow(dpy, title);
X     if (!BContext)
X          XReparentWindow(dpy, awi->client, foster, 0, titleHeight + 2);
X     else
X          XReparentWindow(dpy, awi->client, foster, BContext, titleHeight + 2);
X     XMapWindow(dpy, awi->frame);
X     XMapWindow(dpy, awi->client);
X     XSync(dpy, 0);
X     awi->title = title;
X     awi->frame = foster;
X     awi->border_width = bw;
X     awi->name = GetTitleName(awi->client);
X     /* Make titlebar "frame" inherit characteristics of victim */
X     XStoreName(dpy, foster, awi->name);
X     if (XGetIconName(dpy, w, &icon_name)) {
X	  XSetIconName(dpy, foster, icon_name);
X	  free(icon_name);
X     }
X     if (wm_hints = XGetWMHints(dpy, awi->client)) {
X	  XSetWMHints(dpy, foster, wm_hints);
X	  XFree(wm_hints);
X     }
X     XGetNormalHints(dpy, awi->client, &sz_hints);
X     XSetNormalHints(dpy, foster, &sz_hints);
X     XGetZoomHints(dpy, awi->client, &sz_hints);
X     XSetZoomHints(dpy, foster, &sz_hints);
X     class_hints.res_name = class_hints.res_class = (char *)NULL;
X     if (XGetClassHint(dpy, awi->client, &class_hints) == Success)
X     	  XSetClassHint(dpy, foster, &class_hints);
X
X     XSaveContext(dpy, title, AwmContext, awi);
X     XSaveContext(dpy, foster, AwmContext, awi);
X     Leave(foster)
X}
X
Boolean FDestroyTitle(w, mask, button, x, y)
Window w;
int mask, button, x, y;
X{
X     Entry("FDestroyTitle")
X	  
X     if (w == RootWindow(dpy, scr))
X	  Leave(FALSE)
X     DestroyTitle(w, FALSE);
X     Leave(TRUE)
X}
X
void DestroyTitle(w)
Window w;
X{
X     XWindowAttributes xwa;
X     AwmInfoPtr awi;
X     
X     Entry("DestroyTitle")
X
X     if (!(awi = IsTitled(w)))
X	 Leave_void
X     XGetWindowAttributes(dpy, awi->frame, &xwa);
X     /* put away our toys when we're done playing with them */
X     if (TitlePush == FALSE)
X	  xwa.y += (titleHeight + 2);
X     XReparentWindow(dpy, awi->client, RootWindow(dpy, scr), xwa.x,
X	xwa.y);
X     XSetWindowBorderWidth(dpy, awi->client, awi->border_width);
X     DestroyGadgets(w);
X     XDeleteContext(dpy, awi->frame, AwmContext);
X     XDeleteContext(dpy, awi->title, AwmContext);
X     XDestroyWindow(dpy, awi->title);
X     XDestroyWindow(dpy, awi->frame);
X     XSync(dpy, FALSE);
X     if (awi->state != ICON)
X	  XRemoveFromSaveSet(dpy, awi->client);
X     if (awi->back)
X	  XFreePixmap(dpy, awi->back);
X     if (awi->bold)
X	  XFreePixmap(dpy, awi->bold);
X     free(awi->name);
X     awi->frame = awi->title = awi->back = awi->bold = 0;
X     awi->name = (char *)NULL;
X     Leave_void
X}
X
void PaintTitle(w)
Window w;
X{
X     static GC gc, rgc;
X     int x, y, ijunk;
X     XWindowAttributes xwa;
X     Window junk, chld;
X     Boolean reversed;
X     XFontStruct *f_info;
X     AwmInfoPtr awi;
X     XGCValues gcv;
X
X     Entry("PaintTitle")
X
X     if (!(awi = IsTitled(w)))
X	 Leave_void
X     XGetWindowAttributes(dpy, awi->title, &xwa);
X     XQueryPointer(dpy, awi->frame, &junk, &chld, &ijunk, &ijunk,
X		   &ijunk, &ijunk, &ijunk);
X     reversed = (chld == awi->client && Hilite);
X     if (reversed && TFontBoldInfo)
X	  f_info = TFontBoldInfo;
X     else
X	  f_info = TFontInfo;
X     gcv.font = f_info->fid;
X     gcv.foreground = (reversed && !TFontBoldInfo) ?
X	  TTextBackground : TTextForeground;
X     gcv.background = (reversed && !TFontBoldInfo) ?
X	  TTextForeground : TTextBackground;
X     XChangeGC(dpy, awi->winGC, (GCFont | GCForeground | GCBackground), &gcv);
X     XClearWindow(dpy, awi->title);
X     if (ShowName) {	/* print window names? */
X	  int textlen;
X
X	  textlen = XTextWidth(f_info, awi->name, strlen(awi->name));
X
X	  if (!NameOffset)
X	       x = (xwa.width - textlen) / 2;
X	  else {
X	       if (NameOffset < 0)
X		    x = (xwa.width - textlen) + NameOffset;
X	       else
X		    x = NameOffset;
X	       if (x + textlen > xwa.width)
X		    x = (xwa.width - textlen) + 1;
X	  }
X	  y = ((f_info->max_bounds.ascent + f_info->max_bounds.descent +
X		xwa.height - 1) / 2) - (TitlePad * 2);
X	  XDrawImageString(dpy, awi->title, awi->winGC, x, y, awi->name,
X			   strlen(awi->name));
X     }
X     Leave_void
X}
X
AwmInfoPtr IsTitled(w)
Window w;
X{
X     AwmInfoPtr tmp;
X
X     Entry("IsTitled")
X
X     if (!XFindContext(dpy, w, AwmContext, &tmp)) {
X	  if (tmp->title)
X	       Leave(tmp)
X     }
X     Leave((AwmInfoPtr)NULL)
X}
END_OF_FILE
if test 13616 -ne `wc -c <'awm/Titlebar.c'`; then
    echo shar: \"'awm/Titlebar.c'\" unpacked with wrong size!
fi
# end of 'awm/Titlebar.c'
fi
if test -f 'awm/globals.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'awm/globals.c'\"
else
echo shar: Extracting \"'awm/globals.c'\" \(13669 characters\)
sed "s/^X//" >'awm/globals.c' <<'END_OF_FILE'
X#ident   "%W% %G%"
X
X#ifndef lint
static char *rcsid_globals_c = "$Header: globals.c,v 1.1 88/06/15 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 * 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 
Window Pop;			/* Pop up dimension display window. */
Window 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 */
Pixmap GrayPixmap;		/* Gray pixmap. */
Pixmap SolidPixmap;		/* Solid pixmap */
Pixmap IBackPixmap;		/* Icon window background pixmap. */
Pixel ForeColor;		/* Generic foreground color */
Pixel BackColor;		/* Generic background color */
Pixel IBorder;			/* Icon window border color. */
Pixel PBorder;			/* Pop-Up Window border color. */
Pixel WBorder;			/* Window border color */
Pixel BBackground;		/* Border context background color */
Pixel BForeground;		/* Border context foreground color */
Pixel PBackground;		/* Pop-up Window background color. */
Pixel PForeground;		/* Pop-up Window foregrould color */
Pixel TBackground;		/* Titlebar background color */
Pixel TForeground;		/* Titlebar foreground color */
Pixel TTextBackground;		/* Titlebar text background color */
Pixel TTextForeground;		/* Titlebar text foreground color */
Pixel IBackground;		/* Icon background (for pixmap) color */
Pixel IForeground;		/* Icon foreground (for pixmap) color */
Pixel ITextForeground;		/* Icon text foreground color */
Pixel ITextBackground;		/* Icon text background color */
Cursor ArrowCrossCursor;	/* Arrow cross cursor. */
Cursor TextCursor;		/* Text cursor used in icon windows. */
Cursor IconCursor;		/* Icon Cursor. */
Cursor LeftButtonCursor;	/* Left button main cursor. */
Cursor MiddleButtonCursor;	/* Middle button main cursor. */
Cursor RightButtonCursor;	/* Right button main cursor. */
Cursor TargetCursor;		/* Target (select-a-window) cursor. */
Cursor TitleCursor;		/* Titlebar cursor */
Cursor FrameCursor;		/* Border context cursor */
int GadgetBorder;		/* Width of gadget borders */
int ScreenWidth;		/* Display screen width. */
int ScreenHeight;		/* Display screen height. */
int IBorderWidth;		/* Icon window border width. */
int TitleHeight;		/* Height of title bar(s) (in pixels) */
int titleHeight;		/* Derived height of title bar(s) in pixels */
int gadgetHeight;		/* Height of highest gadget */
int NameOffset;			/* Offset for window name */
int TitlePad;			/* Padding for titles */
int PWidth;			/* Pop-up window width. */
int PHeight;			/* Pop-up window height. */
int PBorderWidth;		/* Pop-up window border width. */
int PPadding;			/* Pop-up window padding. */
int Delta;			/* Mouse movement slop. */
int HIconPad;			/* Icon horizontal padding. */
int VIconPad;			/* Icon vertical padding. */
int MaxColors;			/* Maximum number of colors to use. */
int Pushval;			/* Number of pixels to push window by. */
int BContext;			/* Border context area width (in pixels) */
int RaiseDelay;			/* Number of milliseconds delay before autoraise */
int NumGadgets;			/* Number of gadgets we're using */
int GadgetPad;			/* Amount of padding for gadgets */
int Volume;			/* Audible alarm volume. */
int status;			/* Routine return status. */
int Maxfd;			/* Maximum file descriptors for select(2). */
int BCursor;			/* Border context cursor */
int TCursor;			/* Title context cursor */
MenuLink *Menus;		/* Linked list of menus. */
GC  IconGC;			/* graphics context for icon */
GC  PopGC;			/* graphics context for pop */
GC  DrawGC;			/* graphics context for drawing */
Binding *Blist;			/* Button/key binding list. */
X
XXContext AwmContext;		/* Main context for awm */
X
Boolean Autoselect;		/* Warp mouse to default menu selection? */
Boolean Autoraise;		/* Raise window on input focus? */
Boolean ConstrainResize;	/* Don't resize until pointer leaves window */
Boolean Freeze;			/* Freeze server during move/resize? */
Boolean Grid;			/* Should the m/r box contain a 9 seg. grid. */
Boolean ShowName;		/* If True, print window names in titlebars */
Boolean Hilite;			/* Should we highlight titles on focus? */
Boolean BorderHilite;		/* Should we highlight borders on focus? */
Boolean NWindow;		/* Normalize windows? */
Boolean NIcon;			/* Normalize icons? */
Boolean Push;			/* Relative=TRUE, Absolute=FALSE. */
Boolean RootResizeBox;		/* Resize window is placed over sized window? */
Boolean ResizeRelative;		/* resizes should be relative to window edge */
Boolean Titles;			/* Title bar frob on windows? */
Boolean UseGadgets;		/* Gadget bars on titles? */
Boolean FrameFocus;		/* Treat the frame as part of the window? */
Boolean Reverse;		/* Reverse video? */
Boolean SaveUnder;		/* Save unders? */
Boolean TitlePush;		/* Down=TRUE, Up=FALSE */
Boolean Wall;			/* restrict to root window boundries? */
Boolean WarpOnRaise;		/* Warp to upper right corner on raise. */
Boolean WarpOnIconify;          /* Warp to icon center on iconify. */
Boolean WarpOnDeIconify;        /* Warp to upper right corner on de-iconify. */
Boolean FocusSetByUser;         /* True if f.focus called */
Boolean Zap;			/* Should the the zap effect be used. */
X 
char PText[7] = INIT_PTEXT;	/* Pop-up window dummy text. */
int PTextSize = sizeof(PText);	/* Pop-up window dummy text size. */
X 
int Lineno = 1;			/* Line count for parser. */
Boolean Startup_File_Error = FALSE;/* Startup file error flag. */
char Startup_File[NAME_LEN] = "";/* Startup file name. */
char *TBackPixmapData;		/* Bitmap data file title background */
char *TBoldPixmapData;		/* ditto, except highlighted */
char *BBackPixmapData;		/* Border context background pixmap data */
char *BBoldPixmapData;		/* Border context bold pixmap data */
char *awmPath;			/* Optional pathlist to search for pixmaps */
char **Argv;			/* Pointer to command line parameters. */
char **Environ;			/* Pointer to environment. */
X
char 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
char 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
int scr;
Display *dpy;
X
X#ifdef NEATEN
int AbsMinWidth;
int AbsMinHeight;
Boolean RetainSize;
Boolean KeepOpen;
Boolean Fill;
Boolean UsePriorities;
Boolean FixTopOfStack;
char *PrimaryIconPlacement;
char *SecondaryIconPlacement;
X#endif
X
X/*
X * Keyword lookup table for parser.
X */
Keyword 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    { "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.exit",		IsQuitFunction,	0, Quit },
X    { "f.focus",	IsFunction,	0, Focus },
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, PushDown },
X    { "f.pushleft",	IsFunction,	0, PushLeft },
X    { "f.pushright",	IsFunction,	0, PushRight },
X    { "f.pushup",	IsFunction,	0, PushUp },
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.title",        IsFunction,     0, FAddTitle },
X    { "f.gadgets",	IsFunction,	0, FPutGadgets },
X    { "f.notitle",      IsFunction,     0, FDestroyTitle },
X    { "f.nogadgets",	IsFunction,	0, FDestroyGadgets },
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 */
KeyExpr 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 */
ContExpr 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 */
GravityExpr 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 */
ButtonModifier 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_FILE
if test 13669 -ne `wc -c <'awm/globals.c'`; then
    echo shar: \"'awm/globals.c'\" unpacked with wrong size!
fi
# end of 'awm/globals.c'
fi
echo shar: End of archive 9 \(of 17\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 17 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