static void dndGetTypeList(XClientMessageEvent *evt) { if (xdndTypeList) { free(xdndTypeList); xdndTypeList= 0; } xdndWillAccept= 0; if (xdndEnter_hasThreeTypes(evt)) { int i; dprintf((stderr, " 3 types\n")); xdndTypeList= (Atom *)xcalloc(3 + 1, sizeof(Atom)); for (i= 0; i < 3; ++i) xdndTypeList[i]= xdndEnter_typeAt(evt, i); xdndTypeList[3]= 0; } else { Atom type, *atoms; int format; unsigned long i, count, remaining; unsigned char *data= 0; XGetWindowProperty(stDisplay, xdndSourceWindow, XdndTypeList, 0, 0x8000000L, False, XA_ATOM, &type, &format, &count, &remaining, &data); if ((type != XA_ATOM) || (format != 32) || (count == 0) || !data) { if (data) XFree(data); fprintf(stderr, "XGetWindowProperty failed in xdndGetTypeList\n"); return; } xdndTypeList= (Atom *)xcalloc(count + 1, sizeof(Atom)); atoms= (Atom *)data; for (i= 0; i < count; ++i) xdndTypeList[i]= atoms[i]; xdndTypeList[count]= 0; XFree(data); dprintf((stderr, " %ld types\n", count)); } /* We only accept filenames (MIME type "text/uri-list"). */ { int i; for (i= 0; xdndTypeList[i]; ++i) { dprintf((stderr, " type %d == %ld %s\n", i, xdndTypeList[i], XGetAtomName(stDisplay, xdndTypeList[i]))); if (XdndTextUriList == xdndTypeList[i]) xdndWillAccept= 1; } } }
static void dndGetTypeList(XClientMessageEvent *evt) { xdndWillAccept= 0; isUrlList= 0; if (xdndEnter_hasThreeTypes(evt)) { fdebugf((stderr, " 3 types\n")); updateInTypes((Atom *) xdndEnter_targets(evt), 3); } else { Atom type; int format; unsigned long count, remaining; unsigned char *data= 0; XGetWindowProperty(stDisplay, xdndSourceWindow, XdndTypeList, 0, 0x8000000L, False, XA_ATOM, &type, &format, &count, &remaining, &data); if ((type != XA_ATOM) || (format != 32) || (count == 0) || !data) { if (data) XFree(data); fprintf(stderr, "XGetWindowProperty failed in xdndGetTypeList\n"); return; } updateInTypes((Atom *) data, count); XFree(data); fdebugf((stderr, " %ld types\n", count)); } /* We only accept filenames (MIME type "text/uri-list"). */ { int i; for (i= 0; xdndInTypes[i]; ++i) { fdebugf((stderr, " type %d == %ld %s\n", i, xdndInTypes[i], XGetAtomName(stDisplay, xdndInTypes[i]))); if (XdndTextUriList == xdndInTypes[i]) { isUrlList= 1; xdndWillAccept= 1; } } } xdndWillAccept= 1; }