X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6..ecc95c903ba6c9a548588a79c1093e6372555f2c:/event.c?ds=sidebyside

diff --git a/event.c b/event.c
index 0c159c7..69a628e 100644
--- a/event.c
+++ b/event.c
@@ -105,7 +105,7 @@ buttonpress(XEvent *e)
 		switch(ev->button) {
 		default:
 			x = 0;
-			for(a.i = 0; a.i < TLast; a.i++) {
+			for(a.i = 0; a.i < ntags; a.i++) {
 				x += textw(tags[a.i]);
 				if(ev->x < x) {
 					view(&a);
@@ -156,22 +156,17 @@ configurerequest(XEvent *e)
 
 	if((c = getclient(ev->window))) {
 		gravitate(c, True);
-		if(c->isfloat) {
-			if(ev->value_mask & CWX)
-				c->x = ev->x;
-			if(ev->value_mask & CWY)
-				c->y = ev->y;
-			if(ev->value_mask & CWWidth)
-				c->w = ev->width;
-			if(ev->value_mask & CWHeight)
-				c->h = ev->height;
-		}
+		if(ev->value_mask & CWX)
+			c->x = ev->x;
+		if(ev->value_mask & CWY)
+			c->y = ev->y;
+		if(ev->value_mask & CWWidth)
+			c->w = ev->width;
+		if(ev->value_mask & CWHeight)
+			c->h = ev->height;
 		if(ev->value_mask & CWBorderWidth)
 			c->border = ev->border_width;
 		gravitate(c, False);
-
-		resize(c, True, TopLeft);
-
 		wc.x = c->x;
 		wc.y = c->y;
 		wc.width = c->w;
@@ -193,6 +188,11 @@ configurerequest(XEvent *e)
 			/* Send synthetic ConfigureNotify */
 			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
 		}
+		XSync(dpy, False);
+		if(c->isfloat)
+			resize(c, False, TopLeft);
+		else
+			arrange(NULL);
 	}
 	else {
 		wc.x = ev->x;
@@ -203,8 +203,8 @@ configurerequest(XEvent *e)
 		wc.sibling = ev->above;
 		wc.stack_mode = ev->detail;
 		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
+		XSync(dpy, False);
 	}
-	XSync(dpy, False);
 }
 
 static void