summaryrefslogtreecommitdiffstats
path: root/view.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@10kloc.org>2006-08-29 09:23:44 +0200
committerAnselm R. Garbe <arg@10kloc.org>2006-08-29 09:23:44 +0200
commit8a6679b3b4999559059df3ae9e08951099511036 (patch)
tree7b8c4ac2e4647caffba13638cac03c183c7faab2 /view.c
parentremoved crappy variables (diff)
downloaddwm-8a6679b3b4999559059df3ae9e08951099511036.tar.gz
dwm-8a6679b3b4999559059df3ae9e08951099511036.zip
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Diffstat (limited to '')
-rw-r--r--view.c63
1 files changed, 46 insertions, 17 deletions
diff --git a/view.c b/view.c
index 0108a23..9ba8e0b 100644
--- a/view.c
+++ b/view.c
@@ -9,6 +9,45 @@
9void (*arrange)(Arg *) = DEFMODE; 9void (*arrange)(Arg *) = DEFMODE;
10 10
11void 11void
12attach(Client *c)
13{
14 Client *first = getnext(clients);
15
16 if(!first) {
17 if(clients) {
18 for(first = clients; first->next; first = first->next);
19 first->next = c;
20 c->prev = first;
21 }
22 else
23 clients = c;
24 }
25 else if(first == clients) {
26 c->next = clients;
27 clients->prev = c;
28 clients = c;
29 }
30 else {
31 first->prev->next = c;
32 c->prev = first->prev;
33 first->prev = c;
34 c->next = first;
35 }
36}
37
38void
39detach(Client *c)
40{
41 if(c->prev)
42 c->prev->next = c->next;
43 if(c->next)
44 c->next->prev = c->prev;
45 if(c == clients)
46 clients = c->next;
47 c->next = c->prev = NULL;
48}
49
50void
12dofloat(Arg *arg) 51dofloat(Arg *arg)
13{ 52{
14 Client *c; 53 Client *c;
@@ -228,26 +267,16 @@ view(Arg *arg)
228void 267void
229zoom(Arg *arg) 268zoom(Arg *arg)
230{ 269{
231 Client *c; 270 Client *c = sel;
232 271
233 if(!sel || (arrange != dotile) || sel->isfloat || sel->ismax) 272 if(!c || (arrange != dotile) || c->isfloat || c->ismax)
234 return; 273 return;
235 274
236 if(sel == getnext(clients)) { 275 if(c == getnext(clients))
237 if((c = getnext(sel->next))) 276 if(!(c = getnext(c->next)))
238 sel = c;
239 else
240 return; 277 return;
241 } 278 detach(c);
242 279 attach(c);
243 /* pop */ 280 focus(c);
244 sel->prev->next = sel->next;
245 if(sel->next)
246 sel->next->prev = sel->prev;
247 sel->prev = NULL;
248 clients->prev = sel;
249 sel->next = clients;
250 clients = sel;
251 focus(sel);
252 arrange(NULL); 281 arrange(NULL);
253} 282}