fix: deck layout caculate error when multi master

This commit is contained in:
DreamMaoMao 2026-06-09 21:56:48 +08:00
parent 52732c928b
commit ef59224cdb
2 changed files with 20 additions and 24 deletions

View file

@ -500,16 +500,13 @@ void deck(Monitor *m) {
return; return;
wl_list_for_each(fc, &clients, link) { wl_list_for_each(fc, &clients, link) {
if (VISIBLEON(fc, m) && ISFAKETILED(fc)) if (VISIBLEON(fc, m) && ISFAKETILED(fc))
break; break;
} }
// Calculate master width using mfact from pertag
mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per
: m->pertag->mfacts[m->pertag->curtag]; : m->pertag->mfacts[m->pertag->curtag];
// Calculate master width including outer gaps
if (n > nmasters) if (n > nmasters)
mw = nmasters ? round((m->w.width - 2 * cur_gappoh) * mfact) : 0; mw = nmasters ? round((m->w.width - 2 * cur_gappoh) * mfact) : 0;
else else
@ -521,16 +518,15 @@ void deck(Monitor *m) {
continue; continue;
if (i < nmasters) { if (i < nmasters) {
c->master_mfact_per = mfact; c->master_mfact_per = mfact;
// Master area clients int32_t h =
client_tile_resize( (m->w.height - 2 * cur_gappov - my) / (MIN(n, nmasters) - i);
c, client_tile_resize(c,
(struct wlr_box){.x = m->w.x + cur_gappoh, (struct wlr_box){.x = m->w.x + cur_gappoh,
.y = m->w.y + cur_gappov + my, .y = m->w.y + cur_gappov + my,
.width = mw, .width = mw,
.height = (m->w.height - 2 * cur_gappov - my) / .height = h},
(MIN(n, nmasters) - i)}, 0);
0); my += h;
my += c->geom.height;
} else { } else {
// Stack area clients // Stack area clients
c->master_mfact_per = mfact; c->master_mfact_per = mfact;

View file

@ -137,12 +137,10 @@ void vertical_deck(Monitor *m) {
return; return;
wl_list_for_each(fc, &clients, link) { wl_list_for_each(fc, &clients, link) {
if (VISIBLEON(fc, m) && ISFAKETILED(fc)) if (VISIBLEON(fc, m) && ISFAKETILED(fc))
break; break;
} }
// Calculate master width using mfact from pertag
mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per
: m->pertag->mfacts[m->pertag->curtag]; : m->pertag->mfacts[m->pertag->curtag];
@ -156,16 +154,18 @@ void vertical_deck(Monitor *m) {
if (!VISIBLEON(c, m) || !ISFAKETILED(c)) if (!VISIBLEON(c, m) || !ISFAKETILED(c))
continue; continue;
if (i < nmasters) { if (i < nmasters) {
client_tile_resize( c->master_mfact_per = mfact;
c, int32_t w =
(struct wlr_box){.x = m->w.x + cur_gappoh + mx, (m->w.width - 2 * cur_gappoh - mx) / (MIN(n, nmasters) - i);
.y = m->w.y + cur_gappov, client_tile_resize(c,
.width = (m->w.width - 2 * cur_gappoh - mx) / (struct wlr_box){.x = m->w.x + cur_gappoh + mx,
(MIN(n, nmasters) - i), .y = m->w.y + cur_gappov,
.height = mh}, .width = w,
0); .height = mh},
mx += c->geom.width; 0);
mx += w;
} else { } else {
c->master_mfact_per = mfact;
client_tile_resize( client_tile_resize(
c, c,
(struct wlr_box){.x = m->w.x + cur_gappoh, (struct wlr_box){.x = m->w.x + cur_gappoh,