]> git.lizzy.rs Git - bspwm.git/blob - src/tree.h
Adjust nearby ratios when moving a fence
[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, layout_t l, 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_leaf(node_t *n, node_t *r);
60 node_t *prev_leaf(node_t *n, node_t *r);
61 node_t *next_tiled_leaf(node_t *n, node_t *r);
62 node_t *prev_tiled_leaf(node_t *n, node_t *r);
63 bool is_adjacent(node_t *a, node_t *b, direction_t dir);
64 node_t *find_fence(node_t *n, direction_t dir);
65 bool is_child(node_t *a, node_t *b);
66 bool is_descendant(node_t *a, node_t *b);
67 bool find_by_id(uint32_t id, coordinates_t *loc);
68 node_t *find_by_id_in(node_t *r, uint32_t id);
69 void find_any_node(coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
70 bool find_any_node_in(monitor_t *m, desktop_t *d, node_t *n, coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
71 void find_nearest_neighbor(coordinates_t *ref, coordinates_t *dst, direction_t dir, node_select_t *sel);
72 unsigned int node_area(desktop_t *d, node_t *n);
73 int tiled_count(node_t *n, bool include_receptacles);
74 void find_by_area(area_peak_t ap, coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
75 void rotate_tree(node_t *n, int deg);
76 void rotate_tree_rec(node_t *n, int deg);
77 void flip_tree(node_t *n, flip_t flp);
78 void equalize_tree(node_t *n);
79 int balance_tree(node_t *n);
80 void adjust_ratios(node_t *n, xcb_rectangle_t rect);
81 void unlink_node(monitor_t *m, desktop_t *d, node_t *n);
82 void close_node(node_t *n);
83 void kill_node(monitor_t *m, desktop_t *d, node_t *n);
84 void remove_node(monitor_t *m, desktop_t *d, node_t *n);
85 void free_node(node_t *n);
86 bool swap_nodes(monitor_t *m1, desktop_t *d1, node_t *n1, monitor_t *m2, desktop_t *d2, node_t *n2, bool follow);
87 bool transfer_node(monitor_t *ms, desktop_t *ds, node_t *ns, monitor_t *md, desktop_t *dd, node_t *nd, bool follow);
88 bool find_closest_node(coordinates_t *ref, coordinates_t *dst, cycle_dir_t dir, node_select_t *sel);
89 void circulate_leaves(monitor_t *m, desktop_t *d, node_t *n, circulate_dir_t dir);
90 void set_vacant(monitor_t *m, desktop_t *d, node_t *n, bool value);
91 void set_vacant_local(monitor_t *m, desktop_t *d, node_t *n, bool value);
92 void propagate_vacant_downward(monitor_t *m, desktop_t *d, node_t *n, bool value);
93 void propagate_vacant_upward(monitor_t *m, desktop_t *d, node_t *n);
94 bool set_layer(monitor_t *m, desktop_t *d, node_t *n, stack_layer_t l);
95 bool set_state(monitor_t *m, desktop_t *d, node_t *n, client_state_t s);
96 void set_floating(monitor_t *m, desktop_t *d, node_t *n, bool value);
97 void set_fullscreen(monitor_t *m, desktop_t *d, node_t *n, bool value);
98 void neutralize_occluding_windows(monitor_t *m, desktop_t *d, node_t *n);
99 void rebuild_constraints(node_t *n);
100 void update_constraints(node_t *n);
101 void propagate_flags_upward(monitor_t *m, desktop_t *d, node_t *n);
102 void set_hidden(monitor_t *m, desktop_t *d, node_t *n, bool value);
103 void set_hidden_local(monitor_t *m, desktop_t *d, node_t *n, bool value);
104 void propagate_hidden_downward(monitor_t *m, desktop_t *d, node_t *n, bool value);
105 void propagate_hidden_upward(monitor_t *m, desktop_t *d, node_t *n);
106 void set_sticky(monitor_t *m, desktop_t *d, node_t *n, bool value);
107 void set_private(monitor_t *m, desktop_t *d, node_t *n, bool value);
108 void set_locked(monitor_t *m, desktop_t *d, node_t *n, bool value);
109 void set_marked(monitor_t *m, desktop_t *d, node_t *n, bool value);
110 void set_urgent(monitor_t *m, desktop_t *d, node_t *n, bool value);
111 xcb_rectangle_t get_rectangle(monitor_t *m, desktop_t *d, node_t *n);
112 void listen_enter_notify(node_t *n, bool enable);
113 void regenerate_ids_in(node_t *n);
114
115 unsigned int sticky_count(node_t *n);
116 unsigned int private_count(node_t *n);
117 unsigned int locked_count(node_t *n);
118
119 #endif