X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/f6e41b0bc3a00a2c48a996e2da4ad84be9a719f7..5762e92994ab30aa5cc6e381e897fe847974b7c5:/tile.c?ds=sidebyside

diff --git a/tile.c b/tile.c
index 2481eb3..114e84c 100644
--- a/tile.c
+++ b/tile.c
@@ -9,18 +9,25 @@ static double mwfact = MWFACT;
 /* extern */
 
 void
-addtomwfact(const char *arg) {
+setmwfact(const char *arg) {
 	double delta;
 
-	if(lt->arrange != tile)
+	if(!isarrange(tile))
 		return;
-
 	/* arg handling, manipulate mwfact */
-	if(arg && (1 == sscanf(arg, "%lf", &delta))) {
-		if(delta + mwfact > 0.1 && delta + mwfact < 0.9)
+	if(arg == NULL)
+		mwfact = MWFACT;
+	else if(1 == sscanf(arg, "%lf", &delta)) {
+		if(arg[0] != '+' && arg[0] != '-')
+			mwfact = delta;
+		else
 			mwfact += delta;
+		if(mwfact < 0.1)
+			mwfact = 0.1;
+		else if(mwfact > 0.9)
+			mwfact = 0.9;
 	}
-	lt->arrange();
+	arrange();
 }
 
 void
@@ -39,43 +46,35 @@ tile(void) {
 
 	nx = wax;
 	ny = way;
-	for(i = 0, c = clients; c; c = c->next)
-		if(isvisible(c)) {
-			unban(c);
-			if(c->isfloating)
-				continue;
-			c->ismax = False;
-			if(i == 0) { /* master */
-				nw = mw - 2 * c->border;
-				nh = wah - 2 * c->border;
-			}
-			else {  /* tile window */
-				if(i == 1) {
-					ny = way;
-					nx += mw;
-				}
-				nw = waw - mw - 2 * c->border;
-				if(i + 1 == n) /* remainder */
-					nh = (way + wah) - ny - 2 * c->border;
-				else
-					nh = th - 2 * c->border;
+	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
+		c->ismax = False;
+		if(i == 0) { /* master */
+			nw = mw - 2 * c->border;
+			nh = wah - 2 * c->border;
+		}
+		else {  /* tile window */
+			if(i == 1) {
+				ny = way;
+				nx += mw;
 			}
-			resize(c, nx, ny, nw, nh, False);
-			if(n > 1 && th != wah)
-				ny += nh + 2 * c->border;
-			i++;
+			nw = waw - mw - 2 * c->border;
+			if(i + 1 == n) /* remainder */
+				nh = (way + wah) - ny - 2 * c->border;
+			else
+				nh = th - 2 * c->border;
 		}
-		else
-			ban(c);
-	focus(NULL);
-	restack();
+		resize(c, nx, ny, nw, nh, False);
+		if(n > 1 && th != wah)
+			ny += nh + 2 * c->border;
+		i++;
+	}
 }
 
 void
 zoom(const char *arg) {
 	Client *c;
 
-	if(!sel || lt->arrange == floating || sel->isfloating)
+	if(!sel || !isarrange(tile) || sel->isfloating)
 		return;
 	if((c = sel) == nexttiled(clients))
 		if(!(c = nexttiled(c->next)))
@@ -83,5 +82,5 @@ zoom(const char *arg) {
 	detach(c);
 	attach(c);
 	focus(c);
-	lt->arrange();
+	arrange();
 }