|
|
1.1 root 1: /* $Header: globals.c,v 1.4 87/08/21 13:29:42 swick Exp $ */
2:
3: #include <X11/copyright.h>
4:
5: /*
6: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
7: *
8: * All Rights Reserved
9: *
10: * Permission to use, copy, modify, and distribute this software and its
11: * documentation for any purpose and without fee is hereby granted,
12: * provided that the above copyright notice appear in all copies and that
13: * both that copyright notice and this permission notice appear in
14: * supporting documentation, and that the name of Digital Equipment
15: * Corporation not be used in advertising or publicity pertaining to
16: * distribution of the software without specific, written prior permission.
17: *
18: *
19: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
20: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
21: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
22: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
23: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
25: * SOFTWARE.
26: */
27:
28:
29: /*
30: * MODIFICATION HISTORY
31: *
32: * 000 -- M. Gancarz, DEC Ultrix Engineering Group
33: * 001 -- R. Kittell, DEC Storage A/D May 19, 1986
34: * Added global vars for warp options.
35: * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
36: * Western Software Lab. April 17, 1987
37: * Convert to X11
38: */
39:
40: #ifndef lint
41: static char *sccsid = "%W% %G%";
42: #endif
43: /*
44: * globals.c - window manager global data
45: *
46: */
47:
48: #include "uwm.h"
49:
50: Window Pop; /* Pop up dimension display window. */
51: Window Frozen; /* Contains window id of "gridded" window. */
52: XFontStruct *IFontInfo; /* Icon text font information. */
53: XFontStruct *PFontInfo; /* Pop-up text font information. */
54: XFontStruct *MFontInfo; /* Menu text font information. */
55: Pixmap GrayPixmap; /* Gray pixmap. */
56: Pixel IBorder; /* Icon window border pixmap. */
57: Pixmap IBackground; /* Icon window background pixmap. */
58: Pixel PBorder; /* Pop-Up Window border pixmap. */
59: Pixel PBackground; /* Pop-up Window background pixmap. */
60: Pixel MBorder; /* Menu Window border pixmap. */
61: Pixel MBackground; /* Menu Window background pixmap. */
62: Cursor ArrowCrossCursor; /* Arrow cross cursor. */
63: Cursor TextCursor; /* Text cursor used in icon windows. */
64: Cursor IconCursor; /* Icon Cursor. */
65: Cursor MenuCursor; /* Menu cursor. */
66: Cursor MenuMaskCursor; /* Menu mask cursor. */
67: Cursor LeftButtonCursor; /* Left button main cursor. */
68: Cursor MiddleButtonCursor; /* Middle button main cursor. */
69: Cursor RightButtonCursor; /* Right button main cursor. */
70: Cursor TargetCursor; /* Target (select-a-window) cursor. */
71: int ScreenWidth; /* Display screen width. */
72: int ScreenHeight; /* Display screen height. */
73: int ITextForground; /* Icon window text forground color. */
74: int ITextBackground; /* Icon window text background color. */
75: int IBorderWidth; /* Icon window border width. */
76: int PTextForground; /* Pop-up window text forground color. */
77: int PTextBackground; /* Pop-up window text background color. */
78: int MTextForground; /* Menu window text forground color. */
79: int MTextBackground; /* Menu window text background color. */
80: int PWidth; /* Pop-up window width. */
81: int PHeight; /* Pop-up window height. */
82: int PBorderWidth; /* Pop-up window border width. */
83: int PPadding; /* Pop-up window padding. */
84: int MBorderWidth; /* Menu window border width. */
85: int MPadding; /* Menu window padding. */
86: int Delay; /* Delay between clicks of a double click. */
87: int Delta; /* Mouse movement slop. */
88: int HIconPad; /* Icon horizontal padding. */
89: int VIconPad; /* Icon vertical padding. */
90: int HMenuPad; /* Menu horizontal padding. */
91: int VMenuPad; /* Menu vertical padding. */
92: int MaxColors; /* Maximum number of colors to use. */
93: int Pushval = 5; /* Number of pixels to push window by. */
94: int Volume; /* Audible alarm volume. */
95: int status; /* Routine return status. */
96: int Maxfd; /* Maximum file descriptors for select(2). */
97: MenuLink *Menus; /* Linked list of menus. */
98: GC IconGC; /* graphics context for icon */
99: GC PopGC; /* graphics context for pop */
100: GC MenuGC; /* graphics context for menu */
101: GC MenuInvGC; /* graphics context for menu background */
102: GC DrawGC; /* graphics context for drawing */
103: Binding *Blist; /* Button/key binding list. */
104:
105: Bool Autoselect; /* Warp mouse to default menu selection? */
106: Bool Freeze; /* Freeze server during move/resize? */
107: Bool Grid; /* Should the m/r box contain a 9 seg. grid. */
108: Bool NWindow; /* Normalize windows? */
109: Bool NIcon; /* Normalize icons? */
110: Bool Push; /* Relative=TRUE, Absolute=FALSE. */
111: Bool Reverse; /* Reverse video? */
112: Bool Zap; /* Should the the zap effect be used. */
113: Bool WarpOnRaise; /* Warp to upper right corner on raise. */
114: Bool WarpOnIconify; /* Warp to icon center on iconify. */
115: Bool WarpOnDeIconify; /* Warp to upper right corner on de-iconify. */
116: Bool FocusSetByUser; /* True if f.focus called */
117:
118: char PText[7] = INIT_PTEXT; /* Pop-up window dummy text. */
119: int PTextSize = sizeof(PText); /* Pop-up window dummy text size. */
120:
121: int Lineno = 1; /* Line count for parser. */
122: Bool Startup_File_Error = FALSE;/* Startup file error flag. */
123: char Startup_File[NAME_LEN] = "";/* Startup file name. */
124: char IFontName[NAME_LEN]; /* Icon font name. */
125: char PFontName[NAME_LEN]; /* Pop-up font name. */
126: char MFontName[NAME_LEN]; /* Menu font name. */
127: char **Argv; /* Pointer to command line parameters. */
128: char **Environ; /* Pointer to environment. */
129:
130: int scr;
131: Display *dpy;
132:
133: /*
134: * Keyword lookup table for parser.
135: */
136: Keyword KeywordTable[] = {
137: { "autoselect", IsBoolTrue, &Autoselect,0,0,0 },
138: { "delay", IsNumeric, 0,&Delay,0,0 },
139: { "delta", IsNumeric, 0,&Delta,0,0 },
140: { "freeze", IsBoolTrue, &Freeze,0,0,0 },
141: { "iconfont", IsString, 0,0,IFontName,0 },
142: { "f.beep", IsQuitFunction, 0,0,0,Beep },
143: { "f.circledown", IsQuitFunction, 0,0,0,CircleDown },
144: { "f.circleup", IsQuitFunction, 0,0,0,CircleUp },
145: { "f.continue", IsQuitFunction, 0,0,0,Continue },
146: { "f.exit", IsQuitFunction, 0,0,0,Quit },
147: { "f.focus", IsFunction, 0,0,0,Focus },
148: { "f.iconify", IsFunction, 0,0,0,Iconify },
149: { "f.lower", IsFunction, 0,0,0,Lower },
150: { "f.menu", IsMenuMap, 0,0,0,Menu },
151: { "f.move", IsDownFunction, 0,0,0,Move },
152: { "f.moveopaque", IsDownFunction, 0,0,0,MoveOpaque },
153: { "f.newiconify", IsDownFunction, 0,0,0,NewIconify },
154: { "f.pause", IsQuitFunction, 0,0,0,Pause },
155: { "f.pushdown", IsFunction, 0,0,0,PushDown },
156: { "f.pushleft", IsFunction, 0,0,0,PushLeft },
157: { "f.pushright", IsFunction, 0,0,0,PushRight },
158: { "f.pushup", IsFunction, 0,0,0,PushUp },
159: { "f.raise", IsFunction, 0,0,0,Raise },
160: { "f.redraw", IsFunction, 0,0,0,Redraw },
161: { "f.refresh", IsQuitFunction, 0,0,0,Refresh },
162: { "f.resize", IsDownFunction, 0,0,0,Resize },
163: { "f.restart", IsQuitFunction, 0,0,0,Restart },
164: { "grid", IsBoolTrue, &Grid,0,0,0 },
165: { "hiconpad", IsNumeric, 0,&HIconPad,0,0 },
166: { "hmenupad", IsNumeric, 0,&HMenuPad,0,0 },
167: { "maxcolors", IsNumeric, 0,&MaxColors,0,0 },
168: { "menu", IsMenu, 0,0,0,0 },
169: { "menufont", IsString, 0,0,MFontName,0 },
170: { "noautoselect", IsBoolFalse, &Autoselect,0,0,0 },
171: { "nofreeze", IsBoolFalse, &Freeze,0,0,0 },
172: { "nogrid", IsBoolFalse, &Grid,0,0,0 },
173: { "nonormali", IsBoolFalse, &NIcon,0,0,0 },
174: { "nonormalw", IsBoolFalse, &NWindow,0,0,0 },
175: { "noreverse", IsBoolFalse, &Reverse,0,0,0 },
176: { "normali", IsBoolTrue, &NIcon,0,0,0 },
177: { "normalw", IsBoolTrue, &NWindow,0,0,0 },
178: { "nowarpdi", IsBoolFalse, &WarpOnDeIconify,0,0,0 },
179: { "nowarpi", IsBoolFalse, &WarpOnIconify,0,0,0 },
180: { "nowarpr", IsBoolFalse, &WarpOnRaise,0,0,0 },
181: { "nozap", IsBoolFalse, &Zap,0,0,0 },
182: { "push", IsNumeric, 0,&Pushval,0,0 },
183: { "pushabsolute", IsBoolFalse, &Push,0,0,0 },
184: { "pushrelative", IsBoolTrue, &Push,0,0,0 },
185: { "resetbindings", IsParser, 0,0,0,ResetBindings },
186: { "resetmenus", IsParser, 0,0,0,ResetMenus },
187: { "resetvariables", IsParser, 0,0,0,ResetVariables },
188: { "resizefont", IsString, 0,0,PFontName,0 },
189: { "reverse", IsBoolTrue, &Reverse,0,0,0 },
190: { "viconpad", IsNumeric, 0,&VIconPad,0,0 },
191: { "vmenupad", IsNumeric, 0,&VMenuPad,0,0 },
192: { "volume", IsNumeric, 0,&Volume,0,0 },
193: { "warpdi", IsBoolTrue, &WarpOnDeIconify,0,0,0 },
194: { "warpi", IsBoolTrue, &WarpOnIconify,0,0,0 },
195: { "warpr", IsBoolTrue, &WarpOnRaise,0,0,0 },
196: { "zap", IsBoolTrue, &Zap,0,0,0 },
197: { NULL, NULL, NULL,NULL,NULL,NULL }
198: };
199:
200: /*
201: * Key expression table for parser.
202: */
203: KeyExpr KeyExprTbl[] = {
204: { "ctrl", ControlMask },
205: { "c", ControlMask },
206: { "lock", LockMask },
207: { "l", LockMask },
208: { "meta", Mod1Mask },
209: { "m", Mod1Mask },
210: { "shift", ShiftMask },
211: { "s", ShiftMask },
212: { NULL, NULL }
213: };
214:
215: /*
216: * Context expression table for parser.
217: */
218: ContExpr ContExprTbl[] = {
219: { "icon", ICON },
220: { "i", ICON },
221: { "root", ROOT },
222: { "r", ROOT },
223: { "window", WINDOW },
224: { "w", WINDOW },
225: { NULL, NULL }
226: };
227:
228: /*
229: * Button expression table for parser.
230: */
231: ButtonModifier ButtModTbl[] = {
232: { "left", LeftMask },
233: { "leftbutton", LeftMask },
234: { "l", LeftMask },
235: { "middle", MiddleMask },
236: { "middlebutton", MiddleMask },
237: { "m", MiddleMask },
238: { "right", RightMask },
239: { "rightbutton", RightMask },
240: { "r", RightMask },
241: { "move", DeltaMotion },
242: { "motion", DeltaMotion },
243: { "delta", DeltaMotion },
244: { "down", ButtonDown },
245: { "d", ButtonDown },
246: { "up", ButtonUp },
247: { "u", ButtonUp },
248: { NULL, NULL }
249: };
250:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.