| 764 | } |
| 765 | |
| 766 | bool XWindowsClipboard::insertMultipleReply(Window requestor, ::Time time, Atom property) |
| 767 | { |
| 768 | // get the requested targets |
| 769 | Atom target; |
| 770 | int32_t format; |
| 771 | std::string data; |
| 772 | if (!XWindowsUtil::getWindowProperty(m_display, requestor, property, &data, &target, &format, False)) { |
| 773 | // can't get the requested targets |
| 774 | return false; |
| 775 | } |
| 776 | |
| 777 | // fail if the requested targets isn't of the correct form |
| 778 | if (format != 32 || target != m_atomAtomPair) { |
| 779 | return false; |
| 780 | } |
| 781 | |
| 782 | // data is a list of atom pairs: target, property |
| 783 | XWindowsUtil::convertAtomProperty(data); |
| 784 | auto targets = static_cast<const Atom *>(static_cast<const void *>(data.data())); |
| 785 | const uint32_t numTargets = data.size() / sizeof(Atom); |
| 786 | |
| 787 | // add replies for each target |
| 788 | bool changed = false; |
| 789 | for (uint32_t i = 0; i < numTargets; i += 2) { |
| 790 | const Atom target = targets[i + 0]; |
| 791 | const Atom property = targets[i + 1]; |
| 792 | if (!addSimpleRequest(requestor, target, time, property)) { |
| 793 | // note that we can't perform the requested conversion |
| 794 | XWindowsUtil::replaceAtomData(data, i, None); |
| 795 | changed = true; |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | // update the targets property if we changed it |
| 800 | if (changed) { |
| 801 | XWindowsUtil::setWindowProperty(m_display, requestor, property, data.data(), data.size(), target, format); |
| 802 | } |
| 803 | |
| 804 | // add reply for MULTIPLE request |
| 805 | insertReply(new Reply(requestor, m_atomMultiple, time, property, std::string(), None, 32)); |
| 806 | |
| 807 | return true; |
| 808 | } |
| 809 | |
| 810 | void XWindowsClipboard::insertReply(Reply *reply) |
| 811 | { |