aewl
annotate screen.c @ 74:5370ef170cc9
sanitized names
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 22:54:09 +0200 |
parents | c2ddb9dbbd10 |
children |
rev | line source |
---|---|
garbeam@73 | 1 /* |
garbeam@73 | 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
garbeam@73 | 3 * See LICENSE file for license details. |
garbeam@73 | 4 */ |
garbeam@73 | 5 |
garbeam@73 | 6 #include "dwm.h" |
garbeam@73 | 7 |
garbeam@73 | 8 void (*arrange)(Arg *) = tiling; |
garbeam@73 | 9 |
garbeam@73 | 10 void |
garbeam@73 | 11 view(Arg *arg) |
garbeam@73 | 12 { |
garbeam@73 | 13 Client *c; |
garbeam@73 | 14 |
garbeam@73 | 15 tsel = arg->i; |
garbeam@73 | 16 arrange(NULL); |
garbeam@73 | 17 |
garbeam@74 | 18 for(c = clients; c; c = getnext(c->next)) |
garbeam@74 | 19 drawtitle(c); |
garbeam@74 | 20 drawstatus(); |
garbeam@73 | 21 } |
garbeam@73 | 22 |
garbeam@73 | 23 void |
garbeam@73 | 24 floating(Arg *arg) |
garbeam@73 | 25 { |
garbeam@73 | 26 Client *c; |
garbeam@73 | 27 |
garbeam@73 | 28 arrange = floating; |
garbeam@73 | 29 for(c = clients; c; c = c->next) { |
garbeam@73 | 30 if(c->tags[tsel]) |
garbeam@73 | 31 resize(c, True); |
garbeam@73 | 32 else |
garbeam@74 | 33 ban(c); |
garbeam@73 | 34 } |
garbeam@73 | 35 if(sel && !sel->tags[tsel]) { |
garbeam@74 | 36 if((sel = getnext(clients))) { |
garbeam@74 | 37 higher(sel); |
garbeam@73 | 38 focus(sel); |
garbeam@73 | 39 } |
garbeam@73 | 40 } |
garbeam@74 | 41 drawstatus(); |
garbeam@73 | 42 } |
garbeam@73 | 43 |
garbeam@73 | 44 void |
garbeam@73 | 45 tiling(Arg *arg) |
garbeam@73 | 46 { |
garbeam@73 | 47 Client *c; |
garbeam@73 | 48 int n, i, w, h; |
garbeam@73 | 49 |
garbeam@73 | 50 w = sw - mw; |
garbeam@73 | 51 arrange = tiling; |
garbeam@73 | 52 for(n = 0, c = clients; c; c = c->next) |
garbeam@73 | 53 if(c->tags[tsel] && !c->floating) |
garbeam@73 | 54 n++; |
garbeam@73 | 55 |
garbeam@73 | 56 if(n > 1) |
garbeam@73 | 57 h = (sh - bh) / (n - 1); |
garbeam@73 | 58 else |
garbeam@73 | 59 h = sh - bh; |
garbeam@73 | 60 |
garbeam@73 | 61 for(i = 0, c = clients; c; c = c->next) { |
garbeam@73 | 62 if(c->tags[tsel]) { |
garbeam@73 | 63 if(c->floating) { |
garbeam@74 | 64 higher(c); |
garbeam@73 | 65 resize(c, True); |
garbeam@73 | 66 continue; |
garbeam@73 | 67 } |
garbeam@73 | 68 if(n == 1) { |
garbeam@73 | 69 c->x = sx; |
garbeam@73 | 70 c->y = sy + bh; |
garbeam@73 | 71 c->w = sw - 2 * c->border; |
garbeam@73 | 72 c->h = sh - 2 * c->border - bh; |
garbeam@73 | 73 } |
garbeam@73 | 74 else if(i == 0) { |
garbeam@73 | 75 c->x = sx; |
garbeam@73 | 76 c->y = sy + bh; |
garbeam@73 | 77 c->w = mw - 2 * c->border; |
garbeam@73 | 78 c->h = sh - 2 * c->border - bh; |
garbeam@73 | 79 } |
garbeam@73 | 80 else { |
garbeam@73 | 81 c->x = sx + mw; |
garbeam@73 | 82 c->y = sy + (i - 1) * h + bh; |
garbeam@73 | 83 c->w = w - 2 * c->border; |
garbeam@73 | 84 c->h = h - 2 * c->border; |
garbeam@73 | 85 } |
garbeam@73 | 86 resize(c, False); |
garbeam@73 | 87 i++; |
garbeam@73 | 88 } |
garbeam@73 | 89 else |
garbeam@74 | 90 ban(c); |
garbeam@73 | 91 } |
garbeam@73 | 92 if(!sel || (sel && !sel->tags[tsel])) { |
garbeam@74 | 93 if((sel = getnext(clients))) { |
garbeam@74 | 94 higher(sel); |
garbeam@73 | 95 focus(sel); |
garbeam@73 | 96 } |
garbeam@73 | 97 } |
garbeam@74 | 98 drawstatus(); |
garbeam@73 | 99 } |
garbeam@73 | 100 |