/* Compile with "gcc -lX11 " */
#include <X11/Xlib.h>

int main(int argc, char **argv)
{
    Display *display;
    int screen;
    Window win;
    XEvent report;

    display = XOpenDisplay(NULL);
    screen = DefaultScreen(display);
    win = XCreateSimpleWindow(display, RootWindow(display,screen),
            50, 50, 50, 50, 4,
            BlackPixel(display,screen),
            WhitePixel(display,screen));
    XSelectInput(display, win, ExposureMask | StructureNotifyMask);
    XMapWindow(display, win);


    /* Set WM_TRANSIENT_FOR of win to point to itself. */
    /* This is the operation that makes libwnck self-destruct. */
    XSetTransientForHint(display, win, win);

    /* Process expose event and then quit. */
    while (1)
    {
        XNextEvent(display, &report);
        if (report.type == Expose)
        {
            while (XCheckTypedEvent(display, Expose, &report)) {}

            XDestroyWindow(display, win);
            XCloseDisplay(display);

            return 0;
        }
    }
}
