1 /***********************************************************************
2  *
3  * afterstep per-screen data include file
4  *
5  ***********************************************************************/
6 
7 #ifndef SCREEN_H_HEADER_INCLUDED
8 #define SCREEN_H_HEADER_INCLUDED
9 
10 #include "afterstep.h"
11 #include "clientprops.h"
12 #include "hints.h"
13 #include "asdatabase.h"
14 #include "font.h"
15 #include "mylook.h"
16 #include "asfeel.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #define SIZE_HINDENT 5
23 #define SIZE_VINDENT 3
24 #define MAX_WINDOW_WIDTH 32767
25 #define MAX_WINDOW_HEIGHT 32767
26 
27 /* Maximum number of icon boxes that are allowed */
28 #define MAX_BOXES 4
29 
30 /* button styles */
31 #define NO_BUTTON_STYLE		-1	/* button is undefined */
32 #define XPM_BUTTON_STYLE	2	/* button is a pixmap */
33 
34 #ifndef NO_VIRTUAL
35 typedef struct
36 {
37 	Window win;
38 	int isMapped;
39 }ASPanFrame;
40 
41 #endif
42 
43 /* look file flags */
44 struct MenuRoot;
45 struct MouseButton;
46 struct FuncKey;
47 struct MyStyle;
48 struct ASSupportedHints;
49 struct MyFrame;
50 struct ASHashTable;
51 struct ComplexFunction;
52 struct ASFontManager;
53 struct ASImageManager;
54 struct ASCanvas;
55 struct ASMoveResizeData;
56 
57 typedef struct ASDesktop
58 {
59 	int 	Desk ;
60 	unsigned short vx, vy ;
61 }ASDesktop;
62 
63 typedef struct ASIconBox
64 {
65 	int desktop ;
66 	ASGeometry *areas ;
67 	unsigned short areas_num ;
68 	ASBiDirList *icons ;
69 }ASIconBox;
70 
71 typedef struct ASBackgroundHandler
72 {
73 	Pixmap  pmap;
74 	unsigned int pmap_width, pmap_height ;
75 	int     cmd_pid;
76 	ASImage *im;
77 }ASBackgroundHandler;
78 
79 typedef struct ScreenInfo
80   {
81 	unsigned long screen;
82 	int d_depth;            /* copy of DefaultDepth(dpy, screen) */
83 	int NumberOfScreens;	/* number of screens on display */
84 	int MyDisplayWidth;		/* my copy of DisplayWidth(dpy, screen) */
85 	int MyDisplayHeight;	/* my copy of DisplayHeight(dpy, screen) */
86 
87 	Bool localhost ;
88 	char *rdisplay_string, *display_string;
89 
90 	struct ASWMProps    *wmprops;              /* window management properties */
91 
92 	struct ASVisual *asv ;  /* ASVisual for libAfterImage */
93 	Window Root;        /* the root window */
94 	struct ASImage  *RootImage;
95 	struct ASCanvas *RootCanvas;
96 	/* this is used to limit area of the root window from which to get root image : */
97 	XRectangle RootClipArea;                /* used only by modules */
98 	ASBackgroundHandler *RootBackground;    /* used only by those who change root background */
99 
100 	Window SizeWindow;      /* the resize dimensions window */
101 	Window ServiceWin;      /* Auxilary window that we use for :
102 							 *    1) hiding focus - it will own focus when no other windows have it
103 							 *    2) desktop switching - off-desktop windows will be reparented there
104 							 */
105 
106 	struct ASWindowList *Windows ;
107 /*    ASWindow ASRoot;        the head of the afterstep window list */
108 /*    struct ASHashTable *aswindow_xref;        xreference of window/resource IDs to ASWindow structures */
109 
110 	struct ASIconBox   *default_icon_box ; /* if we have icons following desktops - then we only need one icon box */
111 	struct ASHashTable *icon_boxes ; /* hashed by desk no - one icon box per desktop ! */
112 
113 #define PAN_FRAME_SIDES 4
114 
115 #define AS_PANFRAME_EVENT_MASK (EnterWindowMask|LeaveWindowMask|VisibilityChangeMask)
116 
117 #ifndef NO_VIRTUAL
118 	ASPanFrame PanFrame[PAN_FRAME_SIDES];
119 	int usePanFrames;		/* toggle to disable them */
120 #endif
121 
122 	/* interactive move resize data : */
123 	struct ASMoveResizeData *moveresize_in_progress;
124 
125 	int randomx;        /* values used for randomPlacement */
126 	int randomy;
127 	unsigned VScale;		/* Panner scale factor */
128 	int VxMax;			/* Max location for top left of virt desk */
129 	int VyMax;
130 	int Vx;			/* Current loc for top left of virt desk */
131 	int Vy;
132 
133 	int CurrentDesk;        /* The current desktop number */
134 	int LastValidDesk;      /* Last nonspecial desktop's number  (<> 10000) */
135 
136 	Time   last_Timestamp;                      /* last event timestamp */
137 	Time   menu_grab_Timestamp;                 /* pointer grab time used in menus */
138 
139 	ASFeel  Feel;
140 	MyLook  Look;
141 
142 	Cursor  standard_cursors[MAX_CURSORS];
143 
144 	GC DrawGC;          /* GC to draw lines for move and resize */
145 	GC RootGC;      /* GC to draw on the root window -
146 						   separate as it may have different color depth */
147 
148 	int xinerama_screens_num ;
149 	XRectangle *xinerama_screens;
150 
151 	struct ASFontManager  *font_manager ;
152 	struct ASImageManager *image_manager ;
153 
154 	Bool (*on_dead_window)( Window w );
155 
156 	/* supported X extentions : */
157 	int XineEventBase, XineErrorBase;
158 	int	ShmCompletionEventType ;
159 	int	ShapeEventBase ;
160 	int	ShapeErrorBase ;
161 
162 }ScreenInfo;
163 
164 void init_ScreenInfo(ScreenInfo *scr);
165 void init_screen_gcs(ScreenInfo *scr);
166 void destroy_screen_gcs(ScreenInfo *scr);
167 
168 void make_screen_envvars( ScreenInfo *scr );
169 
170 void init_screen_panframes(ScreenInfo *scr);
171 void check_screen_panframes(ScreenInfo *scr);
172 void raise_scren_panframes (ScreenInfo *scr);
173 Window get_lowest_panframe(ScreenInfo *scr);
174 
175 void reload_screen_image_manager( ScreenInfo *scr, struct ASImageManager **old_imageman );
176 ScreenInfo *get_current_screen();
177 int get_screen_width(ScreenInfo *scr);
178 int get_screen_height(ScreenInfo *scr);
179 int get_screen_current_desk(ScreenInfo *scr);
180 struct MyLook *get_screen_look(ScreenInfo *scr);
181 struct ASImageManager *get_screen_image_manager(ScreenInfo *scr);
182 struct ASFontManager *get_screen_font_manager(ScreenInfo *scr);
183 struct ASVisual *get_screen_visual(ScreenInfo *scr);
184 
185 
186 
187 #ifdef HAVE_XINERAMA
188 void get_Xinerama_rectangles (ScreenInfo * scr);
189 #endif
190 Bool set_synchronous_mode (Bool enable);
191 
192 int ConnectXDisplay (Display *display, ScreenInfo * scr, Bool as_manager);
193 /* this is a shortcut to above : */
194 int ConnectX (ScreenInfo * scr, unsigned long event_mask);
195 
196 void setup_modifiers ();
197 
198 #define  create_screen_window(scr,p,x,y,w,h,bw,c,mask,attr) \
199 	create_visual_window((scr)->asv,((p)==None)?((scr)->Root):(p),x,y,w,h,bw,c,mask,attr)
200 
201 void merge_geometry( ASGeometry *from, ASGeometry *to );
202 void check_desksize_sanity( ScreenInfo *scr );
203 
204 #ifdef __cplusplus
205 }
206 #endif
207 
208 
209 
210 #endif /* _SCREEN_ */
211