]> git.lizzy.rs Git - bspwm.git/blob - src/tree.h
1acc4bb8b09a1036f2b03ff5ef51572b4d8e8c4a
[bspwm.git] / src / tree.h
1 /* Copyright (c) 2012, Bastien Dejean
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  *    list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright notice,
10  *    this list of conditions and the following disclaimer in the documentation
11  *    and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #ifndef BSPWM_TREE_H
26 #define BSPWM_TREE_H
27
28 #define MIN_WIDTH   32
29 #define MIN_HEIGHT  32
30
31 void arrange(monitor_t *m, desktop_t *d);
32 void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, xcb_rectangle_t root_rect);
33 presel_t *make_presel(void);
34 void set_ratio(node_t *n, double rat);
35 void presel_dir(monitor_t *m, desktop_t *d, node_t *n, direction_t dir);
36 void presel_ratio(monitor_t *m, desktop_t *d, node_t *n, double ratio);
37 void cancel_presel(monitor_t *m, desktop_t *d, node_t *n);
38 void cancel_presel_in(monitor_t *m, desktop_t *d, node_t *n);
39 node_t *find_public(desktop_t *d);
40 node_t *insert_node(monitor_t *m, desktop_t *d, node_t *n, node_t *f);
41 void insert_receptacle(monitor_t *m, desktop_t *d, node_t *n);
42 bool activate_node(monitor_t *m, desktop_t *d, node_t *n);
43 void transfer_sticky_nodes(monitor_t *ms, desktop_t *ds, monitor_t *md, desktop_t *dd, node_t *n);
44 bool focus_node(monitor_t *m, desktop_t *d, node_t *n);
45 void hide_node(desktop_t *d, node_t *n);
46 void show_node(desktop_t *d, node_t *n);
47 node_t *make_node(uint32_t id);
48 client_t *make_client(void);
49 void initialize_client(node_t *n);
50 bool is_focusable(node_t *n);
51 bool is_leaf(node_t *n);
52 bool is_first_child(node_t *n);
53 bool is_second_child(node_t *n);
54 unsigned int clients_count_in(node_t *n);
55 node_t *brother_tree(node_t *n);
56 node_t *first_extrema(node_t *n);
57 node_t *second_extrema(node_t *n);
58 node_t *first_focusable_leaf(node_t *n);
59 node_t *next_node(node_t *n);
60 node_t *prev_node(node_t *n);
61 node_t *next_leaf(node_t *n, node_t *r);
62 node_t *prev_leaf(node_t *n, node_t *r);
63 node_t *next_tiled_leaf(node_t *n, node_t *r);
64 node_t *prev_tiled_leaf(node_t *n, node_t *r);
65 bool is_adjacent(node_t *a, node_t *b, direction_t dir);
66 node_t *find_fence(node_t *n, direction_t dir);
67 bool is_child(node_t *a, node_t *b);
68 bool is_descendant(node_t *a, node_t *b);
69 bool find_by_id(uint32_t id, coordinates_t *loc);
70 node_t *find_by_id_in(node_t *r, uint32_t id);
71 void find_any_node(coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
72 bool find_any_node_in(monitor_t *m, desktop_t *d, node_t *n, coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
73 void find_first_ancestor(coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
74 void find_nearest_neighbor(coordinates_t *ref, coordinates_t *dst, direction_t dir, node_select_t *sel);
75 unsigned int node_area(desktop_t *d, node_t *n);
76 int tiled_count(node_t *n, bool include_receptacles);
77 void find_by_area(area_peak_t ap, coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
78 void rotate_tree(node_t *n, int deg);
79 void rotate_tree_rec(node_t *n, int deg);
80 void flip_tree(node_t *n, flip_t flp);
81 void equalize_tree(node_t *n);
82 int balance_tree(node_t *n);
83 void adjust_ratios(node_t *n, xcb_rectangle_t rect);
84 void unlink_node(monitor_t *m, desktop_t *d, node_t *n);
85 void close_node(node_t *n);
86 void kill_node(monitor_t *m, desktop_t *d, node_t *n);
87 void remove_node(monitor_t *m, desktop_t *d, node_t *n);
88 void free_node(node_t *n);
89 bool swap_nodes(monitor_t *m1, desktop_t *d1, node_t *n1, monitor_t *m2, desktop_t *d2, node_t *n2, bool follow);
90 bool transfer_node(monitor_t *ms, desktop_t *ds, node_t *ns, monitor_t *md, desktop_t *dd, node_t *nd, bool follow);
91 bool find_closest_node(coordinates_t *ref, coordinates_t *dst, cycle_dir_t dir, node_select_t *sel);
92 void circulate_leaves(monitor_t *m, desktop_t *d, node_t *n, circulate_dir_t dir);
93 void set_vacant(monitor_t *m, desktop_t *d, node_t *n, bool value);
94 void set_vacant_local(monitor_t *m, desktop_t *d, node_t *n, bool value);
95 void propagate_vacant_downward(monitor_t *m, desktop_t *d, node_t *n, bool value);
96 void propagate_vacant_upward(monitor_t *m, desktop_t *d, node_t *n);
97 bool set_layer(monitor_t *m, desktop_t *d, node_t *n, stack_layer_t l);
98 bool set_state(monitor_t *m, desktop_t *d, node_t *n, client_state_t s);
99 void set_floating(monitor_t *m, desktop_t *d, node_t *n, bool value);
100 void set_fullscreen(monitor_t *m, desktop_t *d, node_t *n, bool value);
101 void neutralize_occluding_windows(monitor_t *m, desktop_t *d, node_t *n);
102 void rebuild_constraints_from_leaves(node_t *n);
103 void rebuild_constraints_towards_root(node_t *n);
104 void update_constraints(node_t *n);
105 void propagate_flags_upward(monitor_t *m, desktop_t *d, node_t *n);
106 void set_hidden(monitor_t *m, desktop_t *d, node_t *n, bool value);
107 void set_hidden_local(monitor_t *m, desktop_t *d, node_t *n, bool value);
108 void propagate_hidden_downward(monitor_t *m, desktop_t *d, node_t *n, bool value);
109 void propagate_hidden_upward(monitor_t *m, desktop_t *d, node_t *n);
110 void set_sticky(monitor_t *m, desktop_t *d, node_t *n, bool value);
111 void set_private(monitor_t *m, desktop_t *d, node_t *n, bool value);
112 void set_locked(monitor_t *m, desktop_t *d, node_t *n, bool value);
113 void set_marked(monitor_t *m, desktop_t *d, node_t *n, bool value);
114 void set_urgent(monitor_t *m, desktop_t *d, node_t *n, bool value);
115 xcb_rectangle_t get_rectangle(monitor_t *m, desktop_t *d, node_t *n);
116 void listen_enter_notify(node_t *n, bool enable);
117 void regenerate_ids_in(node_t *n);
118
119 unsigned int sticky_count(node_t *n);
120 unsigned int private_count(node_t *n);
121 unsigned int locked_count(node_t *n);
122
123 #endif