Well, this is my proposal in patch form. I'm not sure about the
convenience of setting fx and fy in tileresize, but you get the idea.


-- 


- yiyus || JGL .
diff -r 595ed1a4447c dwm.c
--- a/dwm.c	Tue Apr 08 11:49:35 2008 +0100
+++ b/dwm.c	Tue Apr 08 18:59:12 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;
@@ -285,8 +286,11 @@ 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);
 
@@ -676,7 +680,7 @@ floating(void) { /* default floating lay
 
 	for(c = clients; c; c = c->next)
 		if(isvisible(c))
-			resize(c, c->x, c->y, c->w, c->h, True);
+			resize(c, c->fx, c->fy, c->fw, c->fh, True);
 }
 
 void
@@ -996,8 +1000,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 +1019,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 +1116,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) {
 				resize(c, nx, ny, c->w, c->h, False);
+				c->fx = nx;
+				c->fy = ny;
+			}
 			break;
 		}
 	}
@@ -1273,8 +1282,11 @@ resizemouse(Client *c) {
 				nh = 1;
 			if(!c->isfloating && !lt->isfloating && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP))
 				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;
 		}
 	}
@@ -1657,6 +1669,8 @@ tileresize(Client *c, int x, int y, int 
 	if((RESIZEHINTS) && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w)))
 		/* client doesn't accept size constraints */
 		resize(c, x, y, w, h, False);
+	c->fx = x;
+	c->fy = y;
 }
 
 void
@@ -1856,6 +1870,8 @@ view(const char *arg) {
 		memcpy(seltags, tmp, TAGSZ);
 		arrange();
 	}
+	else
+		viewprevtag(NULL);
 }
 
 void

Reply via email to