1 /****************************************************************************
2  * This module is based on Twm, but has been siginificantly modified
3  * by Rob Nation
4  *
5  * modified later
6  * by Bo Yang
7  *
8  * modified again
9  * by Frank S. Fejes
10 ****************************************************************************/
11 /*
12  * Copyright 1989 Massachusetts Institute of Technology
13  *
14  * Permission to use, copy, modify, and distribute this software and its
15  * documentation for any purpose and without fee is hereby granted, provided
16  * that the above copyright notice appear in all copies and that both that
17  * copyright notice and this permission notice appear in supporting
18  * documentation, and that the name of M.I.T. not be used in advertising
19  * or publicity pertaining to distribution of the software without specific,
20  * written prior permission.  M.I.T. makes no representations about the
21  * suitability of this software for any purpose.  It is provided "as is"
22  * without express or implied warranty.
23  *
24  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
26  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
28  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
29  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30  */
31 
32 /***********************************************************************
33  *
34  * afterstep per-screen data include file
35  *
36  ***********************************************************************/
37 
38 #ifndef _SCREEN_
39 #define _SCREEN_
40 
41 #include <X11/Xlib.h>
42 #include <X11/Xutil.h>
43 #include <X11/cursorfont.h>
44 #include "misc.h"
45 #include "menus.h"
46 
47 #define SIZE_HINDENT 5
48 #define SIZE_VINDENT 3
49 #define MAX_WINDOW_WIDTH 32767
50 #define MAX_WINDOW_HEIGHT 32767
51 
52 
53 /* Cursor types */
54 #define POSITION 0		/* upper Left corner cursor */
55 #define TITLE_CURSOR 1          /* title-bar cursor */
56 #define DEFAULT 2		/* cursor for apps to inherit */
57 #define SYS 3        		/* sys-menu and iconify boxes cursor */
58 #define MOVE 4                  /* resize cursor */
59 #if defined(__alpha)
60 #ifdef WAIT
61 #undef WAIT
62 #endif /*WAIT */
63 #endif /*alpha */
64 #define WAIT 5   		/* wait a while cursor */
65 #define MENU 6  		/* menu cursor */
66 #define SELECT 7	        /* dot cursor for f.move, etc. from menus */
67 #define DESTROY 8		/* skull and cross bones, f.destroy */
68 #define TOP 9
69 #define RIGHT 10
70 #define BOTTOM 11
71 #define LEFT 12
72 #define TOP_LEFT 13
73 #define TOP_RIGHT 14
74 #define BOTTOM_LEFT 15
75 #define BOTTOM_RIGHT 16
76 #define MAX_CURSORS 18
77 
78 /* Maximum number of icon boxes that are allowed */
79 #define MAX_BOXES 4
80 
81 /* button styles */
82 #define XPM_BUTTON_STYLE	2
83 
84 /* title bar text alignment  */
85 #define JUSTIFY_CENTER 0
86 #define JUSTIFY_LEFT   1
87 #define JUSTIFY_RIGHT  2
88 
89 #ifndef NON_VIRTUAL
90 typedef struct
91 {
92   Window win;
93   int isMapped;
94 } PanFrame;
95 #endif
96 
97 typedef struct ScreenInfo
98 {
99 
100   unsigned long screen;
101   int d_depth;	        	/* copy of DefaultDepth(dpy, screen) */
102   int NumberOfScreens;          /* number of screens on display */
103   int MyDisplayWidth;		/* my copy of DisplayWidth(dpy, screen) */
104   int MyDisplayHeight;	        /* my copy of DisplayHeight(dpy, screen) */
105 
106   ASWindow ASRoot;		/* the head of the afterstep window list */
107   Window Root;		        /* the root window */
108   Window SizeWindow;		/* the resize dimensions window */
109   Window NoFocusWin;            /* Window which will own focus when no other
110 				 * windows have it */
111 #ifndef NON_VIRTUAL
112   PanFrame PanFrameTop,PanFrameLeft,PanFrameRight,PanFrameBottom;
113   int usePanFrames;		/* toggle to disable them */
114 #endif
115 
116   Pixmap gray_bitmap;           /*dark gray pattern for shaded out menu items*/
117   Pixmap gray_pixmap;           /* dark gray pattern for inactive borders */
118   Pixmap light_gray_pixmap;     /* light gray pattern for inactive borders */
119   Pixmap sticky_gray_pixmap;     /* light gray pattern for sticky borders */
120 
121   MouseButton *MouseButtonRoot;
122   FuncKey FuncKeyRoot;
123 
124   int root_pushes;		/* current push level to install root
125 				   colormap windows */
126   ASWindow *pushed_window;	/* saved window to install when pushes drops
127 				   to zero */
128 #ifndef NO_PAGER
129   ASWindow *ASPager;
130   Window Pager_w;
131   Window CPagerWin;
132 #endif
133   Cursor ASCursors[MAX_CURSORS];
134 
135   name_list *TheList;		/* list of window names with attributes */
136   char *DefaultIcon;            /* Icon to use when no other icons are found */
137 
138   ColorPair MenuColors;
139   ColorPair MenuStippleColors;
140   ColorPair MenuRelief;
141 
142   ColorPair StdColors; 	/* standard fore/back colors */
143   ColorPair StickyColors; 	/* sticky fore/back colors */
144   ColorPair StickyRelief; 	/* sticky hilight colors */
145   ColorPair HiColors; 	/* standard fore/back colors */
146   ColorPair StdRelief;
147   ColorPair HiRelief;
148   MyFont StdFont;     	/* font structure */
149   MyFont WindowFont;   	/* font structure for window titles */
150 #ifndef NO_PAGER
151   MyFont PagerFont;   	/* font struct for window labels in pager (optional)*/
152 #endif
153   MyFont IconFont;      /* for icon labels */
154 
155   GC IconGC;
156   GC NormalGC;		        /* normal GC for menus, pager, resize window */
157   GC StippleGC;		        /* normal GC for menus, pager, resize window */
158   GC DrawGC;			/* GC to draw lines for move and resize */
159   GC LineGC;			/* GC to draw lines on buttons */
160   GC HiReliefGC;                /* GC for highlighted window relief */
161   GC HiShadowGC;                /* GC for highlighted window shadow */
162   GC BevelReliefGC;
163   GC BevelShadowGC;
164   GC MenuGC;
165   GC MenuStippleGC;
166   GC MenuReliefGC;
167   GC MenuShadowGC;
168   GC StdReliefGC;               /* GC for unselected window relief */
169   GC StdShadowGC;               /* GC for unselected window shadow */
170   GC ScratchGC1;
171   GC ScratchGC2;
172 
173   GC StickyReliefGC;               /* GC for unselected sticky window relief */
174   GC StickyShadowGC;               /* GC for unselected sticky window shadow */
175   GC FontGC;                    /* GC for non-standard fonts */
176 
177   int SizeStringWidth;	        /* minimum width of size window */
178   int CornerWidth;	        /* corner width for decoratedwindows */
179   int BoundaryWidth;	        /* frame width for decorated windows */
180   int NoBoundaryWidth;	        /* frame width for decorated windows */
181   int TitleHeight;		/* height of the title bar window */
182   int TitleTextAlign;		/* alignment of title bar text */
183 #ifdef ENABLE_TEXTURE
184   int TitleStyle;		/* old or new titlebar style */
185   Pixmap BackTitle;		/* Cached titlebars for gradient or tiling */
186   Pixmap ForeTitle;		/* types 2 and 3. unfocused, focused */
187   Pixmap StickyTitle;		/* and sticky */
188   Pixmap TitleGradient;		/* gradient for the focused title text */
189 #endif
190   long next_focus_sequence;	/* keep track of previously focused windows */
191   ASWindow *Hilite;		/* the afterstep window that is highlighted
192 				 * except for networking delays, this is the
193 				 * window which REALLY has the focus */
194   ASWindow *Focus;            /* Last window which AS gave the focus to
195                                  * NOT the window that really has the focus */
196   ASWindow *Ungrabbed;
197   ASWindow *PreviousFocus;    /* Window which had focus before afterstep stole it
198 				 * to do moves/menus/etc. */
199   int EntryHeight;		/* menu entry height */
200   int EdgeScrollX;              /* #pixels to scroll on screen edge */
201   int EdgeScrollY;              /* #pixels to scroll on screen edge */
202   unsigned int nonlock_mods;	/* a mask for non-locking modifiers */
203   unsigned int* lock_mods;	/* all combinations of lock modifier masks */
204   unsigned char buttons2grab;   /* buttons to grab in click to focus mode */
205   unsigned long flags;
206   int IconBoxes[MAX_BOXES][4];
207   int NumBoxes;
208   int randomx;                  /* values used for randomPlacement */
209   int randomy;
210   unsigned VScale;              /* Panner scale factor */
211 
212   int VxMax;                    /* Max location for top left of virt desk*/
213   int VyMax;
214   int Vx;                       /* Current loc for top left of virt desk */
215   int Vy;
216 
217   int nr_left_buttons;         /* number of left-side title-bar buttons */
218   int nr_right_buttons;        /* number of right-side title-bar buttons */
219 
220   int ClickTime;               /*Max button-click delay for Function built-in*/
221   int AutoRaiseDelay;          /* Delay between setting focus and raising win*/
222   int ScrollResistance;        /* resistance to scrolling in desktop */
223   int MoveResistance;          /* res to moving windows over viewport edge */
224   int OpaqueSize;
225   int CurrentDesk;             /* The current desktop number */
226   MenuRoot *InitFunction;
227   MenuRoot *RestartFunction;
228 
229   int button_style[10];
230   Pixmap button_pixmap[10];
231   int button_width[10];
232   int button_height[10];
233 
234   Pixmap IconBgPixmap;         /* Iconized button background */
235   Pixmap IconBgMask;
236   int IconBgWidth;
237   int IconBgHeight;
238   int IconBgDepth;
239 
240   int RaiseButtons;		/* The buttons to do click-to-raise */
241 } ScreenInfo;
242 
243 extern ScreenInfo Scr;
244 
245 /* for the flags value - these used to be seperate Bool's */
246 #define ClickToFocus               (1) /* Focus follows mouse, or click to focus?*/
247 #define DecorateTransients         (2) /* decorate transient windows? */
248 #define DontMoveOff                (4) /* make sure all windows stay on desktop*/
249 #define RandomPlacement            (8) /* place windows in random locations? */
250 #define SuppressIcons             (16) /* prevent generation of icon windows */
251 #define StickyIcons               (32) /* Icons always sticky? */
252 #define EdgeWrapX                 (64) /* Should EdgeScroll wrap around? */
253 #define EdgeWrapY                (128)
254 #define CenterOnCirculate        (256) /* center window when circulating? */
255 #define KeepIconWindows		 (512)
256 #define ClickToRaise		(1024)
257 #define EatFocusClick		(2048)
258 /*
259 #define MWMDecorHints           (4096)
260 */
261 #define MenusHigh		(4096)
262 #define NoPPosition             (8192)
263 #define SMART_PLACEMENT        (16384)
264 #define CirculateSkipIcons     (32768)
265 #define StubbornIcons          (65536)
266 #define StubbornPlacement     (131072)
267 #define StubbornIconPlacement (262144)
268 #define OpaqueResize          (524288)
269 /*
270 #define MWMFunctionHints     (1048576)
271 #define MWMHintOverride      (2097152)
272 */
273 #define BackingStore         (4194304)
274 #define AppsBackingStore     (8388608)
275 #define SaveUnders          (16777216)
276 /*
277 #define ClickAndHold        (33554432)
278 */
279 #define SloppyFocus         (67108864)
280 #define IconTitle		(1<<27)
281 #endif /* _SCREEN_ */
282