VirtualBox

Changeset 74472 in vbox for trunk/src


Ignore:
Timestamp:
Sep 26, 2018 8:16:36 AM (6 years ago)
Author:
vboxsync
Message:

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

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp

    r74439 r74472  
    11861186            && (uSessionID != pCtx->uSessionID))
    11871187        {
    1188             LogFlowFunc(("VM session ID changed to %RU64, doing reconnect\n", uSessionID));
    1189 
    1190             /* Try a reconnect to the DnD service. */
    1191             rc2 = VbglR3DnDDisconnect(pCtx);
    1192             AssertRC(rc2);
    1193             rc2 = VbglR3DnDConnect(pCtx);
    1194             AssertRC(rc2);
    1195 
    1196             /* At this point we continue processing the messsages with the new client ID. */
     1188            LogFlowFunc(("VM session ID changed to %RU64\n", uSessionID));
    11971189        }
    11981190    }
  • trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp

    r74459 r74472  
    503503    bool waitForX11ClientMsg(XClientMessageEvent &evMsg, Atom aType, RTMSINTERVAL uTimeoutMS = 100);
    504504
     505    /* Session handling. */
     506    int checkForSessionChange(void);
     507
     508#ifdef VBOX_WITH_DRAG_AND_DROP_GH
     509    /* Guest -> Host handling. */
     510    int ghIsDnDPending(void);
     511    int ghDropped(const RTCString &strFormat, VBOXDNDACTION dndActionRequested);
     512#endif
     513
    505514    /* Host -> Guest handling. */
    506515    int hgEnter(const RTCList<RTCString> &formats, VBOXDNDACTIONLIST dndListActionsAllowed);
     
    509518    int hgDrop(uint32_t uPosX, uint32_t uPosY, VBOXDNDACTION dndActionDefault);
    510519    int hgDataReceive(PVBGLR3GUESTDNDMETADATA pMetaData);
    511 
    512 #ifdef VBOX_WITH_DRAG_AND_DROP_GH
    513     /* Guest -> Host handling. */
    514     int ghIsDnDPending(void);
    515     int ghDropped(const RTCString &strFormat, VBOXDNDACTION dndActionRequested);
    516 #endif
    517520
    518521    /* X11 helpers. */
     
    16151618    do
    16161619    {
     1620        /* Check if the VM session has changed and reconnect to the HGCM service if necessary. */
     1621        rc = checkForSessionChange();
     1622        if (RT_FAILURE(rc))
     1623            break;
     1624
    16171625        rc = toAtomList(lstFormats, m_lstFormats);
    16181626        if (RT_FAILURE(rc))
     
    19801988}
    19811989
     1990/**
     1991 * Checks if the VM session has changed (can happen when restoring the VM from a saved state)
     1992 * and do a reconnect to the DnD HGCM service.
     1993 *
     1994 * @returns IPRT status code.
     1995 */
     1996int DragInstance::checkForSessionChange(void)
     1997{
     1998    uint64_t uSessionID;
     1999    int rc = VbglR3GetSessionId(&uSessionID);
     2000    if (   RT_SUCCESS(rc)
     2001        && uSessionID != m_dndCtx.uSessionID)
     2002    {
     2003        LogFlowThisFunc(("VM session has changed to %RU64\n", uSessionID));
     2004
     2005        rc = VbglR3DnDDisconnect(&m_dndCtx);
     2006        AssertRC(rc);
     2007
     2008        rc = VbglR3DnDConnect(&m_dndCtx);
     2009        AssertRC(rc);
     2010    }
     2011
     2012    LogFlowFuncLeaveRC(rc);
     2013    return rc;
     2014}
     2015
    19822016#ifdef VBOX_WITH_DRAG_AND_DROP_GH
    19832017/**
     
    20132047    else
    20142048    {
    2015         rc = VINF_SUCCESS;
     2049        /* Check if the VM session has changed and reconnect to the HGCM service if necessary. */
     2050        rc = checkForSessionChange();
    20162051
    20172052        /* Determine the current window which currently has the XdndSelection set. */
     
    20202055
    20212056        /* Is this another window which has a Xdnd selection and not our proxy window? */
    2022         if (   wndSelection
     2057        if (   RT_SUCCESS(rc)
     2058            && wndSelection
    20232059            && wndSelection != m_wndCur)
    20242060        {
     
    33313367        /* Wait for new events. */
    33323368        rc = VbglR3DnDEventGetNext(&dndCtx, &e.hgcm);
    3333         if (   RT_SUCCESS(rc)
    3334             || rc == VERR_CANCELLED)
     3369        if (RT_SUCCESS(rc))
    33353370        {
    33363371            cMsgSkippedInvalid = 0; /* Reset skipped messages count. */
     
    33483383             * don't support the stuff we do on the guest side, so make sure we
    33493384             * don't process invalid messages forever. */
    3350             if (rc == VERR_INVALID_PARAMETER)
    3351                 cMsgSkippedInvalid++;
    3352             if (cMsgSkippedInvalid > 32)
     3385            if (cMsgSkippedInvalid++ > 32)
    33533386            {
    33543387                LogRel(("DnD: Too many invalid/skipped messages from host, exiting ...\n"));
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