1 /*
2  * Copyright 1989 Massachusetts Institute of Technology
3  *
4  * Permission to use, copy, modify, and distribute this software and its
5  * documentation for any purpose and without fee is hereby granted, provided
6  * that the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of M.I.T. not be used in advertising
9  * or publicity pertaining to distribution of the software without specific,
10  * written prior permission.  M.I.T. makes no representations about the
11  * suitability of this software for any purpose.  It is provided "as is"
12  * without express or implied warranty.
13  *
14  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
16  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
19  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /***********************************************************************
23  *
24  * $XConsortium: screen.h,v 1.62 91/05/01 17:33:09 keith Exp $
25  *
26  * twm per-screen data include file
27  *
28  * 11-3-88 Dave Payne, Apple Computer			File created
29  *
30  ***********************************************************************/
31 
32 #ifndef _SCREEN_
33 #define _SCREEN_
34 
35 #include <X11/Xlib.h>
36 #include <X11/Xutil.h>
37 #include <X11/cursorfont.h>
38 #include "list.h"
39 #include "menus.h"
40 #include "iconmgr.h"
41 
42 typedef struct _StdCmap {
43     struct _StdCmap *next;		/* next link in chain */
44     Atom atom;				/* property from which this came */
45     int nmaps;				/* number of maps below */
46     XStandardColormap *maps;		/* the actual maps */
47 } StdCmap;
48 
49 #define SIZE_HINDENT 10
50 #define SIZE_VINDENT 2
51 
52 typedef struct _TitlebarPixmaps {
53     Pixmap xlogo;
54     Pixmap resize;
55     Pixmap question;
56     Pixmap menu;
57     Pixmap delete;
58 } TitlebarPixmaps;
59 
60 typedef struct _TwmPixmap {
61     char *name;				/* name of pixmap file */
62     Pixmap bm;				/* bitmap form */
63     Pixmap pm;				/* focus highlight window right end */
64     Pixmap mask;			/* shape mask */
65     Bool isXpm;				/* is it an Xpm format pixmap? */
66     int height, width;			/* cache the size */
67 } TwmPixmap;
68 
69 typedef struct ScreenInfo
70 {
71     char *Identification;	/* human-readable name of the tvtwm instance */
72     int screen;			/* the default screen */
73     int d_depth;		/* copy of DefaultDepth(dpy, screen) */
74     Visual *d_visual;		/* copy of DefaultVisual(dpy, screen) */
75     int Monochrome;		/* is the display monochrome ? */
76     int MyDisplayWidth;		/* my copy of DisplayWidth(dpy, screen) */
77     int MyDisplayHeight;	/* my copy of DisplayHeight(dpy, screen) */
78     int MaxWindowWidth;		/* largest window to allow */
79     int MaxWindowHeight;	/* ditto */
80 
81     TwmWindow TwmRoot;		/* the head of the twm window list */
82 
83     Window Root;		/* the root window */
84     Window SizeWindow;		/* the resize dimensions window */
85     Window InfoWindow;		/* the information window */
86     Window VirtualDesktop;	/* the virtual root window */
87     Window Panner;		/* the panner window */
88     int vdtWidth;		/* width of the virtual desktop */
89     int vdtHeight;		/* height of the virtual desktop */
90     int vdtPositionX;		/* where the virtual desktop is currently positioned */
91     int vdtPositionY;		/* where the virtual desktop is currently positioned */
92     int vdtSaveX;		/* saved position */
93     int vdtSaveY;		/* saved position */
94     int vdtScrollDistanceX;	/* fraction to pan by in the X direction */
95     int vdtScrollDistanceY;	/* fraction to pan by in the Y direction */
96     short ShowVirtualNames;	/* should we paint the names in the virtual windows? */
97     int ShadowWidth;
98 
99     name_list *Icons;		/* list of icon pixmaps */
100     TitlebarPixmaps tbpm;	/* titlebar pixmaps */
101     TwmPixmap Unknown;		/* the unknown icon pixmap */
102     Pixmap rootWeave;		/* root weave pixmap */
103 
104     TwmPixmap hilite;		/* focus highlight window background */
105     TwmPixmap hiliteLeft;	/* focus highlight window left end */
106     TwmPixmap hiliteRight;	/* focus highlight window right end */
107     TwmPixmap iconifyPm;	/* the icon manager iconify pixmap */
108     TwmPixmap pullrightPm;	/* pull right menu arrow */
109     TwmPixmap shadowPm;		/* menu shadow pixmap */
110 
111     MenuRoot *MenuList;		/* head of the menu list */
112     MenuRoot *LastMenu;		/* the last menu (mostly unused?) */
113     MenuRoot *Windows;		/* the TwmWindows menu */
114 
115     TwmWindow *Ring;		/* one of the windows in window ring */
116     TwmWindow *RingLeader;	/* current winodw in ring */
117 
118     MouseButton Mouse[MAX_BUTTONS+1][NUM_CONTEXTS][MOD_SIZE];
119     MouseButton DefaultFunction;
120     MouseButton WindowFunction;
121 
122     struct {
123       Colormaps *cmaps; 	/* current list of colormap windows */
124       int maxCmaps;		/* maximum number of installed colormaps */
125       unsigned long first_req;	/* seq # for first XInstallColormap() req in
126 				   pass thru loading a colortable list */
127       int root_pushes;		/* current push level to install root
128 				   colormap windows */
129       TwmWindow *pushed_window;	/* saved window to install when pushes drops
130 				   to zero */
131     } cmapInfo;
132 
133     struct {
134 	StdCmap *head, *tail;		/* list of maps */
135 	StdCmap *mru;			/* most recently used in list */
136 	int mruindex;			/* index of mru in entry */
137     } StdCmapInfo;
138 
139     struct {
140 	int nleft, nright;		/* numbers of buttons in list */
141 	TitleButton *head;		/* start of list */
142 	int border;			/* button border */
143 	int pad;			/* button-padding */
144 	int width;			/* width of single button & border */
145 	int leftx;			/* start of left buttons */
146 	int titlex;			/* start of title string */
147 	int rightoff;			/* offset back from right edge */
148     } TBInfo;
149     ColorPair BorderTileC;	/* border tile colors */
150     ColorPair TitleC;		/* titlebar colors */
151     ColorPair MenuC;		/* menu colors */
152     ColorPair MenuTitleC;	/* menu title colors */
153     ColorPair IconC;		/* icon colors */
154     ColorPair IconManagerC;	/* icon manager colors */
155     ColorPair DefaultC;		/* default colors */
156     ColorPair vdtC;		/* virtual desktop colors */
157     ColorPair PannerC;		/* Panner colors */
158     ColorPair VirtualC;		/* Virtual window colors */
159     Pixel BorderColor;		/* color of window borders */
160     Pixel MenuShadowColor;	/* menu shadow color */
161     Pixel IconBorderColor;	/* icon border color */
162     Pixel IconManagerHighlight;	/* icon manager highlight */
163 
164     Cursor TitleCursor;		/* title bar cursor */
165     Cursor FrameCursor;		/* frame cursor */
166     Cursor IconCursor;		/* icon cursor */
167     Cursor IconMgrCursor;	/* icon manager cursor */
168     Cursor ButtonCursor;	/* title bar button cursor */
169     Cursor MoveCursor;		/* move cursor */
170     Cursor ResizeCursor;	/* resize cursor */
171     Cursor WaitCursor;		/* wait a while cursor */
172     Cursor MenuCursor;		/* menu cursor */
173     Cursor SelectCursor;	/* dot cursor for f.move, etc. from menus */
174     Cursor DestroyCursor;		/* skull and cross bones, f.destroy */
175 
176     name_list *BorderColorL;
177     name_list *IconBorderColorL;
178     name_list *BorderTileForegroundL;
179     name_list *BorderTileBackgroundL;
180     name_list *TitleForegroundL;
181     name_list *TitleBackgroundL;
182     name_list *IconForegroundL;
183     name_list *IconBackgroundL;
184     name_list *IconManagerFL;
185     name_list *IconManagerBL;
186     name_list *IconMgrs;
187     name_list *NoTitle;		/* list of window names with no title bar */
188     name_list *MakeTitle;	/* list of window names with title bar */
189     name_list *AutoRaise;	/* list of window names to auto-raise */
190     name_list *IconNames;	/* list of window names and icon names */
191     name_list *NoHighlight;	/* list of windows to not highlight */
192     name_list *NoStackModeL;	/* windows to ignore stack mode requests */
193     name_list *NoTitleHighlight;/* list of windows to not highlight the TB*/
194     name_list *DontIconify;	/* don't iconify by unmapping */
195     name_list *IconMgrNoShow;	/* don't show in the icon manager */
196     name_list *IconMgrShow;	/* show in the icon manager */
197     name_list *IconifyByUn;	/* windows to iconify by unmapping */
198     name_list *StartIconified;	/* windows to start iconic */
199     name_list *IconManagerHighlightL;	/* icon manager highlight colors */
200     name_list *SqueezeTitleL;		/* windows of which to squeeze title */
201     name_list *DontSqueezeTitleL;	/* windows of which not to squeeze */
202     name_list *SqueezeIconL;		/* windows of which to squeeze icon */
203     name_list *DontSqueezeIconL;	/* windows of which not to squeeze */
204     name_list *WindowRingL;	/* windows in ring */
205     name_list *WarpCursorL;	/* windows to warp cursor to on deiconify */
206     name_list *StickyL;		/* windows that should be sticky */
207     name_list *VirtualBackgroundL;	/* virtual window colors */
208     name_list *VirtualForegroundL;	/* virtual window colors */
209     name_list *NoIconTitleL;		/* don't display icon names */
210     name_list *IconTitleL;		/* do display icon names */
211 
212     GC NormalGC;		/* normal GC for everything */
213     GC MenuGC;			/* gc for menus */
214     GC DrawGC;			/* GC to draw lines for move and resize */
215     GC PannerGC;		/* GC for the panner outline */
216 
217     unsigned long Black;
218     unsigned long White;
219     unsigned long XORvalue;	/* number to use when drawing xor'ed */
220     Font   cursorFont;		/* the cursor-glyph font */
221     MyFont TitleBarFont;	/* title bar font structure */
222     MyFont MenuFont;		/* menu font structure */
223     MyFont MenuTitleFont;	/* menu title font structure */
224     MyFont IconFont;		/* icon font structure */
225     MyFont SizeFont;		/* resize font structure */
226     MyFont IconManagerFont;	/* window list font structure */
227     MyFont DefaultFont;
228     MyFont VirtualFont;		/* names in the small panner windows */
229     IconMgr iconmgr;		/* default icon manager */
230     name_list *IconRegions;	/* match list of icon regions */
231     char *IconDirectory;	/* icon directory to search */
232     int SizeStringOffset;	/* x offset in size window for drawing */
233     int SizeStringWidth;	/* minimum width of size window */
234     int BorderWidth;		/* border width of twm windows */
235     int IconBorderWidth;	/* border width of icon windows */
236     int TitleHeight;		/* height of the title bar window */
237     TwmWindow *Focus;		/* the twm window that has focus */
238     int EntryHeight;		/* menu entry height */
239     int MenuLineWidth;		/* the width of menu lines 0 means no bars */
240     int FramePadding;		/* distance between decorations and border */
241     int TitleFontPadding;      	/* additional width to add to font height */
242     int TitlePadding;		/* distance between items in titlebar */
243     int ButtonIndent;		/* amount to shrink buttons on each side */
244     int NumAutoRaises;		/* number of autoraise windows on screen */
245     short NoIconTitle;		/* don't display WM_ICON_NAME */
246     short NoDefaults;		/* do not add in default UI stuff */
247     short UsePPosition;		/* what do with PPosition, see values below */
248     short AutoRelativeResize;	/* start resize relative to position in quad */
249     short FocusRoot;		/* is the input focus on the root ? */
250     short WarpCursor;		/* warp cursor on de-iconify ? */
251     short ForceIcon;		/* force the icon to the user specified */
252     short NoGrabServer;		/* don't do server grabs */
253     short NoRaiseMove;		/* don't raise window following move */
254     short NoRaiseResize;	/* don't raise window following resize */
255     short NoRaiseDeicon;	/* don't raise window on deiconify */
256     short NoRaiseWarp;		/* don't raise window on warp */
257     short DontMoveOff;		/* don't allow windows to be moved off */
258     short DoZoom;		/* zoom in and out of icons */
259     short TitleFocus;		/* focus on window in title bar ? */
260     short NoTitlebar;		/* put title bars on windows */
261     short DecorateTransients;	/* put title bars on transients */
262     short IconifyByUnmapping;	/* simply unmap windows when iconifying */
263     short ShowIconManager;	/* display the window list */
264     short IconManagerDontShow;	/* show nothing in the icon manager */
265     short BackingStore;		/* use backing store for menus */
266     short SaveUnder;		/* use save under's for menus */
267     short RandomPlacement;	/* randomly place windows that no give hints */
268     short OpaqueMoveSaveUnders;	/* turn on save unders when opaque moving */
269     short OpaqueMove;		/* move the window rather than outline */
270     short Highlight;		/* should we highlight the window borders */
271     short StackMode;		/* should we honor stack mode requests */
272     short TitleHighlight;	/* should we highlight the titlebar */
273     short MoveDelta;		/* number of pixels before f.move starts */
274     short ZoomCount;		/* zoom outline count */
275     short SortIconMgr;	/* sort entries in the icon manager & windows menu */
276     short Shadow;		/* show the menu shadow */
277     short InterpolateMenuColors;/* make pretty menus */
278     short PopupSensitivity;	/* percantage of a menu's width causing popup */
279     short NoIconManagers;	/* Don't create any icon managers */
280     short ClientBorderWidth;	/* respect client window border width */
281     short SqueezeTitle;		/* make title as small as possible */
282     short SqueezeIcon;		/* Shape the icon and label */
283     short HaveFonts;		/* set if fonts have been loaded */
284     short FirstTime;		/* first time we've read .twmrc */
285     short CaseSensitive;	/* be case-sensitive when sorting names */
286     short WarpUnmapped;		/* allow warping to unmapped windows */
287     short PannerState;		/* the initial state of the panner */
288     short PannerScale;		/* scale of the panner */
289     short PannerOpaqueScroll;   /* When you scroll in the panner, is it opaque? */
290     short RememberScreenPosition; /* when deiconifying, put it back where
291 				it was relative to the screen, rather
292 				than relative to the virtual root */
293     char *PannerGeometry;	/* geometry of the panner */
294     int PannerOutlineWidth;
295     int PannerOutlineHeight;
296     int PannerOutlineX;
297     int PannerOutlineY;
298     int PannerWidth;
299     int PannerHeight;
300     short vdtBackgroundSet;	/* vdt background color has been set */
301     char *vdtPixmap;		/* vdt pixmap */
302     short PannerBackgroundSet;	/* background of panner is set */
303     char *PannerPixmap;		/* Panner pixmap */
304     short StickyAbove;		/* should sticky windows be above? */
305     short StayUpMenus; 		/* do the menus stay up upon release of button ? */
306     short ListRings;		/* allow lists to contain rings */
307     short DontInterpolateTitles;	/* interpolatecolor apply to titles? */
308     short WrapVirtual;		/* wrap-around on the virtual desktop panning */
309     short SetupDone;
310     char *AfterSetupRun;	/* program to run when tvtwm is running */
311 
312     FuncKey FuncKeyRoot;
313 } ScreenInfo;
314 
315 extern int MultiScreen;
316 extern int NumScreens;
317 extern ScreenInfo **ScreenList;
318 extern ScreenInfo *Scr;
319 extern int FirstScreen;
320 
321 #define PPOS_OFF 0
322 #define PPOS_ON 1
323 #define PPOS_NON_ZERO 2
324 /* may eventually want an option for having the PPosition be the initial
325    location for the drag lines */
326 
327 #endif /* _SCREEN_ */
328