1: /* $Header: uwm.h,v 10.3 86/02/01 16:24:37 tony Rel $ */
   2: /************************************************************************
   3:  *									*
   4:  *			Copyright (c) 1986 by				*
   5:  *		Digital Equipment Corporation, Maynard, MA		*
   6:  *		         All Rights Reserved.				*
   7:  *									*
   8:  *	Permission to use, copy, modify, and distribute this software	*
   9:  *	and its documentation is hereby granted only to licensees of 	*
  10:  *	The Regents of the University of California pursuant to their	*
  11:  *	license agreement for the Berkeley Software Distribution 	*
  12:  *	provided that the following appears on all copies.		*
  13:  *									*
  14:  *            "LICENSED FROM DIGITAL EQUIPMENT CORPORATION		*
  15:  *                      COPYRIGHT (C) 1986				*
  16:  *                 DIGITAL EQUIPMENT CORPORATION			*
  17:  *                         MAYNARD, MA					*
  18:  *                     ALL RIGHTS RESERVED.				*
  19:  *									*
  20:  *      THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT	*
  21:  *	NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL	*
  22:  *	EQUIPMENT CORPORATION.  DIGITAL MAKES NO REPRESENTATIONS	*
  23:  *	ABOUT SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS	*
  24:  *	SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.		*
  25:  *									*
  26:  * 	IF THE UNIVERSITY OF CALIFORNIA OR ITS LICENSEES MODIFY 	*
  27:  *	THE SOFTWARE IN A MANNER CREATING DERIVATIVE COPYRIGHT 		*
  28:  *	RIGHTS APPROPRIATE COPYRIGHT LEGENDS MAY BE PLACED ON THE	*
  29:  *	DERIVATIVE WORK IN ADDITION TO THAT SET FORTH ABOVE."		*
  30:  *									*
  31:  ************************************************************************/
  32: 
  33: 
  34: 
  35: /*
  36:  * MODIFICATION HISTORY
  37:  *
  38:  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  39:  */
  40: 
  41: #include <errno.h>
  42: #include <stdio.h>
  43: #include <strings.h>
  44: #include <X/Xlib.h>
  45: 
  46: #define MIN(x, y)   ((x) <= (y) ? (x) : (y))
  47: #define MAX(x, y)   ((x) >= (y) ? (x) : (y))
  48: 
  49: typedef enum _bool {FALSE, TRUE} Bool;
  50: 
  51: #define DEF_DELTA       1
  52: #define DEF_FONT        "6x10"
  53: #define DEF_FUNC        GXcopy
  54: #define DEF_ICON_BORDER_WIDTH   2
  55: #define DEF_ICON_PADDING    4
  56: #define DEF_POP_BORDER_WIDTH    2
  57: #define DEF_POP_PADDING     4
  58: #define DEF_MENU_BORDER_WIDTH   2
  59: #define DEF_MENU_PADDING    4
  60: #define DEF_VOLUME      4
  61: 
  62: #define INIT_PTEXT      {'0', '0', '0', 'x', '0', '0', '0'}
  63: #define TEMPFILE        "/tmp/uwm.XXXXXX"
  64: #define SYSFILE         "/usr/new/lib/X/uwm/system.uwmrc"
  65: 
  66: #define CURSOR_WIDTH        16
  67: #define CURSOR_HEIGHT       16
  68: 
  69: #define MAX_ZAP_VECTORS     16
  70: #define MAX_BOX_VECTORS     26
  71: 
  72: #define DRAW_HEIGHT     1
  73: #define DRAW_WIDTH      1
  74: #define DRAW_VALUE      0xfd
  75: #define DRAW_FUNC       GXxor
  76: #define DRAW_PLANES     1
  77: 
  78: #define ROOT            0x1
  79: #define WINDOW          0x2
  80: #define ICON            0x4
  81: 
  82: #define FAILURE         0
  83: #define NAME_LEN        256 /* Maximum length of filenames. */
  84: #define KeyMask(x)  (x & (ControlMask|MetaMask|ShiftMask|ShiftLockMask))
  85: #define EVENTMASK       (ButtonPressed | ButtonReleased)
  86: #define ButtonValue(x)      (x & (LeftMask|MiddleMask|RightMask) >> 9)
  87: 
  88: #define DrawBox() XDraw(RootWindow,box,num_vectors,DRAW_HEIGHT,DRAW_WIDTH,DRAW_VALUE,DRAW_FUNC,AllPlanes)
  89: #define DrawZap() XDraw(RootWindow,zap,num_vectors,DRAW_HEIGHT,DRAW_WIDTH,DRAW_VALUE,DRAW_FUNC,AllPlanes)
  90: 
  91: /*
  92:  * Keyword table entry.
  93:  */
  94: typedef struct _keyword {
  95:     char *name;
  96:     int type;
  97:     Bool *bptr;
  98:     int *nptr;
  99:     char *sptr;
 100:     Bool (*fptr)();
 101: } Keyword;
 102: 
 103: /*
 104:  * Keyword table type entry.
 105:  */
 106: #define IsString    1
 107: #define IsBoolTrue  2
 108: #define IsBoolFalse 3
 109: #define IsFunction  4
 110: #define IsMenuMap   5
 111: #define IsMenu      6
 112: #define IsDownFunction  7
 113: #define IsParser    8
 114: #define IsNumeric   9
 115: #define IsQuitFunction  10
 116: 
 117: /*
 118:  * Button/key binding type.
 119:  */
 120: typedef struct _binding {
 121:     struct _binding *next;
 122:     int context;
 123:     short mask;
 124:     short button;
 125:     Bool (*func)();
 126:     char *menuname;
 127:     struct _menuinfo *menu;
 128: } Binding;
 129: 
 130: /*
 131:  * Key expression type.
 132:  */
 133: typedef struct _keyexpr {
 134:     char *name;
 135:     short mask;
 136: } KeyExpr;
 137: 
 138: /*
 139:  * Context expression type.
 140:  */
 141: typedef struct _contexpr {
 142:     char *name;
 143:     int mask;
 144: } ContExpr;
 145: 
 146: /*
 147:  * Button modifier type.
 148:  */
 149: typedef struct _buttonmodifier {
 150:     char *name;
 151:     short mask;
 152: } ButtonModifier;
 153: 
 154: /*
 155:  * Button modifier mask definitions.
 156:  * Note: The upper byte definitions are found in <X/X.h>.
 157:  */
 158: #define DoubleClick 0x1
 159: #define DeltaMotion 0x2
 160: #define ButtonUp    0x4
 161: #define ButtonDown  0x8
 162: #define ButtonMods  0xf
 163: 
 164: /*
 165:  * MenuInfo data type.
 166:  */
 167: typedef struct _menuinfo {
 168:     char *name;         /* Name of this menu. */
 169:     Window w;           /* Menu window. */
 170:     int iheight;        /* Height of an item. */
 171:     int width;          /* Width of this menu. */
 172:     int height;         /* Height of this menu. */
 173:     Pixmap image;       /* Saved image of the menu. */
 174:     char *foreground;       /* Name of foreground color. */
 175:     char *background;       /* Name of background color. */
 176:     char *fghighlight;      /* Name of hightlight foreground color. */
 177:     char *bghighlight;      /* Name of highlight background color. */
 178:     Color fg;           /* Foreground color definition. */
 179:     Color bg;           /* Background color definition. */
 180:     Color hlfg;         /* Foreground highlight color definition. */
 181:     Color hlbg;         /* Background highlight color definition. */
 182:     struct _menuline *line; /* Linked list of menu items. */
 183: } MenuInfo;
 184: 
 185: /*
 186:  * Menu Line data type.
 187:  */
 188: typedef struct _menuline {
 189:     struct _menuline *next; /* Pointer to next line. */
 190:     char *name;         /* Name of this line. */
 191:     int type;           /* IsShellCommand, IsText, IsTextNL... */
 192:     Window w;           /* Subwindow for this line. */
 193:     char *text;         /* Text string to be acted upon. */
 194:     Bool (*func)();     /* Window manager function to be invoked. */
 195:     struct _menuinfo *menu; /* Menu to be invoked. */
 196:     char *foreground;       /* Name of foreground color. */
 197:     char *background;       /* Name of background color. */
 198:     Color fg;           /* Foreground color definition. */
 199:     Color bg;           /* Background color definition. */
 200: } MenuLine;
 201: 
 202: /*
 203:  * MenuLine->type definitions.
 204:  */
 205: #define IsShellCommand      1
 206: #define IsText          2
 207: #define IsTextNL        3
 208: #define IsUwmFunction       4
 209: #define IsMenuFunction      5
 210: #define IsImmFunction       6     /* Immediate (context-less) function. */
 211: 
 212: /*
 213:  * Menu Link data type.  Used by the parser when creating a linked list
 214:  * of menus.
 215:  */
 216: typedef struct _menulink {
 217:     struct _menulink *next; /* Pointer to next MenuLink. */
 218:     struct _menuinfo *menu; /* Pointer to the menu in this link. */
 219: } MenuLink;
 220: 
 221: /*
 222:  * External variable definitions.
 223:  */
 224: extern int errno;
 225: extern Window Pop;      /* Pop-up dimension display window. */
 226: extern Window Frozen;       /* Contains window id of "gridded" window. */
 227: extern Font IFont;      /* Icon text font. */
 228: extern Font PFont;      /* Pop-up text font. */
 229: extern Font MFont;      /* Menu text font. */
 230: extern FontInfo IFontInfo;  /* Icon text font information. */
 231: extern FontInfo PFontInfo;  /* Pop-up text font information. */
 232: extern FontInfo MFontInfo;  /* Menu text font information. */
 233: extern Pixmap GrayPixmap;   /* Gray pixmap. */
 234: extern Pixmap IBorder;      /* Icon window border pixmap. */
 235: extern Pixmap IBackground;  /* Icon window background pixmap. */
 236: extern Pixmap PBorder;      /* Pop-Up Window border pixmap. */
 237: extern Pixmap PBackground;  /* Pop-up Window background pixmap. */
 238: extern Pixmap MBorder;      /* Menu Window border pixmap. */
 239: extern Pixmap MBackground;  /* Menu Window background pixmap. */
 240: extern Cursor ArrowCrossCursor; /* Arrow cross cursor. */
 241: extern Cursor TextCursor;   /* Text cursor used in icon windows. */
 242: extern Cursor IconCursor;   /* Icon Cursor. */
 243: extern Cursor MenuCursor;   /* Menu cursor. */
 244: extern Cursor MenuMaskCursor;   /* Menu mask cursor. */
 245: extern Cursor LeftButtonCursor; /* Left button main cursor. */
 246: extern Cursor MiddleButtonCursor;/* Middle button main cursor. */
 247: extern Cursor RightButtonCursor;/* Right button main cursor. */
 248: extern int ScreenWidth;     /* Display screen width. */
 249: extern int ScreenHeight;    /* Display screen height. */
 250: extern int CursorFunc;      /* Mouse cursor function. */
 251: extern int IconCursorFunc;  /* Icon Mouse Cursor function. */
 252: extern int ITextForground;  /* Icon window text forground color. */
 253: extern int ITextBackground; /* Icon window text background color. */
 254: extern int IBorderWidth;    /* Icon window border width. */
 255: extern int PTextForground;  /* Pop-up window text forground color. */
 256: extern int PTextBackground; /* Pop-up window text background color. */
 257: extern int PWidth;      /* Pop-up window width (including borders). */
 258: extern int PHeight;     /* Pop-up window height (including borders). */
 259: extern int PBorderWidth;    /* Pop-up window border width. */
 260: extern int MTextForground;  /* Menu window text forground color. */
 261: extern int MTextBackground; /* Menu window text background color. */
 262: extern int MBorderWidth;    /* Menu window border width. */
 263: extern int PPadding;        /* Pop-up window padding. */
 264: extern int ButtonMask;      /* Global mouse button event mask. */
 265: extern int Delay;       /* Delay between clicks of double click. */
 266: extern int Delta;       /* Mouse movement slop. */
 267: extern int HIconPad;        /* Icon horizontal padding. */
 268: extern int VIconPad;        /* Icon vertical padding. */
 269: extern int HMenuPad;        /* Menu horizontal padding. */
 270: extern int VMenuPad;        /* Menu vertical padding. */
 271: extern int MaxColors;       /* Maximum number of colors to use. */
 272: extern int Pushval;     /* Number of pixels to push window by. */
 273: extern int Volume;      /* Audible alarm volume. */
 274: extern int status;      /* Routine return status. */
 275: extern int Maxfd;       /* Maximum file descriptors for select(2). */
 276: extern MenuLink *Menus;     /* Linked list of menus. */
 277: 
 278: extern Bool Autoselect;     /* Warp mouse to default menu selection? */
 279: extern Bool Freeze;     /* Freeze server during move/resize? */
 280: extern Bool Grid;       /* Should the m/r box contain a 9 seg. grid. */
 281: extern Bool NWindow;        /* Normalize windows? */
 282: extern Bool NIcon;      /* Normalize icons? */
 283: extern Bool Push;       /* Relative=TRUE, Absolute=FALSE. */
 284: extern Bool Reverse;        /* Reverse video? */
 285: extern Bool Zap;        /* Should the the zap effect be used. */
 286: 
 287: extern char PText[];        /* Pop-up window dummy text. */
 288: extern int PTextSize;       /* Pop-up window dummy text size. */
 289: 
 290: extern int Lineno;      /* Line count for parser. */
 291: extern Bool Startup_File_Error; /* Startup file error flag. */
 292: extern char Startup_File[]; /* Startup file name. */
 293: extern char IFontName[];    /* Icon font name. */
 294: extern char PFontName[];    /* Pop-up font name. */
 295: extern char MFontName[];    /* Menu font name. */
 296: extern char **Argv;     /* Pointer to command line parameters. */
 297: extern char **Environ;      /* Pointer to environment. */
 298: 
 299: extern char *DefaultBindings[]; /* Default bindings string array. */
 300: extern Keyword KeywordTable[];  /* Keyword lookup table. */
 301: extern Binding *Blist;      /* Button/key bindings list. */
 302: extern KeyExpr KeyExprTbl[];    /* Key expression table. */
 303: extern ContExpr ContExprTbl[];  /* Context expression table. */
 304: extern ButtonModifier ButtModTbl[];/* Button modifier table. */
 305: 
 306: #ifdef PROFIL
 307: int ptrap();
 308: #endif
 309: 
 310: /*
 311:  * External routine typing.
 312:  */
 313: extern Bool Beep();
 314: extern Bool CircleDown();
 315: extern Bool CircleUp();
 316: extern Bool Continue();
 317: extern Bool Focus();
 318: extern Bool GetButton();
 319: extern Bool Iconify();
 320: extern Bool Lower();
 321: extern Bool Menu();
 322: extern Bool Move();
 323: extern Bool MoveOpaque();
 324: extern Bool NewIconify();
 325: extern Bool Pause();
 326: extern Bool PushDown();
 327: extern Bool PushLeft();
 328: extern Bool PushRight();
 329: extern Bool PushUp();
 330: extern Bool Raise();
 331: extern Bool Refresh();
 332: extern Bool ResetBindings();
 333: extern Bool ResetMenus();
 334: extern Bool ResetVariables();
 335: extern Bool Resize();
 336: extern Bool Restart();
 337: extern int StoreCursors();
 338: extern int StoreBox();
 339: extern int StoreGridBox();
 340: extern int StoreZap();
 341: extern int Error();
 342: extern int XError();
 343: extern int CreateMenus();
 344: 
 345: extern char *stash();

