introduced NOBORDER macro to hide the nasty - 2 * c->bw in various calculations, moved tagset to config.def.h
ec11a347
2 file(s) · +14 −13
| 16 | 16 | ||
| 17 | 17 | /* tagging */ |
|
| 18 | 18 | static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; |
|
| 19 | + | static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */ |
|
| 19 | 20 | ||
| 20 | 21 | static Rule rules[] = { |
|
| 21 | 22 | /* class instance title tags mask isfloating */ |
| 53 | 53 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
|
| 54 | 54 | #define MAXTAGLEN 16 |
|
| 55 | 55 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) |
|
| 56 | + | #define NOBORDER(x) ((x) - 2 * c->bw) |
|
| 56 | 57 | #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) |
|
| 57 | 58 | #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) |
|
| 58 | 59 | ||
| 227 | 228 | static Atom wmatom[WMLast], netatom[NetLast]; |
|
| 228 | 229 | static Bool otherwm; |
|
| 229 | 230 | static Bool running = True; |
|
| 230 | - | static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */ |
|
| 231 | 231 | static Client *clients = NULL; |
|
| 232 | 232 | static Client *sel = NULL; |
|
| 233 | 233 | static Client *stack = NULL; |
|
| 880 | 880 | } |
|
| 881 | 881 | else { |
|
| 882 | 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 | 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 | 886 | c->x = MAX(c->x, sx); |
|
| 887 | 887 | /* only fix client y-offset, if the client center might cover the bar */ |
|
| 888 | 888 | c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) && (c->x + (c->w / 2) < wx + ww)) ? bh : sy); |
|
| 942 | 942 | Client *c; |
|
| 943 | 943 | ||
| 944 | 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 | 948 | void |
|
| 979 | 979 | if(abs(wx - nx) < snap) |
|
| 980 | 980 | nx = wx; |
|
| 981 | 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 | 983 | if(abs(wy - ny) < snap) |
|
| 984 | 984 | ny = wy; |
|
| 985 | 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 | 987 | if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) |
|
| 988 | 988 | togglefloating(NULL); |
|
| 989 | 989 | } |
|
| 1091 | 1091 | if(w <= 0 || h <= 0) |
|
| 1092 | 1092 | return; |
|
| 1093 | 1093 | if(x > sx + sw) |
|
| 1094 | - | x = sw - w - 2 * c->bw; |
|
| 1094 | + | x = sw - NOBORDER(w); |
|
| 1095 | 1095 | if(y > sy + sh) |
|
| 1096 | - | y = sh - h - 2 * c->bw; |
|
| 1096 | + | y = sh - NOBORDER(h); |
|
| 1097 | 1097 | if(x + w + 2 * c->bw < sx) |
|
| 1098 | 1098 | x = sx; |
|
| 1099 | 1099 | if(y + h + 2 * c->bw < sy) |
|
| 1141 | 1141 | break; |
|
| 1142 | 1142 | case MotionNotify: |
|
| 1143 | 1143 | XSync(dpy, False); |
|
| 1144 | - | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); |
|
| 1145 | - | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); |
|
| 1144 | + | nw = MAX(ev.xmotion.x - NOBORDER(ocx) + 1, 1); |
|
| 1145 | + | nh = MAX(ev.xmotion.y - NOBORDER(ocy) + 1, 1); |
|
| 1146 | 1146 | ||
| 1147 | 1147 | if(snap && nw >= wx && nw <= wx + ww |
|
| 1148 | 1148 | && nh >= wy && nh <= wy + wh) { |
|
| 1430 | 1430 | /* master */ |
|
| 1431 | 1431 | c = nexttiled(clients); |
|
| 1432 | 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 | 1435 | if(--n == 0) |
|
| 1436 | 1436 | return; |
|
| 1444 | 1444 | h = wh; |
|
| 1445 | 1445 | ||
| 1446 | 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) |
|
| 1448 | - | ? (wy + wh) - y : h) - 2 * c->bw, resizehints); |
|
| 1447 | + | resize(c, x, y, NOBORDER(w), /* remainder */ ((i + 1 == n) |
|
| 1448 | + | ? NOBORDER(wy + wh) - y : h), resizehints); |
|
| 1449 | 1449 | if(h != wh) |
|
| 1450 | 1450 | y = c->y + c->h + 2 * c->bw; |
|
| 1451 | 1451 | } |
|