… | |
… | |
2714 | |
2714 | |
2715 | unsigned long bytes_after; |
2715 | unsigned long bytes_after; |
2716 | XTextProperty ct; |
2716 | XTextProperty ct; |
2717 | |
2717 | |
2718 | if (XGetWindowProperty (display->display, win, prop, |
2718 | if (XGetWindowProperty (display->display, win, prop, |
2719 | 0, (long)(PROP_SIZE / 4), |
2719 | 0, PROP_SIZE / 4, |
2720 | delete_prop, AnyPropertyType, |
2720 | delete_prop, AnyPropertyType, |
2721 | &ct.encoding, &ct.format, |
2721 | &ct.encoding, &ct.format, |
2722 | &ct.nitems, &bytes_after, |
2722 | &ct.nitems, &bytes_after, |
2723 | &ct.value) != Success) |
2723 | &ct.value) != Success) |
2724 | { |
2724 | { |
… | |
… | |
2731 | |
2731 | |
2732 | if (bytes_after) |
2732 | if (bytes_after) |
2733 | { |
2733 | { |
2734 | // fetch and append remaining data |
2734 | // fetch and append remaining data |
2735 | XTextProperty ct2; |
2735 | XTextProperty ct2; |
2736 | unsigned long bytes_after2; |
|
|
2737 | |
2736 | |
2738 | if (XGetWindowProperty (display->display, win, prop, |
2737 | if (XGetWindowProperty (display->display, win, prop, |
2739 | ct.nitems / 4, (long) (bytes_after + 3) / 4, |
2738 | ct.nitems / 4, (bytes_after + 3) / 4, |
2740 | delete_prop, AnyPropertyType, |
2739 | delete_prop, AnyPropertyType, |
2741 | &ct2.encoding, &ct2.format, |
2740 | &ct2.encoding, &ct2.format, |
2742 | &ct2.nitems, &bytes_after2, |
2741 | &ct2.nitems, &bytes_after, |
2743 | &ct2.value) != Success) |
2742 | &ct2.value) != Success) |
2744 | goto bailout; |
2743 | goto bailout; |
2745 | |
2744 | |
2746 | // realloc should be compatible to XFree, here, and elsewhere, too |
2745 | // realloc should be compatible to XFree, here, and elsewhere, too |
2747 | ct.value = (unsigned char *)realloc (ct.value, ct.nitems + bytes_after); |
2746 | ct.value = (unsigned char *)realloc (ct.value, ct.nitems + ct2.nitems + 1); |
2748 | memcpy (ct.value + ct.nitems, ct2.value, ct2.nitems); |
2747 | memcpy (ct.value + ct.nitems, ct2.value, ct2.nitems + 1); |
2749 | ct.nitems += ct2.nitems; |
2748 | ct.nitems += ct2.nitems; |
2750 | |
2749 | |
2751 | XFree (ct2.value); |
2750 | XFree (ct2.value); |
2752 | } |
2751 | } |
2753 | else if (delete_prop) |
|
|
2754 | XDeleteProperty (display->display, win, prop); |
|
|
2755 | |
2752 | |
2756 | if (ct.value == 0) |
2753 | if (ct.value == 0) |
2757 | goto bailout; |
2754 | goto bailout; |
2758 | |
2755 | |
2759 | if (ct.encoding == xa[XA_INCR]) |
2756 | if (ct.encoding == xa[XA_INCR]) |