VirtualBox

Changeset 82882 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jan 27, 2020 6:08:51 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard: Ditched SHCLDATABLOCK [build fix, forgot file]. bugref:9437

File:
1 edited

Legend:

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

    r82527 r82882  
    2929#include <iprt/mem.h>
    3030#include <iprt/string.h>
     31#include <iprt/path.h>
    3132#include <iprt/process.h>
    3233#include <iprt/semaphore.h>
     
    107108#endif
    108109    {
    109         SHCLDATABLOCK dataBlock;
    110         RT_ZERO(dataBlock);
    111 
    112         dataBlock.uFormat = Format;
    113         dataBlock.cbData  = _4K;
    114         dataBlock.pvData  = RTMemAlloc(dataBlock.cbData);
    115         if (dataBlock.pvData)
    116         {
    117             rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, &dataBlock, &cbRead);
     110        uint32_t cbData = _4K; /** @ŧodo Make this dynamic. */
     111        void    *pvData = RTMemAlloc(cbData);
     112        if (pvData)
     113        {
     114            rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, Format, pvData, cbData, &cbRead);
    118115        }
    119116        else
     
    129126            /* cbRead contains the size required. */
    130127
    131             dataBlock.cbData = cbRead;
    132             dataBlock.pvData = RTMemRealloc(dataBlock.pvData, cbRead);
    133             if (dataBlock.pvData)
     128            cbData = cbRead;
     129            pvData = RTMemRealloc(pvData, cbRead);
     130            if (pvData)
    134131            {
    135                 rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, &dataBlock, &cbRead);
     132                rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, Format, pvData, cbData, &cbRead);
    136133                if (rc == VINF_BUFFER_OVERFLOW)
    137134                    rc = VERR_BUFFER_OVERFLOW;
     
    144141        {
    145142            *pcb = cbRead; /* Actual bytes read. */
    146             *ppv = dataBlock.pvData;
     143            *ppv = pvData;
    147144        }
    148145
     
    154151         */
    155152        if (RT_FAILURE(rc))
    156             RTMemFree(dataBlock.pvData);
     153            RTMemFree(pvData);
    157154    }
    158155
     
    206203    LogFlowFunc(("rc=%Rrc, Format=0x%x, pv=%p, cb=%RU32\n", rc, pReq->Format, pv, cb));
    207204
    208     SHCLDATABLOCK dataBlock;
    209     RT_ZERO(dataBlock);
    210 
    211     dataBlock.uFormat = pReq->Format;
    212 
    213     if (RT_SUCCESS(rc))
    214     {
    215         dataBlock.pvData = pv;
    216         dataBlock.cbData = cb;
    217     }
    218 
    219     int rc2 = VbglR3ClipboardWriteDataEx(&pCtx->CmdCtx, &dataBlock);
     205    int rc2 = VbglR3ClipboardWriteDataEx(&pCtx->CmdCtx, pReq->Format, pv, cb);
    220206    RT_NOREF(rc2);
    221207
     
    230216 * @returns VBox status code.
    231217 */
     218#if 0
    232219static int vboxClipboardConnect(void)
    233220{
     
    259246    return rc;
    260247}
     248#endif
    261249
    262250/**
     
    392380    RTThreadUserSignal(hThreadSelf);
    393381
    394     char szExecPath[RTPATH_MAX];
    395     RTProcGetExecutablePath(szExecPath, sizeof(szExecPath));
    396 
    397     char szTempDir[RTPATH_MAX];
    398     RTStrPrintf(szTempDir, sizeof(szTempDir), "VBoxSharedClipboard-XXXXXXXX");
    399 
    400     int rc = RTDirCreateTemp(szTempDir, 0700);
     382    SHCL_FUSE_OPTS Opts;
     383    RT_ZERO(Opts);
     384
     385    Opts.fForeground     = true;
     386    Opts.fSingleThreaded = false; /** @todo Do we want multithread here? */
     387
     388    int rc = RTPathTemp(Opts.szMountPoint, sizeof(Opts.szMountPoint));
    401389    if (RT_SUCCESS(rc))
    402390    {
    403         char *paArgs[2];
    404         paArgs[0] = szExecPath;
    405         paArgs[1] = szTempDir;
    406 
    407         rc = ShClFuseMain(2 /* argc */, paArgs);
    408     }
     391        rc = RTPathAppend(Opts.szMountPoint, sizeof(Opts.szMountPoint), "VBoxSharedClipboard");
     392        if (RT_SUCCESS(rc))
     393        {
     394            rc = RTDirCreate(Opts.szMountPoint, 0700,
     395                             RTDIRCREATE_FLAGS_NO_SYMLINKS);
     396            if (rc == VERR_ALREADY_EXISTS)
     397                rc = VINF_SUCCESS;
     398        }
     399    }
     400
     401    if (RT_SUCCESS(rc))
     402    {
     403        rc = ShClFuseMain(&Opts);
     404    }
     405    else
     406        LogRel(("Error creating FUSE mount directory, rc=%Rrc\n", rc));
    409407
    410408    LogFlowFuncLeaveRC(rc);
     
    472470
    473471    /* Initialise the guest library. */
    474     int rc = vboxClipboardConnect();
     472    int rc = 0; //vboxClipboardConnect();
    475473    if (RT_SUCCESS(rc))
    476474    {
     
    480478        {
    481479#endif
    482             rc = vboxClipboardMain();
     480            RTThreadSleep(60 * 1000);
     481
     482            //rc = vboxClipboardMain();
    483483
    484484#ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE
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