We need to ensure that the window handle is valid, i. e. the window is
actually created and accessible, before returning.
This is necessary because we immediately fork after returning, and the
child process opens its own X11 connection and expects the window handle
to be valid.
Fixes #46
#include <xcb/xcb.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_atom.h>
+#include <xcb/xcb_aux.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
values[0] = XCB_STACK_MODE_ABOVE;
xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
+ /* Ensure that the window is created and set up before returning */
+ xcb_aux_sync(conn);
+
return win;
}