mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-02 09:01:43 -05:00
fix: deck and tile layout gap error
This commit is contained in:
parent
2e553e3dc5
commit
4b8a3d77c3
2 changed files with 48 additions and 52 deletions
|
|
@ -245,12 +245,10 @@ void deck(Monitor *m) {
|
|||
int i, n = 0;
|
||||
Client *c;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
||||
|
|
@ -273,15 +271,15 @@ void deck(Monitor *m) {
|
|||
continue;
|
||||
if (i < m->nmaster) {
|
||||
// Master area clients
|
||||
resize(c,
|
||||
(struct wlr_box){
|
||||
.x = m->w.x + cur_gappoh,
|
||||
.y = m->w.y + cur_gappov + my,
|
||||
.width = mw,
|
||||
.height = (m->w.height - cur_gappov - my - cur_gappiv) /
|
||||
(MIN(n, m->nmaster) - i)},
|
||||
0);
|
||||
my += c->geom.height + cur_gappiv;
|
||||
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, m->nmaster) - i)},
|
||||
0);
|
||||
my += c->geom.height;
|
||||
} else {
|
||||
// Stack area clients
|
||||
resize(c,
|
||||
|
|
@ -444,48 +442,48 @@ void tile(Monitor *m) {
|
|||
if (n == 0)
|
||||
return;
|
||||
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
|
||||
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
||||
mw = selmon->pertag->nmasters[selmon->pertag->curtag]
|
||||
? (m->w.width + cur_gappiv * ie) *
|
||||
? (m->w.width + cur_gappih * ie) *
|
||||
selmon->pertag->mfacts[selmon->pertag->curtag]
|
||||
: 0;
|
||||
else
|
||||
mw = m->w.width - 2 * cur_gappov + cur_gappiv * ie;
|
||||
mw = m->w.width - 2 * cur_gappoh + cur_gappih * ie;
|
||||
i = 0;
|
||||
my = ty = cur_gappoh;
|
||||
my = ty = cur_gappov;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||
continue;
|
||||
if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
|
||||
r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
|
||||
h = (m->w.height - my - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||
h = (m->w.height - my - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
|
||||
resize(c,
|
||||
(struct wlr_box){.x = m->w.x + cur_gappov,
|
||||
(struct wlr_box){.x = m->w.x + cur_gappoh,
|
||||
.y = m->w.y + my,
|
||||
.width = mw - cur_gappiv * ie,
|
||||
.width = mw - cur_gappih * ie,
|
||||
.height = h},
|
||||
0);
|
||||
my += c->geom.height + cur_gappih * ie;
|
||||
my += c->geom.height + cur_gappiv * ie;
|
||||
} else {
|
||||
r = n - i;
|
||||
h = (m->w.height - ty - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||
h = (m->w.height - ty - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
|
||||
resize(c,
|
||||
(struct wlr_box){.x = m->w.x + mw + cur_gappov,
|
||||
(struct wlr_box){.x = m->w.x + mw + cur_gappoh,
|
||||
.y = m->w.y + ty,
|
||||
.width = m->w.width - mw - 2 * cur_gappov,
|
||||
.width = m->w.width - mw - 2 * cur_gappoh,
|
||||
.height = h},
|
||||
0);
|
||||
ty += c->geom.height + cur_gappih * ie;
|
||||
ty += c->geom.height + cur_gappiv * ie;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,12 +239,10 @@ void vertical_deck(Monitor *m) {
|
|||
unsigned int mh, mx;
|
||||
int i, n = 0;
|
||||
Client *c;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
|
@ -265,15 +263,15 @@ void vertical_deck(Monitor *m) {
|
|||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
resize(c,
|
||||
(struct wlr_box){
|
||||
.x = m->w.x + cur_gappoh + mx,
|
||||
.y = m->w.y + cur_gappov,
|
||||
.width = (m->w.width - cur_gappoh - mx - cur_gappih) /
|
||||
(MIN(n, m->nmaster) - i),
|
||||
.height = mh},
|
||||
0);
|
||||
mx += c->geom.width + cur_gappih;
|
||||
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),
|
||||
.height = mh},
|
||||
0);
|
||||
mx += c->geom.width;
|
||||
} else {
|
||||
resize(c,
|
||||
(struct wlr_box){.x = m->w.x + cur_gappoh,
|
||||
|
|
@ -429,49 +427,49 @@ void vertical_tile(Monitor *m) {
|
|||
if (n == 0)
|
||||
return;
|
||||
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
|
||||
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
||||
mh = selmon->pertag->nmasters[selmon->pertag->curtag]
|
||||
? (m->w.height + cur_gappih * ie) *
|
||||
? (m->w.height + cur_gappiv * ie) *
|
||||
selmon->pertag->mfacts[selmon->pertag->curtag]
|
||||
: 0;
|
||||
else
|
||||
mh = m->w.height - 2 * cur_gappov + cur_gappih * ie;
|
||||
mh = m->w.height - 2 * cur_gappoh + cur_gappiv * ie;
|
||||
i = 0;
|
||||
mx = tx = cur_gappoh;
|
||||
mx = tx = cur_gappov;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||
continue;
|
||||
if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
|
||||
r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
|
||||
w = (m->w.width - mx - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||
w = (m->w.width - mx - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
|
||||
resize(c,
|
||||
(struct wlr_box){.x = m->w.x + mx,
|
||||
.y = m->w.y + cur_gappov,
|
||||
.y = m->w.y + cur_gappoh,
|
||||
.width = w,
|
||||
.height = mh - cur_gappiv * ie},
|
||||
.height = mh - cur_gappih * ie},
|
||||
0);
|
||||
mx += c->geom.width + cur_gappih * ie;
|
||||
mx += c->geom.width + cur_gappiv * ie;
|
||||
} else {
|
||||
r = n - i;
|
||||
w = (m->w.width - tx - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||
w = (m->w.width - tx - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
|
||||
resize(
|
||||
c,
|
||||
(struct wlr_box){.x = m->w.x + tx,
|
||||
.y = m->w.y + mh + cur_gappov,
|
||||
.y = m->w.y + mh + cur_gappoh,
|
||||
.width = w,
|
||||
.height = m->w.height - mh - 2 * cur_gappov},
|
||||
.height = m->w.height - mh - 2 * cur_gappoh},
|
||||
0);
|
||||
tx += c->geom.width + cur_gappih * ie;
|
||||
tx += c->geom.width + cur_gappiv * ie;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue