VirtualBox

Changeset 74476 in vbox for trunk


Ignore:
Timestamp:
Sep 26, 2018 12:06:58 PM (6 years ago)
Author:
vboxsync
Message:

DnD: Fixed message handling on VM restore on Windows guests.

Location:
trunk/src/VBox/Additions/WINNT/VBoxTray
Files:
2 edited

Legend:

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

    r74475 r74476  
    791791    setMode(HG);
    792792
    793     int rc = VINF_SUCCESS;
     793    /* Check if the VM session has changed and reconnect to the HGCM service if necessary. */
     794    int rc = checkForSessionChange();
     795    if (RT_FAILURE(rc))
     796        return rc;
    794797
    795798    try
     
    11251128int VBoxDnDWnd::OnGhIsDnDPending(void)
    11261129{
    1127     LogFlowThisFunc(("mMode=%ld, mState=%ld, uScreenID=%RU32\n", mMode, mState));
     1130    LogFlowThisFunc(("mMode=%ld, mState=%ld\n", mMode, mState));
    11281131
    11291132    if (mMode == Unknown)
     
    11421145    if (mState == Initialized)
    11431146    {
    1144         rc = makeFullscreen();
     1147        /* Check if the VM session has changed and reconnect to the HGCM service if necessary. */
     1148        rc = checkForSessionChange();
    11451149        if (RT_SUCCESS(rc))
    11461150        {
    1147             /*
    1148              * We have to release the left mouse button to
    1149              * get into our (invisible) proxy window.
    1150              */
    1151             mouseRelease();
    1152 
    1153             /*
    1154              * Even if we just released the left mouse button
    1155              * we're still in the dragging state to handle our
    1156              * own drop target (for the host).
    1157              */
    1158             mState = Dragging;
     1151            rc = makeFullscreen();
     1152            if (RT_SUCCESS(rc))
     1153            {
     1154                /*
     1155                 * We have to release the left mouse button to
     1156                 * get into our (invisible) proxy window.
     1157                 */
     1158                mouseRelease();
     1159
     1160                /*
     1161                 * Even if we just released the left mouse button
     1162                 * we're still in the dragging state to handle our
     1163                 * own drop target (for the host).
     1164                 */
     1165                mState = Dragging;
     1166            }
    11591167        }
    11601168    }
     
    12011209    if (RT_SUCCESS(rc))
    12021210    {
    1203         uint32_t dndActionDefault = VBOX_DND_ACTION_IGNORE;
     1211        VBOXDNDACTION dndActionDefault = VBOX_DND_ACTION_IGNORE;
    12041212
    12051213        AssertPtr(pDropTarget);
     
    12151223        {
    12161224            strFormats = "unknown"; /* Prevent VERR_IO_GEN_FAILURE for IOCTL. */
    1217             LogFlowFunc(("No format data available yet\n"));
     1225            LogFlowFunc(("No format data from proxy window available yet\n"));
    12181226        }
    12191227
     
    13721380
    13731381/**
     1382 * Checks if the VM session has changed (can happen when restoring the VM from a saved state)
     1383 * and do a reconnect to the DnD HGCM service.
     1384 *
     1385 * @returns IPRT status code.
     1386 */
     1387int VBoxDnDWnd::checkForSessionChange(void)
     1388{
     1389    uint64_t uSessionID;
     1390    int rc = VbglR3GetSessionId(&uSessionID);
     1391    if (   RT_SUCCESS(rc)
     1392        && uSessionID != mDnDCtx.uSessionID)
     1393    {
     1394        LogFlowThisFunc(("VM session has changed to %RU64\n", uSessionID));
     1395
     1396        rc = VbglR3DnDDisconnect(&mDnDCtx);
     1397        AssertRC(rc);
     1398
     1399        rc = VbglR3DnDConnect(&mDnDCtx);
     1400        AssertRC(rc);
     1401    }
     1402
     1403    LogFlowFuncLeaveRC(rc);
     1404    return rc;
     1405}
     1406
     1407/**
    13741408 * Hides the proxy window again.
    13751409 *
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.h

    r74473 r74476  
    353353protected:
    354354
     355    int checkForSessionChange(void);
    355356    int hide(void);
    356357    int makeFullscreen(void);
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