There was an error in monocle, and the floating() definition hadn't
been removed... (ok, ok, yesterday it was not my day...). I have also
changed zoom() so that it does an arrange if lt->isfloating or
sel->isfloating; this way, after having manually resized windows while
in "[M]" (or "<>=" or "<>|") you can rearrange your windows without
toggling layouts. I think the changes (which now only adds one loc if
you don't count the example layouts) allows much more flexibility in
dwm, especially in floating layouts (now you can have floating layouts
to arrange your windows in a grid, for example), and I won't need
defines to not remember floating layout (I can use "<>=").
Well, now I will really wait to see what you have to say, going back
to plan9,,, sorry again for all this noise.


-- 


- yiyus || JGL .
diff -r 595ed1a4447c config.def.h
--- a/config.def.h	Tue Apr 08 11:49:35 2008 +0100
+++ b/config.def.h	Tue Apr 15 11:38:28 2008 +0200
@@ -35,8 +35,11 @@ Layout layouts[] = {
 Layout layouts[] = {
 	/* symbol		function	isfloating */
 	{ "[]=",		tilev,		False }, /* first entry is default */
+	{ "<>=",		tilev,		True },
 	{ "[]|",		tileh,		False },
-	{ "><>",		floating,	True },
+	{ "<>|",		tileh,		True },
+	{ "><>",		NULL,	True },
+	{ "[m]",		monocle,	False },
 	{ "[M]",		monocle,	True },
 };
 
diff -r 595ed1a4447c dwm.c
--- a/dwm.c	Tue Apr 08 11:49:35 2008 +0100
+++ b/dwm.c	Tue Apr 15 11:38:28 2008 +0200
@@ -66,6 +66,7 @@ struct Client {
 struct Client {
 	char name[256];
 	int x, y, w, h;
+	int fx, fy, fw, fh;
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 	int minax, maxax, minay, maxay;
 	long flags;
@@ -142,7 +143,6 @@ void enternotify(XEvent *e);
 void enternotify(XEvent *e);
 void eprint(const char *errstr, ...);
 void expose(XEvent *e);
-void floating(void); /* default floating layout */
 void focus(Client *c);
 void focusin(XEvent *e);
 void focusnext(const char *arg);
@@ -285,13 +285,17 @@ arrange(void) {
 	Client *c;
 
 	for(c = clients; c; c = c->next)
-		if(isvisible(c))
+		if(isvisible(c)) {
 			unban(c);
+			if(lt->isfloating || c->isfloating)
+				resize(c, c->fx, c->fy, c->fw, c->fh, True);
+		}
 		else
 			ban(c);
 
 	focus(NULL);
-	lt->arrange();
+	if(lt->arrange)
+		lt->arrange();
 	restack();
 }
 
@@ -359,7 +363,7 @@ buttonpress(XEvent *e) {
 			movemouse(c);
 		}
 		else if(ev->button == Button2) {
-			if((floating != lt->arrange) && c->isfloating)
+			if(!lt->isfloating && c->isfloating)
 				togglefloating(NULL);
 			else
 				zoom(NULL);
@@ -668,15 +672,6 @@ expose(XEvent *e) {
 
 	if(ev->count == 0 && (ev->window == barwin))
 		drawbar();
-}
-
-void
-floating(void) { /* default floating layout */
-	Client *c;
-
-	for(c = clients; c; c = c->next)
-		if(isvisible(c))
-			resize(c, c->x, c->y, c->w, c->h, True);
 }
 
 void
@@ -996,8 +991,8 @@ manage(Window w, XWindowAttributes *wa) 
 	/* geometry */
 	c->x = wa->x;
 	c->y = wa->y;
-	c->w = wa->width;
-	c->h = wa->height;
+	c->w = c->fw = wa->width;
+	c->h = c->fh = wa->height;
 	c->oldbw = wa->border_width;
 	if(c->w == sw && c->h == sh) {
 		c->x = sx;
@@ -1015,6 +1010,8 @@ manage(Window w, XWindowAttributes *wa) 
 			c->y = wy;
 		c->bw = BORDERPX;
 	}
+	c->fx = c->x;
+	c->fy = c->y;
 
 	wc.border_width = c->bw;
 	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
@@ -1110,8 +1107,11 @@ movemouse(Client *c) {
 				ny = wy + wh - c->h - 2 * c->bw;
 			if(!c->isfloating && !lt->isfloating && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP))
 				togglefloating(NULL);
-			if((lt->isfloating) || c->isfloating)
+			if(lt->isfloating || c->isfloating) {
+				c->fx = nx;
+				c->fy = ny;
 				resize(c, nx, ny, c->w, c->h, False);
+			}
 			break;
 		}
 	}
@@ -1271,10 +1271,16 @@ resizemouse(Client *c) {
 				nw = 1;
 			if((nh = ev.xmotion.y - ocy - 2 * c->bw + 1) <= 0)
 				nh = 1;
-			if(!c->isfloating && !lt->isfloating && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP))
+			if(!c->isfloating && !lt->isfloating && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) {
+				c->fx = c->x;
+				c->fy = c->y;
 				togglefloating(NULL);
-			if((lt->isfloating) || c->isfloating)
+			}
+			if(lt->isfloating || c->isfloating) {
 				resize(c, c->x, c->y, nw, nh, True);
+				c->fw = nw;
+				c->fh = nh;
+			}
 			break;
 		}
 	}
@@ -1294,16 +1300,11 @@ restack(void) {
 	if(!lt->isfloating) {
 		wc.stack_mode = Below;
 		wc.sibling = barwin;
-		if(!sel->isfloating) {
-			XConfigureWindow(dpy, sel->win, CWSibling|CWStackMode, &wc);
-			wc.sibling = sel->win;
-		}
-		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
-			if(c == sel)
-				continue;
-			XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
-			wc.sibling = c->win;
-		}
+		for(c = stack; c; c = c->snext)
+			if(!c->isfloating && isvisible(c)) {
+				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
+				wc.sibling = c->win;
+			}
 	}
 	XSync(dpy, False);
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
@@ -1856,6 +1857,8 @@ view(const char *arg) {
 		memcpy(seltags, tmp, TAGSZ);
 		arrange();
 	}
+	else
+		viewprevtag(NULL);
 }
 
 void
@@ -1903,14 +1906,14 @@ zoom(const char *arg) {
 zoom(const char *arg) {
 	Client *c = sel;
 
-	if(!sel || lt->isfloating || sel->isfloating)
-		return;
 	if(c == nexttiled(clients))
-		if(!(c = nexttiled(c->next)))
+		if(!c || !(c = nexttiled(c->next)))
 			return;
-	detach(c);
-	attach(c);
-	focus(c);
+	if(!lt->isfloating && !sel->isfloating) {
+		detach(c);
+		attach(c);
+		focus(c);
+	}
 	arrange();
 }
 

Reply via email to