summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.def.h1
-rw-r--r--dwm.c26
2 files changed, 14 insertions, 13 deletions
diff --git a/config.def.h b/config.def.h
index e45faef..706cfa9 100644
--- a/config.def.h
+++ b/config.def.h
@@ -16,6 +16,7 @@ static Bool readin = True; /* False means do not read stdin
16 16
17/* tagging */ 17/* tagging */
18static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 18static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
19static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */
19 20
20static Rule rules[] = { 21static Rule rules[] = {
21 /* class instance title tags mask isfloating */ 22 /* class instance title tags mask isfloating */
diff --git a/dwm.c b/dwm.c
index 52a3540..7faad22 100644
--- a/dwm.c
+++ b/dwm.c
@@ -53,6 +53,7 @@
53#define MIN(a, b) ((a) < (b) ? (a) : (b)) 53#define MIN(a, b) ((a) < (b) ? (a) : (b))
54#define MAXTAGLEN 16 54#define MAXTAGLEN 16
55#define MOUSEMASK (BUTTONMASK|PointerMotionMask) 55#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
56#define NOBORDER(x) ((x) - 2 * c->bw)
56#define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) 57#define TAGMASK ((int)((1LL << LENGTH(tags)) - 1))
57#define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) 58#define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height)
58 59
@@ -227,7 +228,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
227static Atom wmatom[WMLast], netatom[NetLast]; 228static Atom wmatom[WMLast], netatom[NetLast];
228static Bool otherwm; 229static Bool otherwm;
229static Bool running = True; 230static Bool running = True;
230static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */
231static Client *clients = NULL; 231static Client *clients = NULL;
232static Client *sel = NULL; 232static Client *sel = NULL;
233static Client *stack = NULL; 233static Client *stack = NULL;
@@ -880,9 +880,9 @@ manage(Window w, XWindowAttributes *wa) {
880 } 880 }
881 else { 881 else {
882 if(c->x + c->w + 2 * c->bw > sx + sw) 882 if(c->x + c->w + 2 * c->bw > sx + sw)
883 c->x = sx + sw - c->w - 2 * c->bw; 883 c->x = sx + sw - NOBORDER(c->w);
884 if(c->y + c->h + 2 * c->bw > sy + sh) 884 if(c->y + c->h + 2 * c->bw > sy + sh)
885 c->y = sy + sh - c->h - 2 * c->bw; 885 c->y = sy + sh - NOBORDER(c->h);
886 c->x = MAX(c->x, sx); 886 c->x = MAX(c->x, sx);
887 /* only fix client y-offset, if the client center might cover the bar */ 887 /* only fix client y-offset, if the client center might cover the bar */
888 c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) && (c->x + (c->w / 2) < wx + ww)) ? bh : sy); 888 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) {
942 Client *c; 942 Client *c;
943 943
944 for(c = nexttiled(clients); c; c = nexttiled(c->next)) 944 for(c = nexttiled(clients); c; c = nexttiled(c->next))
945 resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints); 945 resize(c, wx, wy, NOBORDER(ww), NOBORDER(wh), resizehints);
946} 946}
947 947
948void 948void
@@ -979,11 +979,11 @@ movemouse(const Arg *arg) {
979 if(abs(wx - nx) < snap) 979 if(abs(wx - nx) < snap)
980 nx = wx; 980 nx = wx;
981 else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap) 981 else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap)
982 nx = wx + ww - c->w - 2 * c->bw; 982 nx = wx + ww - NOBORDER(c->w);
983 if(abs(wy - ny) < snap) 983 if(abs(wy - ny) < snap)
984 ny = wy; 984 ny = wy;
985 else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap) 985 else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap)
986 ny = wy + wh - c->h - 2 * c->bw; 986 ny = wy + wh - NOBORDER(c->h);
987 if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) 987 if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
988 togglefloating(NULL); 988 togglefloating(NULL);
989 } 989 }
@@ -1091,9 +1091,9 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
1091 if(w <= 0 || h <= 0) 1091 if(w <= 0 || h <= 0)
1092 return; 1092 return;
1093 if(x > sx + sw) 1093 if(x > sx + sw)
1094 x = sw - w - 2 * c->bw; 1094 x = sw - NOBORDER(w);
1095 if(y > sy + sh) 1095 if(y > sy + sh)
1096 y = sh - h - 2 * c->bw; 1096 y = sh - NOBORDER(h);
1097 if(x + w + 2 * c->bw < sx) 1097 if(x + w + 2 * c->bw < sx)
1098 x = sx; 1098 x = sx;
1099 if(y + h + 2 * c->bw < sy) 1099 if(y + h + 2 * c->bw < sy)
@@ -1141,8 +1141,8 @@ resizemouse(const Arg *arg) {
1141 break; 1141 break;
1142 case MotionNotify: 1142 case MotionNotify:
1143 XSync(dpy, False); 1143 XSync(dpy, False);
1144 nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); 1144 nw = MAX(ev.xmotion.x - NOBORDER(ocx) + 1, 1);
1145 nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); 1145 nh = MAX(ev.xmotion.y - NOBORDER(ocy) + 1, 1);
1146 1146
1147 if(snap && nw >= wx && nw <= wx + ww 1147 if(snap && nw >= wx && nw <= wx + ww
1148 && nh >= wy && nh <= wy + wh) { 1148 && nh >= wy && nh <= wy + wh) {
@@ -1429,7 +1429,7 @@ tile(void) {
1429 /* master */ 1429 /* master */
1430 c = nexttiled(clients); 1430 c = nexttiled(clients);
1431 mw = mfact * ww; 1431 mw = mfact * ww;
1432 resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); 1432 resize(c, wx, wy, NOBORDER(n == 1 ? ww : mw), NOBORDER(wh), resizehints);
1433 1433
1434 if(--n == 0) 1434 if(--n == 0)
1435 return; 1435 return;
@@ -1443,8 +1443,8 @@ tile(void) {
1443 h = wh; 1443 h = wh;
1444 1444
1445 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { 1445 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
1446 resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) 1446 resize(c, x, y, NOBORDER(w), /* remainder */ ((i + 1 == n)
1447 ? (wy + wh) - y : h) - 2 * c->bw, resizehints); 1447 ? NOBORDER(wy + wh) - y : h), resizehints);
1448 if(h != wh) 1448 if(h != wh)
1449 y = c->y + c->h + 2 * c->bw; 1449 y = c->y + c->h + 2 * c->bw;
1450 } 1450 }