Lines 2762-2785
Link Here
|
2762 |
XTextProperty ct; |
2762 |
XTextProperty ct; |
2763 |
Atom actual_type; |
2763 |
Atom actual_type; |
2764 |
int actual_fmt; |
2764 |
int actual_fmt; |
2765 |
int dummy_count; |
2765 |
int count, i; |
2766 |
char **cl; |
2766 |
char **cl; |
2767 |
XEvent ev; |
2767 |
XEvent ev; |
2768 |
XWindowAttributes wa; |
2768 |
XWindowAttributes wa; |
2769 |
int setpropertyevent = 0; |
2769 |
int setpropertyevent = 0; |
|
|
2770 |
|
2771 |
Atom *targets; |
2770 |
|
2772 |
|
2771 |
if (prop == None) { |
2773 |
if (prop == None) { |
2772 |
prop = XInternAtom(Xdisplay, "VT_SELECTION", False); |
2774 |
printf("Warning: selection_paste FAILED!\n"); |
2773 |
|
2775 |
return; |
2774 |
if (selection.type == 0) { |
|
|
2775 |
selection.type++; |
2776 |
XConvertSelection(Xdisplay, XA_PRIMARY, XA_UTF8_STRING(Xdisplay), prop, TermWin.vt,selection.request_time); |
2777 |
} else if (selection.type == 1) { |
2778 |
selection.type++; |
2779 |
XConvertSelection(Xdisplay, XA_PRIMARY, XA_STRING, prop, TermWin.vt,selection.request_time); |
2780 |
} |
2776 |
} |
2781 |
return; |
2777 |
|
2782 |
} |
2778 |
/* meaning: get supported TARGETS list */ |
|
|
2779 |
if (selection.type == 0) { |
2780 |
|
2781 |
if ((XGetWindowProperty(Xdisplay, win, prop, 0, PROP_SIZE, |
2782 |
False, AnyPropertyType, &ct.encoding, &ct.format, |
2783 |
&ct.nitems, &bytes_after, &targets) != Success)) { |
2784 |
XFree(ct.value); |
2785 |
return; |
2786 |
} |
2787 |
|
2788 |
selection.type++; |
2789 |
count = 0; |
2790 |
|
2791 |
printf("Supported targets: "); |
2792 |
|
2793 |
for (i = 0; i < ct.nitems; i++) { |
2794 |
printf("%s ",XmuGetAtomName(Xdisplay, targets[i])); |
2795 |
|
2796 |
if (targets[i] == XA_COMPOUND_TEXT(Xdisplay)) { |
2797 |
XConvertSelection(Xdisplay, XA_PRIMARY, XA_COMPOUND_TEXT(Xdisplay), |
2798 |
prop, TermWin.vt, selection.request_time); |
2799 |
printf("\nConverting to COMPOUND_TEXT.\n"); |
2800 |
return; |
2801 |
} |
2802 |
|
2803 |
if (targets[i] == XA_STRING) { |
2804 |
count = 1; |
2805 |
} |
2806 |
} |
2807 |
|
2808 |
printf("\n"); |
2809 |
|
2810 |
if (count == 1) { |
2811 |
printf("Converting to STRING\n"); |
2812 |
XConvertSelection(Xdisplay, XA_PRIMARY, XA_STRING, prop, TermWin.vt, |
2813 |
selection.request_time); |
2814 |
} else { |
2815 |
printf("Warning: failed to convert selection!\n"); |
2816 |
} |
2817 |
} |
2783 |
|
2818 |
|
2784 |
for (nread = 0, bytes_after = 1; bytes_after > 0; nread += nitems) { |
2819 |
for (nread = 0, bytes_after = 1; bytes_after > 0; nread += nitems) { |
2785 |
if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE, |
2820 |
if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE, |
Lines 2818-2824
Link Here
|
2818 |
break; |
2853 |
break; |
2819 |
} |
2854 |
} |
2820 |
else { |
2855 |
else { |
2821 |
if (XmbTextPropertyToTextList(Xdisplay, &ct, &cl, &dummy_count) == Success && cl) { |
2856 |
if (XmbTextPropertyToTextList(Xdisplay, &ct, &cl, &count) == Success && cl) { |
2822 |
PasteIt(cl[0], strlen(cl[0])); |
2857 |
PasteIt(cl[0], strlen(cl[0])); |
2823 |
XFreeStringList(cl); |
2858 |
XFreeStringList(cl); |
2824 |
} else { |
2859 |
} else { |
Lines 2842-2848
Link Here
|
2842 |
XDeleteProperty(Xdisplay, win, prop); |
2877 |
XDeleteProperty(Xdisplay, win, prop); |
2843 |
} |
2878 |
} |
2844 |
|
2879 |
|
2845 |
if (XmbTextPropertyToTextList(Xdisplay, &ct, &cl, &dummy_count) == Success && cl) { |
2880 |
if (XmbTextPropertyToTextList(Xdisplay, &ct, &cl, &count) == Success && cl) { |
2846 |
PasteIt(cl[0], strlen(cl[0])); |
2881 |
PasteIt(cl[0], strlen(cl[0])); |
2847 |
XFreeStringList(cl); |
2882 |
XFreeStringList(cl); |
2848 |
} else { |
2883 |
} else { |
Lines 2880-2886
Link Here
|
2880 |
} else { |
2915 |
} else { |
2881 |
prop = XInternAtom(Xdisplay, "VT_SELECTION", False); |
2916 |
prop = XInternAtom(Xdisplay, "VT_SELECTION", False); |
2882 |
selection.type = 0; |
2917 |
selection.type = 0; |
2883 |
XConvertSelection(Xdisplay, XA_PRIMARY, xa, prop, TermWin.vt,tm); |
2918 |
XConvertSelection(Xdisplay, XA_PRIMARY, XA_TARGETS(Xdisplay), prop, TermWin.vt,tm); |
2884 |
} |
2919 |
} |
2885 |
} |
2920 |
} |
2886 |
|
2921 |
|