rem: *type = target; return data;
add: data = WMCreateDataWithBytes(ptr, 4 * 4); WMSetDataFormat(data, 32);  *type = target; return data;
context: requestHandler(WMView *view, Atom selection, Atom target,               void *cdata, Atom *type){    Text *tPtr = view->self;    int count;    Display *dpy = tPtr->view->screen->display;    Atom _TARGETS;    Atom TEXT = XInternAtom(dpy, "TEXT", False);    Atom COMPOUND_TEXT = XInternAtom(dpy, "COMPOUND_TEXT", False);    WMData *data = NULL;    if(!tPtr->ownsSelection || !tPtr->paragraphs) return NULL;    //printf("got here\n");    if (target == XA_STRING || target == TEXT || target == COMPOUND_TEXT) {        //for bleh in selection...        char *s = NULL;        Paragraph *para  = tPtr->paragraphs;        Chunk *chunk = NULL;        char pixmap[] = "[pixmap]";        Bool first=True;        short len;        while(para) {            chunk = para->chunks;            while(chunk) {                if(chunk->selected && chunk->type == ctText) {                    len = chunk->chars; //chunk->sEnd - chunk->sStart;                    if(len>0) {                        s = wmalloc(len+1);                        if(s) {                            memcpy(s, &chunk->text[0*chunk->sStart], len);                            s[len] = 0;                            if(first) {                                data = WMCreateDataWithBytes(s, strlen(s));                                first = False;                            } else {                                printf("append: %c %d\n", *s, strlen(s));                                WMAppendDataBytes(data, s, strlen(s));                            }                            //gdbFree(s);                        } } }#if 0                printf("len is %d [%d %d] %d \n", len, chunk->sStart, chunk->sEnd,                       chunk->chars);#endif                chunk = chunk->next;            }            para = para->next;        }        if(data) {            WMSetDataFormat(data, 8);            *type = target;        }        return data;    }#if 0    _TARGETS = XInternAtom(dpy, "TARGETS", False);    if (target == _TARGETS) {        Atom *ptr = wmalloc(4 * sizeof(Atom));        ptr[0] = _TARGETS;        ptr[1] = XA_STRING;        ptr[2] = TEXT;        ptr[3] = COMPOUND_TEXT;        data = WMCreateDataWithBytes(ptr, 4*4);        WMSetDataFormat(data, 32);        *type = target;        return data;    }#endif    return NULL;}