VirtualBox

Ignore:
Timestamp:
Feb 19, 2024 2:55:20 PM (12 months ago)
Author:
vboxsync
Message:

Shared Clipboard: Condensed more code by adding a new Windows-specific function SharedClipboardWinTransferHandOffToDataObject(). bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp

    r100665 r103450  
    11921192
    11931193/**
     1194 * Hands off a transfer to the current data object in-flight.
     1195 *
     1196 * @returns VBox status code.
     1197 * @param   pWinCtx             Windows context to use.
     1198 * @param   pTransfer           Transfer to hand off to the data object.
     1199 *
     1200 * @note    The data object will be put into running state on success and handed over to Windows.
     1201 *          Our data object pointer will be invalid afterwards.
     1202 */
     1203int SharedClipboardWinTransferHandOffToDataObject(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer)
     1204{
     1205    int rc = RTCritSectEnter(&pCtx->Win.CritSect);
     1206    if (RT_SUCCESS(rc))
     1207    {
     1208        SharedClipboardWinDataObject *pObj = pCtx->Win.pDataObjInFlight;
     1209        if (pObj)
     1210        {
     1211            rc = pObj->SetTransfer(pTransfer);
     1212            if (RT_SUCCESS(rc))
     1213                rc = pObj->SetStatus(SharedClipboardWinDataObject::Running);
     1214
     1215            pCtx->Win.pDataObjInFlight = NULL; /* Hand off to Windows. */
     1216        }
     1217        else
     1218        {
     1219            AssertMsgFailed(("No data object in flight (yet)!\n"));
     1220            rc = VERR_WRONG_ORDER);
     1221        }
     1222
     1223        int rc2 = RTCritSectLeave(&pCtx->Win.CritSect);
     1224        AssertRC(rc2);
     1225    }
     1226
     1227    return rc;
     1228}
     1229
     1230/**
    11941231 * Retrieves the roots for a transfer by opening the clipboard and getting the clipboard data
    11951232 * as string list (CF_HDROP), assigning it to the transfer as roots then.
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