ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.368 by sf-exg, Tue Feb 1 00:41:01 2011 UTC vs.
Revision 1.371 by sf-exg, Wed Feb 9 23:07:18 2011 UTC

38 while (len--) 38 while (len--)
39 *start++ = value; 39 *start++ = value;
40} 40}
41 41
42/* ------------------------------------------------------------------------- */ 42/* ------------------------------------------------------------------------- */
43#define PROP_SIZE 256*1024
44#define PASTE_SIZE 32768
45#define TABSIZE 8 /* default tab size */ 43#define TABSIZE 8 /* default tab size */
46 44
47/* ------------------------------------------------------------------------- * 45/* ------------------------------------------------------------------------- *
48 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * 46 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES *
49 * ------------------------------------------------------------------------- */ 47 * ------------------------------------------------------------------------- */
2744{ 2742{
2745 if (prop == None) /* check for failed XConvertSelection */ 2743 if (prop == None) /* check for failed XConvertSelection */
2746 { 2744 {
2747 int selnum = selection_type & Sel_whereMask; 2745 int selnum = selection_type & Sel_whereMask;
2748 2746
2749 if (selnum == Sel_direct)
2750 selection_type = 0;
2751
2752 if ((selection_type & Sel_CompoundText)) 2747 if ((selection_type & Sel_CompoundText))
2753 { 2748 {
2754 selection_type = 0; 2749 selection_type = 0;
2755 selection_request_other (XA_STRING, selnum); 2750 selection_request_other (XA_STRING, selnum);
2756 } 2751 }
2765 } 2760 }
2766 2761
2767 unsigned long bytes_after; 2762 unsigned long bytes_after;
2768 XTextProperty ct; 2763 XTextProperty ct;
2769 2764
2765 // length == (2^31 - 1) / 4, as gdk
2770 if (XGetWindowProperty (dpy, win, prop, 2766 if (XGetWindowProperty (dpy, win, prop,
2771 0, PROP_SIZE / 4, 2767 0, 0x1fffffff,
2772 delete_prop, AnyPropertyType, 2768 delete_prop, AnyPropertyType,
2773 &ct.encoding, &ct.format, 2769 &ct.encoding, &ct.format,
2774 &ct.nitems, &bytes_after, 2770 &ct.nitems, &bytes_after,
2775 &ct.value) != Success) 2771 &ct.value) != Success)
2776 { 2772 {
2778 goto bailout; 2774 goto bailout;
2779 } 2775 }
2780 2776
2781 if (ct.encoding == None) 2777 if (ct.encoding == None)
2782 goto bailout; 2778 goto bailout;
2783
2784 if (bytes_after)
2785 {
2786 // fetch and append remaining data
2787 XTextProperty ct2;
2788
2789 if (XGetWindowProperty (dpy, win, prop,
2790 ct.nitems / 4, (bytes_after + 3) / 4,
2791 delete_prop, AnyPropertyType,
2792 &ct2.encoding, &ct2.format,
2793 &ct2.nitems, &bytes_after,
2794 &ct2.value) != Success)
2795 goto bailout;
2796
2797 // realloc should be compatible to XFree, here, and elsewhere, too
2798 ct.value = (unsigned char *)rxvt_realloc (ct.value, ct.nitems + ct2.nitems + 1);
2799 memcpy (ct.value + ct.nitems, ct2.value, ct2.nitems + 1);
2800 ct.nitems += ct2.nitems;
2801
2802 XFree (ct2.value);
2803 }
2804 2779
2805 if (ct.value == 0) 2780 if (ct.value == 0)
2806 goto bailout; 2781 goto bailout;
2807 2782
2808 if (ct.encoding == xa[XA_INCR]) 2783 if (ct.encoding == xa[XA_INCR])
2903{ 2878{
2904 selection_wait = Sel_none; 2879 selection_wait = Sel_none;
2905 2880
2906 incr_buf_size = 0; 2881 incr_buf_size = 0;
2907 free (incr_buf); 2882 free (incr_buf);
2883 incr_buf = 0;
2908 2884
2909 rxvt_warn ("data loss: timeout on INCR selection paste, ignoring.\n"); 2885 rxvt_warn ("data loss: timeout on INCR selection paste, ignoring.\n");
2910} 2886}
2911 2887
2912void 2888void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines