summaryrefslogtreecommitdiffstats
path: root/view.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-19 13:53:40 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-19 13:53:40 +0100
commitb3d7e07f18f0f69f8c3b3542615da62dfc4c6175 (patch)
tree55ef91ea3249738001b2f60aa80fb8d68af32862 /view.c
parentadded some new convenience functions (diff)
downloaddwm-b3d7e07f18f0f69f8c3b3542615da62dfc4c6175.tar.gz
dwm-b3d7e07f18f0f69f8c3b3542615da62dfc4c6175.zip
some more refactoring
Diffstat (limited to 'view.c')
-rw-r--r--view.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/view.c b/view.c
index cd07b94..4781b4e 100644
--- a/view.c
+++ b/view.c
@@ -8,6 +8,20 @@
8void (*arrange)(void) = DEFMODE; 8void (*arrange)(void) = DEFMODE;
9 9
10void 10void
11attach(Client *c) {
12 if(clients)
13 clients->prev = c;
14 c->next = clients;
15 clients = c;
16}
17
18void
19attachstack(Client *c) {
20 c->snext = stack;
21 stack = c;
22}
23
24void
11dofloat(void) { 25dofloat(void) {
12 Client *c; 26 Client *c;
13 27
@@ -31,6 +45,24 @@ dofloat(void) {
31} 45}
32 46
33void 47void
48detach(Client *c) {
49 if(c->prev)
50 c->prev->next = c->next;
51 if(c->next)
52 c->next->prev = c->prev;
53 if(c == clients)
54 clients = c->next;
55 c->next = c->prev = NULL;
56}
57
58void
59detachstack(Client *c) {
60 Client **tc;
61 for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
62 *tc = c->snext;
63}
64
65void
34focusnext(Arg *arg) { 66focusnext(Arg *arg) {
35 Client *c; 67 Client *c;
36 68
@@ -62,6 +94,16 @@ focusprev(Arg *arg) {
62 } 94 }
63} 95}
64 96
97Client *
98getclient(Window w) {
99 Client *c;
100
101 for(c = clients; c; c = c->next)
102 if(c->win == w)
103 return c;
104 return NULL;
105}
106
65Bool 107Bool
66isvisible(Client *c) { 108isvisible(Client *c) {
67 unsigned int i; 109 unsigned int i;