From 984bb8e29338ccc2edd45efec03ca85055db1a60 Mon Sep 17 00:00:00 2001 From: Tsuki Date: Sat, 29 Aug 2026 07:59:37 +0800 Subject: [PATCH] Fixed dwindle on ultrawides --- src/swindle.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/swindle.c b/src/swindle.c index da4f6f2..fd435aa 100644 --- a/src/swindle.c +++ b/src/swindle.c @@ -3257,9 +3257,7 @@ 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){ @@ -3341,17 +3339,20 @@ 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 = split_top ? EDGE_BOTTOM : EDGE_RIGHT; + hint->edge = new_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 = (opening_on->box.height > opening_on->box.width); + new_parent->split_top = new_split_top; new_parent->children[0] = opening_on; new_parent->children[1] = new_leaf; @@ -4219,4 +4220,3 @@ main(int argc, char *argv[]) usage: die("Usage: %s [-v] [-d] [-s startup command] [-c config file]", argv[0]); } -