Defined struct's

_binding defined in line 120; used 2 times
  • in line 121(2)
_buttonmodifier defined in line 149; never used
_contexpr defined in line 141; never used
_keyexpr defined in line 133; never used
_keyword defined in line 94; never used
_menuinfo defined in line 167; used 7 times
_menuline defined in line 188; used 5 times
_menulink defined in line 216; used 2 times
  • in line 217(2)

Defined enum's

_bool defined in line 49; never used

Defined typedef's

Binding defined in line 128; used 13 times
ButtonModifier defined in line 152; used 2 times
ContExpr defined in line 144; used 2 times
KeyExpr defined in line 136; used 2 times
Keyword defined in line 101; used 2 times
MenuInfo defined in line 183; used 15 times
MenuLine defined in line 200; used 19 times
MenuLink defined in line 219; used 19 times

Defined macros

ButtonMods defined in line 162; used 7 times
ButtonValue defined in line 86; never used
CURSOR_HEIGHT defined in line 67; used 4 times
CURSOR_WIDTH defined in line 66; used 4 times
DEF_DELTA defined in line 51; used 1 times
DEF_FONT defined in line 52; used 3 times
DEF_FUNC defined in line 53; used 1 times
DEF_ICON_BORDER_WIDTH defined in line 54; used 1 times
DEF_ICON_PADDING defined in line 55; used 2 times
DEF_MENU_BORDER_WIDTH defined in line 58; used 1 times
DEF_MENU_PADDING defined in line 59; used 2 times
DEF_POP_BORDER_WIDTH defined in line 56; used 1 times
DEF_POP_PADDING defined in line 57; used 1 times
DEF_VOLUME defined in line 60; used 1 times
DRAW_FUNC defined in line 75; used 2 times
DRAW_HEIGHT defined in line 72; used 2 times
DRAW_PLANES defined in line 76; never used
DRAW_VALUE defined in line 74; used 2 times
DRAW_WIDTH defined in line 73; used 2 times
DoubleClick defined in line 158; never used
DrawBox defined in line 88; used 18 times
DrawZap defined in line 89; used 7 times
ICON defined in line 80; used 8 times
INIT_PTEXT defined in line 62; used 1 times
IsBoolFalse defined in line 108; used 8 times
IsBoolTrue defined in line 107; used 8 times
IsDownFunction defined in line 112; used 5 times
IsFunction defined in line 109; used 15 times
IsImmFunction defined in line 210; used 1 times
IsMenu defined in line 111; used 1 times
IsMenuFunction defined in line 209; used 2 times
IsMenuMap defined in line 110; used 2 times
IsNumeric defined in line 114; used 9 times
IsParser defined in line 113; used 3 times
IsQuitFunction defined in line 115; used 3 times
IsShellCommand defined in line 205; used 1 times
IsString defined in line 106; used 3 times
IsText defined in line 206; used 1 times
IsTextNL defined in line 207; used 1 times
IsUwmFunction defined in line 208; used 1 times
KeyMask defined in line 84; used 7 times
MAX defined in line 47; used 8 times
MIN defined in line 46; used 8 times
NAME_LEN defined in line 83; used 6 times
ROOT defined in line 78; used 8 times
SYSFILE defined in line 64; used 2 times
TEMPFILE defined in line 63; used 1 times
WINDOW defined in line 79; used 8 times

Usage of this include

Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1964
Valid CSS Valid XHTML 1.0 Strict