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
137
patch/bstack.c
137
patch/bstack.c
@ -1,96 +1,37 @@
|
||||
#if VANITYGAPS_PATCH && 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;
|
||||
int oh, ov, ih, iv;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
Client *c;
|
||||
|
||||
#if VANITYGAPS_PATCH
|
||||
int oh, ov, ih, iv;
|
||||
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)
|
||||
return;
|
||||
|
||||
#if VANITYGAPS_PATCH
|
||||
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);
|
||||
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) {
|
||||
sh = (mh - ih) * (1 - m->mfact);
|
||||
mh = (mh - ih) * m->mfact;
|
||||
sx = mx;
|
||||
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 * (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);
|
||||
|
||||
#else
|
||||
sx = mx = m->wx;
|
||||
sy = my = m->wy;
|
||||
sh = mh = m->wh;
|
||||
@ -101,49 +42,33 @@ bstack(Monitor *m)
|
||||
mh = mh * m->mfact;
|
||||
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++) {
|
||||
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);
|
||||
#endif
|
||||
} 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);
|
||||
#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
|
||||
bstackhoriz(Monitor *m)
|
||||
{
|
||||
@ -84,14 +5,34 @@ bstackhoriz(Monitor *m)
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
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++);
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
if (n == 0)
|
||||
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;
|
||||
sy = my = m->wy;
|
||||
sh = mh = m->wh;
|
||||
@ -103,50 +44,33 @@ bstackhoriz(Monitor *m)
|
||||
sy = my + 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++) {
|
||||
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);
|
||||
#endif
|
||||
} 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);
|
||||
#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
|
||||
centeredfloatingmaster(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
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++);
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
if (n == 0)
|
||||
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;
|
||||
sy = my = m->wy;
|
||||
sh = mh = m->wh;
|
||||
@ -142,64 +61,37 @@ centeredfloatingmaster(Monitor *m)
|
||||
mx = m->wx + (m->ww - mw) / 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) {
|
||||
/* 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);
|
||||
focus(c);
|
||||
#endif
|
||||
detachstack(c);
|
||||
attachstack(c);
|
||||
} else {
|
||||
/* 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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
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
|
||||
centeredmaster(Monitor *m)
|
||||
{
|
||||
@ -6,24 +5,23 @@ centeredmaster(Monitor *m)
|
||||
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;
|
||||
float mfacts = 0, lfacts = 0, rfacts = 0;
|
||||
int mtotal = 0, ltotal = 0, rtotal = 0;
|
||||
int mrest = 0, lrest = 0, rrest = 0;
|
||||
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++);
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
if (n == 0)
|
||||
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 */
|
||||
#if VANITYGAPS_PATCH
|
||||
mx = m->wx + ov;
|
||||
my = m->wy + oh;
|
||||
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;
|
||||
ry = m->wy + oh;
|
||||
}
|
||||
|
||||
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) + ih;
|
||||
} 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) + 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));
|
||||
#else
|
||||
mx = m->wx;
|
||||
my = m->wy;
|
||||
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 - 2*ov - 2*iv) * m->mfact;
|
||||
lw = (m->ww - mw - 2*ov - 2*iv) / 2;
|
||||
mx += lw + iv;
|
||||
mw = m->ww * m->mfact;
|
||||
lw = (m->ww - mw) / 2;
|
||||
mx += lw;
|
||||
} else {
|
||||
/* ||<---M--->|<-S->|| */
|
||||
mw = (mw - iv) * m->mfact;
|
||||
lw = m->ww - mw - iv - 2*ov;
|
||||
mw = mw * m->mfact;
|
||||
lw = m->ww - mw;
|
||||
}
|
||||
rw = lw;
|
||||
lx = m->wx + ov;
|
||||
ly = m->wy + oh;
|
||||
rx = mx + mw + iv;
|
||||
ry = m->wy + oh;
|
||||
lx = m->wx;
|
||||
ly = m->wy;
|
||||
rx = mx + mw;
|
||||
ry = m->wy;
|
||||
}
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
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 / 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;
|
||||
|
||||
/* calculate facts */
|
||||
#if CFACTS_PATCH
|
||||
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
|
||||
lfacts += c->cfact; // total factor of left hand stack area
|
||||
else
|
||||
rfacts += c->cfact; // total factor of right hand stack area
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/* initialize areas */
|
||||
mx = m->wx;
|
||||
my = m->wy;
|
||||
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++) {
|
||||
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++)
|
||||
if (!m->nmaster || n < m->nmaster)
|
||||
mtotal += mh / mfacts;
|
||||
else if ((n - m->nmaster) % 2)
|
||||
ltotal += lh * (c->cfact / lfacts);
|
||||
else
|
||||
rtotal += rh * (c->cfact / rfacts);
|
||||
#else
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
||||
if (!m->nmaster || n < m->nmaster)
|
||||
mn += 1;
|
||||
mfacts += 1;
|
||||
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
|
||||
rn += 1; // total factor of right hand stack area
|
||||
rfacts += 1; // total factor of right hand stack area
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
|
||||
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 */
|
||||
mx = m->wx;
|
||||
my = m->wy;
|
||||
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;
|
||||
}
|
||||
mrest = mh - mtotal;
|
||||
lrest = lh - ltotal;
|
||||
rrest = rh - rtotal;
|
||||
|
||||
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 / 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);
|
||||
#endif
|
||||
} 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);
|
||||
#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);
|
||||
#endif
|
||||
} 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);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -16,22 +16,3 @@ setcfact(const Arg *arg)
|
||||
c->cfact = f;
|
||||
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 getfacts(Monitor *m, float *mf, float *sf);
|
||||
#endif
|
||||
static void setcfact(const Arg *arg);
|
146
patch/columns.c
146
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
|
||||
col(Monitor *m)
|
||||
{
|
||||
@ -80,14 +5,33 @@ col(Monitor *m)
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
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++);
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
if (n == 0)
|
||||
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;
|
||||
sy = my = m->wy;
|
||||
sh = mh = m->wh;
|
||||
@ -98,40 +42,32 @@ col(Monitor *m)
|
||||
mw = mw * m->mfact;
|
||||
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++)
|
||||
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);
|
||||
#endif
|
||||
} 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);
|
||||
#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
|
126
patch/deck.c
126
patch/deck.c
@ -1,20 +1,24 @@
|
||||
#if VANITYGAPS_PATCH && 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;
|
||||
int oh, ov, ih, iv;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
Client *c;
|
||||
|
||||
#if VANITYGAPS_PATCH
|
||||
int oh, ov, ih, iv;
|
||||
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)
|
||||
return;
|
||||
|
||||
#if VANITYGAPS_PATCH
|
||||
sx = mx = m->wx + ov;
|
||||
sy = my = m->wy + oh;
|
||||
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
||||
@ -26,72 +30,7 @@ deck(Monitor *m)
|
||||
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 * (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);
|
||||
|
||||
#else
|
||||
sx = mx = m->wx;
|
||||
sy = my = m->wy;
|
||||
sh = mh = m->wh;
|
||||
@ -102,51 +41,26 @@ deck(Monitor *m)
|
||||
mw = mw * m->mfact;
|
||||
sx = mx + mw;
|
||||
}
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||
|
||||
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);
|
||||
#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);
|
||||
#endif
|
||||
} else {
|
||||
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 },
|
||||
};
|
||||
|
||||
static float
|
||||
getfactsforrange(Monitor *m, int an, int ai)
|
||||
static void
|
||||
getfactsforrange(Monitor *m, int an, int ai, int size, int *rest, float *fact)
|
||||
{
|
||||
int i;
|
||||
float facts;
|
||||
Client *c;
|
||||
int total = 0;
|
||||
|
||||
facts = 0;
|
||||
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;
|
||||
#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
|
||||
@ -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;
|
||||
mh = h * m->mfact;
|
||||
}
|
||||
x += (w - mw) / 2;
|
||||
y += (h - mh) / 2;
|
||||
x = x + (w - mw) / 2;
|
||||
y = y + (h - mh) / 2;
|
||||
|
||||
(&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
|
||||
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;
|
||||
Client *c;
|
||||
|
||||
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++) {
|
||||
if (i >= ai && i < (ai + an)) {
|
||||
#if CFACTS_PATCH
|
||||
fact = c->cfact;
|
||||
#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;
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
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;
|
||||
Client *c;
|
||||
|
||||
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++) {
|
||||
if (i >= ai && i < (ai + an)) {
|
||||
#if CFACTS_PATCH
|
||||
fact = c->cfact;
|
||||
#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;
|
||||
}
|
||||
}
|
||||
@ -656,3 +668,16 @@ incnstack(const Arg *arg)
|
||||
#endif // PERTAG_PATCH
|
||||
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 rotatelayoutaxis(const Arg *arg);
|
||||
static void incnstack(const Arg *arg);
|
||||
static void reattachstack(Monitor *m, int ai, int an);
|
||||
|
||||
/* Symbol handlers */
|
||||
static void setflexsymbols(Monitor *m, unsigned int n);
|
||||
|
@ -162,6 +162,9 @@
|
||||
#include "xrdb.c"
|
||||
#endif
|
||||
/* Layouts */
|
||||
#if BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || TILE_LAYOUT
|
||||
#include "layout_facts.c"
|
||||
#endif
|
||||
#if BSTACK_LAYOUT
|
||||
#include "bstack.c"
|
||||
#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
|
146
patch/tile.c
146
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
|
||||
tile(Monitor *m)
|
||||
{
|
||||
@ -80,14 +5,33 @@ tile(Monitor *m)
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
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++);
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
if (n == 0)
|
||||
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;
|
||||
sy = my = m->wy;
|
||||
sh = mh = m->wh;
|
||||
@ -98,40 +42,32 @@ tile(Monitor *m)
|
||||
mw = mw * m->mfact;
|
||||
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++)
|
||||
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);
|
||||
#endif
|
||||
} 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);
|
||||
#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