aewl
view 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 |
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
6 #include "dwm.h"
8 void (*arrange)(Arg *) = tiling;
10 void
11 view(Arg *arg)
12 {
13 Client *c;
15 tsel = arg->i;
16 arrange(NULL);
18 for(c = clients; c; c = getnext(c->next))
19 drawtitle(c);
20 drawstatus();
21 }
23 void
24 floating(Arg *arg)
25 {
26 Client *c;
28 arrange = floating;
29 for(c = clients; c; c = c->next) {
30 if(c->tags[tsel])
31 resize(c, True);
32 else
33 ban(c);
34 }
35 if(sel && !sel->tags[tsel]) {
36 if((sel = getnext(clients))) {
37 higher(sel);
38 focus(sel);
39 }
40 }
41 drawstatus();
42 }
44 void
45 tiling(Arg *arg)
46 {
47 Client *c;
48 int n, i, w, h;
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++;
56 if(n > 1)
57 h = (sh - bh) / (n - 1);
58 else
59 h = sh - bh;
61 for(i = 0, c = clients; c; c = c->next) {
62 if(c->tags[tsel]) {
63 if(c->floating) {
64 higher(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(c);
91 }
92 if(!sel || (sel && !sel->tags[tsel])) {
93 if((sel = getnext(clients))) {
94 higher(sel);
95 focus(sel);
96 }
97 }
98 drawstatus();
99 }