VirtualBox

Ignore:
Timestamp:
Dec 10, 2018 11:21:07 AM (6 years ago)
Author:
vboxsync
Message:

DnD/VBoxTray: Added VBoxDnDWnd::Abort() to (hopefully) properly abort an in-flight DnD operation on the guest. Besides hiding the proxy window we also have to let the Windows data object know that we're done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp

    r76104 r76105  
    769769
    770770/**
     771 * Aborts an in-flight DnD operation on the guest.
     772 *
     773 * @return  VBox status code.
     774 */
     775int VBoxDnDWnd::Abort(void)
     776{
     777    LogFlowThisFunc(("mMode=%ld, mState=%RU32\n", mMode, mState));
     778    LogRel(("DnD: Drag and drop operation aborted\n"));
     779
     780    int rc = RTCritSectEnter(&mCritSect);
     781    if (RT_SUCCESS(rc))
     782    {
     783        if (startupInfo.pDataObject)
     784            startupInfo.pDataObject->Abort();
     785
     786        RTCritSectLeave(&mCritSect);
     787    }
     788
     789    /* Post ESC to our window to officially abort the
     790     * drag and drop operation. */
     791    this->PostMessage(WM_KEYDOWN, VK_ESCAPE /* wParam */, 0 /* lParam */);
     792
     793    Reset();
     794
     795    return rc;
     796}
     797
     798/**
    771799 * Handles actions required when the host cursor enters
    772800 * the guest's screen to initiate a host -> guest DnD operation.
     
    9771005        return VERR_WRONG_ORDER;
    9781006
    979     LogFlowThisFunc(("mMode=%ld, mState=%RU32\n", mMode, mState));
    980     LogRel(("DnD: Drag and drop operation aborted\n"));
    981 
    982     Reset();
    983 
    984     int rc = VINF_SUCCESS;
    985 
    986     /* Post ESC to our window to officially abort the
    987      * drag and drop operation. */
    988     this->PostMessage(WM_KEYDOWN, VK_ESCAPE /* wParam */, 0 /* lParam */);
     1007    int rc = Abort();
    9891008
    9901009    LogFlowFuncLeaveRC(rc);
     
    10861105int VBoxDnDWnd::OnHgCancel(void)
    10871106{
    1088     int rc = RTCritSectEnter(&mCritSect);
    1089     if (RT_SUCCESS(rc))
    1090     {
    1091         if (startupInfo.pDataObject)
    1092             startupInfo.pDataObject->Abort();
    1093 
    1094         RTCritSectLeave(&mCritSect);
    1095     }
    1096 
    1097     int rc2 = mouseRelease();
    1098     if (RT_SUCCESS(rc))
    1099         rc = rc2;
    1100 
    1101     Reset();
    1102 
    1103     return rc;
     1107    return Abort();
    11041108}
    11051109
     
    18751879            /* Make sure our proxy window is hidden when an error occured to
    18761880             * not block the guest's UI. */
    1877             pWnd->Reset();
     1881            int rc2 = pWnd->Abort();
     1882            AssertRC(rc2);
    18781883        }
    18791884
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