VirtualBox

Ignore:
Timestamp:
Feb 29, 2024 6:36:37 PM (9 months ago)
Author:
vboxsync
Message:

Shared Clipboard/Transfers: Made code a bit easier to follow / read, removed some unnecessary locking (cleanup). bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp

    r103453 r103615  
    312312        case SHCLTRANSFERDIR_FROM_REMOTE: /* G->H */
    313313        {
    314             rc = SharedClipboardWinTransferHandOffToDataObject(&pCtx->Win, pTransfer);
     314            rc = SharedClipboardWinTransferInitialize(&pCtx->Win, pTransfer);
    315315            break;
    316316        }
     
    329329    LogFlowFuncLeaveRC(rc);
    330330    return rc;
     331}
     332
     333/**
     334 * @copydoc SHCLTRANSFERCALLBACKS::pfnOnInitialized
     335 *
     336 * Called by ShClTransferInit via VbglR3.
     337 * For H->G: Called on transfer intialization to start the data transfer for the "in-flight" IDataObject.
     338 * For G->H: Nothing to do here.
     339 *
     340 * @thread  Clipboard main thread.
     341 */
     342static DECLCALLBACK(void) shClSvcWinTransferOnInitializedCallback(PSHCLTRANSFERCALLBACKCTX pCbCtx)
     343{
     344    LogFlowFuncEnter();
     345
     346    int rc = VINF_SUCCESS;
     347
     348    PSHCLCONTEXT pCtx = (PSHCLCONTEXT)pCbCtx->pvUser;
     349    AssertPtr(pCtx);
     350
     351    PSHCLTRANSFER pTransfer = pCbCtx->pTransfer;
     352    AssertPtr(pTransfer);
     353
     354    switch(ShClTransferGetDir(pTransfer))
     355    {
     356        case SHCLTRANSFERDIR_FROM_REMOTE: /* H->G */
     357        {
     358            rc = SharedClipboardWinTransferStart(&pCtx->Win, pTransfer);
     359            break;
     360        }
     361
     362        case SHCLTRANSFERDIR_TO_REMOTE: /* G->H */
     363            break;
     364
     365        default:
     366            break;
     367    }
     368
     369    LogFlowFuncLeaveRC(rc);
    331370}
    332371
     
    840879        pClient->Transfers.Callbacks.cbUser = sizeof(SHCLCONTEXT);
    841880
    842         pClient->Transfers.Callbacks.pfnOnCreated    = shClSvcWinTransferOnCreatedCallback;
    843         pClient->Transfers.Callbacks.pfnOnInitialize = shClSvcWinTransferOnInitializeCallback;
    844         pClient->Transfers.Callbacks.pfnOnDestroy    = shClSvcWinTransferOnDestroyCallback;
     881        pClient->Transfers.Callbacks.pfnOnCreated     = shClSvcWinTransferOnCreatedCallback;
     882        pClient->Transfers.Callbacks.pfnOnInitialize  = shClSvcWinTransferOnInitializeCallback;
     883        pClient->Transfers.Callbacks.pfnOnInitialized = shClSvcWinTransferOnInitializedCallback;
     884        pClient->Transfers.Callbacks.pfnOnDestroy     = shClSvcWinTransferOnDestroyCallback;
    845885#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    846886    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette