Apple smartborders patch (dwm-smartborders-6.2.diff)
and remove noborder patch
This commit is contained in:
parent
d20b2bc3c8
commit
90f4f5f147
|
@ -6,8 +6,8 @@ Applied patches
|
|||
* focusonclick
|
||||
* hide_vacant_tags
|
||||
* movestack
|
||||
* noborder
|
||||
* pertag
|
||||
* smartborders
|
||||
* statusallmons
|
||||
* systray
|
||||
|
||||
|
|
87
dwm.c
87
dwm.c
|
@ -167,7 +167,7 @@ struct Systray {
|
|||
|
||||
/* function declarations */
|
||||
static void applyrules(Client *c);
|
||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int bw, int interact);
|
||||
static void arrange(Monitor *m);
|
||||
static void arrangemon(Monitor *m);
|
||||
static void attach(Client *c);
|
||||
|
@ -209,15 +209,14 @@ static void monocle(Monitor *m);
|
|||
static void movemouse(const Arg *arg);
|
||||
static void movestack(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
static bool noborder(Client *c);
|
||||
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 removesystrayicon(Client *i);
|
||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||
static void resize(Client *c, int x, int y, int w, int h, int bw, int interact);
|
||||
static void resizebarwin(Monitor *m);
|
||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
static void resizeclient(Client *c, int x, int y, int w, int h, int bw);
|
||||
static void resizemouse(const Arg *arg);
|
||||
static void resizerequest(XEvent *e);
|
||||
static void restack(Monitor *m);
|
||||
|
@ -356,7 +355,7 @@ applyrules(Client *c)
|
|||
}
|
||||
|
||||
int
|
||||
applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
||||
applysizehints(Client *c, int *x, int *y, int *w, int *h, int bw, int interact)
|
||||
{
|
||||
int baseismin;
|
||||
Monitor *m = c->mon;
|
||||
|
@ -369,18 +368,18 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
|||
*x = sw - WIDTH(c);
|
||||
if (*y > sh)
|
||||
*y = sh - HEIGHT(c);
|
||||
if (*x + *w + 2 * c->bw < 0)
|
||||
if (*x + *w + 2 * bw < 0)
|
||||
*x = 0;
|
||||
if (*y + *h + 2 * c->bw < 0)
|
||||
if (*y + *h + 2 * 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 * c->bw <= m->wx)
|
||||
if (*x + *w + 2 * bw <= m->wx)
|
||||
*x = m->wx;
|
||||
if (*y + *h + 2 * c->bw <= m->wy)
|
||||
if (*y + *h + 2 * bw <= m->wy)
|
||||
*y = m->wy;
|
||||
}
|
||||
if (*h < bh)
|
||||
|
@ -418,7 +417,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
|||
if (c->maxh)
|
||||
*h = MIN(*h, c->maxh);
|
||||
}
|
||||
return *x != c->x || *y != c->y || *w != c->w || *h != c->h;
|
||||
return *x != c->x || *y != c->y || *w != c->w || *h != c->h || bw != c->bw;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -438,9 +437,16 @@ 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
|
||||
/* <>< case; rather than providing an arrange function and upsetting other logic that tests for its presence, simply add borders here */
|
||||
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
|
||||
|
@ -1262,7 +1268,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 - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
resize(c, m->wx, m->wy, m->ww, m->wh, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1311,7 +1317,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, 1);
|
||||
resize(c, nx, ny, c->w, c->h, c->bw, 1);
|
||||
break;
|
||||
}
|
||||
} while (ev.type != ButtonRelease);
|
||||
|
@ -1379,26 +1385,6 @@ nexttiled(Client *c)
|
|||
return c;
|
||||
}
|
||||
|
||||
bool
|
||||
noborder(Client *c)
|
||||
{
|
||||
void (*const arrange_func)(Monitor*) = c->mon->lt[c->mon->sellt]->arrange;
|
||||
|
||||
/* Layout is floating */
|
||||
if (arrange_func == NULL) return false;
|
||||
|
||||
/* Client is floating */
|
||||
if (c->isfloating) return false;
|
||||
|
||||
if (arrange_func == tile) {
|
||||
return nexttiled(c->mon->clients) == c && nexttiled(c->next) == NULL;
|
||||
} else if (arrange_func == monocle) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pop(Client *c)
|
||||
{
|
||||
|
@ -1490,10 +1476,10 @@ removesystrayicon(Client *i)
|
|||
|
||||
|
||||
void
|
||||
resize(Client *c, int x, int y, int w, int h, int interact)
|
||||
resize(Client *c, int x, int y, int w, int h, int bw, int interact)
|
||||
{
|
||||
if (applysizehints(c, &x, &y, &w, &h, interact))
|
||||
resizeclient(c, x, y, w, h);
|
||||
if (applysizehints(c, &x, &y, &w, &h, bw, interact))
|
||||
resizeclient(c, x, y, w, h, bw);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1505,7 +1491,7 @@ resizebarwin(Monitor *m) {
|
|||
}
|
||||
|
||||
void
|
||||
resizeclient(Client *c, int x, int y, int w, int h)
|
||||
resizeclient(Client *c, int x, int y, int w, int h, int bw)
|
||||
{
|
||||
XWindowChanges wc;
|
||||
|
||||
|
@ -1513,14 +1499,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|||
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;
|
||||
wc.border_width = c->bw;
|
||||
|
||||
if (noborder(c)) {
|
||||
c->w = wc.width += c->bw * 2;
|
||||
c->h = wc.height += c->bw * 2;
|
||||
wc.border_width = 0;
|
||||
}
|
||||
|
||||
c->oldbw = c->bw; c->bw = wc.border_width = bw;
|
||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||
configure(c);
|
||||
XSync(dpy, False);
|
||||
|
@ -1567,7 +1546,7 @@ resizemouse(const Arg *arg)
|
|||
togglefloating(NULL);
|
||||
}
|
||||
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
||||
resize(c, c->x, c->y, nw, nh, 1);
|
||||
resize(c, c->x, c->y, nw, nh, c->bw, 1);
|
||||
break;
|
||||
}
|
||||
} while (ev.type != ButtonRelease);
|
||||
|
@ -1865,7 +1844,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)
|
||||
resize(c, c->x, c->y, c->w, c->h, 0);
|
||||
resize(c, c->x, c->y, c->w, c->h, c->bw, 0);
|
||||
showhide(c->snext);
|
||||
} else {
|
||||
/* hide clients bottom up */
|
||||
|
@ -1919,13 +1898,17 @@ tagmon(const Arg *arg)
|
|||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, mw, my, ty;
|
||||
unsigned int i, n, h, mw, my, ty, bw;
|
||||
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
|
||||
|
@ -1933,12 +1916,12 @@ tile(Monitor *m)
|
|||
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);
|
||||
resize(c, m->wx, m->wy + my, mw - 2*bw, h - 2*bw, 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);
|
||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - 2*bw, h - 2*bw, bw, 0);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
ty += HEIGHT(c);
|
||||
}
|
||||
|
@ -1972,7 +1955,9 @@ 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, selmon->sel->h, 0);
|
||||
selmon->sel->w - 2 * (borderpx - selmon->sel->bw),
|
||||
selmon->sel->h - 2 * (borderpx - selmon->sel->bw),
|
||||
borderpx, 0);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@ -2314,7 +2299,7 @@ updatesystrayicongeom(Client *i, int w, int h)
|
|||
i->w = w;
|
||||
else
|
||||
i->w = (int) ((float)bh * ((float)w / (float)h));
|
||||
applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
|
||||
applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), 0, False);
|
||||
/* force icons into the systray dimensions if they don't want to */
|
||||
if (i->h > bh) {
|
||||
if (i->w == i->h)
|
||||
|
|
Loading…
Reference in New Issue