VirtualBox

Ignore:
Timestamp:
Jul 17, 2020 10:02:58 AM (4 years ago)
Author:
vboxsync
Message:

DnD: Revamped code to simplify / untangle of internal data handling:

  • C-ifying and renaming classes DnDURIList / DnDURIObject -> DnDTransferList / DnDTransferObject
  • Added testcases for DnDTransferList / DnDTransferObject + DnDPath API
  • Reduced memory footprint
  • Greatly simplified / stripped down internal data flow of Main side
  • More (optional) release logging for further diagnosis

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp

    r82968 r85371  
    549549    int hgMove(uint32_t uPosX, uint32_t uPosY, VBOXDNDACTION dndActionDefault);
    550550    int hgDrop(uint32_t uPosX, uint32_t uPosY, VBOXDNDACTION dndActionDefault);
    551     int hgDataReceive(PVBGLR3GUESTDNDMETADATA pMetaData);
     551    int hgDataReceive(PVBGLR3GUESTDNDMETADATA pMeta);
    552552
    553553    /* X11 helpers. */
     
    19001900 *
    19011901 * @returns IPRT status code.
    1902  * @param   pMetaData               Pointer to meta data from host.
    1903  */
    1904 int DragInstance::hgDataReceive(PVBGLR3GUESTDNDMETADATA pMetaData)
     1902 * @param   pMeta               Pointer to meta data from host.
     1903 */
     1904int DragInstance::hgDataReceive(PVBGLR3GUESTDNDMETADATA pMeta)
    19051905{
    19061906    LogFlowThisFunc(("enmMode=%RU32, enmState=%RU32\n", m_enmMode, m_enmState));
    1907     LogFlowThisFunc(("enmMetaDataType=%RU32\n", pMetaData->enmType));
     1907    LogFlowThisFunc(("enmMetaType=%RU32\n", pMeta->enmType));
    19081908
    19091909    if (   m_enmMode  != HG
     
    19131913    }
    19141914
    1915     if (   pMetaData->pvMeta == NULL
    1916         || pMetaData->cbMeta == 0)
    1917     {
    1918         return VERR_INVALID_PARAMETER;
    1919     }
    1920 
    1921     int rc = VINF_SUCCESS;
    1922 
    1923     const void    *pvData = pMetaData->pvMeta;
    1924     const uint32_t cbData = pMetaData->cbMeta;
     1915    void  *pvData = NULL;
     1916    size_t cbData = 0;
     1917
     1918    int rc;
     1919
     1920    switch (pMeta->enmType)
     1921    {
     1922        case VBGLR3GUESTDNDMETADATATYPE_RAW:
     1923        {
     1924            AssertBreakStmt(pMeta->u.Raw.pvMeta != NULL, rc = VERR_INVALID_POINTER);
     1925            pvData = pMeta->u.Raw.pvMeta;
     1926            AssertBreakStmt(pMeta->u.Raw.cbMeta, rc = VERR_INVALID_PARAMETER);
     1927            cbData = pMeta->u.Raw.cbMeta;
     1928
     1929            rc = VINF_SUCCESS;
     1930            break;
     1931        }
     1932
     1933        case VBGLR3GUESTDNDMETADATATYPE_URI_LIST:
     1934        {
     1935            VBClLogInfo(("URI transfer root directory is '%s'\n", DnDTransferListGetRootPathAbs(&pMeta->u.URI.Transfer)));
     1936
     1937            /* Note: The transfer list already has its root set to a temporary directory, so no need to set/add a new
     1938             *       path base here. */
     1939            rc = DnDTransferListGetRootsEx(&pMeta->u.URI.Transfer, DNDTRANSFERLISTFMT_NATIVE, NULL /* pszPathBase */,
     1940                                           DND_PATH_SEPARATOR, (char **)&pvData, &cbData);
     1941            break;
     1942        }
     1943
     1944        default:
     1945            AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED);
     1946            break;
     1947    }
     1948
     1949    if (RT_FAILURE(rc))
     1950        return rc;
    19251951
    19261952    /*
     
    19281954     * be on the guest, so proceed working on communicating with the target window.
    19291955     */
    1930     VBClLogInfo("Received %RU32 bytes of URI list meta data from host\n", cbData);
     1956    VBClLogInfo("Received %RU32 bytes of meta data from host\n", cbData);
    19311957
    19321958    /* Destroy any old data. */
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