#include #include int main() { Display *display = XOpenDisplay(NULL); if (display) { XEvent event; XSelectInput(display, DefaultRootWindow(display), SubstructureNotifyMask); do { XNextEvent(display, &event); } while (event.type != CreateNotify); XCloseDisplay(display); } exit(display == NULL); }