From 80a6ec28ba02e897c45d96eb91d2931a52d01184 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sun, 28 Aug 2022 11:55:45 +0200 Subject: refactored some functions into vanitygaps.c --- dwm.c | 103 ------------------------------------------------------------------ 1 file changed, 103 deletions(-) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 859efd9..59bae57 100755 --- a/dwm.c +++ b/dwm.c @@ -214,12 +214,6 @@ static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); -static void setgaps(int oh, int ov, int ih, int iv); -static void incrgaps(const Arg *arg); -static void incrigaps(const Arg *arg); -static void incrogaps(const Arg *arg); -static void togglegaps(const Arg *arg); -static void defaultgaps(const Arg *arg); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); @@ -229,7 +223,6 @@ static void sigchld(int unused); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); -static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -267,7 +260,6 @@ static char stext[256]; static int screen; static int sw, sh; /* X display screen geometry width, height */ static int bh; /* bar height */ -static int enablegaps = 1; /* enables gaps, used by togglegaps */ static int lrpad; /* sum of left and right padding for text */ static int (*xerrorxlib)(Display *, XErrorEvent *); static unsigned int numlockmask = 0; @@ -1550,67 +1542,6 @@ setfullscreen(Client *c, int fullscreen) } } -void -setgaps(int oh, int ov, int ih, int iv) -{ - if (oh < 0) oh = 0; - if (ov < 0) ov = 0; - if (ih < 0) ih = 0; - if (iv < 0) iv = 0; - - selmon->gappoh = oh; - selmon->gappov = ov; - selmon->gappih = ih; - selmon->gappiv = iv; - arrange(selmon); -} - -void -togglegaps(const Arg *arg) -{ - enablegaps = !enablegaps; - arrange(selmon); -} - -void -defaultgaps(const Arg *arg) -{ - setgaps(gappoh, gappov, gappih, gappiv); -} - -void -incrgaps(const Arg *arg) -{ - setgaps( - selmon->gappoh + arg->i, - selmon->gappov + arg->i, - selmon->gappih + arg->i, - selmon->gappiv + arg->i - ); -} - -void -incrigaps(const Arg *arg) -{ - setgaps( - selmon->gappoh, - selmon->gappov, - selmon->gappih + arg->i, - selmon->gappiv + arg->i - ); -} - -void -incrogaps(const Arg *arg) -{ - setgaps( - selmon->gappoh + arg->i, - selmon->gappov + arg->i, - selmon->gappih, - selmon->gappiv - ); -} - void setlayout(const Arg *arg) { @@ -1781,40 +1712,6 @@ tagmon(const Arg *arg) sendmon(selmon->sel, dirtomon(arg->i)); } -void -tile(Monitor *m) -{ - unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (n == 0) - return; - - if (smartgaps == n) { - oe = 0; // outer gaps disabled - } - - if (n > m->nmaster) - mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0; - else - mw = m->ww - 2*m->gappov*oe + m->gappiv*ie; - for (i = 0, my = ty = m->gappoh*oe, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { - r = MIN(n, m->nmaster) - i; - h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; - resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0); - if (my + HEIGHT(c) + m->gappih*ie < m->wh) - my += HEIGHT(c) + m->gappih*ie; - } else { - r = n - i; - h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; - resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0); - if (ty + HEIGHT(c) + m->gappih*ie < m->wh) - ty += HEIGHT(c) + m->gappih*ie; - } -} - void togglebar(const Arg *arg) { -- cgit v1.2.3