Changeset 82286 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
- Timestamp:
- Nov 29, 2019 4:08:08 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r82266 r82286 23 23 #include <iprt/asm.h> 24 24 #include <iprt/assert.h> 25 #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE 26 # include <iprt/dir.h> 27 #endif 25 28 #include <iprt/initterm.h> 26 29 #include <iprt/mem.h> … … 37 40 #include "VBoxClient.h" 38 41 42 #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE 43 # include "clipboard-fuse.h" 44 #endif 39 45 40 46 /********************************************************************************************************************************* 41 47 * Global Variables * 42 48 *********************************************************************************************************************************/ 49 50 #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE 51 typedef struct _SHCLCTXFUSE 52 { 53 RTTHREAD Thread; 54 } SHCLCTXFUSE; 55 #endif /* VBOX_WITH_SHARED_CLIPBOARD_FUSE */ 43 56 44 57 /** … … 52 65 /** Associated transfer data. */ 53 66 SHCLTRANSFERCTX TransferCtx; 67 # ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE 68 SHCLCTXFUSE FUSE; 69 # endif 54 70 #endif 55 71 /** X11 clipboard context. */ … … 430 446 } 431 447 448 #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE 449 static DECLCALLBACK(int) vboxClipoardFUSEThread(RTTHREAD hThreadSelf, void *pvUser) 450 { 451 RT_NOREF(hThreadSelf, pvUser); 452 453 VbglR3Init(); 454 455 LogFlowFuncEnter(); 456 457 RTThreadUserSignal(hThreadSelf); 458 459 char szExecPath[RTPATH_MAX]; 460 RTProcGetExecutablePath(szExecPath, sizeof(szExecPath)); 461 462 char szTempDir[RTPATH_MAX]; 463 RTStrPrintf(szTempDir, sizeof(szTempDir), "VBoxSharedClipboard-XXXXXXXX"); 464 465 int rc = RTDirCreateTemp(szTempDir, 0700); 466 if (RT_SUCCESS(rc)) 467 { 468 char *paArgs[2]; 469 paArgs[0] = szExecPath; 470 paArgs[1] = szTempDir; 471 472 rc = ShClFuseMain(2 /* argc */, paArgs); 473 } 474 475 LogFlowFuncLeaveRC(rc); 476 return rc; 477 } 478 479 static int vboxClipboardFUSEStart() 480 { 481 LogFlowFuncEnter(); 482 483 PSHCLCONTEXT pCtx = &g_Ctx; 484 485 int rc = RTThreadCreate(&pCtx->FUSE.Thread, vboxClipoardFUSEThread, &pCtx->FUSE, 0, 486 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLFUSE"); 487 if (RT_SUCCESS(rc)) 488 rc = RTThreadUserWait(pCtx->FUSE.Thread, 30 * 1000); 489 490 LogFlowFuncLeaveRC(rc); 491 return rc; 492 } 493 494 static int vboxClipboardFUSEStop() 495 { 496 LogFlowFuncEnter(); 497 498 PSHCLCONTEXT pCtx = &g_Ctx; 499 500 int rcThread; 501 int rc = RTThreadWait(pCtx->FUSE.Thread, 1000, &rcThread); 502 503 LogFlowFuncLeaveRC(rc); 504 return rc; 505 } 506 #endif /* VBOX_WITH_SHARED_CLIPBOARD_FUSE */ 507 432 508 static const char *getName() 433 509 { … … 448 524 if (RT_SUCCESS(rc)) 449 525 { 450 rc = vboxClipboardMain(); 526 #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE 527 rc = vboxClipboardFUSEStart(); 528 if (RT_SUCCESS(rc)) 529 { 530 #endif 531 rc = vboxClipboardMain(); 532 533 #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE 534 int rc2 = vboxClipboardFUSEStop(); 535 if (RT_SUCCESS(rc)) 536 rc = rc2; 537 } 538 #endif 451 539 } 452 540
Note:
See TracChangeset
for help on using the changeset viewer.