mirror of git://git.suckless.org/dwm
introduced NOBORDER macro to hide the nasty - 2 * c->bw in various calculations, moved tagset to config.def.h
This commit is contained in:
parent
288cf78b18
commit
ec11a3470c
|
@ -16,6 +16,7 @@ static Bool readin = True; /* False means do not read stdin
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */
|
||||||
|
|
||||||
static Rule rules[] = {
|
static Rule rules[] = {
|
||||||
/* class instance title tags mask isfloating */
|
/* class instance title tags mask isfloating */
|
||||||
|
|
26
dwm.c
26
dwm.c
|
@ -53,6 +53,7 @@
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#define MAXTAGLEN 16
|
#define MAXTAGLEN 16
|
||||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||||
|
#define NOBORDER(x) ((x) - 2 * c->bw)
|
||||||
#define TAGMASK ((int)((1LL << LENGTH(tags)) - 1))
|
#define TAGMASK ((int)((1LL << LENGTH(tags)) - 1))
|
||||||
#define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height)
|
#define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height)
|
||||||
|
|
||||||
|
@ -227,7 +228,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
static Atom wmatom[WMLast], netatom[NetLast];
|
static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
static Bool otherwm;
|
static Bool otherwm;
|
||||||
static Bool running = True;
|
static Bool running = True;
|
||||||
static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */
|
|
||||||
static Client *clients = NULL;
|
static Client *clients = NULL;
|
||||||
static Client *sel = NULL;
|
static Client *sel = NULL;
|
||||||
static Client *stack = NULL;
|
static Client *stack = NULL;
|
||||||
|
@ -880,9 +880,9 @@ manage(Window w, XWindowAttributes *wa) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(c->x + c->w + 2 * c->bw > sx + sw)
|
if(c->x + c->w + 2 * c->bw > sx + sw)
|
||||||
c->x = sx + sw - c->w - 2 * c->bw;
|
c->x = sx + sw - NOBORDER(c->w);
|
||||||
if(c->y + c->h + 2 * c->bw > sy + sh)
|
if(c->y + c->h + 2 * c->bw > sy + sh)
|
||||||
c->y = sy + sh - c->h - 2 * c->bw;
|
c->y = sy + sh - NOBORDER(c->h);
|
||||||
c->x = MAX(c->x, sx);
|
c->x = MAX(c->x, sx);
|
||||||
/* only fix client y-offset, if the client center might cover the bar */
|
/* only fix client y-offset, if the client center might cover the bar */
|
||||||
c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) && (c->x + (c->w / 2) < wx + ww)) ? bh : sy);
|
c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) && (c->x + (c->w / 2) < wx + ww)) ? bh : sy);
|
||||||
|
@ -942,7 +942,7 @@ monocle(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = nexttiled(clients); c; c = nexttiled(c->next))
|
for(c = nexttiled(clients); c; c = nexttiled(c->next))
|
||||||
resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints);
|
resize(c, wx, wy, NOBORDER(ww), NOBORDER(wh), resizehints);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -979,11 +979,11 @@ movemouse(const Arg *arg) {
|
||||||
if(abs(wx - nx) < snap)
|
if(abs(wx - nx) < snap)
|
||||||
nx = wx;
|
nx = wx;
|
||||||
else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap)
|
else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap)
|
||||||
nx = wx + ww - c->w - 2 * c->bw;
|
nx = wx + ww - NOBORDER(c->w);
|
||||||
if(abs(wy - ny) < snap)
|
if(abs(wy - ny) < snap)
|
||||||
ny = wy;
|
ny = wy;
|
||||||
else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap)
|
else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap)
|
||||||
ny = wy + wh - c->h - 2 * c->bw;
|
ny = wy + wh - NOBORDER(c->h);
|
||||||
if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
|
if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
|
||||||
togglefloating(NULL);
|
togglefloating(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1091,9 +1091,9 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
||||||
if(w <= 0 || h <= 0)
|
if(w <= 0 || h <= 0)
|
||||||
return;
|
return;
|
||||||
if(x > sx + sw)
|
if(x > sx + sw)
|
||||||
x = sw - w - 2 * c->bw;
|
x = sw - NOBORDER(w);
|
||||||
if(y > sy + sh)
|
if(y > sy + sh)
|
||||||
y = sh - h - 2 * c->bw;
|
y = sh - NOBORDER(h);
|
||||||
if(x + w + 2 * c->bw < sx)
|
if(x + w + 2 * c->bw < sx)
|
||||||
x = sx;
|
x = sx;
|
||||||
if(y + h + 2 * c->bw < sy)
|
if(y + h + 2 * c->bw < sy)
|
||||||
|
@ -1141,8 +1141,8 @@ resizemouse(const Arg *arg) {
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
nw = MAX(ev.xmotion.x - NOBORDER(ocx) + 1, 1);
|
||||||
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
|
nh = MAX(ev.xmotion.y - NOBORDER(ocy) + 1, 1);
|
||||||
|
|
||||||
if(snap && nw >= wx && nw <= wx + ww
|
if(snap && nw >= wx && nw <= wx + ww
|
||||||
&& nh >= wy && nh <= wy + wh) {
|
&& nh >= wy && nh <= wy + wh) {
|
||||||
|
@ -1430,7 +1430,7 @@ tile(void) {
|
||||||
/* master */
|
/* master */
|
||||||
c = nexttiled(clients);
|
c = nexttiled(clients);
|
||||||
mw = mfact * ww;
|
mw = mfact * ww;
|
||||||
resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints);
|
resize(c, wx, wy, NOBORDER(n == 1 ? ww : mw), NOBORDER(wh), resizehints);
|
||||||
|
|
||||||
if(--n == 0)
|
if(--n == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1444,8 +1444,8 @@ tile(void) {
|
||||||
h = wh;
|
h = wh;
|
||||||
|
|
||||||
for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
|
for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
|
||||||
resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
|
resize(c, x, y, NOBORDER(w), /* remainder */ ((i + 1 == n)
|
||||||
? (wy + wh) - y : h) - 2 * c->bw, resizehints);
|
? NOBORDER(wy + wh) - y : h), resizehints);
|
||||||
if(h != wh)
|
if(h != wh)
|
||||||
y = c->y + c->h + 2 * c->bw;
|
y = c->y + c->h + 2 * c->bw;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue