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