diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-14 22:33:38 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-14 22:33:38 +0200 |
| commit | 29355bd38284ed9aec8d3ffabde61db73947c9f9 (patch) | |
| tree | e8c9d94e52b57df9c93bc58bdd5c37b9e3262e65 /screen.c | |
| parent | I prefer the tiled/floating indicator on the right side (diff) | |
| download | dwm-29355bd38284ed9aec8d3ffabde61db73947c9f9.tar.gz dwm-29355bd38284ed9aec8d3ffabde61db73947c9f9.zip | |
rearranged
Diffstat (limited to 'screen.c')
| -rw-r--r-- | screen.c | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/screen.c b/screen.c new file mode 100644 index 0000000..f2891cf --- /dev/null +++ b/screen.c | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /* | ||
| 2 | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | ||
| 3 | * See LICENSE file for license details. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include "dwm.h" | ||
| 7 | |||
| 8 | void (*arrange)(Arg *) = tiling; | ||
| 9 | |||
| 10 | void | ||
| 11 | view(Arg *arg) | ||
| 12 | { | ||
| 13 | Client *c; | ||
| 14 | |||
| 15 | tsel = arg->i; | ||
| 16 | arrange(NULL); | ||
| 17 | |||
| 18 | for(c = clients; c; c = next(c->next)) | ||
| 19 | draw_client(c); | ||
| 20 | draw_bar(); | ||
| 21 | } | ||
| 22 | |||
| 23 | void | ||
| 24 | floating(Arg *arg) | ||
| 25 | { | ||
| 26 | Client *c; | ||
| 27 | |||
| 28 | arrange = floating; | ||
| 29 | for(c = clients; c; c = c->next) { | ||
| 30 | if(c->tags[tsel]) | ||
| 31 | resize(c, True); | ||
| 32 | else | ||
| 33 | ban_client(c); | ||
| 34 | } | ||
| 35 | if(sel && !sel->tags[tsel]) { | ||
| 36 | if((sel = next(clients))) { | ||
| 37 | craise(sel); | ||
| 38 | focus(sel); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | draw_bar(); | ||
| 42 | } | ||
| 43 | |||
| 44 | void | ||
| 45 | tiling(Arg *arg) | ||
| 46 | { | ||
| 47 | Client *c; | ||
| 48 | int n, i, w, h; | ||
| 49 | |||
| 50 | w = sw - mw; | ||
| 51 | arrange = tiling; | ||
| 52 | for(n = 0, c = clients; c; c = c->next) | ||
| 53 | if(c->tags[tsel] && !c->floating) | ||
| 54 | n++; | ||
| 55 | |||
| 56 | if(n > 1) | ||
| 57 | h = (sh - bh) / (n - 1); | ||
| 58 | else | ||
| 59 | h = sh - bh; | ||
| 60 | |||
| 61 | for(i = 0, c = clients; c; c = c->next) { | ||
| 62 | if(c->tags[tsel]) { | ||
| 63 | if(c->floating) { | ||
| 64 | craise(c); | ||
| 65 | resize(c, True); | ||
| 66 | continue; | ||
| 67 | } | ||
| 68 | if(n == 1) { | ||
| 69 | c->x = sx; | ||
| 70 | c->y = sy + bh; | ||
| 71 | c->w = sw - 2 * c->border; | ||
| 72 | c->h = sh - 2 * c->border - bh; | ||
| 73 | } | ||
| 74 | else if(i == 0) { | ||
| 75 | c->x = sx; | ||
| 76 | c->y = sy + bh; | ||
| 77 | c->w = mw - 2 * c->border; | ||
| 78 | c->h = sh - 2 * c->border - bh; | ||
| 79 | } | ||
| 80 | else { | ||
| 81 | c->x = sx + mw; | ||
| 82 | c->y = sy + (i - 1) * h + bh; | ||
| 83 | c->w = w - 2 * c->border; | ||
| 84 | c->h = h - 2 * c->border; | ||
| 85 | } | ||
| 86 | resize(c, False); | ||
| 87 | i++; | ||
| 88 | } | ||
| 89 | else | ||
| 90 | ban_client(c); | ||
| 91 | } | ||
| 92 | if(!sel || (sel && !sel->tags[tsel])) { | ||
| 93 | if((sel = next(clients))) { | ||
| 94 | craise(sel); | ||
| 95 | focus(sel); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | draw_bar(); | ||
| 99 | } | ||
| 100 | |||
