From: Bastien Dejean Date: Tue, 18 May 2021 14:37:53 +0000 (+0200) Subject: Propagate the size constraints towards the root X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=101d83ff7cf75430f24a3c7c4e2e76e16ecce341;p=bspwm.git Propagate the size constraints towards the root --- diff --git a/src/tree.c b/src/tree.c index ec7a785..a1fd906 100644 --- a/src/tree.c +++ b/src/tree.c @@ -1183,7 +1183,8 @@ void find_by_area(area_peak_t ap, coordinates_t *ref, coordinates_t *dst, node_s void rotate_tree(node_t *n, int deg) { rotate_tree_rec(n, deg); - rebuild_constraints(n); + rebuild_constraints_from_leaves(n); + rebuild_constraints_towards_root(n); } void rotate_tree_rec(node_t *n, int deg) @@ -1966,17 +1967,32 @@ void neutralize_occluding_windows(monitor_t *m, desktop_t *d, node_t *n) } } -void rebuild_constraints(node_t *n) +void rebuild_constraints_from_leaves(node_t *n) { if (n == NULL || is_leaf(n)) { return; } else { - rebuild_constraints(n->first_child); - rebuild_constraints(n->second_child); + rebuild_constraints_from_leaves(n->first_child); + rebuild_constraints_from_leaves(n->second_child); update_constraints(n); } } +void rebuild_constraints_towards_root(node_t *n) +{ + if (n == NULL) { + return; + } + + node_t *p = n->parent; + + if (p != NULL) { + update_constraints(p); + } + + rebuild_constraints_towards_root(p); +} + void update_constraints(node_t *n) { if (n == NULL || is_leaf(n)) { diff --git a/src/tree.h b/src/tree.h index 5a83a01..1acc4bb 100644 --- a/src/tree.h +++ b/src/tree.h @@ -99,7 +99,8 @@ bool set_state(monitor_t *m, desktop_t *d, node_t *n, client_state_t s); void set_floating(monitor_t *m, desktop_t *d, node_t *n, bool value); void set_fullscreen(monitor_t *m, desktop_t *d, node_t *n, bool value); void neutralize_occluding_windows(monitor_t *m, desktop_t *d, node_t *n); -void rebuild_constraints(node_t *n); +void rebuild_constraints_from_leaves(node_t *n); +void rebuild_constraints_towards_root(node_t *n); void update_constraints(node_t *n); void propagate_flags_upward(monitor_t *m, desktop_t *d, node_t *n); void set_hidden(monitor_t *m, desktop_t *d, node_t *n, bool value);