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 typedef struct button
{
207 int index
; /* index into button array */
208 int x
, y
, w
, h
; /* current coords of button */
213 char *display_string
;
215 Uchar iconified
, state
;
216 int ex
, ey
, ew
, eh
; /* expose damage relatively the main win */
220 typedef struct button_array
{
222 int num_buttons
, drawn_num_buttons
; /* size of buttons array */
223 int num_windows
, drawn_num_windows
; /* number of windows with buttons */
238 /* Things which we can change go in here.
239 * Things like border width go in WinManager */
240 int x
, y
, width
, height
;
241 int gravity_x
, gravity_y
; /* anchor point for window's gravity */
242 unsigned int rows
, cols
;
243 int boxheight
, boxwidth
;
253 SortNone
, /* no sorting */
254 SortId
, /* sort by window id */
255 SortName
, /* case insensitive name sorting */
256 SortNameCase
, /* case sensitive name sorting */
257 SortWeighted
, /* custom sort order */
268 typedef struct win_manager
{
272 /* .fvwm2rc options or things set as a result of options */
275 Pixel backcolor
[NUM_CONTEXTS
], forecolor
[NUM_CONTEXTS
];
276 Pixel hicolor
[NUM_CONTEXTS
], shadowcolor
[NUM_CONTEXTS
];
277 GC hiContext
[NUM_CONTEXTS
], backContext
[NUM_CONTEXTS
],
278 reliefContext
[NUM_CONTEXTS
];
279 GC shadowContext
[NUM_CONTEXTS
], flatContext
[NUM_CONTEXTS
];
280 FlocaleFont
*FButtonFont
;
285 Binding
*bindings
[NUM_ACTIONS
];
287 int colorsets
[NUM_CONTEXTS
];
288 Pixmap pixmap
[NUM_CONTEXTS
];
289 char *backColorName
[NUM_CONTEXTS
];
290 char *foreColorName
[NUM_CONTEXTS
];
291 ButtonState buttonState
[NUM_CONTEXTS
];
292 char *geometry_str
, *button_geometry_str
;
293 int max_button_width
;
294 int max_button_width_columns
;
295 char *titlename
, *iconname
;
297 NameType format_depend
;
301 WeightedSort
*weighted_sorts
;
302 int weighted_sorts_len
, weighted_sorts_size
;
304 Uchar showonlyiconic
;
305 Uchar showonlyfocused
;
308 rectangle managed_g
; /* dimensions of managed screen portion */
309 int relief_thickness
; /* relief thickness for each non-flat button */
311 #define TIPS_ALWAYS 1
312 #define TIPS_NEEDED 2
315 char *tips_formatstring
;
316 ftips_config
*tips_conf
;
319 Window theWindow
, theFrame
;
320 long sizehints_flags
;
322 int fontheight
, fontwidth
;
323 int win_title
, win_border
;
325 Uchar cursor_in_window
;
327 Uchar can_draw
; /* = 0 until we get our first ConfigureNotify */
331 ManGeometry geometry
, drawn_geometry
;
332 Button
*select_button
, *focus_button
, *tipped_button
;
333 Uchar window_mapped
, drawn_mapping
;
334 ShapeState shape
, drawn_shape
;
338 int we_are_drawing
, configures_expected
;
340 Window swallower_win
;
343 unsigned is_shaded
: 1;
344 unsigned needs_resize_after_unshade
: 1;
348 #define MANAGER_EMPTY(man) ((man)->buttons.num_windows == 0)
352 Ulong x
, y
; /* of the view window */
353 WinManager
*managers
;
364 char *forecolor
[2]; /* 0 is mono, 1 is color */
365 char *backcolor
[2]; /* 0 is mono, 1 is color */
369 extern char *contextNames
[NUM_CONTEXTS
];
371 extern GlobalData globals
;
372 extern int fvwm_fd
[2];
374 extern Display
*theDisplay
;
377 extern int ModuleLen
;
378 extern ContextDefaults contextDefaults
[];
379 extern int mods_unused
;
381 extern void ReadFvwmPipe(void);
382 extern void Free (void *p
);
383 extern void ShutMeDown (int flag
) __attribute__ ((__noreturn__
));
384 extern RETSIGTYPE
DeadPipe (int nothing
);
385 extern char *copy_string (char **target
, const char *src
);
387 extern void init_globals (void);
388 extern int allocate_managers (int num
);
389 extern int expand_weighted_sorts (void);
391 extern WinData
*new_windata (void);
392 extern void free_windata (WinData
*p
);
393 extern int check_win_complete (WinData
*p
);
394 int check_resolution(WinManager
*man
, WinData
*win
);
395 extern WinManager
*figure_win_manager (WinData
*win
, Uchar mask
);
396 extern void init_winlists (void);
397 extern void delete_win_hashtab (WinData
*win
);
398 extern void insert_win_hashtab (WinData
*win
);
399 extern WinData
*find_win_hashtab (Ulong id
);
400 extern void walk_hashtab (void (*func
)(void *));
401 extern int accumulate_walk_hashtab (int (*func
)(void *));
402 extern void print_stringlist (StringList
*list
);
403 extern void add_to_stringlist (StringList
*list
, char *s
);
404 extern void update_window_stuff (WinManager
*man
);
405 extern void print_managers (void);
407 extern WinManager
*find_windows_manager (Window win
);
408 extern int win_in_viewport (WinData
*win
);
409 extern WinData
*id_to_win(Ulong id
);
411 #endif /* IN_FVWMICONMAN_H */