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 12 (of 17)." # Contents: awm/awm.h # Wrapped by jkh@ardent on Thu Jun 16 00:44:20 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'awm/awm.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'awm/awm.h'\" else echo shar: Extracting \"'awm/awm.h'\" \(20819 characters\) sed "s/^X//" >'awm/awm.h' <<'END_OF_FILE' X#ident "%W% %G%" X X#ifndef lint static char *rcsid_awm_h = "$Header: awm.h,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/* 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 * 003 -- Jordan Hubbard, Ardent Computer X * Many additional declarations for awm. 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_GADGET_BORDER 1 X#define DEF_TITLE_PAD 2 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#define gray_width 16 X#define gray_height 16 extern char gray_bits[]; X X#define solid_width 16 X#define solid_height 16 extern char solid_bits[]; 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#define CenterGadgetGravity 3 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 SolidPixmap; 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 WBorder; /* 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 Cursor TitleCursor; /* Title bar cursor */ extern Cursor FrameCursor; /* Frame cursor */ extern int GadgetBorder; /* Width of gadget borders */ extern int ScreenWidth; /* Display screen width. */ extern int ScreenHeight; /* Display screen height. */ extern int TitleHeight; /* Height in pixels of title bar(s) */ extern int titleHeight; /* Derived height of title bar(s) */ extern int gadgetHeight; /* Height of highest gadget */ extern int NameOffset; /* Offset for window name */ 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 TitlePad; /* Title text padding */ 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 ConstrainResize; /* Don't resize until pointer leaves window */ 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 titles on focus? */ extern Boolean BorderHilite; /* Should we highlight borders on focus? */ extern Boolean FrameFocus; /* Should frame be considered part of window */ 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 20819 -ne `wc -c <'awm/awm.h'`; then echo shar: \"'awm/awm.h'\" unpacked with wrong size! fi # end of 'awm/awm.h' fi echo shar: End of archive 12 \(of 17\). cp /dev/null ark12isdone 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