Changeset 85921 in vbox
- Timestamp:
- Aug 28, 2020 9:57:19 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 140110
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
r85920 r85921 578 578 579 579 /* Atom / HGCM formatting helpers. */ 580 int append ToAtomList(const RTCList<RTCString> &lstFormats, VBoxDnDAtomList &lstAtoms) const;581 int append ToAtomList(const void *pvData, uint32_t cbData, VBoxDnDAtomList &lstAtoms) const;580 int appendFormatsToList(const RTCList<RTCString> &lstFormats, VBoxDnDAtomList &lstAtoms) const; 581 int appendDataToList(const void *pvData, uint32_t cbData, VBoxDnDAtomList &lstAtoms) const; 582 582 static Atom toAtomAction(VBOXDNDACTION dndAction); 583 583 static int toAtomActions(VBOXDNDACTIONLIST dndActionList, VBoxDnDAtomList &lstAtoms); … … 607 607 long m_curVer; 608 608 /** List of (Atom) formats the source window supports. */ 609 VBoxDnDAtomList m_lst Formats;609 VBoxDnDAtomList m_lstAtomFormats; 610 610 /** List of (Atom) actions the source window supports. */ 611 VBoxDnDAtomList m_lstA ctions;611 VBoxDnDAtomList m_lstAtomActions; 612 612 /** Buffer for answering the target window's selection request. */ 613 613 void *m_pvSelReqData; … … 747 747 wndXDnDClearActionList(m_wndProxy.hWnd); 748 748 749 /* Reset the internal state. */ 750 m_lstActions.clear(); 751 m_lstFormats.clear(); 749 m_lstAtomActions.clear(); 750 751 /* First, clear the formats list. */ 752 m_lstAtomFormats.clear(); 753 /* Append default targets we support. 754 * Note: The order is sorted by preference; be careful when changing this. */ 755 m_lstAtomFormats.append(xAtom(XA_TARGETS)); 756 m_lstAtomFormats.append(xAtom(XA_MULTIPLE)); 757 /** @todo Support INC (incremental transfers). */ 758 752 759 m_wndCur = 0; 753 760 m_curVer = -1; … … 1045 1052 { 1046 1053 LogFlowThisFunc(("\t%s\n", gX11->xAtomToString(e.xclient.data.l[i]).c_str())); 1047 m_lst Formats.append(e.xclient.data.l[i]);1054 m_lstAtomFormats.append(e.xclient.data.l[i]); 1048 1055 } 1049 1056 } … … 1051 1058 { 1052 1059 /* More than 3 format types supported. */ 1053 rc = wndXDnDGetFormatList(wndSelection, m_lst Formats);1060 rc = wndXDnDGetFormatList(wndSelection, m_lstAtomFormats); 1054 1061 } 1055 1062 … … 1061 1068 if (m_curVer >= 2) /* More than one action allowed since protocol version 2. */ 1062 1069 { 1063 rc = wndXDnDGetActionList(wndSelection, m_lstA ctions);1070 rc = wndXDnDGetActionList(wndSelection, m_lstAtomActions); 1064 1071 } 1065 1072 else /* Only "copy" action allowed on legacy applications. */ 1066 m_lstA ctions.append(XA_XdndActionCopy);1073 m_lstAtomActions.append(XA_XdndActionCopy); 1067 1074 } 1068 1075 … … 1296 1303 #ifdef DEBUG 1297 1304 LogFlowFunc(("Supported formats:\n")); 1298 for (size_t i = 0; i < m_lst Formats.size(); i++)1299 LogFlowFunc(("\t%s\n", xAtomToString(m_lst Formats.at(i)).c_str()));1305 for (size_t i = 0; i < m_lstAtomFormats.size(); i++) 1306 LogFlowFunc(("\t%s\n", xAtomToString(m_lstAtomFormats.at(i)).c_str())); 1300 1307 #endif 1301 1308 /* Is the requestor asking for the possible MIME types? */ … … 1306 1313 /* If so, set the window property with the formats on the requestor 1307 1314 * window. */ 1308 rc = wndXDnDSetFormatList(pEvReq->requestor, pEvReq->property, m_lst Formats);1315 rc = wndXDnDSetFormatList(pEvReq->requestor, pEvReq->property, m_lstAtomFormats); 1309 1316 if (RT_SUCCESS(rc)) 1310 1317 pEvResp->property = pEvReq->property; 1311 1318 } 1312 1319 /* Is the requestor asking for a specific MIME type (we support)? */ 1313 else if (m_lst Formats.contains(pEvReq->target))1320 else if (m_lstAtomFormats.contains(pEvReq->target)) 1314 1321 { 1315 1322 VBClLogInfo("Target window %#x ('%s') is asking for data as '%s'\n", … … 1628 1635 /* Check if the VM session has changed and reconnect to the HGCM service if necessary. */ 1629 1636 rc = checkForSessionChange(); 1630 if (RT_FAILURE(rc)) 1631 break; 1632 1633 rc = appendToAtomList(lstFormats, m_lstFormats); 1634 if (RT_FAILURE(rc)) 1635 break; 1636 1637 /* If we have more than 3 formats we have to use the type list extension. */ 1638 if (m_lstFormats.size() > 3) 1639 { 1640 rc = wndXDnDSetFormatList(m_wndProxy.hWnd, xAtom(XA_XdndTypeList), m_lstFormats); 1641 if (RT_FAILURE(rc)) 1642 break; 1643 } 1637 AssertRCBreak(rc); 1638 1639 /* Append all actual (MIME) formats we support to the list. 1640 * These must come last, after the default Atoms above. */ 1641 rc = appendFormatsToList(lstFormats, m_lstAtomFormats); 1642 AssertRCBreak(rc); 1643 1644 rc = wndXDnDSetFormatList(m_wndProxy.hWnd, xAtom(XA_XdndTypeList), m_lstAtomFormats); 1645 AssertRCBreak(rc); 1644 1646 1645 1647 /* Announce the possible actions. */ … … 1812 1814 m.data.l[XdndEnterFlags] = RT_MAKE_U32_FROM_U8( 1813 1815 /* Bit 0 is set if the source supports more than three data types. */ 1814 m_lst Formats.size() > 3 ? RT_BIT(0) : 0,1816 m_lstAtomFormats.size() > 3 ? RT_BIT(0) : 0, 1815 1817 /* Reserved for future use. */ 1816 1818 0, 0, 1817 1819 /* Protocol version to use. */ 1818 1820 RT_MIN(VBOX_XDND_VERSION, newVer)); 1819 m.data.l[XdndEnterType1] = m_lst Formats.value(0, None); /* First data type to use. */1820 m.data.l[XdndEnterType2] = m_lst Formats.value(1, None); /* Second data type to use. */1821 m.data.l[XdndEnterType3] = m_lst Formats.value(2, None); /* Third data type to use. */1821 m.data.l[XdndEnterType1] = m_lstAtomFormats.value(0, None); /* First data type to use. */ 1822 m.data.l[XdndEnterType2] = m_lstAtomFormats.value(1, None); /* Second data type to use. */ 1823 m.data.l[XdndEnterType3] = m_lstAtomFormats.value(2, None); /* Third data type to use. */ 1822 1824 1823 1825 xRc = XSendEvent(m_pDisplay, wndCursor, False, NoEventMask, reinterpret_cast<XEvent*>(&m)); … … 2165 2167 if (RT_SUCCESS(rc2)) 2166 2168 { 2167 RTCString strFormatsCur = gX11->xAtomListToString(m_lst Formats);2169 RTCString strFormatsCur = gX11->xAtomListToString(m_lstAtomFormats); 2168 2170 if (!strFormatsCur.isEmpty()) 2169 2171 { … … 2171 2173 dndActionDefault = VBOX_DND_ACTION_COPY; /** @todo Handle default action! */ 2172 2174 dndActionList = VBOX_DND_ACTION_COPY; /** @todo Ditto. */ 2173 dndActionList |= toHGCMActions(m_lstA ctions);2175 dndActionList |= toHGCMActions(m_lstAtomActions); 2174 2176 } 2175 2177 … … 2816 2818 return VERR_INVALID_PARAMETER; 2817 2819 2818 /* We support TARGETS and the data types. */2819 VBoxDnDAtomList lstFormatsExt(lstFormats.size() + 1);2820 lstFormatsExt.append(xAtom(XA_TARGETS));2821 lstFormatsExt.append(lstFormats);2822 2823 2820 /* Add the property with the property data to the window. */ 2824 2821 XChangeProperty(m_pDisplay, wndThis, atmProp, … … 2837 2834 * @param lstAtoms Reference to VBoxDnDAtomList list to store results in. 2838 2835 */ 2839 int DragInstance::append ToAtomList(const RTCList<RTCString> &lstFormats, VBoxDnDAtomList &lstAtoms) const2836 int DragInstance::appendFormatsToList(const RTCList<RTCString> &lstFormats, VBoxDnDAtomList &lstAtoms) const 2840 2837 { 2841 2838 for (size_t i = 0; i < lstFormats.size(); ++i) … … 2853 2850 * @param lstAtoms Reference to VBoxDnDAtomList list to store results in. 2854 2851 */ 2855 int DragInstance::append ToAtomList(const void *pvData, uint32_t cbData, VBoxDnDAtomList &lstAtoms) const2852 int DragInstance::appendDataToList(const void *pvData, uint32_t cbData, VBoxDnDAtomList &lstAtoms) const 2856 2853 { 2857 2854 RT_NOREF1(lstAtoms);
Note:
See TracChangeset
for help on using the changeset viewer.