From ec4474a33acd02d1bf0df17aee7fb1a490bc9676 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 3 Apr 2013 19:20:50 +0000 Subject: [PATCH] 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. --- client.c | 6 +++--- 1 file 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); }