Move the tile layout function into splated file😉
This commit is contained in:
parent
793c1cc205
commit
08ea82d301
3 changed files with 28 additions and 28 deletions
28
dwm.c
28
dwm.c
|
@ -2010,34 +2010,6 @@ tagmon(const Arg *arg)
|
||||||
sendmon(selmon->sel, dirtomon(arg->i));
|
sendmon(selmon->sel, dirtomon(arg->i));
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
if (my + HEIGHT(c) < m->wh)
|
|
||||||
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);
|
|
||||||
if (ty + HEIGHT(c) < m->wh)
|
|
||||||
ty += HEIGHT(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
togglebar(const Arg *arg)
|
togglebar(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef layouts_H
|
#ifndef layouts_H
|
||||||
#define layouts_H
|
#define layouts_H
|
||||||
|
|
||||||
|
#include "tile.c"
|
||||||
#include "grid.c"
|
#include "grid.c"
|
||||||
#include "fibonacci.c"
|
#include "fibonacci.c"
|
||||||
|
|
||||||
|
|
27
layouts/tile.c
Normal file
27
layouts/tile.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
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);
|
||||||
|
if (my + HEIGHT(c) < m->wh)
|
||||||
|
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);
|
||||||
|
if (ty + HEIGHT(c) < m->wh)
|
||||||
|
ty += HEIGHT(c);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue