diff options
| author | Anselm R. Garbe <arg@10kloc.org> | 2006-08-29 09:23:44 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@10kloc.org> | 2006-08-29 09:23:44 +0200 |
| commit | 8a6679b3b4999559059df3ae9e08951099511036 (patch) | |
| tree | 7b8c4ac2e4647caffba13638cac03c183c7faab2 /view.c | |
| parent | removed crappy variables (diff) | |
| download | dwm-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.c | 63 |
1 files changed, 46 insertions, 17 deletions
| @@ -9,6 +9,45 @@ | |||
| 9 | void (*arrange)(Arg *) = DEFMODE; | 9 | void (*arrange)(Arg *) = DEFMODE; |
| 10 | 10 | ||
| 11 | void | 11 | void |
| 12 | attach(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 | |||
| 38 | void | ||
| 39 | detach(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 | |||
| 50 | void | ||
| 12 | dofloat(Arg *arg) | 51 | dofloat(Arg *arg) |
| 13 | { | 52 | { |
| 14 | Client *c; | 53 | Client *c; |
| @@ -228,26 +267,16 @@ view(Arg *arg) | |||
| 228 | void | 267 | void |
| 229 | zoom(Arg *arg) | 268 | zoom(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 | } |
