Changeset 86871 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
- Timestamp:
- Nov 12, 2020 10:15:18 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r85834 r86871 58 58 59 59 /** 60 * Global clipboard context information.60 * Struct keeping a Shared Clipboard context. 61 61 */ 62 62 struct SHCLCONTEXT … … 75 75 }; 76 76 77 /** Only one c lient is supported. There seems to be no need for more clients. */77 /** Only one context is supported at a time for now. */ 78 78 static SHCLCONTEXT g_Ctx; 79 79 … … 258 258 int vboxClipboardMain(void) 259 259 { 260 LogRel(("Worker loop running\n"));261 262 260 int rc; 263 261 … … 331 329 case VBGLR3CLIPBOARDEVENTTYPE_QUIT: 332 330 { 333 LogRel2(("Host requested termination\n"));331 VBClLogVerbose(2, "Host requested termination\n"); 334 332 fShutdown = true; 335 333 break; … … 368 366 } 369 367 370 LogRel(("Worker loop ended\n"));371 372 368 LogFlowFuncLeaveRC(rc); 373 369 return rc; … … 377 373 static DECLCALLBACK(int) vboxClipoardFUSEThread(RTTHREAD hThreadSelf, void *pvUser) 378 374 { 379 RT_NOREF( hThreadSelf,pvUser);375 RT_NOREF(pvUser); 380 376 381 377 VbglR3Init(); … … 409 405 } 410 406 else 411 LogRel(("Error creating FUSE mount directory, rc=%Rrc\n", rc));412 413 LogFlowFuncLeaveRC(rc); 414 return rc; 415 } 416 417 static int vboxClipboardFUSEStart( )407 VBClLogError("Error creating FUSE mount directory, rc=%Rrc\n", rc); 408 409 LogFlowFuncLeaveRC(rc); 410 return rc; 411 } 412 413 static int vboxClipboardFUSEStart(void) 418 414 { 419 415 LogFlowFuncEnter(); … … 430 426 } 431 427 432 static int vboxClipboardFUSEStop( )428 static int vboxClipboardFUSEStop(void) 433 429 { 434 430 LogFlowFuncEnter(); … … 444 440 #endif /* VBOX_WITH_SHARED_CLIPBOARD_FUSE */ 445 441 446 static const char *getName() 447 { 448 return "Shared Clipboard"; 449 } 450 451 static const char *getPidFilePath() 452 { 453 return ".vboxclient-clipboard.pid"; 454 } 455 456 static int init(struct VBCLSERVICE **pSelf) 457 { 458 RT_NOREF(pSelf); 459 442 /** @copydoc VBCLSERVICE::pfnInit */ 443 static int vbclShClInit(void) 444 { 460 445 int rc; 461 446 … … 470 455 } 471 456 472 static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised) 473 { 474 RT_NOREF(ppInterface, fDaemonised); 457 /** @copydoc VBCLSERVICE::pfnWorker */ 458 static int vbclShClWorker(bool volatile *pfShutdown) 459 { 460 RT_NOREF(pfShutdown); 475 461 476 462 /* Initialise the guest library. */ … … 483 469 { 484 470 #endif 471 /* Let the main thread know that it can continue spawning services. */ 472 RTThreadUserSignal(RTThreadSelf()); 473 485 474 rc = vboxClipboardMain(); 486 475 … … 502 491 } 503 492 504 static void cleanup(struct VBCLSERVICE **ppInterface) 505 { 506 RT_NOREF(ppInterface); 507 493 /** @copydoc VBCLSERVICE::pfnStop */ 494 static void vbclShClStop(void) 495 { 496 /* Disconnect from the host service. 497 * This will also send a VBOX_SHCL_HOST_MSG_QUIT from the host so that we can break out from our message worker. */ 498 VbglR3ClipboardDisconnect(g_Ctx.CmdCtx.idClient); 499 g_Ctx.CmdCtx.idClient = 0; 500 } 501 502 /** @copydoc VBCLSERVICE::pfnTerm */ 503 static int vbclShClTerm(void) 504 { 508 505 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 509 506 ShClTransferCtxDestroy(&g_Ctx.TransferCtx); 510 507 #endif 511 } 512 513 struct VBCLSERVICE vbclClipboardInterface = 514 { 515 getName, 516 getPidFilePath, 517 init, 518 run, 519 cleanup 508 509 return VINF_SUCCESS; 510 } 511 512 VBCLSERVICE g_SvcClipboard = 513 { 514 "shcl", /* szName */ 515 "Shared Clipboard", /* pszDescription */ 516 ".vboxclient-clipboard.pid", /* pszPidFilePath */ 517 NULL, /* pszUsage */ 518 NULL, /* pszOptions */ 519 NULL, /* pfnOption */ 520 vbclShClInit, /* pfnInit */ 521 vbclShClWorker, /* pfnWorker */ 522 vbclShClStop, /* pfnStop*/ 523 vbclShClTerm /* pfnTerm */ 520 524 }; 521 525 522 struct CLIPBOARDSERVICE523 {524 struct VBCLSERVICE *pInterface;525 };526 527 struct VBCLSERVICE **VBClGetClipboardService(void)528 {529 struct CLIPBOARDSERVICE *pService =530 (struct CLIPBOARDSERVICE *)RTMemAlloc(sizeof(*pService));531 532 if (!pService)533 VBClLogFatalError("Out of memory\n");534 pService->pInterface = &vbclClipboardInterface;535 return &pService->pInterface;536 }
Note:
See TracChangeset
for help on using the changeset viewer.