Changeset 100393 in vbox
- Timestamp:
- Jul 5, 2023 4:18:02 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard-transfers.h
r100373 r100393 1129 1129 */ 1130 1130 int ShClTransferCreateEx(SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, uint32_t cbMaxChunkSize, uint32_t cMaxListHandles, uint32_t cMaxObjHandles, PSHCLTRANSFER *ppTransfer); 1131 int ShClTransferCreate(SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, PSHCLTRANSFER *ppTransfer);1131 int ShClTransferCreate(SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, PSHCLTRANSFERCALLBACKS pCallbacks, PSHCLTRANSFER *ppTransfer); 1132 1132 int ShClTransferInit(PSHCLTRANSFER pTransfer); 1133 1133 int ShClTransferDestroy(PSHCLTRANSFER pTransfer); … … 1188 1188 PSHCLLISTENTRY ShClTransferListEntryDup(PSHCLLISTENTRY pListEntry); 1189 1189 1190 void ShClTransferCopyCallbacks(PSHCLTRANSFERCALLBACKS pCallbacksDst, PSHCLTRANSFERCALLBACKS pCallbacksSrc);1191 void ShClTransferSetCallbacks(PSHCLTRANSFER pTransfer, PSHCLTRANSFERCALLBACKS pCallbacks);1192 1190 int ShClTransferSetProvider(PSHCLTRANSFER pTransfer, PSHCLTXPROVIDER pProvider); 1193 1191 -
trunk/include/VBox/GuestHost/SharedClipboard.h
r100328 r100393 402 402 DECLCALLBACKMEMBER(int, pfnOnSendDataToDest, (PSHCLCONTEXT pCtx, void *pv, uint32_t cb, void *pvUser)); 403 403 } SHCLCALLBACKS; 404 /** Pointer to a Shared Clipboard callback table. */ 404 405 typedef SHCLCALLBACKS *PSHCLCALLBACKS; 405 406 /** @} */ -
trunk/include/VBox/VBoxGuestLib.h
r100367 r100393 724 724 # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 725 725 VBGLR3DECL(int) VbglR3ClipboardTransferRequest(PVBGLR3SHCLCMDCTX pCmdCtx); 726 VBGLR3DECL(void) VbglR3ClipboardTransferSetCallbacks(PSHCLTRANSFERCALLBACKS pCallbacks);727 726 VBGLR3DECL(int) VbglR3ClipboardEventGetNextEx(uint32_t idMsg, uint32_t cParms, PVBGLR3SHCLCMDCTX pCtx, PSHCLTRANSFERCTX pTransferCtx, PVBGLR3CLIPBOARDEVENT pEvent); 728 727 -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r100391 r100393 1973 1973 1974 1974 PSHCLTRANSFER pTransfer; 1975 int rc = ShClTransferCreate(enmDir, enmSource, &pTransfer); 1976 if (RT_SUCCESS(rc)) 1977 { 1978 /* Set the callbacks the (OS-dependent) implementation relies on. Optional. */ 1979 ShClTransferSetCallbacks(pTransfer, &pCmdCtx->Transfers.Callbacks); 1980 1975 int rc = ShClTransferCreate(enmDir, enmSource, &pCmdCtx->Transfers.Callbacks, &pTransfer); 1976 if (RT_SUCCESS(rc)) 1977 { 1981 1978 rc = ShClTransferCtxRegisterById(pTransferCtx, pTransfer, idTransfer); 1982 1979 if ( RT_SUCCESS(rc) … … 2218 2215 LogFlowFuncLeaveRC(rc); 2219 2216 return rc; 2220 }2221 2222 /**2223 * Sets transfer callbacks of a Shared Clipboard command context.2224 *2225 * @param pCmdCtx Command context to set callbacks for.2226 * @param pCallbacks Pointer to callback table to set.2227 */2228 VBGLR3DECL(void) VbglR3ClipboardTransferSetCallbacks(PVBGLR3SHCLCMDCTX pCmdCtx, PSHCLTRANSFERCALLBACKS pCallbacks)2229 {2230 AssertPtrReturnVoid(pCmdCtx);2231 AssertPtrReturnVoid(pCallbacks);2232 2233 ShClTransferCopyCallbacks(&pCmdCtx->Transfers.Callbacks, pCallbacks);2234 2217 } 2235 2218 -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp
r100385 r100393 44 44 45 45 46 47 /********************************************************************************************************************************* 48 * Prototypes * 49 ********************************************************************************************************************************/ 50 51 static void shClTransferCopyCallbacks(PSHCLTRANSFERCALLBACKS pCallbacksDst, PSHCLTRANSFERCALLBACKS pCallbacksSrc); 46 52 DECLINLINE(void) shClTransferLock(PSHCLTRANSFER pTransfer); 47 53 DECLINLINE(void) shClTransferUnlock(PSHCLTRANSFER pTransfer); 54 static void shClTransferSetCallbacks(PSHCLTRANSFER pTransfer, PSHCLTRANSFERCALLBACKS pCallbacks); 48 55 static int shClTransferSetStatus(PSHCLTRANSFER pTransfer, SHCLTRANSFERSTATUS enmStatus); 49 56 static int shClTransferThreadCreate(PSHCLTRANSFER pTransfer, PFNRTTHREAD pfnThreadFunc, void *pvUser); … … 1052 1059 * @param enmDir Specifies the transfer direction of this transfer. 1053 1060 * @param enmSource Specifies the data source of the transfer. 1061 * @param pCallbacks Callback table to use. Optional and can be NULL. 1054 1062 * @param cbMaxChunkSize Maximum transfer chunk size (in bytes) to use. 1055 1063 * @param cMaxListHandles Maximum list entries the transfer can have. … … 1058 1066 * Must be destroyed by ShClTransferDestroy(). 1059 1067 */ 1060 int ShClTransferCreateEx(SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, 1068 int ShClTransferCreateEx(SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, PSHCLTRANSFERCALLBACKS pCallbacks, 1061 1069 uint32_t cbMaxChunkSize, uint32_t cMaxListHandles, uint32_t cMaxObjHandles, PSHCLTRANSFER *ppTransfer) 1062 1070 { 1063 1064 1065 1071 AssertPtrReturn(ppTransfer, VERR_INVALID_POINTER); 1072 /* pCallbacks can be NULL. */ 1066 1073 1067 1074 LogFlowFuncEnter(); … … 1096 1103 RT_ZERO(pTransfer->ProviderCtx); 1097 1104 RT_ZERO(pTransfer->ProviderIface); 1105 1106 /* Make sure to set the callbacks before calling pfnOnCreate below. */ 1107 shClTransferSetCallbacks(pTransfer, pCallbacks); 1098 1108 1099 1109 ShClTransferListInit(&pTransfer->lstRoots); … … 1132 1142 * @param enmDir Specifies the transfer direction of this transfer. 1133 1143 * @param enmSource Specifies the data source of the transfer. 1144 * @param pCallbacks Callback table to use. Optional and can be NULL. 1134 1145 * @param ppTransfer Where to return the created clipboard transfer struct. 1135 1146 * Must be destroyed by ShClTransferDestroy(). 1136 1147 */ 1137 int ShClTransferCreate(SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, PSHCLTRANSFER *ppTransfer)1138 { 1139 return ShClTransferCreateEx(enmDir, enmSource, 1148 int ShClTransferCreate(SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, PSHCLTRANSFERCALLBACKS pCallbacks, PSHCLTRANSFER *ppTransfer) 1149 { 1150 return ShClTransferCreateEx(enmDir, enmSource, pCallbacks, 1140 1151 SHCL_TRANSFER_DEFAULT_MAX_CHUNK_SIZE, 1141 1152 SHCL_TRANSFER_DEFAULT_MAX_LIST_HANDLES, … … 1469 1480 * destination callback table will be unset. 1470 1481 */ 1471 void ShClTransferCopyCallbacks(PSHCLTRANSFERCALLBACKS pCallbacksDst, 1472 PSHCLTRANSFERCALLBACKS pCallbacksSrc) 1482 static void shClTransferCopyCallbacks(PSHCLTRANSFERCALLBACKS pCallbacksDst, PSHCLTRANSFERCALLBACKS pCallbacksSrc) 1473 1483 { 1474 1484 AssertPtrReturnVoid(pCallbacksDst); 1485 /* pCallbacksSrc can be NULL */ 1475 1486 1476 1487 if (pCallbacksSrc) /* Set */ … … 1508 1519 * @note Must come before initializing the transfer via ShClTransferInit(). 1509 1520 */ 1510 void ShClTransferSetCallbacks(PSHCLTRANSFER pTransfer, 1511 PSHCLTRANSFERCALLBACKS pCallbacks) 1521 static void shClTransferSetCallbacks(PSHCLTRANSFER pTransfer, PSHCLTRANSFERCALLBACKS pCallbacks) 1512 1522 { 1513 1523 AssertPtrReturnVoid(pTransfer); 1514 1524 /* pCallbacks can be NULL. */ 1515 1525 1516 ShClTransferCopyCallbacks(&pTransfer->Callbacks, pCallbacks);1526 shClTransferCopyCallbacks(&pTransfer->Callbacks, pCallbacks); 1517 1527 1518 1528 /* Make sure that the callback context has all values set according to the callback table. -
trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardHttpServer.cpp
r100367 r100393 212 212 { 213 213 PSHCLTRANSFER pTx; 214 RTTEST_CHECK_RC_OK(hTest, ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, &pTx));214 RTTEST_CHECK_RC_OK(hTest, ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, NULL /* Callbacks */, &pTx)); 215 215 RTTEST_CHECK_RC_OK(hTest, ShClTransferSetProvider(pTx, &Provider)); 216 216 RTTEST_CHECK_RC_OK(hTest, ShClTransferInit(pTx)); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp
r100374 r100393 2258 2258 2259 2259 PSHCLTRANSFER pTransfer; 2260 int rc = ShClTransferCreate(enmDir, enmSource, &p Transfer);2260 int rc = ShClTransferCreate(enmDir, enmSource, &pClient->Transfers.Callbacks, &pTransfer); 2261 2261 if (RT_SUCCESS(rc)) 2262 2262 { … … 2342 2342 LogRel2(("Shared Clipboard: Initializing %s transfer ...\n", 2343 2343 enmDir == SHCLTRANSFERDIR_FROM_REMOTE ? "guest -> host" : "host -> guest")); 2344 2345 ShClTransferSetCallbacks(pTransfer, &pClient->Transfers.Callbacks);2346 2347 pClient->Transfers.Provider.enmSource = pClient->State.enmSource;2348 pClient->Transfers.Provider.pvUser = pClient;2349 2344 2350 2345 rc = ShClTransferInit(pTransfer); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp
r100392 r100393 417 417 418 418 PSHCLTXPROVIDERIFACE pIface = &pClient->Transfers.Provider.Interface; 419 420 pClient->Transfers.Provider.enmSource = pClient->State.enmSource; 421 pClient->Transfers.Provider.pvUser = pClient; 419 422 420 423 switch (ShClTransferGetDir(pTransfer)) -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardTransfers.cpp
r100367 r100393 212 212 { 213 213 PSHCLTRANSFER pTransfer; 214 int rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, &pTransfer);214 int rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, NULL /* Callbacks */, &pTransfer); 215 215 RTTESTI_CHECK_RC_OK(rc); 216 216 … … 246 246 247 247 PSHCLTRANSFER pTransfer; 248 int rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, &pTransfer);248 int rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, NULL /* Callbacks */, &pTransfer); 249 249 RTTESTI_CHECK_RC_OK(rc); 250 250 … … 309 309 RTTESTI_CHECK_RC_OK(rc); 310 310 PSHCLTRANSFER pTransfer; 311 rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, &pTransfer);311 rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, NULL /* Callbacks */, &pTransfer); 312 312 RTTESTI_CHECK_RC_OK(rc); 313 313 rc = ShClTransferDestroy(pTransfer); … … 318 318 PSHCLLIST pList = ShClTransferListAlloc(); 319 319 RTTESTI_CHECK(pList != NULL); 320 rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, &pTransfer);320 rc = ShClTransferCreate(SHCLTRANSFERDIR_TO_REMOTE, SHCLSOURCE_LOCAL, NULL /* Callbacks */, &pTransfer); 321 321 RTTESTI_CHECK_RC_OK(rc); 322 322 ShClTransferListFree(pList);
Note:
See TracChangeset
for help on using the changeset viewer.