Fixed dwindle on ultrawides

This commit is contained in:
Tsuki 2026-08-29 07:59:37 +08:00
parent 50fc8532be
commit 984bb8e293

View file

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