Changeset 100655 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Jul 19, 2023 4:06:24 PM (17 months ago)
- Location:
- trunk/src/VBox/HostServices/SharedClipboard
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-darwin.cpp
r100646 r100655 94 94 &fFormats, &fChanged); 95 95 if ( RT_SUCCESS(rc) 96 && fChanged 97 && ShClSvcIsBackendActive()) 96 && fChanged) 98 97 rc = ShClSvcReportFormats(pCtx->pClient, fFormats); 99 98 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r100646 r100655 319 319 bool ShClSvcLock(void); 320 320 void ShClSvcUnlock(void); 321 322 /**323 * Checks if the backend is active (@c true), or if VRDE is in control of324 * the host side.325 */326 DECLINLINE(bool) ShClSvcIsBackendActive(void)327 {328 return g_ExtState.pfnExtension == NULL;329 }330 321 /** @} */ 331 322 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp
r100646 r100655 789 789 SHCLFORMATS fFormats = 0; 790 790 rc = SharedClipboardWinGetFormats(&pCtx->Win, &fFormats); 791 if ( RT_SUCCESS(rc) 792 && fFormats != VBOX_SHCL_FMT_NONE /** @todo r=bird: BUGBUG: revisit this. */ 793 && ShClSvcIsBackendActive()) 791 if (RT_SUCCESS(rc)) 794 792 rc = ShClSvcReportFormats(pCtx->pClient, fFormats); 795 793 } -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp
r100646 r100655 220 220 * there is data in the host clipboard it will automatically be sent to 221 221 * the guest when the clipboard starts up. */ 222 if (ShClSvcIsBackendActive()) 223 return ShClSvcReportFormats(pClient, VBOX_SHCL_FMT_NONE); 224 return VINF_SUCCESS; 222 return ShClSvcReportFormats(pClient, VBOX_SHCL_FMT_NONE); 225 223 } 226 224 … … 369 367 AssertPtr(pClient); 370 368 371 rc = RTCritSectEnter(&pClient->CritSect); 372 if (RT_SUCCESS(rc)) 373 { 374 if (ShClSvcIsBackendActive()) 375 { 376 /** @todo r=bird: BUGBUG: Revisit this */ 377 if (fFormats != VBOX_SHCL_FMT_NONE) /* No formats to report? */ 378 { 379 rc = ShClSvcReportFormats(pCtx->pClient, fFormats); 380 } 381 } 382 383 RTCritSectLeave(&pClient->CritSect); 384 } 369 rc = ShClSvcReportFormats(pCtx->pClient, fFormats); 385 370 386 371 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r100646 r100655 1473 1473 * Reports clipboard formats to the guest. 1474 1474 * 1475 * @note Host backend callers must check if it's active (use1476 * ShClSvcIsBackendActive) before calling to prevent mixing up the1477 * VRDE clipboard.1478 *1479 1475 * @returns VBox status code. 1480 1476 * @param pClient Client to report clipboard formats to. 1481 * @param fFormats The formats to report (VBOX_SHCL_FMT_XXX), zero 1482 * is okay (empty the clipboard). 1483 * 1477 * @param fFormats The formats to report (VBOX_SHCL_FMT_XXX). 1478 * VBOX_SHCL_FMT_NONE will empty (clear) the clipboard. 1484 1479 * @thread Backend thread. 1485 1480 */ 1486 1481 int ShClSvcReportFormats(PSHCLCLIENT pClient, SHCLFORMATS fFormats) 1487 1482 { 1488 LogFlowFuncEnter(); 1483 AssertPtrReturn(pClient, VERR_INVALID_POINTER); 1484 1485 LogFlowFunc(("fFormats=%#x\n", fFormats)); 1489 1486 1490 1487 /* … … 1501 1498 return VINF_SUCCESS; 1502 1499 1503 AssertPtrReturn(pClient, VERR_INVALID_POINTER);1504 1505 LogFlowFunc(("fFormats=%#x\n", fFormats));1506 1507 1500 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 1508 1501 bool fSkipTransfers = false; … … 1529 1522 #endif 1530 1523 1524 int rc; 1525 1526 /* 1527 * Check if the HGCM callback can handle this first. 1528 * This is needed in order to not mess up the clipboard if VRDE is active, for example. 1529 */ 1530 if (g_ExtState.pfnExtension) /* Extension set? */ 1531 { 1532 SHCLEXTPARMS parms; 1533 RT_ZERO(parms); 1534 1535 parms.u.ReportFormats.uFormats = fFormats; 1536 1537 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_FORMAT_REPORT_TO_GUEST, &parms, sizeof(parms)); 1538 if (rc == VERR_NOT_SUPPORTED) 1539 { 1540 /* Not handled by the extension, continue below. */ 1541 } 1542 else /* Handled by the extension, bail out. */ 1543 return rc; 1544 } 1545 1531 1546 /* 1532 1547 * Allocate a message, populate parameters and post it to the client. 1533 1548 */ 1534 int rc;1535 1549 PSHCLCLIENTMSG pMsg = shClSvcMsgAlloc(pClient, VBOX_SHCL_HOST_MSG_FORMATS_REPORT, 2); 1536 1550 if (pMsg) … … 1539 1553 HGCMSvcSetU32(&pMsg->aParms[1], fFormats); 1540 1554 1541 RTCritSectEnter(&pClient->CritSect); 1555 shClSvcClientLock(pClient); 1556 1542 1557 rc = shClSvcMsgAddAndWakeupClient(pClient, pMsg); 1543 RTCritSectLeave(&pClient->CritSect); 1558 1559 shClSvcClientUnlock(pClient); 1544 1560 } 1545 1561 else … … 1620 1636 parms.u.ReportFormats.uFormats = fFormats; 1621 1637 1622 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_FORMAT_ ANNOUNCE, &parms, sizeof(parms));1638 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_FORMAT_REPORT_TO_HOST, &parms, sizeof(parms)); 1623 1639 } 1624 1640 else … … 2730 2746 switch (u32Function) 2731 2747 { 2732 /* The service extension announces formats to the guest. */2733 case VBOX_CLIPBOARD_EXT_FN_FORMAT_ ANNOUNCE:2748 /* The service extension announces formats to the host. */ 2749 case VBOX_CLIPBOARD_EXT_FN_FORMAT_REPORT_TO_HOST: 2734 2750 { 2735 LogFlowFunc(("VBOX_CLIPBOARD_EXT_FN_FORMAT_ ANNOUNCE: g_ExtState.fReadingData=%RTbool\n", g_ExtState.fReadingData));2751 LogFlowFunc(("VBOX_CLIPBOARD_EXT_FN_FORMAT_REPORT_TO_HOST: g_ExtState.fReadingData=%RTbool\n", g_ExtState.fReadingData)); 2736 2752 if (!g_ExtState.fReadingData) 2737 2753 rc = ShClSvcReportFormats(pClient, u32Format); … … 2775 2791 } 2776 2792 2777 /** @todo BUGBUG Why no VBOX_CLIPBOARD_EXT_FN_DATA_WRITE here? */2778 2779 2793 default: 2780 2794 /* Just skip other messages. */
Note:
See TracChangeset
for help on using the changeset viewer.