diff options
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 26 |
1 files changed, 7 insertions, 19 deletions
| @@ -41,6 +41,7 @@ | |||
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | /* macros */ | 43 | /* macros */ |
| 44 | #define ADJUSTBORDER(C, BW) if((C)->bw != (BW)) XSetWindowBorder(dpy, (C)->win, (BW)); | ||
| 44 | #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) | 45 | #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) |
| 45 | #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) | 46 | #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) |
| 46 | #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) | 47 | #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) |
| @@ -128,7 +129,6 @@ typedef struct { | |||
| 128 | } Rule; | 129 | } Rule; |
| 129 | 130 | ||
| 130 | /* function declarations */ | 131 | /* function declarations */ |
| 131 | static void adjustborder(Client *c, Bool issingle); | ||
| 132 | static void applyrules(Client *c); | 132 | static void applyrules(Client *c); |
| 133 | static void arrange(void); | 133 | static void arrange(void); |
| 134 | static void attach(Client *c); | 134 | static void attach(Client *c); |
| @@ -246,17 +246,6 @@ struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 | |||
| 246 | 246 | ||
| 247 | /* function implementations */ | 247 | /* function implementations */ |
| 248 | void | 248 | void |
| 249 | adjustborder(Client *c, Bool issingle) { | ||
| 250 | XWindowChanges wc; | ||
| 251 | |||
| 252 | wc.border_width = issingle ? 0 : borderpx; | ||
| 253 | if(c->bw != wc.border_width) { | ||
| 254 | c->bw = wc.border_width; | ||
| 255 | XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); | ||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | void | ||
| 260 | applyrules(Client *c) { | 249 | applyrules(Client *c) { |
| 261 | unsigned int i; | 250 | unsigned int i; |
| 262 | Rule *r; | 251 | Rule *r; |
| @@ -941,7 +930,7 @@ monocle(void) { | |||
| 941 | 930 | ||
| 942 | for(n = 0, c = nexttiled(clients); c && n < 2; c = nexttiled(c->next), n++); | 931 | for(n = 0, c = nexttiled(clients); c && n < 2; c = nexttiled(c->next), n++); |
| 943 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) { | 932 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
| 944 | adjustborder(c, n == 1); | 933 | ADJUSTBORDER(c, (n == 1 ? 0 : borderpx)) |
| 945 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints); | 934 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints); |
| 946 | } | 935 | } |
| 947 | } | 936 | } |
| @@ -1148,9 +1137,8 @@ resizemouse(const Arg *arg) { | |||
| 1148 | handler[ev.type](&ev); | 1137 | handler[ev.type](&ev); |
| 1149 | break; | 1138 | break; |
| 1150 | case MotionNotify: | 1139 | case MotionNotify: |
| 1151 | nw = MAX(ev.xmotion.x - ocx - 2*c->bw + 1, 1); | 1140 | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); |
| 1152 | nh = MAX(ev.xmotion.y - ocy - 2*c->bw + 1, 1); | 1141 | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); |
| 1153 | |||
| 1154 | if(snap && nw >= wx && nw <= wx + ww | 1142 | if(snap && nw >= wx && nw <= wx + ww |
| 1155 | && nh >= wy && nh <= wy + wh) { | 1143 | && nh >= wy && nh <= wy + wh) { |
| 1156 | if(!c->isfloating && lt[sellt]->arrange | 1144 | if(!c->isfloating && lt[sellt]->arrange |
| @@ -1346,7 +1334,7 @@ showhide(Client *c) { | |||
| 1346 | if(!c) | 1334 | if(!c) |
| 1347 | return; | 1335 | return; |
| 1348 | if(ISVISIBLE(c)) { /* show clients top down */ | 1336 | if(ISVISIBLE(c)) { /* show clients top down */ |
| 1349 | adjustborder(c, False); | 1337 | ADJUSTBORDER(c, borderpx) |
| 1350 | XMoveWindow(dpy, c->win, c->x, c->y); | 1338 | XMoveWindow(dpy, c->win, c->x, c->y); |
| 1351 | if(!lt[sellt]->arrange || c->isfloating) | 1339 | if(!lt[sellt]->arrange || c->isfloating) |
| 1352 | resize(c, c->x, c->y, c->w, c->h, True); | 1340 | resize(c, c->x, c->y, c->w, c->h, True); |
| @@ -1410,7 +1398,7 @@ tile(void) { | |||
| 1410 | /* master */ | 1398 | /* master */ |
| 1411 | c = nexttiled(clients); | 1399 | c = nexttiled(clients); |
| 1412 | mw = mfact * ww; | 1400 | mw = mfact * ww; |
| 1413 | adjustborder(c, n == 1); | 1401 | ADJUSTBORDER(c, (n == 1 ? 0 : borderpx)) |
| 1414 | resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); | 1402 | resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); |
| 1415 | 1403 | ||
| 1416 | if(--n == 0) | 1404 | if(--n == 0) |
| @@ -1425,7 +1413,7 @@ tile(void) { | |||
| 1425 | h = wh; | 1413 | h = wh; |
| 1426 | 1414 | ||
| 1427 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { | 1415 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
| 1428 | adjustborder(c, False); | 1416 | ADJUSTBORDER(c, borderpx) |
| 1429 | resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) | 1417 | resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) |
| 1430 | ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints); | 1418 | ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints); |
| 1431 | if(h != wh) | 1419 | if(h != wh) |
