about summary refs log tree commit diff stats
path: root/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'view.c')
-rw-r--r--view.c136
1 files changed, 5 insertions, 131 deletions
diff --git a/view.c b/view.c
index 66f550c..72aa04e 100644
--- a/view.c
+++ b/view.c
@@ -2,34 +2,6 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
-#include <stdio.h>
-
-/* static */
-
-static Client *
-nexttiled(Client *c) {
-	for(; c && (c->isfloat || !isvisible(c)); c = c->next);
-	return c;
-}
-
-static void
-togglemax(Client *c) {
-	XEvent ev;
-		
-	if(c->isfixed)
-		return;
-
-	if((c->ismax = !c->ismax)) {
-		c->rx = c->x;
-		c->ry = c->y;
-		c->rw = c->w;
-		c->rh = c->h;
-		resize(c, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True);
-	}
-	else
-		resize(c, c->rx, c->ry, c->rw, c->rh, True);
-	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
-}
 
 /* extern */
 
@@ -70,58 +42,6 @@ dofloat(void) {
 }
 
 void
-dotile(void) {
-	unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
-	Client *c;
-
-	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
-		n++;
-	/* window geoms */
-	mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
-	mw = (n > nmaster) ? (waw * master) / 1000 : waw;
-	th = (n > nmaster) ? wah / (n - nmaster) : 0;
-	tw = waw - mw;
-
-	for(i = 0, c = clients; c; c = c->next)
-		if(isvisible(c)) {
-			if(c->isbanned)
-				XMoveWindow(dpy, c->win, c->x, c->y);
-			c->isbanned = False;
-			if(c->isfloat)
-				continue;
-			c->ismax = False;
-			nx = wax;
-			ny = way;
-			if(i < nmaster) {
-				ny += i * mh;
-				nw = mw - 2 * BORDERPX;
-				nh = mh - 2 * BORDERPX;
-			}
-			else {  /* tile window */
-				nx += mw;
-				nw = tw - 2 * BORDERPX;
-				if(th > 2 * BORDERPX) {
-					ny += (i - nmaster) * th;
-					nh = th - 2 * BORDERPX;
-				}
-				else /* fallback if th <= 2 * BORDERPX */
-					nh = wah - 2 * BORDERPX;
-			}
-			resize(c, nx, ny, nw, nh, False);
-			i++;
-		}
-		else {
-			c->isbanned = True;
-			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
-		}
-	if(!sel || !isvisible(sel)) {
-		for(c = stack; c && !isvisible(c); c = c->snext);
-		focus(c);
-	}
-	restack();
-}
-
-void
 focusnext(Arg *arg) {
 	Client *c;
    
@@ -153,18 +73,6 @@ focusprev(Arg *arg) {
 	}
 }
 
-void
-incnmaster(Arg *arg) {
-	if((arrange == dofloat) || (nmaster + arg->i < 1)
-	|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
-		return;
-	nmaster += arg->i;
-	if(sel)
-		arrange();
-	else
-		drawstatus();
-}
-
 Bool
 isvisible(Client *c) {
 	unsigned int i;
@@ -175,19 +83,10 @@ isvisible(Client *c) {
 	return False;
 }
 
-void
-resizemaster(Arg *arg) {
-	if(arrange != dotile)
-		return;
-	if(arg->i == 0)
-		master = MASTER;
-	else {
-		if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
-		|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
-			return;
-		master += arg->i;
-	}
-	arrange();
+Client *
+nextmanaged(Client *c) {
+	for(; c && (c->isfloat || !isvisible(c)); c = c->next);
+	return c;
 }
 
 void
@@ -203,7 +102,7 @@ restack(void) {
 	if(arrange != dofloat) {
 		if(!sel->isfloat)
 			XLowerWindow(dpy, sel->win);
-		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
+		for(c = nextmanaged(clients); c; c = nextmanaged(c->next)) {
 			if(c == sel)
 				continue;
 			XLowerWindow(dpy, c->win);
@@ -252,28 +151,3 @@ view(Arg *arg) {
 	arrange();
 }
 
-void
-zoom(Arg *arg) {
-	unsigned int n;
-	Client *c;
-
-	if(!sel)
-		return;
-	if(sel->isfloat || (arrange == dofloat)) {
-		togglemax(sel);
-		return;
-	}
-	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
-		n++;
-
-	if((c = sel) == nexttiled(clients))
-		if(!(c = nexttiled(c->next)))
-			return;
-	detach(c);
-	if(clients)
-		clients->prev = c;
-	c->next = clients;
-	clients = c;
-	focus(c);
-	arrange();
-}
='n332' href='#n332'>332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458