break change: new monitorrule format

This commit is contained in:
DreamMaoMao 2026-01-27 14:45:28 +08:00
parent 722aa6e76e
commit 9f476a1a07
4 changed files with 149 additions and 148 deletions

View file

@ -117,6 +117,7 @@ void deck(Monitor *m) {
Client *c = NULL;
Client *fc = NULL;
float mfact;
uint32_t nmasters = m->pertag->nmasters[m->pertag->curtag];
int32_t cur_gappih = enablegaps ? m->gappih : 0;
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
@ -142,8 +143,8 @@ void deck(Monitor *m) {
: m->pertag->mfacts[m->pertag->curtag];
// Calculate master width including outer gaps
if (n > m->nmaster)
mw = m->nmaster ? round((m->w.width - 2 * cur_gappoh) * mfact) : 0;
if (n > nmasters)
mw = nmasters ? round((m->w.width - 2 * cur_gappoh) * mfact) : 0;
else
mw = m->w.width - 2 * cur_gappoh;
@ -151,7 +152,7 @@ void deck(Monitor *m) {
wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || !ISTILED(c))
continue;
if (i < m->nmaster) {
if (i < nmasters) {
c->master_mfact_per = mfact;
// Master area clients
resize(
@ -160,7 +161,7 @@ void deck(Monitor *m) {
.y = m->w.y + cur_gappov + my,
.width = mw,
.height = (m->w.height - 2 * cur_gappov - my) /
(MIN(n, m->nmaster) - i)},
(MIN(n, nmasters) - i)},
0);
my += c->geom.height;
} else {

View file

@ -110,6 +110,7 @@ void vertical_deck(Monitor *m) {
Client *c = NULL;
Client *fc = NULL;
float mfact;
uint32_t nmasters = m->pertag->nmasters[m->pertag->curtag];
int32_t cur_gappiv = enablegaps ? m->gappiv : 0;
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
@ -134,8 +135,8 @@ void vertical_deck(Monitor *m) {
mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per
: m->pertag->mfacts[m->pertag->curtag];
if (n > m->nmaster)
mh = m->nmaster ? round((m->w.height - 2 * cur_gappov) * mfact) : 0;
if (n > nmasters)
mh = nmasters ? round((m->w.height - 2 * cur_gappov) * mfact) : 0;
else
mh = m->w.height - 2 * cur_gappov;
@ -143,13 +144,13 @@ void vertical_deck(Monitor *m) {
wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || !ISTILED(c))
continue;
if (i < m->nmaster) {
if (i < nmasters) {
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, m->nmaster) - i),
(MIN(n, nmasters) - i),
.height = mh},
0);
mx += c->geom.width;