From ef59224cdb110731c361a68959f4596665e6d2a2 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 9 Jun 2026 21:56:48 +0800 Subject: [PATCH] fix: deck layout caculate error when multi master --- src/layout/horizontal.h | 22 +++++++++------------- src/layout/vertical.h | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index 24eed392..419e218a 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -500,16 +500,13 @@ void deck(Monitor *m) { return; wl_list_for_each(fc, &clients, link) { - if (VISIBLEON(fc, m) && ISFAKETILED(fc)) break; } - // Calculate master width using mfact from pertag mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per : m->pertag->mfacts[m->pertag->curtag]; - // Calculate master width including outer gaps if (n > nmasters) mw = nmasters ? round((m->w.width - 2 * cur_gappoh) * mfact) : 0; else @@ -521,16 +518,15 @@ void deck(Monitor *m) { continue; if (i < nmasters) { c->master_mfact_per = mfact; - // Master area clients - client_tile_resize( - c, - (struct wlr_box){.x = m->w.x + cur_gappoh, - .y = m->w.y + cur_gappov + my, - .width = mw, - .height = (m->w.height - 2 * cur_gappov - my) / - (MIN(n, nmasters) - i)}, - 0); - my += c->geom.height; + int32_t h = + (m->w.height - 2 * cur_gappov - my) / (MIN(n, nmasters) - i); + client_tile_resize(c, + (struct wlr_box){.x = m->w.x + cur_gappoh, + .y = m->w.y + cur_gappov + my, + .width = mw, + .height = h}, + 0); + my += h; } else { // Stack area clients c->master_mfact_per = mfact; diff --git a/src/layout/vertical.h b/src/layout/vertical.h index 6e058dea..b1de212e 100644 --- a/src/layout/vertical.h +++ b/src/layout/vertical.h @@ -137,12 +137,10 @@ void vertical_deck(Monitor *m) { return; wl_list_for_each(fc, &clients, link) { - if (VISIBLEON(fc, m) && ISFAKETILED(fc)) break; } - // Calculate master width using mfact from pertag mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per : m->pertag->mfacts[m->pertag->curtag]; @@ -156,16 +154,18 @@ void vertical_deck(Monitor *m) { if (!VISIBLEON(c, m) || !ISFAKETILED(c)) continue; if (i < nmasters) { - client_tile_resize( - c, - (struct wlr_box){.x = m->w.x + cur_gappoh + mx, - .y = m->w.y + cur_gappov, - .width = (m->w.width - 2 * cur_gappoh - mx) / - (MIN(n, nmasters) - i), - .height = mh}, - 0); - mx += c->geom.width; + c->master_mfact_per = mfact; + int32_t w = + (m->w.width - 2 * cur_gappoh - mx) / (MIN(n, nmasters) - i); + client_tile_resize(c, + (struct wlr_box){.x = m->w.x + cur_gappoh + mx, + .y = m->w.y + cur_gappov, + .width = w, + .height = mh}, + 0); + mx += w; } else { + c->master_mfact_per = mfact; client_tile_resize( c, (struct wlr_box){.x = m->w.x + cur_gappoh,