--- rxvt-unicode/src/screen.C 2011/01/28 00:08:58 1.366 +++ rxvt-unicode/src/screen.C 2011/02/06 11:42:03 1.369 @@ -40,8 +40,6 @@ } /* ------------------------------------------------------------------------- */ -#define PROP_SIZE 256*1024 -#define PASTE_SIZE 32768 #define TABSIZE 8 /* default tab size */ /* ------------------------------------------------------------------------- * @@ -2744,24 +2742,21 @@ { if (prop == None) /* check for failed XConvertSelection */ { + int selnum = selection_type & Sel_whereMask; + + if (selnum == Sel_direct) + selection_type = 0; + if ((selection_type & Sel_CompoundText)) { - int selnum = selection_type & Sel_whereMask; - selection_type = 0; - if (selnum != Sel_direct) - selection_request_other (XA_STRING, selnum); + selection_request_other (XA_STRING, selnum); } if ((selection_type & Sel_UTF8String)) { - int selnum = selection_type & Sel_whereMask; - selection_type = Sel_CompoundText; - if (selnum != Sel_direct) - selection_request_other (xa[XA_COMPOUND_TEXT], selnum); - else - selection_type = 0; + selection_request_other (xa[XA_COMPOUND_TEXT], selnum); } return; @@ -2770,8 +2765,9 @@ unsigned long bytes_after; XTextProperty ct; + // length == (2^31 - 1) / 4, as gdk if (XGetWindowProperty (dpy, win, prop, - 0, PROP_SIZE / 4, + 0, 0x1fffffff, delete_prop, AnyPropertyType, &ct.encoding, &ct.format, &ct.nitems, &bytes_after, @@ -2784,27 +2780,6 @@ if (ct.encoding == None) goto bailout; - if (bytes_after) - { - // fetch and append remaining data - XTextProperty ct2; - - if (XGetWindowProperty (dpy, win, prop, - ct.nitems / 4, (bytes_after + 3) / 4, - delete_prop, AnyPropertyType, - &ct2.encoding, &ct2.format, - &ct2.nitems, &bytes_after, - &ct2.value) != Success) - goto bailout; - - // realloc should be compatible to XFree, here, and elsewhere, too - ct.value = (unsigned char *)rxvt_realloc (ct.value, ct.nitems + ct2.nitems + 1); - memcpy (ct.value + ct.nitems, ct2.value, ct2.nitems + 1); - ct.nitems += ct2.nitems; - - XFree (ct2.value); - } - if (ct.value == 0) goto bailout; @@ -2844,7 +2819,7 @@ * pass through again trying CUT_BUFFER0 if we've come from * XConvertSelection () but nothing was presented */ - selection_paste (display->root, XA_CUT_BUFFER0, False); + selection_paste (display->root, XA_CUT_BUFFER0, false); } goto bailout;