client.c
changeset 270 dacd3f3c5823
parent 261 d6fd632d861c
child 272 be40a56df248
--- a/client.c	Mon Aug 14 08:52:15 2006 +0200
+++ b/client.c	Mon Aug 14 10:18:24 2006 +0200
@@ -59,8 +59,6 @@
 		drawtitle(old);
 	drawtitle(c);
 	XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
-	XSync(dpy, False);
-	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }
 
 void
@@ -77,8 +75,8 @@
 	if(!(c = getnext(sel->next)))
 		c = getnext(clients);
 	if(c) {
-		higher(c);
 		focus(c);
+		restack();
 	}
 }
 
@@ -98,8 +96,8 @@
 		c = getprev(c);
 	}
 	if(c) {
-		higher(c);
 		focus(c);
+		restack();
 	}
 }
 
@@ -181,13 +179,6 @@
 }
 
 void
-higher(Client *c)
-{
-	XRaiseWindow(dpy, c->win);
-	XRaiseWindow(dpy, c->title);
-}
-
-void
 killclient(Arg *arg)
 {
 	if(!sel)
@@ -271,13 +262,12 @@
 			|| (c->maxw && c->minw &&
 				c->maxw == c->minw && c->maxh == c->minh);
 	settitle(c);
-	arrange(NULL);
 
-	/* mapping the window now prevents flicker */
-	XMapRaised(dpy, c->win);
-	XMapRaised(dpy, c->title);
+	XMapWindow(dpy, c->win);
+	XMapWindow(dpy, c->title);
 	if(isvisible(c))
 		focus(c);
+	arrange(NULL);
 }
 
 void
@@ -410,7 +400,7 @@
 		sel->w = sw - 2;
 		sel->h = sh - 2 - bh;
 
-		higher(sel);
+		restack();
 		resize(sel, arrange == dofloat, TopLeft);
 
 		sel->x = ox;
@@ -446,9 +436,9 @@
 	XSync(dpy, False);
 	XSetErrorHandler(xerror);
 	XUngrabServer(dpy);
-	arrange(NULL);
 	if(sel)
 		focus(sel);
+	arrange(NULL);
 }
 
 void
@@ -474,6 +464,6 @@
 	clients->prev = sel;
 	sel->next = clients;
 	clients = sel;
+	focus(sel);
 	arrange(NULL);
-	focus(sel);
 }