From 4b8a3bc2b98550fcd3752bc06b7400efc34e1592 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 3 Apr 2013 19:20:50 +0000 Subject: 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client.c b/client.c index 9845a32..96f63f4 100644 --- a/client.c +++ b/client.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.119 2013/01/08 15:16:05 okan Exp $ + * $OpenBSD: client.c,v 1.120 2013/04/03 19:20:50 okan Exp $ */ #include @@ -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); } -- cgit v1.2.3-2-gb3c3