2 #ifndef IN_FVWMICONMAN_H
3 #define IN_FVWMICONMAN_H
8 #include "libs/ftime.h"
11 #include <X11/Intrinsic.h>
13 #include "libs/fvwmlib.h"
14 #include "libs/Flocale.h"
15 #include "libs/Picture.h"
16 #include "libs/Colorset.h"
17 #include "libs/Bindings.h"
18 #include "libs/charmap.h"
19 #include "libs/modifiers.h"
22 #include "fvwm/fvwm.h"
23 #include "libs/vpacket.h"
24 #include "libs/FTips.h"
26 #ifndef DEFAULT_ACTION
27 #define DEFAULT_ACTION "Iconify"
34 #define MALLOC_MAGIC 0xdeadbeaf
36 #define SET_BIT(field,bit) ((field) |= (bit))
37 #define CLEAR_BIT(field,bit) ((field) &= ~(bit))
39 #define SET_BIT_TO_VAL(field,bit,val) ((val) ? SET_BIT (field,bit) : CLEAR_BIT (field, bit))
43 struct malloc_header
{
44 unsigned long magic
, len
;
53 extern void PrintMemuse(void);
55 typedef unsigned long Ulong
;
56 typedef unsigned char Uchar
;
58 typedef signed char Schar
;
65 NO_SHOW_DESKTOP
, /* "!desk" Show windows not on the current desk */
66 NO_SHOW_PAGE
, /* "!page" Show windows not on the current page */
67 NO_SHOW_SCREEN
, /* "!screen" Show windows not on the current screen */
84 /* The clicks must be the first three elements in this type, X callbacks
98 /* had better be FOCUS_CONTEXT | SELECT_CONTEXT */
99 FOCUS_SELECT_CONTEXT
= 3,
115 typedef struct win_list
{
117 struct win_data
*head
, *tail
;
120 typedef struct string_list
{
123 struct string_list
*next
;
152 } ButtonType
; /* doubles for manager too */
159 typedef struct builtin_arg
{
163 ButtonValue button_value
;
168 typedef struct Function
{
169 int (*func
)(int numargs
, BuiltinArg
*args
);
171 BuiltinArg args
[MAX_ARGS
];
172 struct Function
*next
;
173 struct Function
*prev
;
176 typedef struct win_data
{
177 struct button
*button
;
178 /* stuff shadowed in the Button structure */
181 Uchar iconified
, state
;
184 long x
, y
, width
, height
;
186 rectangle real_g
; /* geometry of the client possibliy shaded */
188 /* Ulong fvwm_flags; */
190 struct win_data
*win_prev
, *win_next
;
191 struct win_manager
*manager
;
193 int geometry_set
: 1;
196 /* this data must be freed */
197 char *display_string
; /* what gets shown in the manager window */
203 char *visible_icon_name
;
206 #define WINDATA_ICONIFIED(win) ((win)->iconified)
208 typedef struct button
{
209 int index
; /* index into button array */
210 int x
, y
, w
, h
; /* current coords of button */
215 char *display_string
;
217 Uchar iconified
, state
;
218 int ex
, ey
, ew
, eh
; /* expose damage relatively the main win */
222 typedef struct button_array
{
224 int num_buttons
, drawn_num_buttons
; /* size of buttons array */
225 int num_windows
, drawn_num_windows
; /* number of windows with buttons */
240 /* Things which we can change go in here.
241 * Things like border width go in WinManager */
242 int x
, y
, width
, height
;
243 int gravity_x
, gravity_y
; /* anchor point for window's gravity */
244 unsigned int rows
, cols
;
245 int boxheight
, boxwidth
;
255 SortNone
, /* no sorting */
256 SortId
, /* sort by window id */
257 SortName
, /* case insensitive name sorting */
258 SortNameCase
, /* case sensitive name sorting */
259 SortWeighted
, /* custom sort order */
270 typedef struct win_manager
{
274 /* .fvwm2rc options or things set as a result of options */
277 Pixel backcolor
[NUM_CONTEXTS
], forecolor
[NUM_CONTEXTS
];
278 Pixel hicolor
[NUM_CONTEXTS
], shadowcolor
[NUM_CONTEXTS
];
279 GC hiContext
[NUM_CONTEXTS
], backContext
[NUM_CONTEXTS
],
280 reliefContext
[NUM_CONTEXTS
];
281 GC shadowContext
[NUM_CONTEXTS
], flatContext
[NUM_CONTEXTS
];
282 FlocaleFont
*FButtonFont
;
287 Binding
*bindings
[NUM_ACTIONS
];
289 int colorsets
[NUM_CONTEXTS
];
290 Pixmap pixmap
[NUM_CONTEXTS
];
291 char *backColorName
[NUM_CONTEXTS
];
292 char *foreColorName
[NUM_CONTEXTS
];
293 ButtonState buttonState
[NUM_CONTEXTS
];
294 char *geometry_str
, *button_geometry_str
;
295 int max_button_width
;
296 int max_button_width_columns
;
297 char *titlename
, *iconname
;
299 NameType format_depend
;
303 WeightedSort
*weighted_sorts
;
304 int weighted_sorts_len
, weighted_sorts_size
;
306 Uchar showonlyiconic
;
307 Uchar showonlyfocused
;
310 rectangle managed_g
; /* dimensions of managed screen portion */
311 int relief_thickness
; /* relief thickness for each non-flat button */
313 #define TIPS_ALWAYS 1
314 #define TIPS_NEEDED 2
317 char *tips_formatstring
;
318 ftips_config
*tips_conf
;
321 Window theWindow
, theFrame
;
322 long sizehints_flags
;
324 int fontheight
, fontwidth
;
325 int win_title
, win_border
;
327 Uchar cursor_in_window
;
329 Uchar can_draw
; /* = 0 until we get our first ConfigureNotify */
333 ManGeometry geometry
, drawn_geometry
;
334 Button
*select_button
, *focus_button
, *tipped_button
;
335 Uchar window_mapped
, drawn_mapping
;
336 ShapeState shape
, drawn_shape
;
340 int we_are_drawing
, configures_expected
;
342 Window swallower_win
;
345 unsigned is_shaded
: 1;
346 unsigned needs_resize_after_unshade
: 1;
350 #define MANAGER_EMPTY(man) ((man)->buttons.num_windows == 0)
354 Ulong x
, y
; /* of the view window */
355 WinManager
*managers
;
366 char *forecolor
[2]; /* 0 is mono, 1 is color */
367 char *backcolor
[2]; /* 0 is mono, 1 is color */
371 extern char *contextNames
[NUM_CONTEXTS
];
373 extern GlobalData globals
;
374 extern int fvwm_fd
[2];
376 extern Display
*theDisplay
;
379 extern int ModuleLen
;
380 extern ContextDefaults contextDefaults
[];
381 extern int mods_unused
;
383 extern void ReadFvwmPipe(void);
384 extern void Free (void *p
);
385 extern void ShutMeDown (int flag
) __attribute__ ((__noreturn__
));
386 extern RETSIGTYPE
DeadPipe (int nothing
);
387 extern char *copy_string (char **target
, const char *src
);
389 extern void init_globals (void);
390 extern int allocate_managers (int num
);
391 extern int expand_weighted_sorts (void);
393 extern WinData
*new_windata (void);
394 extern void free_windata (WinData
*p
);
395 extern int check_win_complete (WinData
*p
);
396 int check_resolution(WinManager
*man
, WinData
*win
);
397 extern WinManager
*figure_win_manager (WinData
*win
, Uchar mask
);
398 extern void init_winlists (void);
399 extern void delete_win_hashtab (WinData
*win
);
400 extern void insert_win_hashtab (WinData
*win
);
401 extern WinData
*find_win_hashtab (Ulong id
);
402 extern void walk_hashtab (void (*func
)(void *));
403 extern int accumulate_walk_hashtab (int (*func
)(void *));
404 extern void print_stringlist (StringList
*list
);
405 extern void add_to_stringlist (StringList
*list
, char *s
);
406 extern void update_window_stuff (WinManager
*man
);
407 extern void print_managers (void);
409 extern WinManager
*find_windows_manager (Window win
);
410 extern int win_in_viewport (WinData
*win
);
411 extern WinData
*id_to_win(Ulong id
);
413 #endif /* IN_FVWMICONMAN_H */