mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Layouts - re-distributing remaining pixels after even split to address #12
This commit is contained in:
parent
143f94cbc2
commit
8047fe257b
139
patch/bstack.c
139
patch/bstack.c
@ -1,96 +1,37 @@
|
|||||||
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
||||||
static void
|
static void
|
||||||
bstack(Monitor *m)
|
bstack(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||||
int oh, ov, ih, iv;
|
|
||||||
float mfacts, sfacts;
|
float mfacts, sfacts;
|
||||||
|
int mrest, srest;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
int oh, ov, ih, iv;
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||||
getfacts(m, &mfacts, &sfacts);
|
#else
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
sx = mx = m->wx + ov;
|
sx = mx = m->wx + ov;
|
||||||
sy = my = m->wy + oh;
|
sy = my = m->wy + oh;
|
||||||
sh = mh = m->wh - 2*oh;
|
sh = mh = m->wh - 2*oh;
|
||||||
sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
||||||
|
sw = m->ww - 2*ov - iv * (n - m->nmaster - 1);
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
if (m->nmaster && n > m->nmaster) {
|
||||||
sh = (mh - ih) * (1 - m->mfact);
|
sh = (mh - ih) * (1 - m->mfact);
|
||||||
mh = (mh - ih) * m->mfact;
|
mh = (mh - ih) * m->mfact;
|
||||||
sx = mx;
|
sx = mx;
|
||||||
sy = my + mh + ih;
|
sy = my + mh + ih;
|
||||||
sw = m->ww - 2*ov - iv * (n - m->nmaster - 1);
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw * (c->cfact / sfacts) - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
sx += WIDTH(c) + iv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif VANITYGAPS_PATCH
|
|
||||||
static void
|
|
||||||
bstack(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh;
|
|
||||||
sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sh = (mh - ih) * (1 - m->mfact);
|
|
||||||
mh = (mh - ih) * m->mfact;
|
|
||||||
sy = my + mh + ih;
|
|
||||||
sw = m->ww - 2*ov - iv * (n - m->nmaster - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw / (n - MIN(n, m->nmaster)) - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
sx += WIDTH(c) + iv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif CFACTS_PATCH
|
|
||||||
static void
|
|
||||||
bstack(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
float mfacts, sfacts;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
|
||||||
|
|
||||||
sx = mx = m->wx;
|
sx = mx = m->wx;
|
||||||
sy = my = m->wy;
|
sy = my = m->wy;
|
||||||
sh = mh = m->wh;
|
sh = mh = m->wh;
|
||||||
@ -101,49 +42,33 @@ bstack(Monitor *m)
|
|||||||
mh = mh * m->mfact;
|
mh = mh * m->mfact;
|
||||||
sy = my + mh;
|
sy = my + mh;
|
||||||
}
|
}
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
|
getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, mx, my, (mw / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, mx, my, (mw / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
mx += WIDTH(c) + iv;
|
||||||
|
#else
|
||||||
mx += WIDTH(c);
|
mx += WIDTH(c);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
resize(c, sx, sy, sw * (c->cfact / sfacts) - (2*c->bw), sh - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, sx, sy, (sw / sfacts) * c->cfact + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, sx, sy, (sw / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
sx += WIDTH(c) + iv;
|
||||||
|
#else
|
||||||
sx += WIDTH(c);
|
sx += WIDTH(c);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static void
|
|
||||||
bstack(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx;
|
|
||||||
sy = my = m->wy;
|
|
||||||
sh = mh = m->wh;
|
|
||||||
sw = mw = m->ww;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sh = mh * (1 - m->mfact);
|
|
||||||
mh = mh * m->mfact;
|
|
||||||
sy = my + mh;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c);
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw / (n - MIN(n, m->nmaster)) - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
sx += WIDTH(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,82 +1,3 @@
|
|||||||
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
||||||
static void
|
|
||||||
bstackhoriz(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
float mfacts, sfacts;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh;
|
|
||||||
sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sh = (mh - ih) * (1 - m->mfact);
|
|
||||||
mh = (mh - ih) * m->mfact;
|
|
||||||
sy = my + mh + ih;
|
|
||||||
sh = m->wh - mh - 2*oh - ih * (n - m->nmaster);
|
|
||||||
sw = m->ww - 2*ov;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0);
|
|
||||||
sy += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif VANITYGAPS_PATCH
|
|
||||||
static void
|
|
||||||
bstackhoriz(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh;
|
|
||||||
sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sh = (mh - ih) * (1 - m->mfact);
|
|
||||||
mh = (mh - ih) * m->mfact;
|
|
||||||
sy = my + mh + ih;
|
|
||||||
sh = m->wh - mh - 2*oh - ih * (n - m->nmaster);
|
|
||||||
sw = m->ww - 2*ov;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh / (n - MIN(n, m->nmaster)) - (2*c->bw), 0);
|
|
||||||
sy += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif CFACTS_PATCH
|
|
||||||
static void
|
static void
|
||||||
bstackhoriz(Monitor *m)
|
bstackhoriz(Monitor *m)
|
||||||
{
|
{
|
||||||
@ -84,14 +5,34 @@ bstackhoriz(Monitor *m)
|
|||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||||
float mfacts, sfacts;
|
float mfacts, sfacts;
|
||||||
|
int mrest, srest;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
int oh, ov, ih, iv;
|
||||||
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||||
|
#else
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
#if VANITYGAPS_PATCH
|
||||||
|
sx = mx = m->wx + ov;
|
||||||
|
sy = my = m->wy + oh;
|
||||||
|
mh = m->wh - 2*oh;
|
||||||
|
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
||||||
|
mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
||||||
|
sw = m->ww - 2*ov;
|
||||||
|
|
||||||
|
if (m->nmaster && n > m->nmaster) {
|
||||||
|
sh = (mh - ih) * (1 - m->mfact);
|
||||||
|
mh = (mh - ih) * m->mfact;
|
||||||
|
sy = my + mh + ih;
|
||||||
|
sh = m->wh - mh - 2*oh - ih * (n - m->nmaster);
|
||||||
|
}
|
||||||
|
#else
|
||||||
sx = mx = m->wx;
|
sx = mx = m->wx;
|
||||||
sy = my = m->wy;
|
sy = my = m->wy;
|
||||||
sh = mh = m->wh;
|
sh = mh = m->wh;
|
||||||
@ -103,50 +44,33 @@ bstackhoriz(Monitor *m)
|
|||||||
sy = my + mh;
|
sy = my + mh;
|
||||||
sh = m->wh - mh;
|
sh = m->wh - mh;
|
||||||
}
|
}
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
|
getfacts(m, mw, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, mx, my, (mw / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, mx, my, (mw / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
mx += WIDTH(c) + iv;
|
||||||
|
#else
|
||||||
mx += WIDTH(c);
|
mx += WIDTH(c);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) * c->cfact + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
sy += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
sy += HEIGHT(c);
|
sy += HEIGHT(c);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static void
|
|
||||||
bstackhoriz(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx;
|
|
||||||
sy = my = m->wy;
|
|
||||||
sh = mh = m->wh;
|
|
||||||
sw = mw = m->ww;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sh = mh * (1 - m->mfact);
|
|
||||||
mh = mh * m->mfact;
|
|
||||||
sy = my + mh;
|
|
||||||
sh = m->wh - mh;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c);
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh / (n - MIN(n, m->nmaster)) - (2*c->bw), 0);
|
|
||||||
sy += HEIGHT(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,130 +1,49 @@
|
|||||||
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
||||||
void
|
|
||||||
centeredfloatingmaster(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
float mivf, mfacts, sfacts;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mivf = 0.8; // master inner vertical gap factor
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh;
|
|
||||||
sw = mw = m->ww - 2*ov - iv*(n - 1);
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
/* go mfact box in the center if more than nmaster clients */
|
|
||||||
if (m->ww > m->wh) {
|
|
||||||
mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
|
|
||||||
mh = m->wh * 0.9;
|
|
||||||
} else {
|
|
||||||
mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
|
|
||||||
mh = m->wh * m->mfact;
|
|
||||||
}
|
|
||||||
mx = m->wx + (m->ww - mw) / 2;
|
|
||||||
my = m->wy + (m->wh - mh - 2*oh) / 2;
|
|
||||||
|
|
||||||
sx = m->wx + ov;
|
|
||||||
sy = m->wy + oh;
|
|
||||||
sh = m->wh - 2*oh;
|
|
||||||
sw = m->ww - 2*ov - iv*(n - m->nmaster - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
/* nmaster clients are stacked horizontally, in the center of the screen */
|
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv*mivf;
|
|
||||||
focus(c);
|
|
||||||
} else {
|
|
||||||
/* stack clients are stacked horizontally */
|
|
||||||
resize(c, sx, sy, sw * (c->cfact / sfacts) - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
sx += WIDTH(c) + iv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
restack(m);
|
|
||||||
}
|
|
||||||
#elif VANITYGAPS_PATCH
|
|
||||||
void
|
|
||||||
centeredfloatingmaster(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
float mivf;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mivf = 0.8; // master inner vertical gap factor
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh;
|
|
||||||
sw = mw = m->ww - 2*ov - iv*(n - 1);
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
/* go mfact box in the center if more than nmaster clients */
|
|
||||||
if (m->ww > m->wh) {
|
|
||||||
mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
|
|
||||||
mh = m->wh * 0.9;
|
|
||||||
} else {
|
|
||||||
mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
|
|
||||||
mh = m->wh * m->mfact;
|
|
||||||
}
|
|
||||||
mx = m->wx + (m->ww - mw) / 2;
|
|
||||||
my = m->wy + (m->wh - mh - 2*oh) / 2;
|
|
||||||
|
|
||||||
sx = m->wx + ov;
|
|
||||||
sy = m->wy + oh;
|
|
||||||
sh = m->wh - 2*oh;
|
|
||||||
sw = m->ww - 2*ov - iv*(n - m->nmaster - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
/* nmaster clients are stacked horizontally, in the center of the screen */
|
|
||||||
resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv*mivf;
|
|
||||||
focus(c);
|
|
||||||
} else {
|
|
||||||
/* stack clients are stacked horizontally */
|
|
||||||
resize(c, sx, sy, sw / (n - MIN(n, m->nmaster)) - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
sx += WIDTH(c) + iv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
restack(m);
|
|
||||||
}
|
|
||||||
#elif CFACTS_PATCH
|
|
||||||
void
|
void
|
||||||
centeredfloatingmaster(Monitor *m)
|
centeredfloatingmaster(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
float mfacts, sfacts;
|
float mfacts, sfacts;
|
||||||
|
int mrest, srest;
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
float mivf = 1.0; // master inner vertical gap factor
|
||||||
|
int oh, ov, ih, iv;
|
||||||
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||||
|
#else
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
#if VANITYGAPS_PATCH
|
||||||
|
sx = mx = m->wx + ov;
|
||||||
|
sy = my = m->wy + oh;
|
||||||
|
sh = mh = m->wh - 2*oh;
|
||||||
|
mw = m->ww - 2*ov - iv*(n - 1);
|
||||||
|
sw = m->ww - 2*ov - iv*(n - m->nmaster - 1);
|
||||||
|
|
||||||
|
if (m->nmaster && n > m->nmaster) {
|
||||||
|
mivf = 0.8;
|
||||||
|
/* go mfact box in the center if more than nmaster clients */
|
||||||
|
if (m->ww > m->wh) {
|
||||||
|
mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
|
||||||
|
mh = m->wh * 0.9;
|
||||||
|
} else {
|
||||||
|
mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
|
||||||
|
mh = m->wh * m->mfact;
|
||||||
|
}
|
||||||
|
mx = m->wx + (m->ww - mw) / 2;
|
||||||
|
my = m->wy + (m->wh - mh - 2*oh) / 2;
|
||||||
|
|
||||||
|
sx = m->wx + ov;
|
||||||
|
sy = m->wy + oh;
|
||||||
|
sh = m->wh - 2*oh;
|
||||||
|
}
|
||||||
|
#else
|
||||||
sx = mx = m->wx;
|
sx = mx = m->wx;
|
||||||
sy = my = m->wy;
|
sy = my = m->wy;
|
||||||
sh = mh = m->wh;
|
sh = mh = m->wh;
|
||||||
@ -142,64 +61,37 @@ centeredfloatingmaster(Monitor *m)
|
|||||||
mx = m->wx + (m->ww - mw) / 2;
|
mx = m->wx + (m->ww - mw) / 2;
|
||||||
my = m->wy + (m->wh - mh) / 2;
|
my = m->wy + (m->wh - mh) / 2;
|
||||||
}
|
}
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
|
||||||
|
|
||||||
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
/* nmaster clients are stacked horizontally, in the center of the screen */
|
/* nmaster clients are stacked horizontally, in the center of the screen */
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, mx, my, (mw / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, mx, my, (mw / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
mx += WIDTH(c) + iv*mivf;
|
||||||
|
#else
|
||||||
mx += WIDTH(c);
|
mx += WIDTH(c);
|
||||||
focus(c);
|
#endif
|
||||||
|
detachstack(c);
|
||||||
|
attachstack(c);
|
||||||
} else {
|
} else {
|
||||||
/* stack clients are stacked horizontally */
|
/* stack clients are stacked horizontally */
|
||||||
resize(c, sx, sy, sw * (c->cfact / sfacts) - (2*c->bw), sh - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
sx += WIDTH(c) + iv;
|
||||||
|
#else
|
||||||
sx += WIDTH(c);
|
sx += WIDTH(c);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
restack(m);
|
restack(m);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
centeredfloatingmaster(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx;
|
|
||||||
sy = my = m->wy;
|
|
||||||
sh = mh = m->wh;
|
|
||||||
sw = mw = m->ww;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
/* go mfact box in the center if more than nmaster clients */
|
|
||||||
if (m->ww > m->wh) {
|
|
||||||
mw = m->ww * m->mfact;
|
|
||||||
mh = m->wh * 0.9;
|
|
||||||
} else {
|
|
||||||
mw = m->ww * 0.9;
|
|
||||||
mh = m->wh * m->mfact;
|
|
||||||
}
|
|
||||||
mx = m->wx + (m->ww - mw) / 2;
|
|
||||||
my = m->wy + (m->wh - mh) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
/* nmaster clients are stacked horizontally, in the center of the screen */
|
|
||||||
resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c);
|
|
||||||
focus(c);
|
|
||||||
} else {
|
|
||||||
/* stack clients are stacked horizontally */
|
|
||||||
resize(c, sx, sy, sw / (n - MIN(n, m->nmaster)) - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
sx += WIDTH(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
restack(m);
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||||||
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
||||||
void
|
void
|
||||||
centeredmaster(Monitor *m)
|
centeredmaster(Monitor *m)
|
||||||
{
|
{
|
||||||
@ -6,24 +5,23 @@ centeredmaster(Monitor *m)
|
|||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||||
int lx = 0, ly = 0, lw = 0, lh = 0;
|
int lx = 0, ly = 0, lw = 0, lh = 0;
|
||||||
int rx = 0, ry = 0, rw = 0, rh = 0;
|
int rx = 0, ry = 0, rw = 0, rh = 0;
|
||||||
int oh, ov, ih, iv;
|
|
||||||
float mfacts = 0, lfacts = 0, rfacts = 0;
|
float mfacts = 0, lfacts = 0, rfacts = 0;
|
||||||
|
int mtotal = 0, ltotal = 0, rtotal = 0;
|
||||||
|
int mrest = 0, lrest = 0, rrest = 0;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
int oh, ov, ih, iv;
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||||
|
#else
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
|
||||||
if (!m->nmaster || n < m->nmaster)
|
|
||||||
mfacts += c->cfact; // total factor of master area
|
|
||||||
else if ((n - m->nmaster) % 2)
|
|
||||||
lfacts += c->cfact; // total factor of left hand stacke area
|
|
||||||
else
|
|
||||||
rfacts += c->cfact; // total factor of right hand stack area
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize areas */
|
/* initialize areas */
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
mx = m->wx + ov;
|
mx = m->wx + ov;
|
||||||
my = m->wy + oh;
|
my = m->wy + oh;
|
||||||
mh = m->wh - 2*oh - ih * ((!m->nmaster ? n : MIN(n, m->nmaster)) - 1);
|
mh = m->wh - 2*oh - ih * ((!m->nmaster ? n : MIN(n, m->nmaster)) - 1);
|
||||||
@ -49,226 +47,113 @@ centeredmaster(Monitor *m)
|
|||||||
rx = mx + mw + iv;
|
rx = mx + mw + iv;
|
||||||
ry = m->wy + oh;
|
ry = m->wy + oh;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
mx = m->wx;
|
||||||
if (!m->nmaster || i < m->nmaster) {
|
my = m->wy;
|
||||||
/* nmaster clients are stacked vertically, in the center of the screen */
|
mh = m->wh;
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
mw = m->ww;
|
||||||
my += HEIGHT(c) + ih;
|
lh = m->wh;
|
||||||
} else {
|
rh = m->wh;
|
||||||
/* stack clients are stacked vertically */
|
|
||||||
if ((i - m->nmaster) % 2 ) {
|
|
||||||
resize(c, lx, ly, lw - (2*c->bw), lh * (c->cfact / lfacts) - (2*c->bw), 0);
|
|
||||||
ly += HEIGHT(c) + ih;
|
|
||||||
} else {
|
|
||||||
resize(c, rx, ry, rw - (2*c->bw), rh * (c->cfact / rfacts) - (2*c->bw), 0);
|
|
||||||
ry += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif VANITYGAPS_PATCH
|
|
||||||
void
|
|
||||||
centeredmaster(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int lx = 0, ly = 0, lw = 0, lh = 0;
|
|
||||||
int rx = 0, ry = 0, rw = 0, rh = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
int mn = 0, ln = 0, rn = 0; // number of clients in master, left and right area
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
|
||||||
if (!m->nmaster || n < m->nmaster)
|
|
||||||
mn += 1;
|
|
||||||
else if ((n - m->nmaster) % 2)
|
|
||||||
ln += 1; // total factor of left hand stacke area
|
|
||||||
else
|
|
||||||
rn += 1; // total factor of right hand stack area
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize areas */
|
|
||||||
mx = m->wx + ov;
|
|
||||||
my = m->wy + oh;
|
|
||||||
mh = m->wh - 2*oh - ih * ((!m->nmaster ? n : MIN(n, m->nmaster)) - 1);
|
|
||||||
mw = m->ww - 2*ov;
|
|
||||||
lh = m->wh - 2*oh - ih * (((n - m->nmaster) / 2) - 1);
|
|
||||||
rh = m->wh - 2*oh - ih * (((n - m->nmaster) / 2) - ((n - m->nmaster) % 2 ? 0 : 1));
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
if (m->nmaster && n > m->nmaster) {
|
||||||
/* go mfact box in the center if more than nmaster clients */
|
/* go mfact box in the center if more than nmaster clients */
|
||||||
if (n - m->nmaster > 1) {
|
if (n - m->nmaster > 1) {
|
||||||
/* ||<-S->|<---M--->|<-S->|| */
|
/* ||<-S->|<---M--->|<-S->|| */
|
||||||
mw = (m->ww - 2*ov - 2*iv) * m->mfact;
|
mw = m->ww * m->mfact;
|
||||||
lw = (m->ww - mw - 2*ov - 2*iv) / 2;
|
lw = (m->ww - mw) / 2;
|
||||||
mx += lw + iv;
|
mx += lw;
|
||||||
} else {
|
} else {
|
||||||
/* ||<---M--->|<-S->|| */
|
/* ||<---M--->|<-S->|| */
|
||||||
mw = (mw - iv) * m->mfact;
|
mw = mw * m->mfact;
|
||||||
lw = m->ww - mw - iv - 2*ov;
|
lw = m->ww - mw;
|
||||||
}
|
}
|
||||||
rw = lw;
|
rw = lw;
|
||||||
lx = m->wx + ov;
|
lx = m->wx;
|
||||||
ly = m->wy + oh;
|
ly = m->wy;
|
||||||
rx = mx + mw + iv;
|
rx = mx + mw;
|
||||||
ry = m->wy + oh;
|
ry = m->wy;
|
||||||
}
|
}
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
/* calculate facts */
|
||||||
if (!m->nmaster || i < m->nmaster) {
|
#if CFACTS_PATCH
|
||||||
/* nmaster clients are stacked vertically, in the center of the screen */
|
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh / mn - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c) + ih;
|
|
||||||
} else {
|
|
||||||
/* stack clients are stacked vertically */
|
|
||||||
if ((i - m->nmaster) % 2 ) {
|
|
||||||
resize(c, lx, ly, lw - (2*c->bw), lh / ln - (2*c->bw), 0);
|
|
||||||
ly += HEIGHT(c) + ih;
|
|
||||||
} else {
|
|
||||||
resize(c, rx, ry, rw - (2*c->bw), rh / rn - (2*c->bw), 0);
|
|
||||||
ry += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif CFACTS_PATCH
|
|
||||||
void
|
|
||||||
centeredmaster(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int lx = 0, ly = 0, lw = 0, lh = 0;
|
|
||||||
int rx = 0, ry = 0, rw = 0, rh = 0;
|
|
||||||
float mfacts = 0, lfacts = 0, rfacts = 0;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
||||||
if (!m->nmaster || n < m->nmaster)
|
if (!m->nmaster || n < m->nmaster)
|
||||||
mfacts += c->cfact; // total factor of master area
|
mfacts += c->cfact; // total factor of master area
|
||||||
else if ((n - m->nmaster) % 2)
|
else if ((n - m->nmaster) % 2)
|
||||||
lfacts += c->cfact; // total factor of left hand stacke area
|
lfacts += c->cfact; // total factor of left hand stack area
|
||||||
else
|
else
|
||||||
rfacts += c->cfact; // total factor of right hand stack area
|
rfacts += c->cfact; // total factor of right hand stack area
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 0)
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
|
||||||
return;
|
if (!m->nmaster || n < m->nmaster)
|
||||||
|
mtotal += mh / mfacts;
|
||||||
/* initialize areas */
|
else if ((n - m->nmaster) % 2)
|
||||||
mx = m->wx;
|
ltotal += lh * (c->cfact / lfacts);
|
||||||
my = m->wy;
|
else
|
||||||
mh = m->wh;
|
rtotal += rh * (c->cfact / rfacts);
|
||||||
mw = m->ww;
|
#else
|
||||||
lh = m->wh;
|
|
||||||
rh = m->wh;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
/* go mfact box in the center if more than nmaster clients */
|
|
||||||
if (n - m->nmaster > 1) {
|
|
||||||
/* ||<-S->|<---M--->|<-S->|| */
|
|
||||||
mw = m->ww * m->mfact;
|
|
||||||
lw = (m->ww - mw) / 2;
|
|
||||||
mx += lw;
|
|
||||||
} else {
|
|
||||||
/* ||<---M--->|<-S->|| */
|
|
||||||
mw = mw * m->mfact;
|
|
||||||
lw = m->ww - mw;
|
|
||||||
}
|
|
||||||
rw = lw;
|
|
||||||
lx = m->wx;
|
|
||||||
ly = m->wy;
|
|
||||||
rx = mx + mw;
|
|
||||||
ry = m->wy;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (!m->nmaster || i < m->nmaster) {
|
|
||||||
/* nmaster clients are stacked vertically, in the center of the screen */
|
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c);
|
|
||||||
} else {
|
|
||||||
/* stack clients are stacked vertically */
|
|
||||||
if ((i - m->nmaster) % 2 ) {
|
|
||||||
resize(c, lx, ly, lw - (2*c->bw), lh * (c->cfact / lfacts) - (2*c->bw), 0);
|
|
||||||
ly += HEIGHT(c);
|
|
||||||
} else {
|
|
||||||
resize(c, rx, ry, rw - (2*c->bw), rh * (c->cfact / rfacts) - (2*c->bw), 0);
|
|
||||||
ry += HEIGHT(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void
|
|
||||||
centeredmaster(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int lx = 0, ly = 0, lw = 0, lh = 0;
|
|
||||||
int rx = 0, ry = 0, rw = 0, rh = 0;
|
|
||||||
int mn = 0, ln = 0, rn = 0; // number of clients in master, left and right area
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
||||||
if (!m->nmaster || n < m->nmaster)
|
if (!m->nmaster || n < m->nmaster)
|
||||||
mn += 1;
|
mfacts += 1;
|
||||||
else if ((n - m->nmaster) % 2)
|
else if ((n - m->nmaster) % 2)
|
||||||
ln += 1; // total factor of left hand stacke area
|
lfacts += 1; // total factor of left hand stack area
|
||||||
else
|
else
|
||||||
rn += 1; // total factor of right hand stack area
|
rfacts += 1; // total factor of right hand stack area
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 0)
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
|
||||||
return;
|
if (!m->nmaster || n < m->nmaster)
|
||||||
|
mtotal += mh / mfacts;
|
||||||
|
else if ((n - m->nmaster) % 2)
|
||||||
|
ltotal += lh / sfacts;
|
||||||
|
else
|
||||||
|
rtotal += rh / lfacts;
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
|
||||||
/* initialize areas */
|
mrest = mh - mtotal;
|
||||||
mx = m->wx;
|
lrest = lh - ltotal;
|
||||||
my = m->wy;
|
rrest = rh - rtotal;
|
||||||
mh = m->wh;
|
|
||||||
mw = m->ww;
|
|
||||||
lh = m->wh;
|
|
||||||
rh = m->wh;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
/* go mfact box in the center if more than nmaster clients */
|
|
||||||
if (n - m->nmaster > 1) {
|
|
||||||
/* ||<-S->|<---M--->|<-S->|| */
|
|
||||||
mw = m->ww * m->mfact;
|
|
||||||
lw = (m->ww - mw) / 2;
|
|
||||||
mx += lw;
|
|
||||||
} else {
|
|
||||||
/* ||<---M--->|<-S->|| */
|
|
||||||
mw = mw * m->mfact;
|
|
||||||
lw = m->ww - mw;
|
|
||||||
}
|
|
||||||
rw = lw;
|
|
||||||
lx = m->wx;
|
|
||||||
ly = m->wy;
|
|
||||||
rx = mx + mw;
|
|
||||||
ry = m->wy;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||||
if (!m->nmaster || i < m->nmaster) {
|
if (!m->nmaster || i < m->nmaster) {
|
||||||
/* nmaster clients are stacked vertically, in the center of the screen */
|
/* nmaster clients are stacked vertically, in the center of the screen */
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh / mn - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
my += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* stack clients are stacked vertically */
|
/* stack clients are stacked vertically */
|
||||||
if ((i - m->nmaster) % 2 ) {
|
if ((i - m->nmaster) % 2 ) {
|
||||||
resize(c, lx, ly, lw - (2*c->bw), lh / ln - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, lx, ly, lw - (2*c->bw), (lh / lfacts) * c->cfact + ((i - 2*m->nmaster) < 2*lrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, lx, ly, lw - (2*c->bw), (lh / lfacts) + ((i - 2*m->nmaster) < 2*lrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
ly += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
ly += HEIGHT(c);
|
ly += HEIGHT(c);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
resize(c, rx, ry, rw - (2*c->bw), rh / rn - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, rx, ry, rw - (2*c->bw), (rh / rfacts) * c->cfact + ((i - 2*m->nmaster) < 2*rrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, rx, ry, rw - (2*c->bw), (rh / rfacts) + ((i - 2*m->nmaster) < 2*rrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
ry += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
ry += HEIGHT(c);
|
ry += HEIGHT(c);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
@ -15,23 +15,4 @@ setcfact(const Arg *arg)
|
|||||||
return;
|
return;
|
||||||
c->cfact = f;
|
c->cfact = f;
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || TILE_LAYOUT
|
|
||||||
void
|
|
||||||
getfacts(Monitor *m, float *mf, float *sf)
|
|
||||||
{
|
|
||||||
unsigned int n;
|
|
||||||
float mfacts = 0, sfacts = 0;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
|
||||||
if (m->nmaster && n < m->nmaster)
|
|
||||||
mfacts += c->cfact;
|
|
||||||
else
|
|
||||||
sfacts += c->cfact;
|
|
||||||
}
|
|
||||||
*mf = mfacts; // total factor of master area
|
|
||||||
*sf = sfacts; // total factor of slave area
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,4 +1 @@
|
|||||||
#if BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || TILE_LAYOUT
|
static void setcfact(const Arg *arg);
|
||||||
static void getfacts(Monitor *m, float *mf, float *sf);
|
|
||||||
#endif
|
|
||||||
static void setcfact(const Arg *arg);
|
|
148
patch/columns.c
148
patch/columns.c
@ -1,78 +1,3 @@
|
|||||||
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
||||||
static void
|
|
||||||
col(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
float mfacts, sfacts;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
|
||||||
sw = mw = m->ww - 2*ov;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sw = (mw - iv) * (1 - m->mfact);
|
|
||||||
mw = (mw - iv) * m->mfact;
|
|
||||||
sx = mx + mw + iv;
|
|
||||||
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0);
|
|
||||||
sy += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif VANITYGAPS_PATCH
|
|
||||||
static void
|
|
||||||
col(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
|
||||||
sw = mw = m->ww - 2*ov;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sw = (mw - iv) * (1 - m->mfact);
|
|
||||||
mw = (mw - iv) * m->mfact;
|
|
||||||
sx = mx + mw + iv;
|
|
||||||
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
|
|
||||||
mx += WIDTH(c) + iv;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh / (n - MIN(n, m->nmaster)) - (2*c->bw), 0);
|
|
||||||
sy += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif CFACTS_PATCH
|
|
||||||
static void
|
static void
|
||||||
col(Monitor *m)
|
col(Monitor *m)
|
||||||
{
|
{
|
||||||
@ -80,14 +5,33 @@ col(Monitor *m)
|
|||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||||
float mfacts, sfacts;
|
float mfacts, sfacts;
|
||||||
|
int mrest, srest;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
int oh, ov, ih, iv;
|
||||||
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||||
|
#else
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
#if VANITYGAPS_PATCH
|
||||||
|
sx = mx = m->wx + ov;
|
||||||
|
sy = my = m->wy + oh;
|
||||||
|
mh = m->wh - 2*oh;
|
||||||
|
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
||||||
|
mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
||||||
|
sw = m->ww - 2*ov;
|
||||||
|
|
||||||
|
if (m->nmaster && n > m->nmaster) {
|
||||||
|
sw = (mw - iv) * (1 - m->mfact);
|
||||||
|
mw = (mw - iv) * m->mfact;
|
||||||
|
sx = mx + mw + iv * m->nmaster;
|
||||||
|
}
|
||||||
|
#else
|
||||||
sx = mx = m->wx;
|
sx = mx = m->wx;
|
||||||
sy = my = m->wy;
|
sy = my = m->wy;
|
||||||
sh = mh = m->wh;
|
sh = mh = m->wh;
|
||||||
@ -98,40 +42,32 @@ col(Monitor *m)
|
|||||||
mw = mw * m->mfact;
|
mw = mw * m->mfact;
|
||||||
sx = mx + mw;
|
sx = mx + mw;
|
||||||
}
|
}
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
|
getfacts(m, mw, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
resize(c, mx, my, mw * (c->cfact / mfacts) - (2*c->bw), mh - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, mx, my, (mw / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, mx, my, (mw / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
mx += WIDTH(c) + iv;
|
||||||
|
#else
|
||||||
mx += WIDTH(c);
|
mx += WIDTH(c);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) * c->cfact + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
sy += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
sy += HEIGHT(c);
|
sy += HEIGHT(c);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
col(Monitor *m) {
|
|
||||||
unsigned int i, n, h, w, x, y,mw;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
if (n > m->nmaster)
|
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
|
||||||
else
|
|
||||||
mw = m->ww;
|
|
||||||
for (i = x = y = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
w = (mw - x) / (MIN(n, m->nmaster)-i);
|
|
||||||
resize(c, x + m->wx, m->wy, w - (2*c->bw), m->wh - (2*c->bw), False);
|
|
||||||
x += WIDTH(c);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
h = (m->wh - y) / (n - i);
|
|
||||||
resize(c, x + m->wx, m->wy + y, m->ww - x - (2*c->bw), h - (2*c->bw), False);
|
|
||||||
y += HEIGHT(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
128
patch/deck.c
128
patch/deck.c
@ -1,20 +1,24 @@
|
|||||||
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
||||||
static void
|
static void
|
||||||
deck(Monitor *m)
|
deck(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||||
int oh, ov, ih, iv;
|
|
||||||
float mfacts, sfacts;
|
float mfacts, sfacts;
|
||||||
|
int mrest, srest;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
int oh, ov, ih, iv;
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||||
getfacts(m, &mfacts, &sfacts);
|
#else
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
sx = mx = m->wx + ov;
|
sx = mx = m->wx + ov;
|
||||||
sy = my = m->wy + oh;
|
sy = my = m->wy + oh;
|
||||||
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
||||||
@ -26,72 +30,7 @@ deck(Monitor *m)
|
|||||||
sx = mx + mw + iv;
|
sx = mx + mw + iv;
|
||||||
sh = m->wh - 2*oh;
|
sh = m->wh - 2*oh;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
if (n - m->nmaster > 0) /* override layout symbol */
|
|
||||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c) + ih;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif VANITYGAPS_PATCH
|
|
||||||
static void
|
|
||||||
deck(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
|
||||||
sw = mw = m->ww - 2*ov;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sw = (mw - iv) * (1 - m->mfact);
|
|
||||||
mw = (mw - iv) * m->mfact;
|
|
||||||
sx = mx + mw + iv;
|
|
||||||
sh = m->wh - 2*oh;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n - m->nmaster > 0) /* override layout symbol */
|
|
||||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh / MIN(n, m->nmaster) - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c) + ih;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif CFACTS_PATCH
|
|
||||||
static void
|
|
||||||
deck(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
float mfacts, sfacts;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
|
||||||
|
|
||||||
sx = mx = m->wx;
|
sx = mx = m->wx;
|
||||||
sy = my = m->wy;
|
sy = my = m->wy;
|
||||||
sh = mh = m->wh;
|
sh = mh = m->wh;
|
||||||
@ -102,51 +41,26 @@ deck(Monitor *m)
|
|||||||
mw = mw * m->mfact;
|
mw = mw * m->mfact;
|
||||||
sx = mx + mw;
|
sx = mx + mw;
|
||||||
}
|
}
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
|
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||||
|
|
||||||
if (n - m->nmaster > 0) /* override layout symbol */
|
if (n - m->nmaster > 0) /* override layout symbol */
|
||||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
|
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
my += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static void
|
|
||||||
deck(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx;
|
|
||||||
sy = my = m->wy;
|
|
||||||
sh = mh = m->wh;
|
|
||||||
sw = mw = m->ww;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sw = mw * (1 - m->mfact);
|
|
||||||
mw = mw * m->mfact;
|
|
||||||
sx = mx + mw;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n - m->nmaster > 0) /* override layout symbol */
|
|
||||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh / MIN(n, m->nmaster) - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c);
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -35,12 +35,13 @@ static const TileArranger flextiles[] = {
|
|||||||
{ arrange_spiral },
|
{ arrange_spiral },
|
||||||
};
|
};
|
||||||
|
|
||||||
static float
|
static void
|
||||||
getfactsforrange(Monitor *m, int an, int ai)
|
getfactsforrange(Monitor *m, int an, int ai, int size, int *rest, float *fact)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float facts;
|
float facts;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
facts = 0;
|
facts = 0;
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
@ -51,7 +52,16 @@ getfactsforrange(Monitor *m, int an, int ai)
|
|||||||
facts += 1;
|
facts += 1;
|
||||||
#endif // CFACTS_PATCH
|
#endif // CFACTS_PATCH
|
||||||
|
|
||||||
return facts;
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
if (i >= ai && i < (ai + an))
|
||||||
|
#if CFACTS_PATCH
|
||||||
|
total += size * (c->cfact / facts);
|
||||||
|
#else
|
||||||
|
total += size / sfacts;
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
|
||||||
|
*rest = size - total;
|
||||||
|
*fact = facts;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -302,27 +312,29 @@ layout_floating_master_fixed(Monitor *m, int x, int y, int h, int w, int ih, int
|
|||||||
mw = w * 0.9;
|
mw = w * 0.9;
|
||||||
mh = h * m->mfact;
|
mh = h * m->mfact;
|
||||||
}
|
}
|
||||||
x += (w - mw) / 2;
|
x = x + (w - mw) / 2;
|
||||||
y += (h - mh) / 2;
|
y = y + (h - mh) / 2;
|
||||||
|
|
||||||
(&flextiles[m->ltaxis[MASTER]])->arrange(m, x, y, mh, mw, ih, iv, n, m->nmaster, 0);
|
(&flextiles[m->ltaxis[MASTER]])->arrange(m, x, y, mh, mw, ih, iv, n, m->nmaster, 0);
|
||||||
|
reattachstack(m, m->nmaster, 0);
|
||||||
|
restack(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
arrange_left_to_right(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, int an, int ai)
|
arrange_left_to_right(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, int an, int ai)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rest;
|
||||||
float facts, fact = 1;
|
float facts, fact = 1;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
w -= iv * (an - 1);
|
w -= iv * (an - 1);
|
||||||
facts = getfactsforrange(m, an, ai);
|
getfactsforrange(m, an, ai, w, &rest, &facts);
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||||
if (i >= ai && i < (ai + an)) {
|
if (i >= ai && i < (ai + an)) {
|
||||||
#if CFACTS_PATCH
|
#if CFACTS_PATCH
|
||||||
fact = c->cfact;
|
fact = c->cfact;
|
||||||
#endif // CFACTS_PATCH
|
#endif // CFACTS_PATCH
|
||||||
resize(c, x, y, w * (fact / facts) - (2*c->bw), h - (2*c->bw), 0);
|
resize(c, x, y, w * (fact / facts) + ((i - ai) < rest ? 1 : 0) - (2*c->bw), h - (2*c->bw), 0);
|
||||||
x += WIDTH(c) + iv;
|
x += WIDTH(c) + iv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,18 +343,18 @@ arrange_left_to_right(Monitor *m, int x, int y, int h, int w, int ih, int iv, in
|
|||||||
static void
|
static void
|
||||||
arrange_top_to_bottom(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, int an, int ai)
|
arrange_top_to_bottom(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, int an, int ai)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rest;
|
||||||
float facts, fact = 1;
|
float facts, fact = 1;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
h -= ih * (an - 1);
|
h -= ih * (an - 1);
|
||||||
facts = getfactsforrange(m, an, ai);
|
getfactsforrange(m, an, ai, h, &rest, &facts);
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||||
if (i >= ai && i < (ai + an)) {
|
if (i >= ai && i < (ai + an)) {
|
||||||
#if CFACTS_PATCH
|
#if CFACTS_PATCH
|
||||||
fact = c->cfact;
|
fact = c->cfact;
|
||||||
#endif // CFACTS_PATCH
|
#endif // CFACTS_PATCH
|
||||||
resize(c, x, y, w - (2*c->bw), h * (fact / facts) - (2*c->bw), 0);
|
resize(c, x, y, w - (2*c->bw), h * (fact / facts) + ((i - ai) < rest ? 1 : 0) - (2*c->bw), 0);
|
||||||
y += HEIGHT(c) + ih;
|
y += HEIGHT(c) + ih;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -655,4 +667,17 @@ incnstack(const Arg *arg)
|
|||||||
selmon->nstack = MAX(selmon->nstack + arg->i, 0);
|
selmon->nstack = MAX(selmon->nstack + arg->i, 0);
|
||||||
#endif // PERTAG_PATCH
|
#endif // PERTAG_PATCH
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
reattachstack(Monitor *m, int an, int ai)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
if (i >= ai && i < (ai + an)) {
|
||||||
|
detachstack(c);
|
||||||
|
attachstack(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@ static void flextile(Monitor *m);
|
|||||||
static void mirrorlayout(const Arg *arg);
|
static void mirrorlayout(const Arg *arg);
|
||||||
static void rotatelayoutaxis(const Arg *arg);
|
static void rotatelayoutaxis(const Arg *arg);
|
||||||
static void incnstack(const Arg *arg);
|
static void incnstack(const Arg *arg);
|
||||||
|
static void reattachstack(Monitor *m, int ai, int an);
|
||||||
|
|
||||||
/* Symbol handlers */
|
/* Symbol handlers */
|
||||||
static void setflexsymbols(Monitor *m, unsigned int n);
|
static void setflexsymbols(Monitor *m, unsigned int n);
|
||||||
|
@ -162,6 +162,9 @@
|
|||||||
#include "xrdb.c"
|
#include "xrdb.c"
|
||||||
#endif
|
#endif
|
||||||
/* Layouts */
|
/* Layouts */
|
||||||
|
#if BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || TILE_LAYOUT
|
||||||
|
#include "layout_facts.c"
|
||||||
|
#endif
|
||||||
#if BSTACK_LAYOUT
|
#if BSTACK_LAYOUT
|
||||||
#include "bstack.c"
|
#include "bstack.c"
|
||||||
#endif
|
#endif
|
||||||
|
51
patch/layout_facts.c
Normal file
51
patch/layout_facts.c
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#if CFACTS_PATCH
|
||||||
|
void
|
||||||
|
getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr)
|
||||||
|
{
|
||||||
|
unsigned int n;
|
||||||
|
float mfacts = 0, sfacts = 0;
|
||||||
|
int mtotal = 0, stotal = 0;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
|
||||||
|
if (n < m->nmaster)
|
||||||
|
mfacts += c->cfact;
|
||||||
|
else
|
||||||
|
sfacts += c->cfact;
|
||||||
|
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
|
||||||
|
if (n < m->nmaster)
|
||||||
|
mtotal += msize * (c->cfact / mfacts);
|
||||||
|
else
|
||||||
|
stotal += ssize * (c->cfact / sfacts);
|
||||||
|
|
||||||
|
*mf = mfacts; // total factor of master area
|
||||||
|
*sf = sfacts; // total factor of slave area
|
||||||
|
*mr = msize - mtotal; // the remainder (rest) of pixels after a cfacts master split
|
||||||
|
*sr = ssize - stotal; // the remainder (rest) of pixels after a cfacts slave split
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void
|
||||||
|
getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr)
|
||||||
|
{
|
||||||
|
unsigned int n;
|
||||||
|
float mfacts, sfacts;
|
||||||
|
int mtotal = 0, stotal = 0;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
mfacts = MIN(n, m->nmaster);
|
||||||
|
sfacts = n - m->nmaster;
|
||||||
|
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
|
||||||
|
if (n < m->nmaster)
|
||||||
|
mtotal += msize / mfacts;
|
||||||
|
else
|
||||||
|
stotal += ssize / sfacts;
|
||||||
|
|
||||||
|
*mf = mfacts; // total factor of master area
|
||||||
|
*sf = sfacts; // total factor of slave area
|
||||||
|
*mr = msize - mtotal; // the remainder (rest) of pixels after an even master split
|
||||||
|
*sr = ssize - stotal; // the remainder (rest) of pixels after an even slave split
|
||||||
|
}
|
||||||
|
#endif // CFACTS_PATCH
|
148
patch/tile.c
148
patch/tile.c
@ -1,78 +1,3 @@
|
|||||||
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
||||||
static void
|
|
||||||
tile(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
float mfacts, sfacts;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
|
||||||
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
|
||||||
sw = mw = m->ww - 2*ov;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sw = (mw - iv) * (1 - m->mfact);
|
|
||||||
mw = (mw - iv) * m->mfact;
|
|
||||||
sx = mx + mw + iv;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c) + ih;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0);
|
|
||||||
sy += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif VANITYGAPS_PATCH
|
|
||||||
static void
|
|
||||||
tile(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n;
|
|
||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
||||||
int oh, ov, ih, iv;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sx = mx = m->wx + ov;
|
|
||||||
sy = my = m->wy + oh;
|
|
||||||
mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
|
||||||
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
|
||||||
sw = mw = m->ww - 2*ov;
|
|
||||||
|
|
||||||
if (m->nmaster && n > m->nmaster) {
|
|
||||||
sw = (mw - iv) * (1 - m->mfact);
|
|
||||||
mw = (mw - iv) * m->mfact;
|
|
||||||
sx = mx + mw + iv;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh / MIN(n, m->nmaster) - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c) + ih;
|
|
||||||
} else {
|
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh / (n - MIN(n, m->nmaster)) - (2*c->bw), 0);
|
|
||||||
sy += HEIGHT(c) + ih;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif CFACTS_PATCH
|
|
||||||
static void
|
static void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
@ -80,14 +5,33 @@ tile(Monitor *m)
|
|||||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||||
float mfacts, sfacts;
|
float mfacts, sfacts;
|
||||||
|
int mrest, srest;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
int oh, ov, ih, iv;
|
||||||
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||||
|
#else
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getfacts(m, &mfacts, &sfacts);
|
#if VANITYGAPS_PATCH
|
||||||
|
sx = mx = m->wx + ov;
|
||||||
|
sy = my = m->wy + oh;
|
||||||
|
mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
||||||
|
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
||||||
|
sw = mw = m->ww - 2*ov;
|
||||||
|
|
||||||
|
if (m->nmaster && n > m->nmaster) {
|
||||||
|
sw = (mw - iv) * (1 - m->mfact);
|
||||||
|
mw = (mw - iv) * m->mfact;
|
||||||
|
sx = mx + mw + iv;
|
||||||
|
}
|
||||||
|
#else
|
||||||
sx = mx = m->wx;
|
sx = mx = m->wx;
|
||||||
sy = my = m->wy;
|
sy = my = m->wy;
|
||||||
sh = mh = m->wh;
|
sh = mh = m->wh;
|
||||||
@ -98,40 +42,32 @@ tile(Monitor *m)
|
|||||||
mw = mw * m->mfact;
|
mw = mw * m->mfact;
|
||||||
sx = mx + mw;
|
sx = mx + mw;
|
||||||
}
|
}
|
||||||
|
#endif // VANITYGAPS_PATCH
|
||||||
|
|
||||||
|
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||||
|
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
my += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0);
|
#if CFACTS_PATCH
|
||||||
|
resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) * c->cfact + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#else
|
||||||
|
resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||||
|
#endif // CFACTS_PATCH
|
||||||
|
#if VANITYGAPS_PATCH
|
||||||
|
sy += HEIGHT(c) + ih;
|
||||||
|
#else
|
||||||
sy += HEIGHT(c);
|
sy += HEIGHT(c);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
tile(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n, h, mw, my, ty;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (n > m->nmaster)
|
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
|
||||||
else
|
|
||||||
mw = m->ww;
|
|
||||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
|
||||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
|
||||||
my += HEIGHT(c);
|
|
||||||
} else {
|
|
||||||
h = (m->wh - ty) / (n - i);
|
|
||||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
|
||||||
ty += HEIGHT(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user