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/Additions/WINNT/VBoxTray/VBoxClipboard.cpp

    r103450 r103615  
    165165 *
    166166 * Called by ShClTransferInit via VbglR3.
    167  * For G->H: Called on transfer intialization to notify the "in-flight" IDataObject about a data transfer.
    168  * For H->G: Called on transfer intialization to populate the transfer's root list.
     167 * For H->G: Called on transfer intialization to initialize the "in-flight" IDataObject for a data transfer.
     168 * For G->H: Called on transfer intialization to populate the transfer's root list.
    169169 *
    170170 * @thread  Clipboard main thread.
     
    184184    switch(ShClTransferGetDir(pTransfer))
    185185    {
    186         case SHCLTRANSFERDIR_FROM_REMOTE: /* G->H */
    187         {
    188             rc = SharedClipboardWinTransferHandOffToDataObject(&pCtx->Win, pTransfer);
    189             break;
    190         }
    191 
    192         case SHCLTRANSFERDIR_TO_REMOTE: /* H->G */
     186        case SHCLTRANSFERDIR_FROM_REMOTE: /* H->G */
     187        {
     188            rc = SharedClipboardWinTransferInitialize(&pCtx->Win, pTransfer);
     189            break;
     190        }
     191
     192        case SHCLTRANSFERDIR_TO_REMOTE: /* G->H */
    193193        {
    194194            rc = SharedClipboardWinTransferGetRootsFromClipboard(&pCtx->Win, pTransfer);
     
    202202    LogFlowFuncLeaveRC(rc);
    203203    return rc;
     204}
     205
     206/**
     207 * @copydoc SHCLTRANSFERCALLBACKS::pfnOnInitialized
     208 *
     209 * Called by ShClTransferInit via VbglR3.
     210 * For H->G: Called on transfer intialization to start the data transfer for the "in-flight" IDataObject.
     211 * For G->H: Nothing to do here.
     212 *
     213 * @thread  Clipboard main thread.
     214 */
     215static DECLCALLBACK(void) vbtrShClTransferInitializedCallback(PSHCLTRANSFERCALLBACKCTX pCbCtx)
     216{
     217    LogFlowFuncEnter();
     218
     219    int rc = VINF_SUCCESS;
     220
     221    PSHCLCONTEXT pCtx = (PSHCLCONTEXT)pCbCtx->pvUser;
     222    AssertPtr(pCtx);
     223
     224    PSHCLTRANSFER pTransfer = pCbCtx->pTransfer;
     225    AssertPtr(pTransfer);
     226
     227    switch(ShClTransferGetDir(pTransfer))
     228    {
     229        case SHCLTRANSFERDIR_FROM_REMOTE: /* H->G */
     230        {
     231            rc = SharedClipboardWinTransferStart(&pCtx->Win, pTransfer);
     232            break;
     233        }
     234
     235        case SHCLTRANSFERDIR_TO_REMOTE: /* G->H */
     236            break;
     237
     238        default:
     239            break;
     240    }
     241
     242    LogFlowFuncLeaveRC(rc);
    204243}
    205244
     
    9731012    pCtx->CmdCtx.Transfers.Callbacks.pfnOnDestroy     = vbtrShClTransferDestroyCallback;
    9741013    pCtx->CmdCtx.Transfers.Callbacks.pfnOnInitialize  = vbtrShClTransferInitializeCallback;
     1014    pCtx->CmdCtx.Transfers.Callbacks.pfnOnInitialized = vbtrShClTransferInitializedCallback;
    9751015    pCtx->CmdCtx.Transfers.Callbacks.pfnOnStarted     = vbtrShClTransferStartedCallback;
    9761016    pCtx->CmdCtx.Transfers.Callbacks.pfnOnCompleted   = vbtrShClTransferCompletedCallback;
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