diff --git a/src/swindle.c b/src/swindle.c index fd435aa..da4f6f2 100644 --- a/src/swindle.c +++ b/src/swindle.c @@ -3257,7 +3257,9 @@ dwindle_recalc(DwindleNode *n, int gap) return; } - + /* Wider than tall -> split left/right; taller -> split top/bottom. */ + n->split_top = (n->box.height > n->box.width); + if (!n->split_top) { int w1 = MAX(1, (int)(n->box.width / 2.0f * n->split_ratio) - gap / 2); n->children[0]->box = (struct wlr_box){ @@ -3339,20 +3341,17 @@ dwindle_insert(DwindleNode **root, Client *new_c, Client *focused, DwindleHint * if (!opening_on) opening_on = dwindle_first_leaf(*root); - int new_split_top = opening_on->parent - ? !opening_on->parent->split_top - : (opening_on->box.height > opening_on->box.width); - if (hint) { + int split_top = (opening_on->box.height > opening_on->box.width); hint->old_box = opening_on->box; - hint->edge = new_split_top ? EDGE_BOTTOM : EDGE_RIGHT; + hint->edge = split_top ? EDGE_BOTTOM : EDGE_RIGHT; } DwindleNode *new_parent = dwindle_new_node(); new_parent->is_node = 1; new_parent->box = opening_on->box; new_parent->parent = opening_on->parent; - new_parent->split_top = new_split_top; + new_parent->split_top = (opening_on->box.height > opening_on->box.width); new_parent->children[0] = opening_on; new_parent->children[1] = new_leaf; @@ -4220,3 +4219,4 @@ main(int argc, char *argv[]) usage: die("Usage: %s [-v] [-d] [-s startup command] [-c config file]", argv[0]); } +