diff options
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 21 |
1 files changed, 20 insertions, 1 deletions
| @@ -128,6 +128,7 @@ typedef struct { | |||
| 128 | } Rule; | 128 | } Rule; |
| 129 | 129 | ||
| 130 | /* function declarations */ | 130 | /* function declarations */ |
| 131 | static void adjustborder(Client *c, Bool issingle); | ||
| 131 | static void applyrules(Client *c); | 132 | static void applyrules(Client *c); |
| 132 | static void arrange(void); | 133 | static void arrange(void); |
| 133 | static void attach(Client *c); | 134 | static void attach(Client *c); |
| @@ -245,6 +246,17 @@ struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 | |||
| 245 | 246 | ||
| 246 | /* function implementations */ | 247 | /* function implementations */ |
| 247 | 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 | ||
| 248 | applyrules(Client *c) { | 260 | applyrules(Client *c) { |
| 249 | unsigned int i; | 261 | unsigned int i; |
| 250 | Rule *r; | 262 | Rule *r; |
| @@ -924,10 +936,14 @@ maprequest(XEvent *e) { | |||
| 924 | 936 | ||
| 925 | void | 937 | void |
| 926 | monocle(void) { | 938 | monocle(void) { |
| 939 | unsigned int n; | ||
| 927 | Client *c; | 940 | Client *c; |
| 928 | 941 | ||
| 929 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) | 942 | for(n = 0, c = nexttiled(clients); c && n < 2; c = nexttiled(c->next), n++); |
| 943 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) { | ||
| 944 | adjustborder(c, n == 1); | ||
| 930 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints); | 945 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints); |
| 946 | } | ||
| 931 | } | 947 | } |
| 932 | 948 | ||
| 933 | void | 949 | void |
| @@ -1330,6 +1346,7 @@ showhide(Client *c) { | |||
| 1330 | if(!c) | 1346 | if(!c) |
| 1331 | return; | 1347 | return; |
| 1332 | if(ISVISIBLE(c)) { /* show clients top down */ | 1348 | if(ISVISIBLE(c)) { /* show clients top down */ |
| 1349 | adjustborder(c, False); | ||
| 1333 | XMoveWindow(dpy, c->win, c->x, c->y); | 1350 | XMoveWindow(dpy, c->win, c->x, c->y); |
| 1334 | if(!lt[sellt]->arrange || c->isfloating) | 1351 | if(!lt[sellt]->arrange || c->isfloating) |
| 1335 | resize(c, c->x, c->y, c->w, c->h, True); | 1352 | resize(c, c->x, c->y, c->w, c->h, True); |
| @@ -1393,6 +1410,7 @@ tile(void) { | |||
| 1393 | /* master */ | 1410 | /* master */ |
| 1394 | c = nexttiled(clients); | 1411 | c = nexttiled(clients); |
| 1395 | mw = mfact * ww; | 1412 | mw = mfact * ww; |
| 1413 | adjustborder(c, n == 1); | ||
| 1396 | resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); | 1414 | resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); |
| 1397 | 1415 | ||
| 1398 | if(--n == 0) | 1416 | if(--n == 0) |
| @@ -1407,6 +1425,7 @@ tile(void) { | |||
| 1407 | h = wh; | 1425 | h = wh; |
| 1408 | 1426 | ||
| 1409 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { | 1427 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
| 1428 | adjustborder(c, False); | ||
| 1410 | resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) | 1429 | resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) |
| 1411 | ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints); | 1430 | ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints); |
| 1412 | if(h != wh) | 1431 | if(h != wh) |
