From c555b06d0fcb2baa3c642698f43cb6264413ef22 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Wed, 26 Nov 2003 12:33:25 +0000 Subject: inspires from xwait: keep a client until some window is created, otherwise X server blinks to hell --- perl-install/c/stuff.xs.pl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index c9477dae5..2e80b0998 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -159,8 +159,17 @@ Xtest(display) if ((pid = fork()) == 0) { Display *d = XOpenDisplay(display); if (d) { - XSetCloseDownMode(d, RetainPermanent); - XCloseDisplay(d); + int child; + /* keep a client until some window is created, otherwise X server blinks to hell */ + if ((child = fork()) == 0) { + XEvent event; + XSelectInput(d, DefaultRootWindow(d), SubstructureNotifyMask); + do { + XNextEvent(d, &event); + } while (event.type != CreateNotify); + XCloseDisplay(d); + exit(0); + } } _exit(d != NULL); } -- cgit v1.2.1