#include #include #include #include int main() { Display *d; Window w; XSetWindowAttributes attr; d = XOpenDisplay(NULL); if(d == NULL) abort(); attr.background_pixel = BlackPixelOfScreen(DefaultScreenOfDisplay(d)); attr.event_mask = StructureNotifyMask | ExposureMask; attr.override_redirect = True; w = XCreateWindow(d,DefaultRootWindow(d),0,0,100,100,0,CopyFromParent,InputOutput,CopyFromParent, CWBackPixel|CWEventMask,&attr); XMapWindow(d,w); XFlush(d); for(;;) { XEvent e; XNextEvent(d,&e); switch(e.type) { case Expose: printf("Expose\n"); break; case ConfigureNotify: { XConfigureEvent *ce = (XConfigureEvent*) &e; printf("ConfigureNotify: width: %d height: %d\n",ce->width,ce->height); printf("Rendering...\n"); sleep(1); printf("Done rendering\n"); break; } } } }