Close fd in CMD_Exec
[fvwm.git] / libs / gravity.h
blobc8221f697abf3e450bc93ec1c74cdc2f72d54428
1 /* -*-c-*- */
3 #ifndef GRAVITY_H
4 #define GRAVITY_H
6 /* ---------------------------- included header files ---------------------- */
8 /* ---------------------------- global definitions ------------------------- */
10 /* ---------------------------- global macros ------------------------------ */
12 /* ---------------------------- type definitions --------------------------- */
14 typedef enum
16 DIR_NONE = -1,
17 DIR_N = 0,
18 DIR_E = 1,
19 DIR_S = 2,
20 DIR_W = 3,
21 DIR_MAJOR_MASK = 3,
22 DIR_NE = 4,
23 DIR_SE = 5,
24 DIR_SW = 6,
25 DIR_NW = 7,
26 DIR_MINOR_MASK = 7,
27 DIR_MASK = 7,
28 DIR_C = 8,
29 DIR_ALL_MASK = 8
30 } direction_t;
32 typedef enum
34 MULTI_DIR_NONE = 0,
35 MULTI_DIR_FIRST = (1 << DIR_N),
36 MULTI_DIR_N = (1 << DIR_N),
37 MULTI_DIR_E = (1 << DIR_E),
38 MULTI_DIR_S = (1 << DIR_S),
39 MULTI_DIR_W = (1 << DIR_W),
40 MULTI_DIR_NE = (1 << DIR_NE),
41 MULTI_DIR_SE = (1 << DIR_SE),
42 MULTI_DIR_SW = (1 << DIR_SW),
43 MULTI_DIR_NW = (1 << DIR_NW),
44 MULTI_DIR_ALL = ((1 << (DIR_MASK + 1)) - 1),
45 MULTI_DIR_C = (1 << DIR_C),
46 MULTI_DIR_LAST = (1 << DIR_ALL_MASK)
47 } multi_direction_t;
49 typedef enum
51 ROTATION_0 = 0,
52 ROTATION_90 = 1,
53 ROTATION_180 = 2,
54 ROTATION_270 = 3,
55 ROTATION_MASK = 3
56 } rotation_t;
58 /* ---------------------------- exported variables (globals) --------------- */
60 /* ---------------------------- interface functions ------------------------ */
62 void gravity_get_offsets(int grav, int *xp,int *yp);
63 void gravity_move(int gravity, rectangle *rect, int xdiff, int ydiff);
64 void gravity_resize(int gravity, rectangle *rect, int wdiff, int hdiff);
65 void gravity_move_resize_parent_child(
66 int child_gravity, rectangle *parent_diff_r, rectangle *child_r);
67 direction_t gravity_grav_to_dir(
68 int grav);
69 int gravity_dir_to_grav(
70 direction_t dir);
71 int gravity_combine_xy_grav(
72 int grav_x, int grav_y);
73 void gravity_split_xy_grav(
74 int *ret_grav_x, int *ret_grav_y, int in_grav);
75 int gravity_combine_xy_dir(
76 int dir_x, int dir_y);
77 void gravity_split_xy_dir(
78 int *ret_dir_x, int *ret_dir_y, int in_dir);
79 int gravity_dir_to_sign_one_axis(
80 direction_t dir);
81 direction_t gravity_parse_dir_argument(
82 char *action, char **ret_action, direction_t default_ret);
83 char *gravity_dir_to_string(direction_t dir, char *default_str);
84 multi_direction_t gravity_parse_multi_dir_argument(
85 char *action, char **ret_action);
86 void gravity_get_next_multi_dir(int dir_set, multi_direction_t *dir);
87 direction_t gravity_multi_dir_to_dir(multi_direction_t mdir);
88 void gravity_rotate_xy(rotation_t rot, int x, int y, int *ret_x, int *ret_y);
89 rotation_t gravity_add_rotations(rotation_t rot1, rotation_t rot2);
91 #endif /* GRAVITY_H */