VirtualBox

Changeset 76891 in vbox


Ignore:
Timestamp:
Jan 18, 2019 1:17:20 PM (6 years ago)
Author:
vboxsync
Message:

DnD: Renamed HOST_DND_HG_EVT_CANCEL -> HOST_DND_HG_CANCEL, fixes for host-side cancellation.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HostServices/DragAndDropSvc.h

    r76585 r76891  
    8888    /** The host sets a new DnD mode. */
    8989    HOST_DND_SET_MODE                  = 100,
     90    /** The host requests to cancel the current DnD operation on
     91     *  the guest side. This can happen on user request on the host's
     92     *  UI side or due to some host error which has happened.
     93     *
     94     *  Note: This is a fire-and-forget message, as the host should
     95     *        not rely on an answer from the guest side in order to
     96     *        properly cancel the operation. */
     97    HOST_DND_CANCEL                    = 204,
    9098
    9199    /*
     
    103111     *  ready to transfer data over to the guest. */
    104112    HOST_DND_HG_EVT_DROPPED            = 203,
    105     /** The host requests to cancel the current DnD operation on
    106      *  the guest side. This can happen on user request on the host's
    107      *  UI side or due to some host error which has happened.
    108      *
    109      *  Note: This is a fire-and-forget message, as the host should
    110      *        not rely on an answer from the guest side in order to
    111      *        properly cancel the operation. */
    112     HOST_DND_HG_EVT_CANCEL             = 204,
    113113    /** The host sends the data header at the beginning of a (new)
    114114     *  data transfer. */
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp

    r76553 r76891  
    208208    RT_ZERO(Msg);
    209209
    210     VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, HOST_DND_HG_EVT_CANCEL, 1);
     210    VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, HOST_DND_CANCEL, 1);
    211211    /** @todo Context ID not used yet. */
    212212    Msg.u.v3.uContext.SetUInt32(0);
     
    534534
    535535                    if (   RT_SUCCESS(rc)
    536                         && uNextMsg == HOST_DND_HG_SND_FILE_DATA)
     536                        && uNextMsg == HOST_DND_HG_SND_FILE_DATA
     537                        && cbChunkRead)
    537538                    {
    538539                        uint32_t cbChunkWritten;
     
    570571                    break;
    571572                }
    572                 case HOST_DND_HG_EVT_CANCEL:
     573                case HOST_DND_CANCEL:
    573574                {
    574575                    rc = vbglR3DnDHGRecvCancel(pCtx);
     
    12671268                break;
    12681269            }
    1269             case HOST_DND_HG_EVT_CANCEL:
     1270            case HOST_DND_CANCEL:
    12701271            {
    12711272                rc = vbglR3DnDHGRecvCancel(pCtx);
  • trunk/src/VBox/HostServices/DragAndDrop/dndmanager.h

    r76570 r76891  
    6969    DnDHGCancelMessage(void)
    7070    {
    71         int rc2 = initData(DragAndDropSvc::HOST_DND_HG_EVT_CANCEL,
     71        int rc2 = initData(DragAndDropSvc::HOST_DND_CANCEL,
    7272                           0 /* cParms */, 0 /* aParms */);
    7373        AssertRC(rc2);
  • trunk/src/VBox/HostServices/DragAndDrop/service.cpp

    r76553 r76891  
    931931#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
    932932
    933             /*
    934              * Note: This is a fire-and-forget message, as the host should
    935              *       not rely on an answer from the guest side in order to
    936              *       properly cancel the operation.
    937              */
    938             case HOST_DND_HG_EVT_CANCEL:
    939             {
    940                 LogFlowFunc(("HOST_DND_HG_EVT_CANCEL\n"));
    941 
    942                 VBOXDNDCBEVTERRORDATA data;
    943                 RT_ZERO(data);
    944                 data.hdr.uMagic = CB_MAGIC_DND_GH_EVT_ERROR;
    945 
    946                 switch (pClient->GetProtocolVer())
    947                 {
    948                     case 3:
    949                     {
    950                         /* Protocol v3+ at least requires the context ID. */
    951                         if (cParms == 1)
    952                             rc = HGCMSvcGetU32(&paParms[0], &data.hdr.uContextID);
    953 
    954                         break;
    955                     }
    956 
    957                     default:
    958                         break;
    959                 }
    960 
    961                 /* Tell the host that the guest has cancelled the operation. */
    962                 data.rc = VERR_CANCELLED;
    963 
    964                 DO_HOST_CALLBACK();
    965 
    966                 /* Note: If the host is not prepared for handling the cancelling reply
    967                  *       from the guest, don't report this back to the guest. */
    968                 if (RT_FAILURE(rc))
    969                     rc = VINF_SUCCESS;
    970                 break;
    971             }
    972 
    973933            default:
    974934            {
     
    10691029            }
    10701030
    1071             case HOST_DND_HG_EVT_ENTER:
    1072             {
    1073                 /* Reset the message queue as a new DnD operation just began. */
    1074                 m_pManager->Reset();
    1075 
    1076                 fSendToGuest = true;
    1077                 rc = VINF_SUCCESS;
    1078                 break;
    1079             }
    1080 
    1081             case HOST_DND_HG_EVT_CANCEL:
     1031            case HOST_DND_CANCEL:
    10821032            {
    10831033                LogFlowFunc(("Cancelling all waiting clients ...\n"));
     
    10851035                /* Reset the message queue as the host cancelled the whole operation. */
    10861036                m_pManager->Reset();
     1037
     1038                rc = m_pManager->AddMsg(u32Function, cParms, paParms, true /* fAppend */);
     1039                if (RT_FAILURE(rc))
     1040                {
     1041                    AssertMsgFailed(("Adding new message of type=%RU32 failed with rc=%Rrc\n", u32Function, rc));
     1042                    break;
     1043                }
    10871044
    10881045                /*
     
    10991056                    AssertPtr(pClient);
    11001057
    1101                     int rc2 = pClient->SetDeferredMsgInfo(HOST_DND_HG_EVT_CANCEL,
     1058                    int rc2 = pClient->SetDeferredMsgInfo(HOST_DND_CANCEL,
    11021059                                                          /* Protocol v3+ also contains the context ID. */
    11031060                                                          pClient->GetProtocolVer() >= 3 ? 1 : 0);
     
    11111068
    11121069                /* Tell the host that everything went well. */
     1070                rc = VINF_SUCCESS;
     1071                break;
     1072            }
     1073
     1074            case HOST_DND_HG_EVT_ENTER:
     1075            {
     1076                /* Reset the message queue as a new DnD operation just began. */
     1077                m_pManager->Reset();
     1078
     1079                fSendToGuest = true;
    11131080                rc = VINF_SUCCESS;
    11141081                break;
  • trunk/src/VBox/Main/include/GuestDnDTargetImpl.h

    r76562 r76891  
    8787protected:
    8888
    89     int i_cancelOperation(void);
    9089    int i_sendData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
    9190    int i_sendDataBody(PSENDDATACTX pCtx, GuestDnDData *pData);
  • trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp

    r76553 r76891  
    922922int GuestDnDBase::sendCancel(void)
    923923{
    924     int rc = GuestDnDInst()->hostCall(HOST_DND_HG_EVT_CANCEL,
    925                                       0 /* cParms */, NULL /* paParms */);
    926 
    927     LogFlowFunc(("Generated cancelling request, rc=%Rrc\n", rc));
    928     return rc;
     924    GuestDnDMsg Msg;
     925    Msg.setType(HOST_DND_CANCEL);
     926    if (mDataBase.m_uProtocolVersion >= 3)
     927        Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
     928
     929    LogRel2(("DnD: Cancelling operation on guest ..."));
     930
     931    return GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
    929932}
    930933
  • trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp

    r76553 r76891  
    652652        {
    653653            delete pTask;
    654             LogRel2(("DnD: Could not create SendDataTask object \n"));
     654            LogRel2(("DnD: Could not create SendDataTask object\n"));
    655655            throw hr = E_FAIL;
    656656        }
     
    686686    return hr;
    687687#endif /* VBOX_WITH_DRAG_AND_DROP */
    688 }
    689 
    690 int GuestDnDTarget::i_cancelOperation(void)
    691 {
    692     /** @todo Check for pending cancel requests. */
    693 
    694 #if 0 /** @todo Later. */
    695     /* Cancel any outstanding waits for guest responses first. */
    696     if (pResp)
    697         pResp->notifyAboutGuestResponse();
    698 #endif
    699 
    700     LogFlowFunc(("Cancelling operation, telling guest ...\n"));
    701 
    702     GuestDnDMsg Msg;
    703     Msg.setType(HOST_DND_HG_EVT_CANCEL);
    704     if (mDataBase.m_uProtocolVersion >= 3)
    705         Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
    706 
    707     return GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
    708688}
    709689
     
    15531533#else /* VBOX_WITH_DRAG_AND_DROP */
    15541534
    1555     int rc = i_cancelOperation();
     1535    int rc = GuestDnDBase::sendCancel();
    15561536
    15571537    if (aVeto)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette