screen.h revision 645f5050
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 *  [ ctwm ]
23 *
24 *  Copyright 1992 Claude Lecommandeur.
25 *
26 * Permission to use, copy, modify  and distribute this software  [ctwm] and
27 * its documentation for any purpose is hereby granted without fee, provided
28 * that the above  copyright notice appear  in all copies and that both that
29 * copyright notice and this permission notice appear in supporting documen-
30 * tation, and that the name of  Claude Lecommandeur not be used in adverti-
31 * sing or  publicity  pertaining to  distribution of  the software  without
32 * specific, written prior permission. Claude Lecommandeur make no represen-
33 * tations  about the suitability  of this software  for any purpose.  It is
34 * provided "as is" without express or implied warranty.
35 *
36 * Claude Lecommandeur DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
37 * INCLUDING ALL  IMPLIED WARRANTIES OF  MERCHANTABILITY AND FITNESS.  IN NO
38 * EVENT SHALL  Claude Lecommandeur  BE LIABLE FOR ANY SPECIAL,  INDIRECT OR
39 * CONSEQUENTIAL  DAMAGES OR ANY  DAMAGES WHATSOEVER  RESULTING FROM LOSS OF
40 * USE, DATA  OR PROFITS,  WHETHER IN AN ACTION  OF CONTRACT,  NEGLIGENCE OR
41 * OTHER  TORTIOUS ACTION,  ARISING OUT OF OR IN  CONNECTION WITH THE USE OR
42 * PERFORMANCE OF THIS SOFTWARE.
43 *
44 * Author:  Claude Lecommandeur [ lecom@sic.epfl.ch ][ April 1992 ]
45 */
46
47/***********************************************************************
48 *
49 * $XConsortium: screen.h,v 1.62 91/05/01 17:33:09 keith Exp $
50 *
51 * twm per-screen data include file
52 *
53 * 11-3-88 Dave Payne, Apple Computer			File created
54 *
55 ***********************************************************************/
56
57#ifndef _SCREEN_
58#define _SCREEN_
59
60#ifdef VMS
61#include <decw$include/Xlib.h>
62#include <decw$include/Xutil.h>
63#include <decw$include/cursorfont.h>
64#else
65#include <X11/Xlib.h>
66#include <X11/Xutil.h>
67#include <X11/cursorfont.h>
68#endif
69
70#ifdef GNOME
71#  include "gnome.h"
72#endif /* GNOME */
73#include "list.h"
74#include "menus.h"
75#include "iconmgr.h"
76#include "vscreen.h"
77#include "workmgr.h"
78
79#define ICONIFY_NORMAL  0
80#define ICONIFY_MOSAIC  1
81#define ICONIFY_ZOOMIN  2
82#define ICONIFY_ZOOMOUT 3
83#define ICONIFY_SWEEP   4
84
85struct _StdCmap {
86    struct _StdCmap *next;		/* next link in chain */
87    Atom atom;				/* property from which this came */
88    int nmaps;				/* number of maps below */
89    XStandardColormap *maps;		/* the actual maps */
90};
91
92#define SIZE_HINDENT 10
93#define SIZE_VINDENT 2
94
95struct _TitlebarPixmaps {
96    Pixmap xlogo;
97    Pixmap resize;
98    Pixmap question;
99    Pixmap menu;
100    Pixmap delete;
101};
102
103struct ScreenInfo
104{
105    int screen;			/* the default screen */
106    int d_depth;		/* copy of DefaultDepth(dpy, screen) */
107    Visual *d_visual;		/* copy of DefaultVisual(dpy, screen) */
108    int Monochrome;		/* is the display monochrome ? */
109    int rootx;		        /* The x coordinate of the root window (virtual screen) relative to RealRoot */
110    int rooty;		        /* The y coordinate of the root window (virtual screen) relative to RealRoot */
111    int rootw;		        /* my copy of DisplayWidth(dpy, screen) */
112    int rooth;	                /* my copy of DisplayHeight(dpy, screen) */
113
114    int crootx;		        /* The x coordinate of the captive root window if any */
115    int crooty;		        /* The y coordinate of the captive root window if any */
116    int crootw;		        /* my copy of DisplayWidth(dpy, screen) */
117    int crooth;	                /* my copy of DisplayHeight(dpy, screen) */
118
119    int MaxWindowWidth;		/* largest window to allow */
120    int MaxWindowHeight;	/* ditto */
121
122    TwmWindow *FirstWindow;	/* the head of the twm window list */
123    Colormaps RootColormaps;	/* the colormaps of the root window */
124
125    Window Root;		/* the root window: the current virual screen */
126    Window XineramaRoot;	/* the root window, may be CaptiveRoot or otherwise RealRoot */
127    Window CaptiveRoot;		/* the captive root window, if any, or 0 */
128    Window RealRoot;		/* the actual root window of the display */
129
130/*
131 *  +--RealRoot-----------------------------------------------------------+
132 *  | the root of the display (most uses of this are probably incorrect!) |
133 *  |                                                                     |
134 *  |   +--CaptiveRoot--------------------------------------------------+ |
135 *  |   | when captive window is used (most uses are likely incorrect!) | |
136 *  |   |                                                               | |
137 *  |   | +--XineramaRoot---------------------------------------------+ | |
138 *  |   | | the root that encompasses all virual screens              | | |
139 *  |   | |                                                           | | |
140 *  |   | | +--Root-----------+ +--Root--------+ +--Root------------+ | | |
141 *  |   | | | one or more     | | Most cases   | |                  | | | |
142 *  |   | | | virtual screens | | use Root.    | |                  | | | |
143 *  |   | | |                 | |              | |                  | | | |
144 *  |   | | |                 | |              | |                  | | | |
145 *  |   | | +-----------------+ +--------------+ +------------------+ | | |
146 *  |   | +-----------------------------------------------------------+ | |
147 *  |   +---------------------------------------------------------------+ |
148 *  +---------------------------------------------------------------------+
149 */
150
151    Window SizeWindow;		/* the resize dimensions window */
152    Window InfoWindow;		/* the information window */
153    Window WindowMask;		/* the window masking the screen at startup */
154    Window ShapeWindow;		/* an utilitary window for animated icons */
155
156    Image   *WelcomeImage;
157    GC       WelcomeGC;
158    Colormap WelcomeCmap;
159    Visual  *WelcomeVisual;
160
161    name_list *ImageCache;	/* list of pixmaps */
162    TitlebarPixmaps tbpm;	/* titlebar pixmaps */
163    Image *UnknownImage;	/* the unknown icon pixmap */
164    Pixmap siconifyPm;		/* the icon manager iconify pixmap */
165    Pixmap pullPm;		/* pull right menu icon */
166    unsigned int pullW, pullH;	/* size of pull right menu icon */
167    char *HighlightPixmapName;	/* name of the hilite image if any */
168
169    MenuRoot *MenuList;		/* head of the menu list */
170    MenuRoot *LastMenu;		/* the last menu (mostly unused?) */
171    MenuRoot *Windows;		/* the TwmWindows menu */
172    MenuRoot *Icons;		/* the TwmIcons menu */
173    MenuRoot *Workspaces;	/* the TwmWorkspaces menu */
174    MenuRoot *AllWindows;	/* the TwmAllWindows menu */
175
176  /*Added by dl 2004 */
177    MenuRoot *AllIcons;         /* the TwmAllIcons menu */
178
179  /******************************************************/
180  /* Added by Dan Lilliehorn (dl@dl.nu) 2000-02-29)     */
181    MenuRoot *Keys;             /* the TwmKeys menu     */
182    MenuRoot *Visible;          /* thw TwmVisible menu  */
183
184    TwmWindow *Ring;		/* one of the windows in window ring */
185    TwmWindow *RingLeader;	/* current window in ring */
186
187    MouseButton DefaultFunction;
188    MouseButton WindowFunction;
189    MouseButton ChangeWorkspaceFunction;
190    MouseButton DeIconifyFunction;
191    MouseButton IconifyFunction;
192
193    struct {
194      Colormaps *cmaps; 	/* current list of colormap windows */
195      int maxCmaps;		/* maximum number of installed colormaps */
196      unsigned long first_req;	/* seq # for first XInstallColormap() req in
197				   pass thru loading a colortable list */
198      int root_pushes;		/* current push level to install root
199				   colormap windows */
200      Colormaps *pushed_cmaps;	/* saved colormaps to install when pushes
201				   drops to zero */
202    } cmapInfo;
203
204    struct {
205	StdCmap *head, *tail;		/* list of maps */
206	StdCmap *mru;			/* most recently used in list */
207	int mruindex;			/* index of mru in entry */
208    } StdCmapInfo;
209
210    struct {
211	int nleft, nright;		/* numbers of buttons in list */
212	TitleButton *head;		/* start of list */
213	int border;			/* button border */
214	int pad;			/* button-padding */
215	int width;			/* width of single button & border */
216	int leftx;			/* start of left buttons */
217	int titlex;			/* start of title */
218	int rightoff;			/* offset back from right edge */
219	int titlew;			/* width of title part */
220    } TBInfo;
221    ColorPair BorderTileC;	/* border tile colors */
222    ColorPair TitleC;		/* titlebar colors */
223    ColorPair MenuC;		/* menu colors */
224    ColorPair MenuTitleC;	/* menu title colors */
225    ColorPair IconC;		/* icon colors */
226    ColorPair IconManagerC;	/* icon manager colors */
227    ColorPair DefaultC;		/* default colors */
228    ColorPair BorderColorC;	/* color of window borders */
229    Pixel MenuShadowColor;	/* menu shadow color */
230    Pixel IconBorderColor;	/* icon border color */
231    Pixel IconManagerHighlight;	/* icon manager highlight */
232    short ClearShadowContrast;  /* The contrast of the clear shadow */
233    short DarkShadowContrast;   /* The contrast of the dark shadow */
234    short IconJustification;	/* J_LEFT, J_CENTER or J_RIGHT */
235    short IconRegionJustification;	/* J_LEFT, J_CENTER J_RIGHT or J_BORDER */
236    short IconRegionAlignement;	/* J_TOP, J_CENTER, J_BOTTOM or J_BORDER */
237    short TitleJustification;	/* J_LEFT, J_CENTER or J_RIGHT */
238    short IconifyStyle;         /* ICONIFY_* */
239    int   MaxIconTitleWidth;	/* */
240
241    Cursor TitleCursor;		/* title bar cursor */
242    Cursor FrameCursor;		/* frame cursor */
243    Cursor IconCursor;		/* icon cursor */
244    Cursor IconMgrCursor;	/* icon manager cursor */
245    Cursor ButtonCursor;	/* title bar button cursor */
246    Cursor MoveCursor;		/* move cursor */
247    Cursor ResizeCursor;	/* resize cursor */
248    Cursor WaitCursor;		/* wait a while cursor */
249    Cursor MenuCursor;		/* menu cursor */
250    Cursor SelectCursor;	/* dot cursor for f.move, etc. from menus */
251    Cursor DestroyCursor;	/* skull and cross bones, f.destroy */
252    Cursor AlterCursor;		/* cursor for alternate keymaps */
253
254    WorkSpaceMgr workSpaceMgr;
255    short	workSpaceManagerActive;
256
257    virtualScreen *vScreenList;
258    virtualScreen *currentvs;
259    name_list     *VirtualScreens;
260
261    name_list	*OccupyAll;	/* list of window names occupying all workspaces at startup */
262    name_list	*UnmapByMovingFarAway;
263    name_list	*DontSetInactive;
264    name_list	*AutoSqueeze;
265    name_list	*StartSqueezed;
266    short 	use3Dmenus;
267    short 	use3Dtitles;
268    short 	use3Diconmanagers;
269    short 	use3Dborders;
270    short 	use3Dwmap;
271    short	use3Diconborders;
272    short	SunkFocusWindowTitle;
273    short	WMgrVertButtonIndent;
274    short	WMgrHorizButtonIndent;
275    short	WMgrButtonShadowDepth;
276    short	BeNiceToColormap;
277    short	BorderCursors;
278    short	BorderShadowDepth;
279    short	TitleButtonShadowDepth;
280    short	TitleShadowDepth;
281    short	MenuShadowDepth;
282    short	IconManagerShadowDepth;
283    short	ReallyMoveInWorkspaceManager;
284    short	ShowWinWhenMovingInWmgr;
285    short	ReverseCurrentWorkspace;
286    short	DontWarpCursorInWMap;
287    short	XMoveGrid, YMoveGrid;
288    short	FastServer;
289    short	CenterFeedbackWindow;
290    short	ShrinkIconTitles;
291    short	AutoRaiseIcons;
292    short       AutoFocusToTransients; /* kai */
293    short       PackNewWindows;
294
295    name_list *BorderColorL;
296    name_list *IconBorderColorL;
297    name_list *BorderTileForegroundL;
298    name_list *BorderTileBackgroundL;
299    name_list *TitleForegroundL;
300    name_list *TitleBackgroundL;
301    name_list *IconForegroundL;
302    name_list *IconBackgroundL;
303    name_list *IconManagerFL;
304    name_list *IconManagerBL;
305    name_list *IconMgrs;
306    name_list *NoBorder;	/* list of window without borders          */
307    name_list *NoIconTitle;	/* list of window names with no icon title */
308    name_list *NoTitle;		/* list of window names with no title bar */
309    name_list *MakeTitle;	/* list of window names with title bar */
310    name_list *AutoRaise;	/* list of window names to auto-raise */
311    name_list *AutoLower;	/* list of window names to auto-lower */
312    name_list *IconNames;	/* list of window names and icon names */
313    name_list *NoHighlight;	/* list of windows to not highlight */
314    name_list *NoStackModeL;	/* windows to ignore stack mode requests */
315    name_list *AlwaysOnTopL;	/* windows to keep on top */
316    name_list *NoTitleHighlight;/* list of windows to not highlight the TB*/
317    name_list *DontIconify;	/* don't iconify by unmapping */
318    name_list *IconMgrNoShow;	/* don't show in the icon manager */
319    name_list *IconMgrShow;	/* show in the icon manager */
320    name_list *IconifyByUn;	/* windows to iconify by unmapping */
321    name_list *StartIconified;	/* windows to start iconic */
322    name_list *IconManagerHighlightL;	/* icon manager highlight colors */
323    name_list *SqueezeTitleL;		/* windows of which to squeeze title */
324    name_list *DontSqueezeTitleL;	/* windows of which not to squeeze */
325    name_list *AlwaysSqueezeToGravityL;	/* windows which should squeeze toward gravity */
326    name_list *WindowRingL;	/* windows in ring */
327    name_list *WindowRingExcludeL;      /* windows excluded from ring */
328    name_list *WarpCursorL;	/* windows to warp cursor to on deiconify */
329    name_list *DontSave;
330    name_list *WindowGeometries;
331    name_list *IgnoreTransientL;
332
333    name_list *OpaqueMoveList;
334    name_list *NoOpaqueMoveList;
335    name_list *OpaqueResizeList;
336    name_list *NoOpaqueResizeList;
337    name_list *IconMenuDontShow;
338
339    GC NormalGC;		/* normal GC for everything */
340    GC MenuGC;			/* gc for menus */
341    GC DrawGC;			/* GC to draw lines for move and resize */
342    GC BorderGC;		/* for drawing 3D borders */
343    GC rootGC;                  /* used for allocating pixmaps in FindPixmap (util.c) */
344
345    unsigned long Black;
346    unsigned long White;
347    unsigned long XORvalue;	/* number to use when drawing xor'ed */
348    MyFont TitleBarFont;	/* title bar font structure */
349    MyFont MenuFont;		/* menu font structure */
350    MyFont IconFont;		/* icon font structure */
351    MyFont SizeFont;		/* resize font structure */
352    MyFont IconManagerFont;	/* window list font structure */
353    MyFont DefaultFont;
354    IconMgr *iconmgr;		/* default icon manager  */
355    struct IconRegion *FirstRegion;	/* pointer to icon regions */
356    struct IconRegion *LastRegion;	/* pointer to the last icon region */
357    struct WindowRegion *FirstWindowRegion;	/* pointer to window regions */
358    WindowBox *FirstWindowBox;	/* pointer to window boxes list */
359    char *IconDirectory;	/* icon directory to search */
360    char *PixmapDirectory;	/* Pixmap directory to search */
361    int SizeStringOffset;	/* x offset in size window for drawing */
362    int SizeStringWidth;	/* minimum width of size window */
363    int BorderWidth;		/* border width of twm windows */
364    int BorderLeft;
365    int BorderRight;
366    int BorderTop;
367    int BorderBottom;
368    int ThreeDBorderWidth;	/* 3D border width of twm windows */
369    int IconBorderWidth;	/* border width of icon windows */
370    int TitleHeight;		/* height of the title bar window */
371    TwmWindow *Focus;		/* the twm window that has focus */
372    int EntryHeight;		/* menu entry height */
373    int FramePadding;		/* distance between decorations and border */
374    int TitlePadding;		/* distance between items in titlebar */
375    int ButtonIndent;		/* amount to shrink buttons on each side */
376    int NumAutoRaises;		/* number of autoraise windows on screen */
377    int NumAutoLowers;		/* number of autolower windows on screen */
378    int TransientOnTop;		/* Percentage of the surface of it's leader */
379    short AutoRaiseDefault;	/* AutoRaise all windows if true */
380    short AutoLowerDefault;	/* AutoLower all windows if true */
381    short NoDefaults;		/* do not add in default UI stuff */
382    short UsePPosition;		/* what do with PPosition, see values below */
383    short UseSunkTitlePixmap;
384    short AutoRelativeResize;	/* start resize relative to position in quad */
385    short FocusRoot;		/* is the input focus on the root ? */
386    short WarpCursor;		/* warp cursor on de-iconify ? */
387    short ForceIcon;		/* force the icon to the user specified */
388    short NoGrabServer;		/* don't do server grabs */
389    short NoRaiseMove;		/* don't raise window following move */
390    short NoRaiseResize;	/* don't raise window following resize */
391    short NoRaiseDeicon;	/* don't raise window on deiconify */
392    short RaiseOnWarp;		/* do raise window on warp */
393    short DontMoveOff;		/* don't allow windows to be moved off */
394    int MoveOffResistance;	/* nb of pixel before moveOff gives up */
395    int MovePackResistance;	/* nb of pixel before f.movepack gives up */
396    short DoZoom;		/* zoom in and out of icons */
397    short TitleFocus;		/* focus on window in title bar ? */
398    short IconManagerFocus;	/* focus on iconified window ? */
399    short NoIconTitlebar;	/* put title bars on icons */
400    short NoTitlebar;		/* put title bars on windows */
401    short DecorateTransients;	/* put title bars on transients */
402    short IconifyByUnmapping;	/* simply unmap windows when iconifying */
403    short ShowIconManager;	/* display the window list */
404    short ShowWorkspaceManager;	/* display the workspace manager */
405    short IconManagerDontShow;	/* show nothing in the icon manager */
406    short AutoOccupy;		/* Do we automatically change occupation when name changes */
407    short TransientHasOccupation;	/* Do transient-for windows have their own occupation */
408    short DontPaintRootWindow;	/* don't paint anything on the root window */
409    short BackingStore;		/* use backing store for menus */
410    short SaveUnder;		/* use save under's for menus */
411    short RandomPlacement;	/* randomly place windows that no give hints */
412    short RandomDisplacementX;	/* randomly displace by this much horizontally */
413    short RandomDisplacementY;	/* randomly displace by this much vertically */
414    short OpaqueMove;		/* move the window rather than outline */
415    short DoOpaqueMove;		/* move the window rather than outline */
416    short OpaqueMoveThreshold;		/*  */
417    short DoOpaqueResize;		/* resize the window rather than outline */
418    short OpaqueResize;		/* resize the window rather than outline */
419    short OpaqueResizeThreshold;	/*  */
420    short Highlight;		/* should we highlight the window borders */
421    short StackMode;		/* should we honor stack mode requests */
422    short TitleHighlight;	/* should we highlight the titlebar */
423    short MoveDelta;		/* number of pixels before f.move starts */
424    short ZoomCount;		/* zoom outline count */
425    short SortIconMgr;		/* sort entries in the icon manager */
426    short Shadow;		/* show the menu shadow */
427    short InterpolateMenuColors;/* make pretty menus */
428    short StayUpMenus;		/* stay up menus */
429    short WarpToDefaultMenuEntry; /* warp cursor to default menu entry, if any  */
430    short ClickToFocus;		/* click to focus */
431    short SloppyFocus;		/* "sloppy" focus */
432    short SaveWorkspaceFocus;	/* Save and restore focus on workspace change. */
433    short NoIconManagers;	/* Don't create any icon managers */
434    short ClientBorderWidth;	/* respect client window border width */
435    short SqueezeTitle;		/* make title as small as possible */
436    short AlwaysSqueezeToGravity; /* squeeze toward gravity */
437    short HaveFonts;		/* set if fonts have been loaded */
438    short FirstTime;		/* first time we've read .twmrc */
439    short CaseSensitive;	/* be case-sensitive when sorting names */
440    short WarpUnmapped;		/* allow warping to unmapped windows */
441    short WindowRingAll;	/* add all windows to the ring */
442    short WarpRingAnyWhere;	/* warp to ring even if window is not visible */
443    short ShortAllWindowsMenus;	/* Eliminates Icon and Workspace Managers */
444    short OpenWindowTimeout;	/* Timeout when a window tries to open */
445    short RaiseWhenAutoUnSqueeze;
446    short RaiseOnClick;		/* Raise a window when clieked into */
447    short RaiseOnClickButton;		/* Raise a window when clieked into */
448    short IgnoreLockModifier;	/* Should we ignore the lock modifier */
449    unsigned int IgnoreModifier;
450    short IgnoreCaseInMenuSelection;	/* Should we ignore case in menu selection */
451    short NoWarpToMenuTitle; /* warp cursor to clipped menu title */
452    short NoImagesInWorkSpaceManager;   /* do not display mini images of the desktop background images on WSmap */
453
454    FuncKey FuncKeyRoot;
455    FuncButton FuncButtonRoot;
456
457#ifdef GNOME
458    GnomeData *gnomedata;
459#endif /* GNOME */
460};
461
462extern int captive;
463extern int MultiScreen;
464extern int NumScreens;
465extern ScreenInfo **ScreenList;
466extern ScreenInfo *Scr;
467extern int FirstScreen;
468
469#define PPOS_OFF 0
470#define PPOS_ON 1
471#define PPOS_NON_ZERO 2
472/* may eventually want an option for having the PPosition be the initial
473   location for the drag lines */
474
475#define RP_OFF 0
476#define RP_ALL 1
477#define RP_UNMAPPED 2
478
479#define ONTOP_MAX 16
480#define ONTOP_DEFAULT 8
481
482#endif /* _SCREEN_ */
483