diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-08-27 12:52:44 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-08-27 12:52:44 +0100 |
| commit | ec11a3470c2775a75df00e3b69ee6ef60a467e34 (patch) | |
| tree | 42574ab3003ece98db57bafe089d540e47a6347a /dwm.c | |
| parent | grabbuttons() and grabkeys() are now independent from prior numlockmask initi... (diff) | |
| download | dwm-ec11a3470c2775a75df00e3b69ee6ef60a467e34.tar.gz dwm-ec11a3470c2775a75df00e3b69ee6ef60a467e34.zip | |
introduced NOBORDER macro to hide the nasty - 2 * c->bw in various calculations, moved tagset to config.def.h
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 26 |
1 files changed, 13 insertions, 13 deletions
| @@ -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 *) = { | |||
| 227 | static Atom wmatom[WMLast], netatom[NetLast]; | 228 | static Atom wmatom[WMLast], netatom[NetLast]; |
| 228 | static Bool otherwm; | 229 | static Bool otherwm; |
| 229 | static Bool running = True; | 230 | static Bool running = True; |
| 230 | static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */ | ||
| 231 | static Client *clients = NULL; | 231 | static Client *clients = NULL; |
| 232 | static Client *sel = NULL; | 232 | static Client *sel = NULL; |
| 233 | static Client *stack = NULL; | 233 | static 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 | ||
| 948 | void | 948 | void |
| @@ -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) { |
| @@ -1430,7 +1430,7 @@ tile(void) { | |||
| 1430 | /* master */ | 1430 | /* master */ |
| 1431 | c = nexttiled(clients); | 1431 | c = nexttiled(clients); |
| 1432 | mw = mfact * ww; | 1432 | mw = mfact * ww; |
| 1433 | resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); | 1433 | resize(c, wx, wy, NOBORDER(n == 1 ? ww : mw), NOBORDER(wh), resizehints); |
| 1434 | 1434 | ||
| 1435 | if(--n == 0) | 1435 | if(--n == 0) |
| 1436 | return; | 1436 | return; |
| @@ -1444,8 +1444,8 @@ tile(void) { | |||
| 1444 | h = wh; | 1444 | h = wh; |
| 1445 | 1445 | ||
| 1446 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { | 1446 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
| 1447 | resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) | 1447 | resize(c, x, y, NOBORDER(w), /* remainder */ ((i + 1 == n) |
| 1448 | ? (wy + wh) - y : h) - 2 * c->bw, resizehints); | 1448 | ? NOBORDER(wy + wh) - y : h), resizehints); |
| 1449 | if(h != wh) | 1449 | if(h != wh) |
| 1450 | y = c->y + c->h + 2 * c->bw; | 1450 | y = c->y + c->h + 2 * c->bw; |
| 1451 | } | 1451 | } |
