diff options
| author | Anselm R. Garbe <arg@10kloc.org> | 2006-08-22 16:50:21 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@10kloc.org> | 2006-08-22 16:50:21 +0200 |
| commit | aa13727067af829b94461eb36aa029297ed8e6b9 (patch) | |
| tree | aaaae4d7d65711bfb5c2153b60fdb33990564e6b | |
| parent | removed DEFTAG (diff) | |
| download | dwm-aa13727067af829b94461eb36aa029297ed8e6b9.tar.gz dwm-aa13727067af829b94461eb36aa029297ed8e6b9.zip | |
separated several functions into view.c
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | client.c | 61 | ||||
| -rw-r--r-- | dwm.h | 22 | ||||
| -rw-r--r-- | tag.c | 186 | ||||
| -rw-r--r-- | view.c | 253 |
5 files changed, 266 insertions, 258 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | include config.mk | 4 | include config.mk |
| 5 | 5 | ||
| 6 | SRC = client.c draw.c event.c main.c tag.c util.c | 6 | SRC = client.c draw.c event.c main.c tag.c util.c view.c |
| 7 | OBJ = ${SRC:.c=.o} | 7 | OBJ = ${SRC:.c=.o} |
| 8 | 8 | ||
| 9 | all: options dwm | 9 | all: options dwm |
| @@ -89,40 +89,6 @@ focus(Client *c) | |||
| 89 | XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); | 89 | XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | void | ||
| 93 | focusnext(Arg *arg) | ||
| 94 | { | ||
| 95 | Client *c; | ||
| 96 | |||
| 97 | if(!sel) | ||
| 98 | return; | ||
| 99 | |||
| 100 | if(!(c = getnext(sel->next))) | ||
| 101 | c = getnext(clients); | ||
| 102 | if(c) { | ||
| 103 | focus(c); | ||
| 104 | restack(); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | void | ||
| 109 | focusprev(Arg *arg) | ||
| 110 | { | ||
| 111 | Client *c; | ||
| 112 | |||
| 113 | if(!sel) | ||
| 114 | return; | ||
| 115 | |||
| 116 | if(!(c = getprev(sel->prev))) { | ||
| 117 | for(c = clients; c && c->next; c = c->next); | ||
| 118 | c = getprev(c); | ||
| 119 | } | ||
| 120 | if(c) { | ||
| 121 | focus(c); | ||
| 122 | restack(); | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | Client * | 92 | Client * |
| 127 | getclient(Window w) | 93 | getclient(Window w) |
| 128 | { | 94 | { |
| @@ -446,30 +412,3 @@ unmanage(Client *c) | |||
| 446 | focus(sel); | 412 | focus(sel); |
| 447 | arrange(NULL); | 413 | arrange(NULL); |
| 448 | } | 414 | } |
| 449 | |||
| 450 | void | ||
| 451 | zoom(Arg *arg) | ||
| 452 | { | ||
| 453 | Client *c; | ||
| 454 | |||
| 455 | if(!sel || (arrange != dotile) || sel->isfloat || sel->ismax) | ||
| 456 | return; | ||
| 457 | |||
| 458 | if(sel == getnext(clients)) { | ||
| 459 | if((c = getnext(sel->next))) | ||
| 460 | sel = c; | ||
| 461 | else | ||
| 462 | return; | ||
| 463 | } | ||
| 464 | |||
| 465 | /* pop */ | ||
| 466 | sel->prev->next = sel->next; | ||
| 467 | if(sel->next) | ||
| 468 | sel->next->prev = sel->prev; | ||
| 469 | sel->prev = NULL; | ||
| 470 | clients->prev = sel; | ||
| 471 | sel->next = clients; | ||
| 472 | clients = sel; | ||
| 473 | focus(sel); | ||
| 474 | arrange(NULL); | ||
| 475 | } | ||
| @@ -84,8 +84,6 @@ extern Window root, barwin; | |||
| 84 | /* client.c */ | 84 | /* client.c */ |
| 85 | extern void ban(Client *c); | 85 | extern void ban(Client *c); |
| 86 | extern void focus(Client *c); | 86 | extern void focus(Client *c); |
| 87 | extern void focusnext(Arg *arg); | ||
| 88 | extern void focusprev(Arg *arg); | ||
| 89 | extern Client *getclient(Window w); | 87 | extern Client *getclient(Window w); |
| 90 | extern Client *getctitle(Window w); | 88 | extern Client *getctitle(Window w); |
| 91 | extern void gravitate(Client *c, Bool invert); | 89 | extern void gravitate(Client *c, Bool invert); |
| @@ -96,7 +94,6 @@ extern void setsize(Client *c); | |||
| 96 | extern void settitle(Client *c); | 94 | extern void settitle(Client *c); |
| 97 | extern void togglemax(Arg *arg); | 95 | extern void togglemax(Arg *arg); |
| 98 | extern void unmanage(Client *c); | 96 | extern void unmanage(Client *c); |
| 99 | extern void zoom(Arg *arg); | ||
| 100 | 97 | ||
| 101 | /* draw.c */ | 98 | /* draw.c */ |
| 102 | extern void drawall(); | 99 | extern void drawall(); |
| @@ -117,22 +114,27 @@ extern void sendevent(Window w, Atom a, long value); | |||
| 117 | extern int xerror(Display *dsply, XErrorEvent *ee); | 114 | extern int xerror(Display *dsply, XErrorEvent *ee); |
| 118 | 115 | ||
| 119 | /* tag.c */ | 116 | /* tag.c */ |
| 120 | extern void dofloat(Arg *arg); | ||
| 121 | extern void dotile(Arg *arg); | ||
| 122 | extern void initrregs(); | 117 | extern void initrregs(); |
| 123 | extern Bool isvisible(Client *c); | ||
| 124 | extern Client *getnext(Client *c); | 118 | extern Client *getnext(Client *c); |
| 125 | extern Client *getprev(Client *c); | 119 | extern Client *getprev(Client *c); |
| 126 | extern void restack(); | ||
| 127 | extern void settags(Client *c); | 120 | extern void settags(Client *c); |
| 128 | extern void tag(Arg *arg); | 121 | extern void tag(Arg *arg); |
| 129 | extern void togglemode(Arg *arg); | ||
| 130 | extern void toggletag(Arg *arg); | 122 | extern void toggletag(Arg *arg); |
| 131 | extern void toggleview(Arg *arg); | ||
| 132 | extern void view(Arg *arg); | ||
| 133 | 123 | ||
| 134 | /* util.c */ | 124 | /* util.c */ |
| 135 | extern void *emallocz(unsigned int size); | 125 | extern void *emallocz(unsigned int size); |
| 136 | extern void eprint(const char *errstr, ...); | 126 | extern void eprint(const char *errstr, ...); |
| 137 | extern void *erealloc(void *ptr, unsigned int size); | 127 | extern void *erealloc(void *ptr, unsigned int size); |
| 138 | extern void spawn(Arg *arg); | 128 | extern void spawn(Arg *arg); |
| 129 | |||
| 130 | /* view.c */ | ||
| 131 | extern void dofloat(Arg *arg); | ||
| 132 | extern void dotile(Arg *arg); | ||
| 133 | extern void focusnext(Arg *arg); | ||
| 134 | extern void focusprev(Arg *arg); | ||
| 135 | extern Bool isvisible(Client *c); | ||
| 136 | extern void restack(); | ||
| 137 | extern void togglemode(Arg *arg); | ||
| 138 | extern void toggleview(Arg *arg); | ||
| 139 | extern void view(Arg *arg); | ||
| 140 | extern void zoom(Arg *arg); | ||
| @@ -30,97 +30,8 @@ RULES | |||
| 30 | static RReg *rreg = NULL; | 30 | static RReg *rreg = NULL; |
| 31 | static unsigned int len = 0; | 31 | static unsigned int len = 0; |
| 32 | 32 | ||
| 33 | void (*arrange)(Arg *) = DEFMODE; | ||
| 34 | |||
| 35 | /* extern */ | 33 | /* extern */ |
| 36 | 34 | ||
| 37 | void | ||
| 38 | dofloat(Arg *arg) | ||
| 39 | { | ||
| 40 | Client *c; | ||
| 41 | |||
| 42 | for(c = clients; c; c = c->next) { | ||
| 43 | c->ismax = False; | ||
| 44 | if(isvisible(c)) { | ||
| 45 | resize(c, True, TopLeft); | ||
| 46 | } | ||
| 47 | else | ||
| 48 | ban(c); | ||
| 49 | } | ||
| 50 | if(!sel || !isvisible(sel)) | ||
| 51 | sel = getnext(clients); | ||
| 52 | if(sel) | ||
| 53 | focus(sel); | ||
| 54 | else | ||
| 55 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | ||
| 56 | restack(); | ||
| 57 | } | ||
| 58 | |||
| 59 | void | ||
| 60 | dotile(Arg *arg) | ||
| 61 | { | ||
| 62 | int h, i, n, w; | ||
| 63 | Client *c; | ||
| 64 | |||
| 65 | w = sw - mw; | ||
| 66 | for(n = 0, c = clients; c; c = c->next) | ||
| 67 | if(isvisible(c) && !c->isfloat) | ||
| 68 | n++; | ||
| 69 | |||
| 70 | if(n > 1) | ||
| 71 | h = (sh - bh) / (n - 1); | ||
| 72 | else | ||
| 73 | h = sh - bh; | ||
| 74 | |||
| 75 | for(i = 0, c = clients; c; c = c->next) { | ||
| 76 | c->ismax = False; | ||
| 77 | if(isvisible(c)) { | ||
| 78 | if(c->isfloat) { | ||
| 79 | resize(c, True, TopLeft); | ||
| 80 | continue; | ||
| 81 | } | ||
| 82 | if(n == 1) { | ||
| 83 | c->x = sx; | ||
| 84 | c->y = sy + bh; | ||
| 85 | c->w = sw - 2; | ||
| 86 | c->h = sh - 2 - bh; | ||
| 87 | } | ||
| 88 | else if(i == 0) { | ||
| 89 | c->x = sx; | ||
| 90 | c->y = sy + bh; | ||
| 91 | c->w = mw - 2; | ||
| 92 | c->h = sh - 2 - bh; | ||
| 93 | } | ||
| 94 | else if(h > bh) { | ||
| 95 | c->x = sx + mw; | ||
| 96 | c->y = sy + (i - 1) * h + bh; | ||
| 97 | c->w = w - 2; | ||
| 98 | if(i + 1 == n) | ||
| 99 | c->h = sh - c->y - 2; | ||
| 100 | else | ||
| 101 | c->h = h - 2; | ||
| 102 | } | ||
| 103 | else { /* fallback if h < bh */ | ||
| 104 | c->x = sx + mw; | ||
| 105 | c->y = sy + bh; | ||
| 106 | c->w = w - 2; | ||
| 107 | c->h = sh - 2 - bh; | ||
| 108 | } | ||
| 109 | resize(c, False, TopLeft); | ||
| 110 | i++; | ||
| 111 | } | ||
| 112 | else | ||
| 113 | ban(c); | ||
| 114 | } | ||
| 115 | if(!sel || !isvisible(sel)) | ||
| 116 | sel = getnext(clients); | ||
| 117 | if(sel) | ||
| 118 | focus(sel); | ||
| 119 | else | ||
| 120 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | ||
| 121 | restack(); | ||
| 122 | } | ||
| 123 | |||
| 124 | Client * | 35 | Client * |
| 125 | getnext(Client *c) | 36 | getnext(Client *c) |
| 126 | { | 37 | { |
| @@ -164,69 +75,6 @@ initrregs() | |||
| 164 | } | 75 | } |
| 165 | } | 76 | } |
| 166 | 77 | ||
| 167 | Bool | ||
| 168 | isvisible(Client *c) | ||
| 169 | { | ||
| 170 | unsigned int i; | ||
| 171 | |||
| 172 | for(i = 0; i < ntags; i++) | ||
| 173 | if(c->tags[i] && seltag[i]) | ||
| 174 | return True; | ||
| 175 | return False; | ||
| 176 | } | ||
| 177 | |||
| 178 | void | ||
| 179 | restack() | ||
| 180 | { | ||
| 181 | static unsigned int nwins = 0; | ||
| 182 | static Window *wins = NULL; | ||
| 183 | unsigned int f, fi, m, mi, n; | ||
| 184 | Client *c; | ||
| 185 | XEvent ev; | ||
| 186 | |||
| 187 | for(f = 0, m = 0, c = clients; c; c = c->next) | ||
| 188 | if(isvisible(c)) { | ||
| 189 | if(c->isfloat || arrange == dofloat) | ||
| 190 | f++; | ||
| 191 | else | ||
| 192 | m++; | ||
| 193 | } | ||
| 194 | if(!(n = 2 * (f + m))) { | ||
| 195 | drawstatus(); | ||
| 196 | return; | ||
| 197 | } | ||
| 198 | if(nwins < n) { | ||
| 199 | nwins = n; | ||
| 200 | wins = erealloc(wins, nwins * sizeof(Window)); | ||
| 201 | } | ||
| 202 | |||
| 203 | fi = 0; | ||
| 204 | mi = 2 * f; | ||
| 205 | if(sel->isfloat || arrange == dofloat) { | ||
| 206 | wins[fi++] = sel->title; | ||
| 207 | wins[fi++] = sel->win; | ||
| 208 | } | ||
| 209 | else { | ||
| 210 | wins[mi++] = sel->title; | ||
| 211 | wins[mi++] = sel->win; | ||
| 212 | } | ||
| 213 | for(c = clients; c; c = c->next) | ||
| 214 | if(isvisible(c) && c != sel) { | ||
| 215 | if(c->isfloat || arrange == dofloat) { | ||
| 216 | wins[fi++] = c->title; | ||
| 217 | wins[fi++] = c->win; | ||
| 218 | } | ||
| 219 | else { | ||
| 220 | wins[mi++] = c->title; | ||
| 221 | wins[mi++] = c->win; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | XRestackWindows(dpy, wins, n); | ||
| 225 | drawall(); | ||
| 226 | XSync(dpy, False); | ||
| 227 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | ||
| 228 | } | ||
| 229 | |||
| 230 | void | 78 | void |
| 231 | settags(Client *c) | 79 | settags(Client *c) |
| 232 | { | 80 | { |
| @@ -277,16 +125,6 @@ tag(Arg *arg) | |||
| 277 | } | 125 | } |
| 278 | 126 | ||
| 279 | void | 127 | void |
| 280 | togglemode(Arg *arg) | ||
| 281 | { | ||
| 282 | arrange = arrange == dofloat ? dotile : dofloat; | ||
| 283 | if(sel) | ||
| 284 | arrange(NULL); | ||
| 285 | else | ||
| 286 | drawstatus(); | ||
| 287 | } | ||
| 288 | |||
| 289 | void | ||
| 290 | toggletag(Arg *arg) | 128 | toggletag(Arg *arg) |
| 291 | { | 129 | { |
| 292 | unsigned int i; | 130 | unsigned int i; |
| @@ -302,27 +140,3 @@ toggletag(Arg *arg) | |||
| 302 | if(!isvisible(sel)) | 140 | if(!isvisible(sel)) |
| 303 | arrange(NULL); | 141 | arrange(NULL); |
| 304 | } | 142 | } |
| 305 | |||
| 306 | |||
| 307 | void | ||
| 308 | toggleview(Arg *arg) | ||
| 309 | { | ||
| 310 | unsigned int i; | ||
| 311 | |||
| 312 | seltag[arg->i] = !seltag[arg->i]; | ||
| 313 | for(i = 0; i < ntags && !seltag[i]; i++); | ||
| 314 | if(i == ntags) | ||
| 315 | seltag[arg->i] = True; /* cannot toggle last view */ | ||
| 316 | arrange(NULL); | ||
| 317 | } | ||
| 318 | |||
| 319 | void | ||
| 320 | view(Arg *arg) | ||
| 321 | { | ||
| 322 | unsigned int i; | ||
| 323 | |||
| 324 | for(i = 0; i < ntags; i++) | ||
| 325 | seltag[i] = False; | ||
| 326 | seltag[arg->i] = True; | ||
| 327 | arrange(NULL); | ||
| 328 | } | ||
| @@ -0,0 +1,253 @@ | |||
| 1 | /* | ||
| 2 | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | ||
| 3 | * See LICENSE file for license details. | ||
| 4 | */ | ||
| 5 | #include "dwm.h" | ||
| 6 | |||
| 7 | /* extern */ | ||
| 8 | |||
| 9 | void (*arrange)(Arg *) = DEFMODE; | ||
| 10 | |||
| 11 | void | ||
| 12 | dofloat(Arg *arg) | ||
| 13 | { | ||
| 14 | Client *c; | ||
| 15 | |||
| 16 | for(c = clients; c; c = c->next) { | ||
| 17 | c->ismax = False; | ||
| 18 | if(isvisible(c)) { | ||
| 19 | resize(c, True, TopLeft); | ||
| 20 | } | ||
| 21 | else | ||
| 22 | ban(c); | ||
| 23 | } | ||
| 24 | if(!sel || !isvisible(sel)) | ||
| 25 | sel = getnext(clients); | ||
| 26 | if(sel) | ||
| 27 | focus(sel); | ||
| 28 | else | ||
| 29 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | ||
| 30 | restack(); | ||
| 31 | } | ||
| 32 | |||
| 33 | void | ||
| 34 | dotile(Arg *arg) | ||
| 35 | { | ||
| 36 | int h, i, n, w; | ||
| 37 | Client *c; | ||
| 38 | |||
| 39 | w = sw - mw; | ||
| 40 | for(n = 0, c = clients; c; c = c->next) | ||
| 41 | if(isvisible(c) && !c->isfloat) | ||
| 42 | n++; | ||
| 43 | |||
| 44 | if(n > 1) | ||
| 45 | h = (sh - bh) / (n - 1); | ||
| 46 | else | ||
| 47 | h = sh - bh; | ||
| 48 | |||
| 49 | for(i = 0, c = clients; c; c = c->next) { | ||
| 50 | c->ismax = False; | ||
| 51 | if(isvisible(c)) { | ||
| 52 | if(c->isfloat) { | ||
| 53 | resize(c, True, TopLeft); | ||
| 54 | continue; | ||
| 55 | } | ||
| 56 | if(n == 1) { | ||
| 57 | c->x = sx; | ||
| 58 | c->y = sy + bh; | ||
| 59 | c->w = sw - 2; | ||
| 60 | c->h = sh - 2 - bh; | ||
| 61 | } | ||
| 62 | else if(i == 0) { | ||
| 63 | c->x = sx; | ||
| 64 | c->y = sy + bh; | ||
| 65 | c->w = mw - 2; | ||
| 66 | c->h = sh - 2 - bh; | ||
| 67 | } | ||
| 68 | else if(h > bh) { | ||
| 69 | c->x = sx + mw; | ||
| 70 | c->y = sy + (i - 1) * h + bh; | ||
| 71 | c->w = w - 2; | ||
| 72 | if(i + 1 == n) | ||
| 73 | c->h = sh - c->y - 2; | ||
| 74 | else | ||
| 75 | c->h = h - 2; | ||
| 76 | } | ||
| 77 | else { /* fallback if h < bh */ | ||
| 78 | c->x = sx + mw; | ||
| 79 | c->y = sy + bh; | ||
| 80 | c->w = w - 2; | ||
| 81 | c->h = sh - 2 - bh; | ||
| 82 | } | ||
| 83 | resize(c, False, TopLeft); | ||
| 84 | i++; | ||
| 85 | } | ||
| 86 | else | ||
| 87 | ban(c); | ||
| 88 | } | ||
| 89 | if(!sel || !isvisible(sel)) | ||
| 90 | sel = getnext(clients); | ||
| 91 | if(sel) | ||
| 92 | focus(sel); | ||
| 93 | else | ||
| 94 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | ||
| 95 | restack(); | ||
| 96 | } | ||
| 97 | |||
| 98 | void | ||
| 99 | focusnext(Arg *arg) | ||
| 100 | { | ||
| 101 | Client *c; | ||
| 102 | |||
| 103 | if(!sel) | ||
| 104 | return; | ||
| 105 | |||
| 106 | if(!(c = getnext(sel->next))) | ||
| 107 | c = getnext(clients); | ||
| 108 | if(c) { | ||
| 109 | focus(c); | ||
| 110 | restack(); | ||
| 111 | } | ||
| 112 | } | ||
| 113 | |||
| 114 | void | ||
| 115 | focusprev(Arg *arg) | ||
| 116 | { | ||
| 117 | Client *c; | ||
| 118 | |||
| 119 | if(!sel) | ||
| 120 | return; | ||
| 121 | |||
| 122 | if(!(c = getprev(sel->prev))) { | ||
| 123 | for(c = clients; c && c->next; c = c->next); | ||
| 124 | c = getprev(c); | ||
| 125 | } | ||
| 126 | if(c) { | ||
| 127 | focus(c); | ||
| 128 | restack(); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | Bool | ||
| 133 | isvisible(Client *c) | ||
| 134 | { | ||
| 135 | unsigned int i; | ||
| 136 | |||
| 137 | for(i = 0; i < ntags; i++) | ||
| 138 | if(c->tags[i] && seltag[i]) | ||
| 139 | return True; | ||
| 140 | return False; | ||
| 141 | } | ||
| 142 | |||
| 143 | void | ||
| 144 | restack() | ||
| 145 | { | ||
| 146 | static unsigned int nwins = 0; | ||
| 147 | static Window *wins = NULL; | ||
| 148 | unsigned int f, fi, m, mi, n; | ||
| 149 | Client *c; | ||
| 150 | XEvent ev; | ||
| 151 | |||
| 152 | for(f = 0, m = 0, c = clients; c; c = c->next) | ||
| 153 | if(isvisible(c)) { | ||
| 154 | if(c->isfloat || arrange == dofloat) | ||
| 155 | f++; | ||
| 156 | else | ||
| 157 | m++; | ||
| 158 | } | ||
| 159 | if(!(n = 2 * (f + m))) { | ||
| 160 | drawstatus(); | ||
| 161 | return; | ||
| 162 | } | ||
| 163 | if(nwins < n) { | ||
| 164 | nwins = n; | ||
| 165 | wins = erealloc(wins, nwins * sizeof(Window)); | ||
| 166 | } | ||
| 167 | |||
| 168 | fi = 0; | ||
| 169 | mi = 2 * f; | ||
| 170 | if(sel->isfloat || arrange == dofloat) { | ||
| 171 | wins[fi++] = sel->title; | ||
| 172 | wins[fi++] = sel->win; | ||
| 173 | } | ||
| 174 | else { | ||
| 175 | wins[mi++] = sel->title; | ||
| 176 | wins[mi++] = sel->win; | ||
| 177 | } | ||
| 178 | for(c = clients; c; c = c->next) | ||
| 179 | if(isvisible(c) && c != sel) { | ||
| 180 | if(c->isfloat || arrange == dofloat) { | ||
| 181 | wins[fi++] = c->title; | ||
| 182 | wins[fi++] = c->win; | ||
| 183 | } | ||
| 184 | else { | ||
| 185 | wins[mi++] = c->title; | ||
| 186 | wins[mi++] = c->win; | ||
| 187 | } | ||
| 188 | } | ||
| 189 | XRestackWindows(dpy, wins, n); | ||
| 190 | drawall(); | ||
| 191 | XSync(dpy, False); | ||
| 192 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | ||
| 193 | } | ||
| 194 | |||
| 195 | void | ||
| 196 | togglemode(Arg *arg) | ||
| 197 | { | ||
| 198 | arrange = arrange == dofloat ? dotile : dofloat; | ||
| 199 | if(sel) | ||
| 200 | arrange(NULL); | ||
| 201 | else | ||
| 202 | drawstatus(); | ||
| 203 | } | ||
| 204 | |||
| 205 | void | ||
| 206 | toggleview(Arg *arg) | ||
| 207 | { | ||
| 208 | unsigned int i; | ||
| 209 | |||
| 210 | seltag[arg->i] = !seltag[arg->i]; | ||
| 211 | for(i = 0; i < ntags && !seltag[i]; i++); | ||
| 212 | if(i == ntags) | ||
| 213 | seltag[arg->i] = True; /* cannot toggle last view */ | ||
| 214 | arrange(NULL); | ||
| 215 | } | ||
| 216 | |||
| 217 | void | ||
| 218 | view(Arg *arg) | ||
| 219 | { | ||
| 220 | unsigned int i; | ||
| 221 | |||
| 222 | for(i = 0; i < ntags; i++) | ||
| 223 | seltag[i] = False; | ||
| 224 | seltag[arg->i] = True; | ||
| 225 | arrange(NULL); | ||
| 226 | } | ||
| 227 | |||
| 228 | void | ||
| 229 | zoom(Arg *arg) | ||
| 230 | { | ||
| 231 | Client *c; | ||
| 232 | |||
| 233 | if(!sel || (arrange != dotile) || sel->isfloat || sel->ismax) | ||
| 234 | return; | ||
| 235 | |||
| 236 | if(sel == getnext(clients)) { | ||
| 237 | if((c = getnext(sel->next))) | ||
| 238 | sel = c; | ||
| 239 | else | ||
| 240 | return; | ||
| 241 | } | ||
| 242 | |||
| 243 | /* pop */ | ||
| 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); | ||
| 253 | } | ||
