Changeset 82882 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 27, 2020 6:08:51 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r82527 r82882 29 29 #include <iprt/mem.h> 30 30 #include <iprt/string.h> 31 #include <iprt/path.h> 31 32 #include <iprt/process.h> 32 33 #include <iprt/semaphore.h> … … 107 108 #endif 108 109 { 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); 118 115 } 119 116 else … … 129 126 /* cbRead contains the size required. */ 130 127 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) 134 131 { 135 rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, &dataBlock, &cbRead);132 rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, Format, pvData, cbData, &cbRead); 136 133 if (rc == VINF_BUFFER_OVERFLOW) 137 134 rc = VERR_BUFFER_OVERFLOW; … … 144 141 { 145 142 *pcb = cbRead; /* Actual bytes read. */ 146 *ppv = dataBlock.pvData;143 *ppv = pvData; 147 144 } 148 145 … … 154 151 */ 155 152 if (RT_FAILURE(rc)) 156 RTMemFree( dataBlock.pvData);153 RTMemFree(pvData); 157 154 } 158 155 … … 206 203 LogFlowFunc(("rc=%Rrc, Format=0x%x, pv=%p, cb=%RU32\n", rc, pReq->Format, pv, cb)); 207 204 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); 220 206 RT_NOREF(rc2); 221 207 … … 230 216 * @returns VBox status code. 231 217 */ 218 #if 0 232 219 static int vboxClipboardConnect(void) 233 220 { … … 259 246 return rc; 260 247 } 248 #endif 261 249 262 250 /** … … 392 380 RTThreadUserSignal(hThreadSelf); 393 381 394 char szExecPath[RTPATH_MAX];395 RT ProcGetExecutablePath(szExecPath, sizeof(szExecPath));396 397 char szTempDir[RTPATH_MAX];398 RTStrPrintf(szTempDir, sizeof(szTempDir), "VBoxSharedClipboard-XXXXXXXX");399 400 int rc = RT DirCreateTemp(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)); 401 389 if (RT_SUCCESS(rc)) 402 390 { 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)); 409 407 410 408 LogFlowFuncLeaveRC(rc); … … 472 470 473 471 /* Initialise the guest library. */ 474 int rc = vboxClipboardConnect();472 int rc = 0; //vboxClipboardConnect(); 475 473 if (RT_SUCCESS(rc)) 476 474 { … … 480 478 { 481 479 #endif 482 rc = vboxClipboardMain(); 480 RTThreadSleep(60 * 1000); 481 482 //rc = vboxClipboardMain(); 483 483 484 484 #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE
Note:
See TracChangeset
for help on using the changeset viewer.