1 /***********************************************************************
2  * afterstep include file
3  ***********************************************************************/
4 
5 #ifndef AFTERSTEP_H_HEADER_INCLUDED
6 #define AFTERSTEP_H_HEADER_INCLUDED
7 
8 #define NO_ASRENDER
9 
10 #include "myicon.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #ifndef WithdrawnState
17 #define WithdrawnState 0
18 #endif
19 
20 #ifndef set_flags
21 #define set_flags(v,f)  	((v)|=(f))
22 #define clear_flags(v,f)	((v)&=~(f))
23 #define get_flags(v,f)  	((v)&(f))
24 #endif
25 
26 /************************** Magic Numbers : ********************************/
27 #define MAGIC_ASDBRECORD        0x7A3DBECD
28 #define MAGIC_ASWINDOW          0x7A3819D0
29 #define MAGIC_ASDESKTOP         0x7A3DE347
30 #define MAGIC_ASFEEL            0x7A3FEE1D
31 #define MAGIC_ASICON            0x7A301C07
32 
33 #define MAGIC_MENU_DATA         0x7A3EDDAF
34 #define MAGIC_MENU_DATA_ITEM    0x7A3ED1FE
35 #define MAGIC_COMPLEX_FUNC      0x7A3CCF46
36 #define MAGIC_ASMENU            0x7A3E78C1
37 
38 #define ASMENU_RES_CLASS        "ASMenu"
39 
40 #define MAGIC_MYLOOK_RES_BASE   0x7A311000
41 #define MAGIC_MYLOOK            (MAGIC_MYLOOK_RES_BASE+0)
42 #define MAGIC_MYSTYLE           (MAGIC_MYLOOK_RES_BASE+1)
43 #define MAGIC_MYBACKGROUND      (MAGIC_MYLOOK_RES_BASE+2)
44 #define MAGIC_MYDESKTOP         (MAGIC_MYLOOK_RES_BASE+3)
45 #define MAGIC_MYFRAME           (MAGIC_MYLOOK_RES_BASE+4)
46 #define MAGIC_MYDESKTOPCONFIG   (MAGIC_MYLOOK_RES_BASE+5)
47 
48 
49 
50 
51 
52 /* List of flags that allows us to put AfterSTep in different states : */
53 #define ASS_NormalOperation     (0x01<<0)      /* otherwise we are in restart or shutdown or initialization  */
54 #define ASS_Restarting          (0x01<<1)      /* otherwise we either initializing for the first time or shutting down */
55 #define ASS_Shutdown            (0x01<<2)      /* otherwise we either initializing for the first time or shutting down */
56 #define ASS_SingleScreen        (0x01<<3)      /* if we've been requested not to spawn our copies on other screens */
57 #define ASS_RunningLocal        (0x01<<4)      /* if AfterSTep runs on the same host as X Server */
58 #define ASS_Debugging           (0x01<<5)      /* if we are debugging AfterSTep and hence should run synchronously */
59 #define ASS_HousekeepingMode    (0x01<<6)      /* after GrabEm and before UngrabEm - noone has focus, we can do what we want. */
60 #define ASS_WarpingMode         (0x01<<7)      /* after first F_WARP* and before mouse/keyboard actions. */
61 #define ASS_PointerOutOfScreen  (0x01<<8)      /*  */
62 #define ASS_ScreenGrabbed		(0x01<<9)      /* XGrabScreen had been issued - we should try and
63 												  avoid deadlocks ! */
64 #define ASS_SuppressDeskBack	(0x01<<10)
65 
66 #define AS_Text_ASCII			0
67 #define AS_Text_UTF8			1
68 #define AS_Text_UNICODE			2
69 
70 
71 /* use PanFrames! this replaces the 3 pixel margin with PanFrame windows
72  * it should not be an option, once it works right. HEDU 2/2/94
73  */
74 #define PAN_FRAME_THICKNESS 2	/* or just 1 ? */
75 
76 
77 /* The maximum number of titlebar buttons */
78 #define MAX_BUTTONS 10
79 
80 #define MAX_CURSORS	32                         /* just for the heck of it! */
81 
82 
83 /* the maximum number of mouse buttons afterstep knows about :
84  * This is the better approach : */
85 #define MAX_MOUSE_BUTTONS 	(Button5-Button1+1)
86 
87 #define BW 1			/* border width */
88 #define BOUNDARY_WIDTH 7	/* border width */
89 #define CORNER_WIDTH 16		/* border width */
90 
91 #define HEIGHT_EXTRA 4		/* Extra height for texts in popus */
92 #define HEIGHT_EXTRA_TITLE 4	/* Extra height for underlining title */
93 #define HEIGHT_SEPARATOR 4	/* Height of separator lines */
94 
95 #define SCROLL_REGION 2		/* region around screen edge that */
96 				/* triggers scrolling */
97 
98 #define NO_HILITE     0
99 #define TOP_HILITE    (0x01<<0)
100 #define RIGHT_HILITE  (0x01<<1)
101 #define BOTTOM_HILITE (0x01<<2)
102 #define LEFT_HILITE   (0x01<<3)
103 #define NORMAL_HILITE (TOP_HILITE|RIGHT_HILITE|BOTTOM_HILITE|LEFT_HILITE)
104 #define EXTRA_HILITE  (0x01<<4)
105 #define FULL_HILITE   (EXTRA_HILITE|NORMAL_HILITE)
106 #define NO_HILITE_OUTLINE  	(0x01<<5)
107 #define NO_HILITE_INLINE  	(0x01<<6)
108 #define HILITE_MASK   (NO_HILITE_OUTLINE|NO_HILITE_INLINE|FULL_HILITE)
109 
110 #define DEFAULT_TBAR_HILITE   (BOTTOM_HILITE|RIGHT_HILITE|NO_HILITE_INLINE)
111 #define DEFAULT_MENU_HILITE   (0)
112 
113 
114 #define PAD_H_OFFSET    0
115 #define PAD_LEFT        (0x01<<0)
116 #define PAD_RIGHT       (0x01<<1)
117 #define PAD_H_MASK      (PAD_RIGHT|PAD_LEFT)
118 
119 #define PAD_V_OFFSET    (PAD_H_OFFSET+2)
120 #define PAD_BOTTOM      (0x01<<(PAD_V_OFFSET))    /* rotated with Top on purpose */
121 #define PAD_TOP         (0x01<<(PAD_V_OFFSET+1))
122 #define PAD_V_MASK      (PAD_TOP|PAD_BOTTOM)
123 #define PAD_MASK        (PAD_V_MASK|PAD_H_MASK)
124 
125 #define RESIZE_H_OFFSET (PAD_V_OFFSET+2)
126 #define RESIZE_H        (0x01<<(RESIZE_H_OFFSET))
127 #define RESIZE_H_SCALE  (0x01<<(RESIZE_H_OFFSET+1))
128 #define RESIZE_H_MASK   (RESIZE_H|RESIZE_H_SCALE)
129 
130 #define RESIZE_V_OFFSET (RESIZE_H_OFFSET+2)
131 #define RESIZE_V        (0x01<<(RESIZE_V_OFFSET))
132 #define RESIZE_V_SCALE  (0x01<<(RESIZE_V_OFFSET+1))
133 #define RESIZE_V_MASK   (RESIZE_V|RESIZE_V_SCALE)
134 #define RESIZE_MASK     (RESIZE_V_MASK|RESIZE_H_MASK)
135 
136 #define FIT_LABEL_WIDTH  (0x01<<(RESIZE_V_OFFSET+2))
137 #define FIT_LABEL_HEIGHT (0x01<<(RESIZE_V_OFFSET+3))
138 #define FIT_LABEL_SIZE   (FIT_LABEL_WIDTH|FIT_LABEL_HEIGHT)
139 
140 #define NO_ALIGN      0
141 #define ALIGN_LEFT    PAD_RIGHT
142 #define ALIGN_RIGHT   PAD_LEFT
143 #define ALIGN_TOP     PAD_BOTTOM
144 #define ALIGN_BOTTOM  PAD_TOP
145 #define ALIGN_HCENTER (PAD_LEFT|PAD_RIGHT)
146 #define ALIGN_VCENTER (PAD_TOP|PAD_BOTTOM)
147 #define ALIGN_CENTER  (ALIGN_VCENTER|ALIGN_HCENTER)
148 #define ALIGN_MASK	  (PAD_MASK|RESIZE_MASK|FIT_LABEL_SIZE)
149 
150 #define DEFAULT_TBAR_HSPACING        5
151 #define DEFAULT_TBAR_VSPACING        1
152 #define DEFAULT_MENU_SPACING        5
153 #define DEFAULT_MENU_ITEM_HBORDER   1
154 #define DEFAULT_MENU_ITEM_VBORDER   1
155 
156 
157 /* possible style index values */
158 #define BACK_FOCUSED		0
159 #define BACK_UNFOCUSED		1
160 #define BACK_STICKY         2
161 #define BACK_URGENT			3
162 #define BACK_DEFAULT		4
163 #define BACK_STYLES         5
164 
165 #define MENU_BACK_TITLE     0
166 #define MENU_BACK_ITEM      1
167 #define MENU_BACK_HILITE    2
168 #define MENU_BACK_STIPPLE 	3
169 #define MENU_BACK_SUBITEM   4
170 #define MENU_BACK_HITITLE   5
171 #define MENU_BACK_STYLES    6
172 
173 /* different frame decoration part ids : */
174 typedef enum
175 {				/* don't change order !!!!
176 				 * If you do, the following must be met :
177 				 *     - sides must go first and start with 0
178 				 *     - order must be the same as order of cursors in screen.h
179 				 */
180   FR_N = 0,
181   FR_E,
182   FR_S,
183   FR_W,
184   FRAME_SIDES,
185   FR_NW = FRAME_SIDES,
186   FR_NE,
187   FR_SW,
188   FR_SE,
189   FRAME_CORNERS,
190   FRAME_PARTS = FRAME_CORNERS,
191   FRAME_TITLE = FRAME_PARTS,
192   FRAME_ALL
193 }
194 FrameSide;
195 
196 #define FRAME_TOP_MASK      ((0x01<<FR_N)|(0x01<<FR_NW)|(0x01<<FR_NE))
197 #define FRAME_BTM_MASK      ((0x01<<FR_S)|(0x01<<FR_SW)|(0x01<<FR_SE))
198 #define FRAME_LEFT_MASK      (0x01<<FR_W)
199 #define FRAME_RIGHT_MASK     (0x01<<FR_E)
200 
201 
202 
203 
204 /* contexts for button presses */
205 #define C_NO_CONTEXT		0
206 #define C_FrameN        (0x01<<0)
207 #define C_FrameE        (0x01<<1)
208 #define C_FrameS        (0x01<<2)
209 #define C_FrameW        (0x01<<3)
210 #define C_FrameNW       (0x01<<4)
211 #define C_FrameNE       (0x01<<5)
212 #define C_FrameSW       (0x01<<6)
213 #define C_FrameSE       (0x01<<7)
214 #define C_SIDEBAR           (C_FrameS|C_FrameSW|C_FrameSE)
215 #define C_VERTICAL_SIDEBAR  (C_FrameW|C_FrameNW|C_FrameSW)
216 #define C_FRAME             (C_FrameN|C_FrameE|C_FrameS|C_FrameW| \
217 							 C_FrameNW|C_FrameNE|C_FrameSW|C_FrameSE)
218 #define C_FrameStart    (C_FrameN)
219 #define C_FrameEnd      (C_FrameSE)
220 
221 #define C_WINDOW        (0x01<<8)
222 #define C_CLIENT        C_WINDOW
223 #define C_TITLE         (0x01<<9)
224 #define C_IconTitle     (0x01<<10)
225 #define C_IconButton    (0x01<<11)
226 #define C_ICON          (C_IconButton|C_IconTitle)
227 #define C_ROOT          (0x01<<12)
228 #define C_TButton0      (0x01<<13)
229 #define C_TButton1      (0x01<<14)
230 #define C_TButton2      (0x01<<15)
231 #define C_TButton3      (0x01<<16)
232 #define C_TButton4      (0x01<<17)
233 #define C_TButton5      (0x01<<18)
234 #define C_TButton6      (0x01<<19)
235 #define C_TButton7      (0x01<<20)
236 #define C_TButton8      (0x01<<21)
237 #define C_TButton9      (0x01<<22)
238 #define C_TButtonAll    (C_TButton0|C_TButton1|C_TButton2|C_TButton3|C_TButton4| \
239 						 C_TButton5|C_TButton6|C_TButton7|C_TButton8|C_TButton9)
240 #define C_ALL           (C_WINDOW|C_TITLE|C_ICON|C_ROOT|C_FRAME|C_SIDEBAR|C_TButtonAll)
241 
242 #define TITLE_BUTTONS       10
243 
244 /* possible flags to identify which tasks needs to be done on
245    frame decorations/handles */
246 #define TODO_EVENT		(0x01)
247 #define TODO_RESIZE_X		(0x01<<1)
248 #define TODO_RESIZE_Y		(0x01<<2)
249 #define TODO_RESIZE		(TODO_RESIZE_X|TODO_RESIZE_Y)
250 #define TODO_MOVE_X		(0x01<<3)
251 #define TODO_MOVE_Y		(0x01<<4)
252 #define TODO_MOVE		(TODO_MOVE_Y|TODO_MOVE_X)
253 #define TODO_TITLE		(0x01<<5)
254 #define TODO_SIDE		(0x01<<6)
255 #define TODO_DECOR		(TODO_TITLE|TODO_SIDE)
256 #define TODO_REDRAW_TITLE 	(0x01<<7)
257 #define TODO_REDRAW_SIDE  	(0x01<<8)
258 #define TODO_REDRAW		(TODO_REDRAW_TITLE|TODO_REDRAW_SIDE)
259 #define TODO_PAGE_X		(0x01<<9)
260 #define TODO_PAGE_Y		(0x01<<10)
261 #define TODO_PAGE		(TODO_PAGE_X|TODO_PAGE_Y)
262 /* this 2 are used in MyWidgets : */
263 #define TODO_REBUILD_CACHE	(0x01<<11)
264 #define TODO_REDRAW_WIDGET	(0x01<<12)
265 /* */
266 
267 
268 #define MAX_POSITION        30000
269 #define INVALID_POSITION    (-MAX_POSITION)
270 #define INVALID_DESK        10000
271 #define IsValidDesk(d)		(d!=INVALID_DESK)
272 
273 
274 #define MAX_RUBBER_BAND         7
275 
276 struct icon_t;
277 struct button_t;
278 
279 typedef struct
280 {
281   int flags, x, y;
282   unsigned int width, height;
283 }
284 ASGeometry;
285 
286 typedef struct
287 {
288   unsigned int width, height;
289 }ASSize;
290 
291 typedef struct ASRectangle
292 {/* 64 bit safe : */
293   long x, y;
294   unsigned long width, height;
295 }ASRectangle;
296 
297 typedef struct
298 {
299 #define LeftValue	(0x01<<0)
300 #define TopValue	(0x01<<1)
301 #define RightValue	(0x01<<2)
302 #define BottomValue	(0x01<<3)
303 #define LeftNegative	(0x01<<4)
304 #define TopNegative	(0x01<<5)
305 #define RightNegative	(0x01<<6)
306 #define BottomNegative	(0x01<<7)
307   int flags;
308   int left, top;
309   int right, bottom;
310 }
311 ASBox;
312 
313 typedef struct ASCursor
314 {
315 	char              *image_file;   /* image of the cursor */
316 	char              *mask_file;    /* mask of the cursor  */
317 	Cursor             cursor;       /* loaded X Cursor */
318 }ASCursor;
319 
320 
321 typedef struct fr_pos
322   {
323 	int x;
324 	int y;
325 	int w;
326 	int h;
327   }
328 fr_pos;
329 
330 struct ASHints;
331 struct ASStatusHints;
332 struct ASCanvas;
333 struct ASTBarData;
334 
335 
336 #define AS_CLIENT_EVENT_MASK 		(ColormapChangeMask | \
337 									 EnterWindowMask 	| \
338 									 FocusChangeMask 	| \
339 									 LeaveWindowMask 	| \
340 									 PropertyChangeMask | \
341 									 StructureNotifyMask )
342 
343 
344 #define AS_FRAME_EVENT_MASK  		(ButtonPressMask 	| \
345 									 ButtonReleaseMask 	| \
346 									 EnterWindowMask 	| \
347 									 FocusChangeMask 	| \
348 									 LeaveWindowMask 	| \
349 									 SubstructureRedirectMask| \
350 									 StructureNotifyMask| \
351 									 KeyPressMask 		| \
352 									 PointerMotionMask)  /* needed for proper Balloons operation */
353 
354 #define AS_CANVAS_EVENT_MASK 		(ButtonPressMask 	| \
355 									 ButtonReleaseMask 	| \
356 									 EnterWindowMask 	| \
357 									 LeaveWindowMask 	| PointerMotionMask \
358 									 /*| StructureNotifyMask */ )  /* needed to be able to switch mouse pointers */
359 
360 #define AS_ICON_TITLE_EVENT_MASK 	(ButtonPressMask 	| \
361 									 ButtonReleaseMask 	| \
362 									 EnterWindowMask 	| \
363 									 FocusChangeMask 	| \
364 									 KeyPressMask       | \
365 									 StructureNotifyMask)
366 
367 #define AS_ICON_EVENT_MASK 	 		(ButtonPressMask 	| \
368 									 ButtonReleaseMask 	| \
369 									 EnterWindowMask 	| \
370 									 FocusChangeMask 	| \
371 									 KeyPressMask 		| \
372 									 LeaveWindowMask    | \
373 									 StructureNotifyMask)
374 
375 #define AS_MENU_EVENT_MASK         ( ButtonPressMask    | \
376 									 ButtonReleaseMask 	| \
377 									 PointerMotionMask  | \
378 									 EnterWindowMask 	| \
379 									 KeyPressMask 		| \
380 									 LeaveWindowMask    | \
381 									 StructureNotifyMask)
382 
383 
384 #define AS_ROOT_EVENT_MASK          (LeaveWindowMask | \
385 									 EnterWindowMask | \
386 									 PropertyChangeMask | \
387 									 SubstructureRedirectMask |  \
388 									  /* SubstructureNotifyMask | */\
389 									 KeyPressMask | \
390 									 ButtonPressMask | \
391 									 ButtonReleaseMask )
392 
393 #define AS_ICON_MYSTYLE					"ButtonPixmap"
394 #define AS_ICON_TITLE_MYSTYLE			"ButtonTitleFocus"
395 #define AS_ICON_TITLE_STICKY_MYSTYLE	"ButtonTitleSticky"
396 #define AS_ICON_TITLE_UNFOCUS_MYSTYLE	"ButtonTitleUnfocus"
397 
398 
399 
400 
401 
402 #define TITLE_OLD		0	/* old (NEXTSTEP 3) style titlebar */
403 #define TITLE_NEXT4		1	/* NEXTSTEP 4 style titlebar */
404 
405 #define ASIMMAN_PATH_PIXMAPPATH  	0
406 #define ASIMMAN_PATH_IMAGEPATH   	1
407 #define ASIMMAN_PATH_PATH   		2
408 #define ASIMMAN_PATH_PRIVICONS		3
409 #define ASIMMAN_PATH_PRIVBACKS		4
410 
411 #ifdef __cplusplus
412 }
413 #endif
414 
415 
416 
417 #endif /* #ifndef AFTERSTEP_H_HEADER_INCLUDED */
418