diff options
| author | Anselm R. Garbe <arg@suckless.org> | 2007-01-05 21:55:43 +0100 |
|---|---|---|
| committer | Anselm R. Garbe <arg@suckless.org> | 2007-01-05 21:55:43 +0100 |
| commit | 7ac0de8350c51ef39e4dee5f60e1da641c4fbd5b (patch) | |
| tree | ed1a4f31a0bb89c5a329092b525449cd49315023 | |
| parent | preserving c1->snext and c2->snext in swap() as well. (diff) | |
| download | dwm-7ac0de8350c51ef39e4dee5f60e1da641c4fbd5b.tar.gz dwm-7ac0de8350c51ef39e4dee5f60e1da641c4fbd5b.zip | |
removed swap(), implemented pop for everything
| -rw-r--r-- | view.c | 69 |
1 files changed, 8 insertions, 61 deletions
| @@ -11,44 +11,6 @@ nexttiled(Client *c) { | |||
| 11 | return c; | 11 | return c; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | static Bool | ||
| 15 | ismaster(Client *c) { | ||
| 16 | Client *cl; | ||
| 17 | unsigned int i; | ||
| 18 | |||
| 19 | for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++); | ||
| 20 | return i < nmaster; | ||
| 21 | } | ||
| 22 | |||
| 23 | static void | ||
| 24 | pop(Client *c) { | ||
| 25 | detach(c); | ||
| 26 | if(clients) | ||
| 27 | clients->prev = c; | ||
| 28 | c->next = clients; | ||
| 29 | clients = c; | ||
| 30 | } | ||
| 31 | |||
| 32 | static void | ||
| 33 | swap(Client *c1, Client *c2) { | ||
| 34 | Client tmp = *c1; | ||
| 35 | Client *c1p = c1->prev; | ||
| 36 | Client *c1n = c1->next; | ||
| 37 | Client *c1s = c1->snext; | ||
| 38 | Client *c2p = c2->prev; | ||
| 39 | Client *c2n = c2->next; | ||
| 40 | Client *c2s = c2->snext; | ||
| 41 | |||
| 42 | *c1 = *c2; | ||
| 43 | *c2 = tmp; | ||
| 44 | c1->prev = c1p; | ||
| 45 | c1->next = c1n; | ||
| 46 | c1->snext = c1s; | ||
| 47 | c2->prev = c2p; | ||
| 48 | c2->next = c2n; | ||
| 49 | c2->snext = c2s; | ||
| 50 | } | ||
| 51 | |||
| 52 | static void | 14 | static void |
| 53 | togglemax(Client *c) { | 15 | togglemax(Client *c) { |
| 54 | XEvent ev; | 16 | XEvent ev; |
| @@ -72,15 +34,6 @@ togglemax(Client *c) { | |||
| 72 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | 34 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
| 73 | } | 35 | } |
| 74 | 36 | ||
| 75 | static Client * | ||
| 76 | topofstack() { | ||
| 77 | Client *c; | ||
| 78 | unsigned int i; | ||
| 79 | |||
| 80 | for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++); | ||
| 81 | return (i < nmaster) ? NULL : c; | ||
| 82 | } | ||
| 83 | |||
| 84 | /* extern */ | 37 | /* extern */ |
| 85 | 38 | ||
| 86 | void (*arrange)(void) = DEFMODE; | 39 | void (*arrange)(void) = DEFMODE; |
| @@ -308,19 +261,13 @@ zoom(Arg *arg) { | |||
| 308 | n++; | 261 | n++; |
| 309 | 262 | ||
| 310 | c = sel; | 263 | c = sel; |
| 311 | if(arrange == dofloat) | 264 | if(arrange != dofloat) { |
| 312 | return; | 265 | detach(c); |
| 313 | else if(n <= nmaster) | 266 | if(clients) |
| 314 | pop(c); | 267 | clients->prev = c; |
| 315 | else if(ismaster(sel)) { | 268 | c->next = clients; |
| 316 | if(!(c = topofstack())) | 269 | clients = c; |
| 317 | return; | 270 | focus(c); |
| 318 | swap(c, sel); | 271 | arrange(); |
| 319 | c = sel; | ||
| 320 | } | 272 | } |
| 321 | else | ||
| 322 | pop(c); | ||
| 323 | |||
| 324 | focus(c); | ||
| 325 | arrange(); | ||
| 326 | } | 273 | } |
