From 79dd5c40560a2032c357175ee557ecafd3e2b5df Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 31 Jan 2024 18:31:18 -0500 Subject: Migrate all layouts to vanitygaps.c --- dwm.c | 29 ----------------------------- vanitygaps.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dwm.c b/dwm.c index 65eca6f..e0e24bd 100644 --- a/dwm.c +++ b/dwm.c @@ -227,7 +227,6 @@ static void showhide(Client *c); static void sigstatusbar(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); -static void tilewide(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -1941,34 +1940,6 @@ tagmon(const Arg *arg) sendmon(selmon->sel, dirtomon(arg->i)); } -void -tilewide(Monitor *m) -{ - unsigned int i, n, w, h, mw, mx, 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 = mx = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { - w = (mw - mx) / (MIN(n, m->nmaster) - i); - resize(c, m->wx + mx, m->wy, w - (2*c->bw), (m->wh - ty) - (2*c->bw), 0); - if (mx + WIDTH(c) < m->ww) - mx += WIDTH(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 togglebar(const Arg *arg) { diff --git a/vanitygaps.c b/vanitygaps.c index 37867eb..6daaf22 100644 --- a/vanitygaps.c +++ b/vanitygaps.c @@ -8,6 +8,7 @@ static void incrovgaps(const Arg *arg); static void incrihgaps(const Arg *arg); static void incrivgaps(const Arg *arg); static void togglegaps(const Arg *arg); +static void tilewide(Monitor *m); /* Layouts (delete the ones you do not need) */ static void bstackhoriz(Monitor *m); static void centeredmaster(Monitor *m); @@ -409,3 +410,31 @@ tile(Monitor *m) sy += HEIGHT(c) + ih; } } + +void +tilewide(Monitor *m) +{ + unsigned int i, n, w, h, mw, mx, 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 = mx = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) + if (i < m->nmaster) { + w = (mw - mx) / (MIN(n, m->nmaster) - i); + resize(c, m->wx + mx, m->wy, w - (2*c->bw), (m->wh - ty) - (2*c->bw), 0); + if (mx + WIDTH(c) < m->ww) + mx += WIDTH(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); + } +} -- cgit v1.2.3