]> git.lizzy.rs Git - bspwm.git/commitdiff
Propagate the size constraints towards the root
authorBastien Dejean <nihilhill@gmail.com>
Tue, 18 May 2021 14:37:53 +0000 (16:37 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 18 May 2021 14:37:53 +0000 (16:37 +0200)
src/tree.c
src/tree.h

index ec7a785a3d22e49660a53d06ec6d134c95866cae..a1fd906696d44e3edd724d68b0fde9e9c9713cdd 100644 (file)
@@ -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)) {
index 5a83a01ca180708badc29ca071c31dddc3c3e23b..1acc4bb8b09a1036f2b03ff5ef51572b4d8e8c4a 100644 (file)
@@ -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);