Changeset 74439 in vbox for trunk/src/VBox/Additions/x11/VBoxClient
- Timestamp:
- Sep 24, 2018 12:30:47 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 125282
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
r74411 r74439 440 440 void destroy(); 441 441 442 int sendFinished(Window hWndSource, uint32_t uAction);442 int sendFinished(Window hWndSource, VBOXDNDACTION dndAction); 443 443 444 444 public: … … 504 504 505 505 /* Host -> Guest handling. */ 506 int hgEnter(const RTCList<RTCString> &formats, uint32_t actions);506 int hgEnter(const RTCList<RTCString> &formats, VBOXDNDACTIONLIST dndListActionsAllowed); 507 507 int hgLeave(void); 508 int hgMove(uint32_t uPosX, uint32_t uPosY, uint32_t uDefaultAction);509 int hgDrop(uint32_t uPosX, uint32_t uPosY, uint32_t uDefaultAction);508 int hgMove(uint32_t uPosX, uint32_t uPosY, VBOXDNDACTION dndActionDefault); 509 int hgDrop(uint32_t uPosX, uint32_t uPosY, VBOXDNDACTION dndActionDefault); 510 510 int hgDataReceive(PVBGLR3GUESTDNDMETADATA pMetaData); 511 511 … … 537 537 int toAtomList(const RTCList<RTCString> &lstFormats, VBoxDnDAtomList &lstAtoms) const; 538 538 int toAtomList(const void *pvData, uint32_t cbData, VBoxDnDAtomList &lstAtoms) const; 539 static Atom toAtomAction( uint32_t uAction);540 static int toAtomActions( uint32_t uActions, VBoxDnDAtomList &lstAtoms);539 static Atom toAtomAction(VBOXDNDACTION dndAction); 540 static int toAtomActions(VBOXDNDACTIONLIST dndActionList, VBoxDnDAtomList &lstAtoms); 541 541 static uint32_t toHGCMAction(Atom atom); 542 542 static uint32_t toHGCMActions(const VBoxDnDAtomList &actionsList); … … 950 950 LogFlowThisFunc(("\tReported dead area: x=%RU16, y=%RU16, cx=%RU16, cy=%RU16\n", x, y, cx, cy)); 951 951 #endif 952 953 uint32_t uAction = VBOX_DND_ACTION_IGNORE; /* Default is ignoring. */ 952 VBOXDNDACTION dndAction = VBOX_DND_ACTION_IGNORE; /* Default is ignoring. */ 954 953 /** @todo Compare this with the allowed actions. */ 955 954 if (fAcceptDrop) 956 uAction = toHGCMAction(static_cast<Atom>(e.xclient.data.l[XdndStatusAction]));957 958 rc = VbglR3DnDHGSendAckOp(&m_dndCtx, uAction);955 dndAction = toHGCMAction(static_cast<Atom>(e.xclient.data.l[XdndStatusAction])); 956 957 rc = VbglR3DnDHGSendAckOp(&m_dndCtx, dndAction); 959 958 } 960 959 else if (e.xclient.message_type == xAtom(XA_XdndFinished)) … … 1594 1593 * @returns IPRT status code. 1595 1594 * @param lstFormats List of supported formats from the host. 1596 * @param uActions(ORed) List of supported actions from the host.1597 */ 1598 int DragInstance::hgEnter(const RTCList<RTCString> &lstFormats, uint32_t uActions)1595 * @param dndListActionsAllowed (ORed) List of supported actions from the host. 1596 */ 1597 int DragInstance::hgEnter(const RTCList<RTCString> &lstFormats, uint32_t dndListActionsAllowed) 1599 1598 { 1600 1599 LogFlowThisFunc(("mode=%RU32, state=%RU32\n", m_enmMode, m_enmState)); … … 1606 1605 1607 1606 #ifdef DEBUG 1608 LogFlowThisFunc((" uActions=0x%x, lstFormats=%zu: ", uActions, lstFormats.size()));1607 LogFlowThisFunc(("dndListActionsAllowed=0x%x, lstFormats=%zu: ", dndListActionsAllowed, lstFormats.size())); 1609 1608 for (size_t i = 0; i < lstFormats.size(); ++i) 1610 1609 LogFlow(("'%s' ", lstFormats.at(i).c_str())); … … 1630 1629 /* Announce the possible actions. */ 1631 1630 VBoxDnDAtomList lstActions; 1632 rc = toAtomActions( uActions, lstActions);1631 rc = toAtomActions(dndListActionsAllowed, lstActions); 1633 1632 if (RT_FAILURE(rc)) 1634 1633 break; … … 1667 1666 * @param uPosX Relative X position within the guest's display area. 1668 1667 * @param uPosY Relative Y position within the guest's display area. 1669 * @param uDefaultActionDefault action the host wants to perform on the guest1668 * @param dndActionDefault Default action the host wants to perform on the guest 1670 1669 * as soon as the operation successfully finishes. 1671 1670 */ 1672 int DragInstance::hgMove(uint32_t uPosX, uint32_t uPosY, uint32_t uDefaultAction)1671 int DragInstance::hgMove(uint32_t uPosX, uint32_t uPosY, VBOXDNDACTION dndActionDefault) 1673 1672 { 1674 1673 LogFlowThisFunc(("mode=%RU32, state=%RU32\n", m_enmMode, m_enmState)); 1675 LogFlowThisFunc(("uPosX=%RU32, uPosY=%RU32, uAction=%RU32\n", uPosX, uPosY, uDefaultAction));1674 LogFlowThisFunc(("uPosX=%RU32, uPosY=%RU32, dndActionDefault=%RU32\n", uPosX, uPosY, dndActionDefault)); 1676 1675 1677 1676 if ( m_enmMode != HG … … 1820 1819 * Send a XdndPosition event with the proposed action to the guest. 1821 1820 */ 1822 Atom pa = toAtomAction( uDefaultAction);1821 Atom pa = toAtomAction(dndActionDefault); 1823 1822 LogFlowThisFunc(("strAction=%s\n", xAtomToString(pa).c_str())); 1824 1823 … … 1863 1862 * @param uPosX Relative X position within the guest's display area. 1864 1863 * @param uPosY Relative Y position within the guest's display area. 1865 * @param uDefaultActionDefault action the host wants to perform on the guest1864 * @param dndActionDefault Default action the host wants to perform on the guest 1866 1865 * as soon as the operation successfully finishes. 1867 1866 */ 1868 int DragInstance::hgDrop(uint32_t uPosX, uint32_t uPosY, uint32_t uDefaultAction)1869 { 1870 RT_NOREF3(uPosX, uPosY, uDefaultAction);1867 int DragInstance::hgDrop(uint32_t uPosX, uint32_t uPosY, VBOXDNDACTION dndActionDefault) 1868 { 1869 RT_NOREF3(uPosX, uPosY, dndActionDefault); 1871 1870 LogFlowThisFunc(("wndCur=%RU32, wndProxy=%RU32, mode=%RU32, state=%RU32\n", m_wndCur, m_wndProxy.hWnd, m_enmMode, m_enmState)); 1872 LogFlowThisFunc(("uPosX=%RU32, uPosY=%RU32, uAction=%RU32\n", uPosX, uPosY, uDefaultAction));1871 LogFlowThisFunc(("uPosX=%RU32, uPosY=%RU32, dndActionDefault=%RU32\n", uPosX, uPosY, dndActionDefault)); 1873 1872 1874 1873 if ( m_enmMode != HG … … 1995 1994 1996 1995 RTCString strFormats = "\r\n"; /** @todo If empty, IOCTL fails with VERR_ACCESS_DENIED. */ 1997 uint32_t uDefAction= VBOX_DND_ACTION_IGNORE;1998 uint32_t uAllActions= VBOX_DND_ACTION_IGNORE;1996 VBOXDNDACTION dndActionDefault = VBOX_DND_ACTION_IGNORE; 1997 VBOXDNDACTIONLIST dndActionList = VBOX_DND_ACTION_IGNORE; 1999 1998 2000 1999 /* Currently in wrong mode? Bail out. */ … … 2097 2096 { 2098 2097 strFormats = strFormatsCur; 2099 uDefAction= VBOX_DND_ACTION_COPY; /** @todo Handle default action! */2100 uAllActions= VBOX_DND_ACTION_COPY; /** @todo Ditto. */2101 uAllActions|= toHGCMActions(m_lstActions);2098 dndActionDefault = VBOX_DND_ACTION_COPY; /** @todo Handle default action! */ 2099 dndActionList = VBOX_DND_ACTION_COPY; /** @todo Ditto. */ 2100 dndActionList |= toHGCMActions(m_lstActions); 2102 2101 } 2103 2102 … … 2105 2104 } 2106 2105 2107 rc2 = VbglR3DnDGHSendAckPending(&m_dndCtx, uDefAction, uAllActions,2106 rc2 = VbglR3DnDGHSendAckPending(&m_dndCtx, dndActionDefault, dndActionList, 2108 2107 strFormats.c_str(), strFormats.length() + 1 /* Include termination */); 2109 LogFlowThisFunc(("uClientID=%RU32, uDefAction=0x%x, allActions=0x%x, strFormats=%s, rc=%Rrc\n",2110 m_dndCtx.uClientID, uDefAction, uAllActions, strFormats.c_str(), rc2));2108 LogFlowThisFunc(("uClientID=%RU32, uDefAction=0x%x, uLstActions=0x%x, strFormats=%s, rc=%Rrc\n", 2109 m_dndCtx.uClientID, dndActionDefault, dndActionList, strFormats.c_str(), rc2)); 2111 2110 if (RT_FAILURE(rc2)) 2112 2111 { … … 2822 2821 * 2823 2822 * @returns Converted Atom-based drag'n drop action. 2824 * @param uActionHGCM drag'n drop actions to convert.2823 * @param dndAction HGCM drag'n drop actions to convert. 2825 2824 */ 2826 2825 /* static */ 2827 Atom DragInstance::toAtomAction( uint32_t uAction)2826 Atom DragInstance::toAtomAction(VBOXDNDACTION dndAction) 2828 2827 { 2829 2828 /* Ignore is None. */ 2830 return (isDnDCopyAction( uAction) ? xAtom(XA_XdndActionCopy) :2831 isDnDMoveAction( uAction) ? xAtom(XA_XdndActionMove) :2832 isDnDLinkAction( uAction) ? xAtom(XA_XdndActionLink) :2829 return (isDnDCopyAction(dndAction) ? xAtom(XA_XdndActionCopy) : 2830 isDnDMoveAction(dndAction) ? xAtom(XA_XdndActionMove) : 2831 isDnDLinkAction(dndAction) ? xAtom(XA_XdndActionLink) : 2833 2832 None); 2834 2833 } … … 2838 2837 * 2839 2838 * @returns IPRT status code. 2840 * @param uActionsHGCM drag'n drop actions to convert.2839 * @param dndActionList HGCM drag'n drop actions to convert. 2841 2840 * @param lstAtoms Reference to VBoxDnDAtomList to store actions in. 2842 2841 */ 2843 2842 /* static */ 2844 int DragInstance::toAtomActions( uint32_t uActions, VBoxDnDAtomList &lstAtoms)2845 { 2846 if (hasDnDCopyAction( uActions))2843 int DragInstance::toAtomActions(VBOXDNDACTIONLIST dndActionList, VBoxDnDAtomList &lstAtoms) 2844 { 2845 if (hasDnDCopyAction(dndActionList)) 2847 2846 lstAtoms.append(xAtom(XA_XdndActionCopy)); 2848 if (hasDnDMoveAction( uActions))2847 if (hasDnDMoveAction(dndActionList)) 2849 2848 lstAtoms.append(xAtom(XA_XdndActionMove)); 2850 if (hasDnDLinkAction( uActions))2849 if (hasDnDLinkAction(dndActionList)) 2851 2850 lstAtoms.append(xAtom(XA_XdndActionLink)); 2852 2851 … … 2929 2928 } 2930 2929 2931 int VBoxDnDProxyWnd::sendFinished(Window hWndSource, uint32_t uAction)2930 int VBoxDnDProxyWnd::sendFinished(Window hWndSource, VBOXDNDACTION dndAction) 2932 2931 { 2933 2932 /* Was the drop accepted by the host? That is, anything than ignoring. */ 2934 bool fDropAccepted = uAction > VBOX_DND_ACTION_IGNORE;2935 2936 LogFlowFunc((" uAction=%RU32\n", uAction));2933 bool fDropAccepted = dndAction > VBOX_DND_ACTION_IGNORE; 2934 2935 LogFlowFunc(("dndAction=%RU32\n", dndAction)); 2937 2936 2938 2937 /* Confirm the result of the transfer to the target window. */ … … 2944 2943 m.message_type = xAtom(XA_XdndFinished); 2945 2944 m.format = 32; 2946 m.data.l[XdndFinishedWindow] = hWnd; /* Target window. */2947 m.data.l[XdndFinishedFlags] = fDropAccepted ? RT_BIT(0) : 0; /* Was the drop accepted? */2948 m.data.l[XdndFinishedAction] = fDropAccepted ? DragInstance::toAtomAction( uAction) : None; /* Action used on accept. */2945 m.data.l[XdndFinishedWindow] = hWnd; /* Target window. */ 2946 m.data.l[XdndFinishedFlags] = fDropAccepted ? RT_BIT(0) : 0; /* Was the drop accepted? */ 2947 m.data.l[XdndFinishedAction] = fDropAccepted ? DragInstance::toAtomAction(dndAction) : None; /* Action used on accept. */ 2949 2948 2950 2949 int xRc = XSendEvent(pDisp, hWndSource, True, NoEventMask, reinterpret_cast<XEvent*>(&m)); … … 3111 3110 RTCList<RTCString> lstFormats = 3112 3111 RTCString(pVbglR3Event->u.HG_Enter.pszFormats, pVbglR3Event->u.HG_Enter.cbFormats - 1).split("\r\n"); 3113 rc = m_pCurDnD->hgEnter(lstFormats, pVbglR3Event->u.HG_Enter. uAllActions);3112 rc = m_pCurDnD->hgEnter(lstFormats, pVbglR3Event->u.HG_Enter.dndLstActionsAllowed); 3114 3113 if (RT_FAILURE(rc)) 3115 3114 break; … … 3131 3130 { 3132 3131 rc = m_pCurDnD->hgMove(pVbglR3Event->u.HG_Move.uXpos, pVbglR3Event->u.HG_Move.uYpos, 3133 pVbglR3Event->u.HG_Move. uDefAction);3132 pVbglR3Event->u.HG_Move.dndActionDefault); 3134 3133 break; 3135 3134 } … … 3144 3143 { 3145 3144 rc = m_pCurDnD->hgDrop(pVbglR3Event->u.HG_Drop.uXpos, pVbglR3Event->u.HG_Drop.uYpos, 3146 pVbglR3Event->u.HG_Drop. uDefAction);3145 pVbglR3Event->u.HG_Drop.dndActionDefault); 3147 3146 break; 3148 3147 } … … 3184 3183 case VBGLR3DNDEVENTTYPE_GH_DROP: 3185 3184 { 3186 rc = m_pCurDnD->ghDropped(pVbglR3Event->u.GH_Drop.pszFormat, pVbglR3Event->u.GH_Drop. uAction);3185 rc = m_pCurDnD->ghDropped(pVbglR3Event->u.GH_Drop.pszFormat, pVbglR3Event->u.GH_Drop.dndActionRequested); 3187 3186 break; 3188 3187 }
Note:
See TracChangeset
for help on using the changeset viewer.