if (*transferData)
if (r_context->completed)
wait_for_retrieval(GtkClipboard *clipboard, void **transferData){    if (*transferData)  // the request completed synchronously        return;    Display *xDisplay = GDK_DISPLAY();    checkEventContext context;    context.cbWidget = NULL;    context.selAtom = gdk_x11_atom_to_xatom(gdk_atom_intern("GDK_SELECTION",                                                            FALSE));    // Send X events which are relevant to the ongoing selection retrieval    // to the clipboard widget.  Wait until either the operation completes, or    // we hit our timeout.  All other X events remain queued.    int cnumber;#ifdef VMS    cnumber = XConnectionNumber(xDisplay);#else    cnumber = ConnectionNumber(xDisplay);#endif    fd_set rfds;    struct timeval tv;    FD_ZERO(&rfds);    FD_SET(cnumber++, &rfds);    do {        XEvent xevent;        while (XCheckIfEvent(xDisplay, &xevent, checkEventProc,                             (XPointer) &context)) {            if (xevent.xany.type == SelectionNotify)                DispatchSelectionNotifyEvent(context.cbWidget, &xevent);            else                DispatchPropertyNotifyEvent(context.cbWidget, &xevent);            if (*transferData)                return;        }        tv.tv_sec = 0;        tv.tv_usec = kClipboardTimeout;    } while (select(cnumber, &rfds, NULL, NULL, &tv) == 1);#ifdef DEBUG_CLIPBOARD    printf("exceeded clipboard timeout\n");#endif}