tRevert "Apply smartborder patch, doesn't work for tiled layouts" - dwm - [fork] customized build of dwm, the dynamic window manager
 (HTM) git clone git://src.adamsgaard.dk/dwm
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 7c3dd978316b8869a34163e9679fd7fe8c08ad20
 (DIR) parent 1932f8db3cbc01daf55383eed322528b0330083f
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Thu, 18 Jun 2020 09:48:03 +0200
       
       Revert "Apply smartborder patch, doesn't work for tiled layouts"
       
       This reverts commit 1932f8db3cbc01daf55383eed322528b0330083f.
       
       Diffstat:
         M dwm.c                               |      71 ++++++++++++-------------------
       
       1 file changed, 28 insertions(+), 43 deletions(-)
       ---
 (DIR) diff --git a/dwm.c b/dwm.c
       t@@ -149,7 +149,7 @@ typedef struct {
        
        /* function declarations */
        static void applyrules(Client *c);
       -static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact);
       +static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
        static void arrange(Monitor *m);
        static void arrangemon(Monitor *m);
        static void attach(Client *c);
       t@@ -194,8 +194,8 @@ static void pop(Client *);
        static void propertynotify(XEvent *e);
        static void quit(const Arg *arg);
        static Monitor *recttomon(int x, int y, int w, int h);
       -static void resize(Client *c, int x, int y, int w, int h, int bw, int interact);
       -static void resizeclient(Client *c, int x, int y, int w, int h, int bw);
       +static void resize(Client *c, int x, int y, int w, int h, int interact);
       +static void resizeclient(Client *c, int x, int y, int w, int h);
        static void resizemouse(const Arg *arg);
        static void restack(Monitor *m);
        static void run(void);
       t@@ -329,7 +329,7 @@ applyrules(Client *c)
        }
        
        int
       -applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact)
       +applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
        {
                int baseismin;
                Monitor *m = c->mon;
       t@@ -342,18 +342,18 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact)
                                *x = sw - WIDTH(c);
                        if (*y > sh)
                                *y = sh - HEIGHT(c);
       -                if (*x + *w + 2 * *bw < 0)
       +                if (*x + *w + 2 * c->bw < 0)
                                *x = 0;
       -                if (*y + *h + 2 * *bw < 0)
       +                if (*y + *h + 2 * c->bw < 0)
                                *y = 0;
                } else {
                        if (*x >= m->wx + m->ww)
                                *x = m->wx + m->ww - WIDTH(c);
                        if (*y >= m->wy + m->wh)
                                *y = m->wy + m->wh - HEIGHT(c);
       -                if (*x + *w + 2 * *bw <= m->wx)
       +                if (*x + *w + 2 * c->bw <= m->wx)
                                *x = m->wx;
       -                if (*y + *h + 2 * *bw <= m->wy)
       +                if (*y + *h + 2 * c->bw <= m->wy)
                                *y = m->wy;
                }
                if (*h < bh)
       t@@ -391,7 +391,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact)
                        if (c->maxh)
                                *h = MIN(*h, c->maxh);
                }
       -        return *x != c->x || *y != c->y || *w != c->w || *h != c->h || *bw != c->bw;
       +        return *x != c->x || *y != c->y || *w != c->w || *h != c->h;
        }
        
        void
       t@@ -411,18 +411,9 @@ arrange(Monitor *m)
        void
        arrangemon(Monitor *m)
        {
       -        Client *c;
       -
                strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
                if (m->lt[m->sellt]->arrange)
                        m->lt[m->sellt]->arrange(m);
       -        else
       -                /* float case */
       -                for (c = selmon->clients; c; c = c->next)
       -                        if (ISVISIBLE(c) && c->bw == 0)
       -                                resize(c, c->x, c->y,
       -                                       c->w - 2*borderpx, c->h - 2*borderpx,
       -                                       borderpx, 0);
        }
        
        void
       t@@ -597,7 +588,7 @@ configurenotify(XEvent *e)
                                for (m = mons; m; m = m->next) {
                                        for (c = m->clients; c; c = c->next)
                                                if (c->isfullscreen)
       -                                                resizeclient(c, m->mx, m->my, m->mw, m->mh, 0);
       +                                                resizeclient(c, m->mx, m->my, m->mw, m->mh);
                                        XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
                                }
                                focus(NULL);
       t@@ -1182,7 +1173,7 @@ monocle(Monitor *m)
                if (n > 0) /* override layout symbol */
                        snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
                for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
       -                resize(c, m->wx, m->wy, m->ww, m->wh, 0, 0);
       +                resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
        }
        
        void
       t@@ -1250,7 +1241,7 @@ movemouse(const Arg *arg)
                                && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
                                        togglefloating(NULL);
                                if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
       -                                resize(c, nx, ny, c->w, c->h, c->bw, 1);
       +                                resize(c, nx, ny, c->w, c->h, 1);
                                break;
                        }
                } while (ev.type != ButtonRelease);
       t@@ -1336,14 +1327,14 @@ recttomon(int x, int y, int w, int h)
        }
        
        void
       -resize(Client *c, int x, int y, int w, int h, int interact, int bw)
       +resize(Client *c, int x, int y, int w, int h, int interact)
        {
       -        if (applysizehints(c, &x, &y, &w, &h, &bw, interact))
       -                resizeclient(c, x, y, w, h, bw);
       +        if (applysizehints(c, &x, &y, &w, &h, interact))
       +                resizeclient(c, x, y, w, h);
        }
        
        void
       -resizeclient(Client *c, int x, int y, int w, int h, int bw)
       +resizeclient(Client *c, int x, int y, int w, int h)
        {
                XWindowChanges wc;
        
       t@@ -1351,8 +1342,7 @@ resizeclient(Client *c, int x, int y, int w, int h, int bw)
                c->oldy = c->y; c->y = wc.y = y;
                c->oldw = c->w; c->w = wc.width = w;
                c->oldh = c->h; c->h = wc.height = h;
       -        c->oldbw = c->bw;
       -        c->bw = wc.border_width = bw;
       +        wc.border_width = c->bw;
                XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
                configure(c);
                XSync(dpy, False);
       t@@ -1401,7 +1391,7 @@ resizemouse(const Arg *arg)
                                                togglefloating(NULL);
                                }
                                if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
       -                                resize(c, c->x, c->y, nw, nh, c->bw, 1);
       +                                resize(c, c->x, c->y, nw, nh, 1);
                                break;
                        }
                } while (ev.type != ButtonRelease);
       t@@ -1548,8 +1538,10 @@ setfullscreen(Client *c, int fullscreen)
                                PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
                        c->isfullscreen = 1;
                        c->oldstate = c->isfloating;
       +                c->oldbw = c->bw;
       +                c->bw = 0;
                        c->isfloating = 1;
       -                resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh, 0);
       +                resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
                        XRaiseWindow(dpy, c->win);
                } else if (!fullscreen && c->isfullscreen){
                        XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
       t@@ -1561,7 +1553,7 @@ setfullscreen(Client *c, int fullscreen)
                        c->y = c->oldy;
                        c->w = c->oldw;
                        c->h = c->oldh;
       -                resizeclient(c, c->x, c->y, c->w, c->h, c->bw);
       +                resizeclient(c, c->x, c->y, c->w, c->h);
                        arrange(c->mon);
                }
        }
       t@@ -1688,7 +1680,7 @@ showhide(Client *c)
                        /* show clients top down */
                        XMoveWindow(dpy, c->win, c->x, c->y);
                        if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
       -                        resize(c, c->x, c->y, c->w, c->h, c->bw, 0);
       +                        resize(c, c->x, c->y, c->w, c->h, 0);
                        showhide(c->snext);
                } else {
                        /* hide clients bottom up */
       t@@ -1742,31 +1734,26 @@ tagmon(const Arg *arg)
        void
        tile(Monitor *m)
        {
       -        unsigned int i, n, h, mw, my, ty, bw;
       +        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 == 1)
       -                bw = 0;
       -        else
       -                bw = borderpx;
       -
                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++)
       +        for (i = 0, 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*bw, h - 2*bw, bw, 0);
       +                        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*bw, h - 2*bw, bw, 0);
       +                        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);
                        }
       t@@ -1791,9 +1778,7 @@ togglefloating(const Arg *arg)
                selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
                if (selmon->sel->isfloating)
                        resize(selmon->sel, selmon->sel->x, selmon->sel->y,
       -                        selmon->sel->w - 2 * (borderpx - selmon->sel->bw),
       -                        selmon->sel->h - 2 * (borderpx - selmon->sel->bw),
       -                        borderpx, 0);
       +                        selmon->sel->w, selmon->sel->h, 0);
                arrange(selmon);
        }