VirtualBox

Changeset 50636 in vbox


Ignore:
Timestamp:
Feb 27, 2014 6:46:50 PM (11 years ago)
Author:
vboxsync
Message:

DnD/HostService: Defer client calls if drag'n drop mode is set to disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/DragAndDrop/service.cpp

    r50593 r50636  
    193193
    194194    /* Check if we've the right mode set. */
    195     bool fIgnoreRequest = true; /* Play safe. */
     195    int rc = VERR_ACCESS_DENIED; /* Play safe. */
    196196    switch (u32Function)
    197197    {
     
    199199            if (modeGet() != VBOX_DRAG_AND_DROP_MODE_OFF)
    200200            {
    201                 fIgnoreRequest = false;
     201                rc = VINF_SUCCESS;
    202202            }
    203203            else
    204                 LogFlowFunc(("Drag'n drop disabled, ignoring request\n"));
     204            {
     205                LogFlowFunc(("DnD disabled, deferring request\n"));
     206                rc = VINF_HGCM_ASYNC_EXECUTE;
     207            }
    205208            break;
    206209        case DragAndDropSvc::GUEST_DND_HG_ACK_OP:
     
    209212                || modeGet() == VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST)
    210213            {
    211                 fIgnoreRequest = false;
     214                rc = VINF_SUCCESS;
    212215            }
    213216            else
    214                 LogFlowFunc(("Host -> guest DnD mode disabled, ignoring request\n"));
     217                LogFlowFunc(("Host -> Guest DnD mode disabled, ignoring request\n"));
    215218            break;
    216 #ifdef VBOX_WITH_DRAG_AND_DROP_GH
    217219        case DragAndDropSvc::GUEST_DND_GH_ACK_PENDING:
    218220        case DragAndDropSvc::GUEST_DND_GH_SND_DATA:
     
    220222        case DragAndDropSvc::GUEST_DND_GH_SND_FILE:
    221223        case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
     224#ifdef VBOX_WITH_DRAG_AND_DROP_GH
    222225            if (   modeGet() == VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
    223226                || modeGet() == VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST)
    224227            {
    225                 fIgnoreRequest = false;
     228                rc = VINF_SUCCESS;
    226229            }
    227230            else
    228                 LogFlowFunc(("Guest -> host DnD mode disabled, ignoring request\n"));
     231#endif
     232                LogFlowFunc(("Guest -> Host DnD mode disabled, ignoring request\n"));
    229233            break;
    230 #endif
    231234        default:
    232235            /* Reach through to DnD manager. */
    233             fIgnoreRequest = false;
     236            rc = VINF_SUCCESS;
    234237            break;
    235238    }
    236239
    237     int rc;
    238     if (!fIgnoreRequest)
     240#ifdef DEBUG_andy
     241    LogFlowFunc(("Mode check rc=%Rrc\n", rc));
     242#endif
     243
     244    if (rc == VINF_SUCCESS) /* Note: rc might be VINF_HGCM_ASYNC_EXECUTE! */
    239245    {
    240246        switch (u32Function)
     
    259265                        && paParms[2].u.uint32) /* Blocking? */
    260266                    {
    261                         m_clientQueue.append(new HGCM::Client(u32ClientID, callHandle,
    262                                                               u32Function, cParms, paParms));
     267                        /* Defer client returning. */
    263268                        rc = VINF_HGCM_ASYNC_EXECUTE;
    264269                    }
     
    276281                    DragAndDropSvc::VBOXDNDCBHGACKOPDATA data;
    277282                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP;
    278                     paParms[0].getUInt32(&data.uAction);
    279                     if (m_pfnHostCallback)
    280                         rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
    281     //                m_pHelpers->pfnCallComplete(callHandle, rc);
     283                    paParms[0].getUInt32(&data.uAction); /* Get drop action. */
     284                    if (m_pfnHostCallback)
     285                        rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
    282286                }
    283287                break;
     
    297301                    if (m_pfnHostCallback)
    298302                        rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
    299     //                m_pHelpers->pfnCallComplete(callHandle, rc);
    300     //                if (data.pszFormat)
    301     //                    RTMemFree(data.pszFormat);
    302     //                if (data.pszTmpPath)
    303     //                    RTMemFree(data.pszTmpPath);
    304303                }
    305304                break;
     
    428427        }
    429428    }
    430     else
    431         rc = VERR_ACCESS_DENIED;
    432 
    433     /* If async execute is requested, we didn't notify the guest about
     429
     430    /* If async execution is requested, we didn't notify the guest yet about
    434431     * completion. The client is queued into the waiters list and will be
    435432     * notified as soon as a new event is available. */
     433    if (rc == VINF_HGCM_ASYNC_EXECUTE)
     434    {
     435        m_clientQueue.append(new HGCM::Client(u32ClientID, callHandle,
     436                                              u32Function, cParms, paParms));
     437    }
     438
    436439    if (   rc != VINF_HGCM_ASYNC_EXECUTE
    437440        && m_pHelpers)
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