summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorokan <okan>2013-04-03 19:20:50 +0000
committerokan <okan>2013-04-03 19:20:50 +0000
commitec4474a33acd02d1bf0df17aee7fb1a490bc9676 (patch)
treeb66674fb9bb4a2ba6a42594a05491ab7dc262355 /client.c
parentfbb0df415528094cb7ead17ad3a50dcf6fba6008 (diff)
downloadcwm-ec4474a33acd02d1bf0df17aee7fb1a490bc9676.tar.gz
cwm-ec4474a33acd02d1bf0df17aee7fb1a490bc9676.tar.xz
cwm-ec4474a33acd02d1bf0df17aee7fb1a490bc9676.zip
move XUngrabServer to the end of client_new() to avoid races where clients,
such as those using sdl, attempt to manage the clients themselves when the
clients aren't fully ready.  other wm's grab the xserver during the whole
client setup process, so match.

behavior found by jsg.
Diffstat (limited to 'client.c')
-rw-r--r--client.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/client.c b/client.c
index 4895817..0b9f121 100644
--- a/client.c
+++ b/client.c
@@ -121,9 +121,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 	(state == IconicState) ? client_hide(cc) : client_unhide(cc);
 	xu_setstate(cc, cc->state);
 
-	XSync(X_Dpy, False);
-	XUngrabServer(X_Dpy);
-
 	TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
 	TAILQ_INSERT_TAIL(&Clientq, cc, entry);
 
@@ -135,6 +132,9 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 	if (mapped)
 		group_autogroup(cc);
 
+	XSync(X_Dpy, False);
+	XUngrabServer(X_Dpy);
+
 	return (cc);
 }