code polishing, removed unnecessary newlines
6651dd7f
10 file(s) · +23 −86
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 | #include "dwm.h" |
|
| 156 | 155 | dy = -(c->h); |
|
| 157 | 156 | break; |
|
| 158 | 157 | } |
|
| 159 | - | ||
| 160 | 158 | switch (c->grav) { |
|
| 161 | 159 | default: |
|
| 162 | 160 | break; |
|
| 177 | 175 | dx = -(c->w + c->border); |
|
| 178 | 176 | break; |
|
| 179 | 177 | } |
|
| 180 | - | ||
| 181 | 178 | if(invert) { |
|
| 182 | 179 | dx = -dx; |
|
| 183 | 180 | dy = -dy; |
|
| 210 | 207 | c->w = c->tw = wa->width; |
|
| 211 | 208 | c->h = wa->height; |
|
| 212 | 209 | c->th = bh; |
|
| 213 | - | ||
| 214 | 210 | c->border = 0; |
|
| 215 | 211 | updatesize(c); |
|
| 216 | - | ||
| 217 | 212 | if(c->x + c->w + 2 * BORDERPX > sw) |
|
| 218 | 213 | c->x = sw - c->w - 2 * BORDERPX; |
|
| 219 | 214 | if(c->x < sx) |
|
| 222 | 217 | c->y = sh - c->h - 2 * BORDERPX; |
|
| 223 | 218 | if(c->h != sh && c->y < bh) |
|
| 224 | 219 | c->y = bh; |
|
| 225 | - | ||
| 226 | 220 | c->proto = getproto(c->win); |
|
| 227 | 221 | XSelectInput(dpy, c->win, |
|
| 228 | 222 | StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
|
| 230 | 224 | twa.override_redirect = 1; |
|
| 231 | 225 | twa.background_pixmap = ParentRelative; |
|
| 232 | 226 | twa.event_mask = ExposureMask | EnterWindowMask; |
|
| 233 | - | ||
| 234 | 227 | c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
|
| 235 | 228 | 0, DefaultDepth(dpy, screen), CopyFromParent, |
|
| 236 | 229 | DefaultVisual(dpy, screen), |
|
| 237 | 230 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
|
| 238 | - | ||
| 239 | 231 | grabbuttons(c, False); |
|
| 240 | 232 | updatetitle(c); |
|
| 241 | 233 | settags(c, getclient(trans)); |
|
| 244 | 236 | || (c->maxw && c->minw && |
|
| 245 | 237 | c->maxw == c->minw && c->maxh == c->minh); |
|
| 246 | 238 | resizetitle(c); |
|
| 247 | - | ||
| 248 | 239 | if(clients) |
|
| 249 | 240 | clients->prev = c; |
|
| 250 | 241 | c->next = clients; |
|
| 251 | 242 | c->snext = stack; |
|
| 252 | 243 | stack = clients = c; |
|
| 253 | - | ||
| 254 | 244 | ban(c); |
|
| 255 | 245 | XMapWindow(dpy, c->win); |
|
| 256 | 246 | XMapWindow(dpy, c->twin); |
|
| 283 | 273 | c->x = right - c->w; |
|
| 284 | 274 | if(sticky == BotLeft || sticky == BotRight) |
|
| 285 | 275 | c->y = bottom - c->h; |
|
| 286 | - | ||
| 287 | 276 | /* offscreen appearance fixes */ |
|
| 288 | 277 | if(c->x + c->w < sx) |
|
| 289 | 278 | c->x = sx; |
|
| 293 | 282 | c->x = sw - c->w; |
|
| 294 | 283 | if(c->y > sh) |
|
| 295 | 284 | c->y = sh - c->h; |
|
| 296 | - | ||
| 297 | 285 | resizetitle(c); |
|
| 298 | 286 | wc.x = c->x; |
|
| 299 | 287 | wc.y = c->y; |
|
| 392 | 380 | /* The server grab construct avoids race conditions. */ |
|
| 393 | 381 | XGrabServer(dpy); |
|
| 394 | 382 | XSetErrorHandler(xerrordummy); |
|
| 395 | - | ||
| 396 | 383 | detach(c); |
|
| 397 | 384 | detachstack(c); |
|
| 398 | 385 | if(sel == c) { |
|
| 399 | 386 | for(nc = stack; nc && !isvisible(nc); nc = nc->snext); |
|
| 400 | 387 | focus(nc); |
|
| 401 | 388 | } |
|
| 402 | - | ||
| 403 | 389 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
|
| 404 | 390 | XDestroyWindow(dpy, c->twin); |
|
| 405 | - | ||
| 406 | 391 | free(c->tags); |
|
| 407 | 392 | free(c); |
|
| 408 | - | ||
| 409 | 393 | XSync(dpy, False); |
|
| 410 | 394 | XSetErrorHandler(xerror); |
|
| 411 | 395 | XUngrabServer(dpy); |
|
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 |
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 |
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 | #include "dwm.h" |
|
| 30 | 29 | ||
| 31 | 30 | XSetForeground(dpy, dc.gc, col[ColBG]); |
|
| 32 | 31 | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 33 | - | ||
| 34 | 32 | if(!text) |
|
| 35 | 33 | return; |
|
| 36 | - | ||
| 37 | 34 | w = 0; |
|
| 38 | 35 | olen = len = strlen(text); |
|
| 39 | 36 | if(len >= sizeof(buf)) |
|
| 40 | 37 | len = sizeof(buf) - 1; |
|
| 41 | 38 | memcpy(buf, text, len); |
|
| 42 | 39 | buf[len] = 0; |
|
| 43 | - | ||
| 44 | 40 | h = dc.font.ascent + dc.font.descent; |
|
| 45 | 41 | y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; |
|
| 46 | 42 | x = dc.x + (h / 2); |
|
| 47 | - | ||
| 48 | 43 | /* shorten text if necessary */ |
|
| 49 | 44 | while(len && (w = textnw(buf, len)) > dc.w - h) |
|
| 50 | 45 | buf[--len] = 0; |
|
| 56 | 51 | if(len > 3) |
|
| 57 | 52 | buf[len - 3] = '.'; |
|
| 58 | 53 | } |
|
| 59 | - | ||
| 60 | 54 | if(w > dc.w) |
|
| 61 | 55 | return; /* too long */ |
|
| 62 | 56 | gcv.foreground = col[ColFG]; |
|
| 93 | 87 | int i, x; |
|
| 94 | 88 | ||
| 95 | 89 | dc.x = dc.y = 0; |
|
| 96 | - | ||
| 97 | 90 | for(i = 0; i < ntags; i++) { |
|
| 98 | 91 | dc.w = textw(tags[i]); |
|
| 99 | 92 | if(seltag[i]) |
|
| 102 | 95 | drawtext(tags[i], dc.norm, sel && sel->tags[i]); |
|
| 103 | 96 | dc.x += dc.w; |
|
| 104 | 97 | } |
|
| 105 | - | ||
| 106 | 98 | dc.w = bmw; |
|
| 107 | 99 | drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False); |
|
| 108 | - | ||
| 109 | 100 | x = dc.x + dc.w; |
|
| 110 | 101 | dc.w = textw(stext); |
|
| 111 | 102 | dc.x = bx + bw - dc.w; |
|
| 114 | 105 | dc.w = bw - x; |
|
| 115 | 106 | } |
|
| 116 | 107 | drawtext(stext, dc.status, False); |
|
| 117 | - | ||
| 118 | 108 | if((dc.w = dc.x - x) > bh) { |
|
| 119 | 109 | dc.x = x; |
|
| 120 | 110 | if(sel) |
|
| 134 | 124 | XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); |
|
| 135 | 125 | return; |
|
| 136 | 126 | } |
|
| 137 | - | ||
| 138 | 127 | XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); |
|
| 139 | 128 | XMapWindow(dpy, c->twin); |
|
| 140 | 129 | dc.x = dc.y = 0; |
|
| 177 | 166 | XFontSetExtents *font_extents; |
|
| 178 | 167 | XFontStruct **xfonts; |
|
| 179 | 168 | char **font_names; |
|
| 180 | - | ||
| 181 | 169 | dc.font.ascent = dc.font.descent = 0; |
|
| 182 | 170 | font_extents = XExtentsOfFontSet(dc.font.set); |
|
| 183 | 171 | n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); |
|
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | * |
|
| 5 | 4 | * dynamic window manager is designed like any other X client as well. It is |
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 | #include "dwm.h" |
|
| 64 | 63 | ocx = c->x; |
|
| 65 | 64 | ocy = c->y; |
|
| 66 | 65 | if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
|
| 67 | - | None, cursor[CurResize], CurrentTime) != GrabSuccess) |
|
| 66 | + | None, cursor[CurResize], CurrentTime) != GrabSuccess) |
|
| 68 | 67 | return; |
|
| 69 | 68 | c->ismax = False; |
|
| 70 | 69 | XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); |
|
| 211 | 210 | ||
| 212 | 211 | if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
|
| 213 | 212 | return; |
|
| 214 | - | ||
| 215 | 213 | if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c)) |
|
| 216 | 214 | focus(c); |
|
| 217 | 215 | else if(ev->window == root) { |
|
| 279 | 277 | ||
| 280 | 278 | if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
|
| 281 | 279 | return; |
|
| 282 | - | ||
| 283 | 280 | if(wa.override_redirect) { |
|
| 284 | 281 | XSelectInput(dpy, ev->window, |
|
| 285 | 282 | (StructureNotifyMask | PropertyChangeMask)); |
|
| 286 | 283 | return; |
|
| 287 | 284 | } |
|
| 288 | - | ||
| 289 | 285 | if(!getclient(ev->window)) |
|
| 290 | 286 | manage(ev->window, &wa); |
|
| 291 | 287 | } |
|
| 298 | 294 | ||
| 299 | 295 | if(ev->state == PropertyDelete) |
|
| 300 | 296 | return; /* ignore */ |
|
| 301 | - | ||
| 302 | 297 | if((c = getclient(ev->window))) { |
|
| 303 | 298 | if(ev->atom == wmatom[WMProtocols]) { |
|
| 304 | 299 | c->proto = getproto(c->win); |
|
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 | ||
| 93 | 92 | netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
|
| 94 | 93 | XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
|
| 95 | 94 | PropModeReplace, (unsigned char *) netatom, NetLast); |
|
| 96 | - | ||
| 97 | 95 | /* init cursors */ |
|
| 98 | 96 | cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); |
|
| 99 | 97 | cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); |
|
| 100 | 98 | cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); |
|
| 101 | - | ||
| 99 | + | /* init modifier map */ |
|
| 102 | 100 | modmap = XGetModifierMapping(dpy); |
|
| 103 | 101 | for (i = 0; i < 8; i++) { |
|
| 104 | 102 | for (j = 0; j < modmap->max_keypermod; j++) { |
|
| 107 | 105 | } |
|
| 108 | 106 | } |
|
| 109 | 107 | XFree(modmap); |
|
| 110 | - | ||
| 108 | + | /* select for events */ |
|
| 111 | 109 | wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
|
| 112 | 110 | | EnterWindowMask | LeaveWindowMask; |
|
| 113 | 111 | wa.cursor = cursor[CurNormal]; |
|
| 114 | 112 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
|
| 115 | - | ||
| 116 | 113 | grabkeys(); |
|
| 117 | 114 | initrregs(); |
|
| 118 | - | ||
| 119 | 115 | for(ntags = 0; tags[ntags]; ntags++); |
|
| 120 | 116 | seltag = emallocz(sizeof(Bool) * ntags); |
|
| 121 | 117 | seltag[0] = True; |
|
| 122 | - | ||
| 123 | 118 | /* style */ |
|
| 124 | 119 | dc.norm[ColBG] = getcolor(NORMBGCOLOR); |
|
| 125 | 120 | dc.norm[ColFG] = getcolor(NORMFGCOLOR); |
|
| 128 | 123 | dc.status[ColBG] = getcolor(STATUSBGCOLOR); |
|
| 129 | 124 | dc.status[ColFG] = getcolor(STATUSFGCOLOR); |
|
| 130 | 125 | setfont(FONT); |
|
| 131 | - | ||
| 126 | + | /* geometry */ |
|
| 132 | 127 | bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL); |
|
| 133 | 128 | sx = sy = 0; |
|
| 134 | 129 | sw = DisplayWidth(dpy, screen); |
|
| 135 | 130 | sh = DisplayHeight(dpy, screen); |
|
| 136 | 131 | master = MASTER; |
|
| 137 | - | ||
| 132 | + | /* bar */ |
|
| 138 | 133 | bx = by = 0; |
|
| 139 | 134 | bw = sw; |
|
| 140 | 135 | dc.h = bh = dc.font.height + 2; |
|
| 146 | 141 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
|
| 147 | 142 | XDefineCursor(dpy, barwin, cursor[CurNormal]); |
|
| 148 | 143 | XMapRaised(dpy, barwin); |
|
| 149 | - | ||
| 144 | + | strcpy(stext, "dwm-"VERSION); |
|
| 145 | + | /* pixmap for everything */ |
|
| 150 | 146 | dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); |
|
| 151 | 147 | dc.gc = XCreateGC(dpy, root, 0, 0); |
|
| 152 | 148 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
|
| 153 | - | ||
| 149 | + | /* multihead support */ |
|
| 154 | 150 | issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); |
|
| 155 | - | strcpy(stext, "dwm-"VERSION); |
|
| 156 | 151 | } |
|
| 157 | 152 | ||
| 158 | 153 | /* |
|
| 204 | 199 | readin = running = False; |
|
| 205 | 200 | } |
|
| 206 | 201 | ||
| 207 | - | /* |
|
| 208 | - | * There's no way to check accesses to destroyed windows, thus those cases are |
|
| 202 | + | /* There's no way to check accesses to destroyed windows, thus those cases are |
|
| 209 | 203 | * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
|
| 210 | 204 | * default error handler, which may call exit. |
|
| 211 | 205 | */ |
|
| 236 | 230 | } |
|
| 237 | 231 | else if(argc != 1) |
|
| 238 | 232 | eprint("usage: dwm [-v]\n"); |
|
| 239 | - | ||
| 240 | 233 | dpy = XOpenDisplay(0); |
|
| 241 | 234 | if(!dpy) |
|
| 242 | 235 | eprint("dwm: cannot open display\n"); |
|
| 243 | - | ||
| 244 | 236 | xfd = ConnectionNumber(dpy); |
|
| 245 | 237 | screen = DefaultScreen(dpy); |
|
| 246 | 238 | root = RootWindow(dpy, screen); |
|
| 247 | - | ||
| 248 | 239 | otherwm = False; |
|
| 249 | 240 | XSetErrorHandler(xerrorstart); |
|
| 250 | 241 | /* this causes an error if some other window manager is running */ |
|
| 251 | 242 | XSelectInput(dpy, root, SubstructureRedirectMask); |
|
| 252 | 243 | XSync(dpy, False); |
|
| 253 | - | ||
| 254 | 244 | if(otherwm) |
|
| 255 | 245 | eprint("dwm: another window manager is already running\n"); |
|
| 256 | 246 | ||
| 258 | 248 | XSetErrorHandler(NULL); |
|
| 259 | 249 | xerrorxlib = XSetErrorHandler(xerror); |
|
| 260 | 250 | XSync(dpy, False); |
|
| 261 | - | ||
| 262 | 251 | setup(); |
|
| 263 | 252 | drawstatus(); |
|
| 264 | 253 | scan(); |
|
| 291 | 280 | } |
|
| 292 | 281 | cleanup(); |
|
| 293 | 282 | XCloseDisplay(dpy); |
|
| 294 | - | ||
| 295 | 283 | return 0; |
|
| 296 | 284 | } |
|
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 | #include "dwm.h" |
|
| 53 | 52 | return; |
|
| 54 | 53 | len = sizeof(rule) / sizeof(rule[0]); |
|
| 55 | 54 | rreg = emallocz(len * sizeof(RReg)); |
|
| 56 | - | ||
| 57 | 55 | for(i = 0; i < len; i++) { |
|
| 58 | 56 | if(rule[i].clpattern) { |
|
| 59 | 57 | reg = emallocz(sizeof(regex_t)); |
|
| 115 | 113 | ||
| 116 | 114 | if(!sel) |
|
| 117 | 115 | return; |
|
| 118 | - | ||
| 119 | 116 | for(i = 0; i < ntags; i++) |
|
| 120 | 117 | sel->tags[i] = False; |
|
| 121 | 118 | sel->tags[arg->i] = True; |
|
| 129 | 126 | ||
| 130 | 127 | if(!sel) |
|
| 131 | 128 | return; |
|
| 132 | - | ||
| 133 | 129 | sel->tags[arg->i] = !sel->tags[arg->i]; |
|
| 134 | 130 | for(i = 0; i < ntags && !sel->tags[i]; i++); |
|
| 135 | 131 | if(i == ntags) |
|
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 | #include "dwm.h" |
|
| 33 | 32 | void * |
|
| 34 | 33 | erealloc(void *ptr, unsigned int size) { |
|
| 35 | 34 | void *res = realloc(ptr, size); |
|
| 35 | + | ||
| 36 | 36 | if(!res) |
|
| 37 | 37 | eprint("fatal: could not malloc() %u bytes\n", size); |
|
| 38 | 38 | return res; |
|
| 44 | 44 | ||
| 45 | 45 | if(!shell && !(shell = getenv("SHELL"))) |
|
| 46 | 46 | shell = "/bin/sh"; |
|
| 47 | - | ||
| 48 | 47 | if(!arg->cmd) |
|
| 49 | 48 | return; |
|
| 50 | 49 | /* The double-fork construct avoids zombie processes and keeps the code |
|
| 1 | - | /* |
|
| 2 | - | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 1 | + | /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
| 3 | 2 | * See LICENSE file for license details. |
|
| 4 | 3 | */ |
|
| 5 | 4 | #include "dwm.h" |
|
| 43 | 42 | } |
|
| 44 | 43 | ||
| 45 | 44 | static void |
|
| 46 | - | togglemax(Client *c) |
|
| 47 | - | { |
|
| 45 | + | togglemax(Client *c) { |
|
| 48 | 46 | XEvent ev; |
|
| 47 | + | ||
| 49 | 48 | if((c->ismax = !c->ismax)) { |
|
| 50 | 49 | c->rx = c->x; c->x = sx; |
|
| 51 | 50 | c->ry = c->y; c->y = bh; |
|
| 102 | 101 | ||
| 103 | 102 | for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
|
| 104 | 103 | n++; |
|
| 105 | - | ||
| 106 | 104 | mpx = (sw * master) / 1000; |
|
| 107 | 105 | stackw = sw - mpx; |
|
| 108 | 106 | stackh = sh - bh; |
|
| 109 | - | ||
| 110 | 107 | th = stackh; |
|
| 111 | 108 | if(n > 1) |
|
| 112 | 109 | th /= (n - 1); |
|
| 145 | 142 | } |
|
| 146 | 143 | else |
|
| 147 | 144 | ban(c); |
|
| 145 | + | ||
| 148 | 146 | if(!sel || !isvisible(sel)) { |
|
| 149 | 147 | for(c = stack; c && !isvisible(c); c = c->snext); |
|
| 150 | 148 | focus(c); |
|
| 158 | 156 | ||
| 159 | 157 | if(!sel) |
|
| 160 | 158 | return; |
|
| 161 | - | ||
| 162 | 159 | if(!(c = getnext(sel->next))) |
|
| 163 | 160 | c = getnext(clients); |
|
| 164 | 161 | if(c) { |
|
| 173 | 170 | ||
| 174 | 171 | if(!sel) |
|
| 175 | 172 | return; |
|
| 176 | - | ||
| 177 | 173 | if(!(c = getprev(sel->prev))) { |
|
| 178 | 174 | for(c = clients; c && c->next; c = c->next); |
|
| 179 | 175 | c = getprev(c); |
|
| 204 | 200 | n++; |
|
| 205 | 201 | if(!sel || sel->isfloat || n < 2 || (arrange == dofloat)) |
|
| 206 | 202 | return; |
|
| 207 | - | ||
| 208 | 203 | if(sel == getnext(clients)) { |
|
| 209 | 204 | if(master + arg->i > 950 || master + arg->i < 50) |
|
| 210 | 205 | return; |
|
| 290 | 285 | arrange(NULL); |
|
| 291 | 286 | } |
|
| 292 | 287 | ||
| 293 | - | ||
| 294 | - | ||
| 295 | 288 | void |
|
| 296 | 289 | zoom(Arg *arg) { |
|
| 297 | 290 | unsigned int n; |
|
| 299 | 292 | ||
| 300 | 293 | if(!sel) |
|
| 301 | 294 | return; |
|
| 302 | - | ||
| 303 | 295 | if(sel->isfloat || (arrange == dofloat)) { |
|
| 304 | 296 | togglemax(sel); |
|
| 305 | 297 | return; |
|
| 306 | 298 | } |
|
| 307 | - | ||
| 308 | 299 | for(n = 0, c = clients; c; c = c->next) |
|
| 309 | 300 | if(isvisible(c) && !c->isfloat) |
|
| 310 | 301 | n++; |
|
| 311 | 302 | if(n < 2 || (arrange == dofloat)) |
|
| 312 | 303 | return; |
|
| 313 | - | ||
| 314 | 304 | if((c = sel) == nexttiled(clients)) |
|
| 315 | 305 | if(!(c = nexttiled(c->next))) |
|
| 316 | 306 | return; |
|