VirtualBox

Changeset 81960 in vbox


Ignore:
Timestamp:
Nov 18, 2019 7:00:50 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134757
Message:

Shared Clipboard/Transfers: Update.

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp

    r81843 r81960  
    11451145    }
    11461146
    1147     LogRel(("Shared Clipboard: Worker loop ended\n"));
     1147    LogRel2(("Shared Clipboard: Worker loop ended\n"));
    11481148
    11491149#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp

    r81843 r81960  
    18621862                                                   RT_SUCCESS(rc)
    18631863                                                 ? SHCLTRANSFERSTATUS_STARTED : SHCLTRANSFERSTATUS_ERROR, rc);
    1864     AssertRC(rc2);
     1864    if (RT_SUCCESS(rc))
     1865        rc = rc2;
    18651866
    18661867    if (RT_FAILURE(rc))
  • trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp

    r81871 r81960  
    230230        {
    231231            rc = VbglR3ClipboardConnectEx(&g_Ctx.CmdCtx);
     232#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     233            if (RT_SUCCESS(rc))
     234                rc = ShClTransferCtxInit(&g_Ctx.TransferCtx);
     235#endif
     236            if (RT_FAILURE(rc))
     237                ClipStopX11(g_Ctx.pBackend);
    232238        }
    233239    }
     
    458464{
    459465    RT_NOREF(ppInterface);
     466
     467#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     468    ShClTransferCtxDestroy(&g_Ctx.TransferCtx);
     469#endif
     470
    460471    VbglR3Term();
    461472}
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r81843 r81960  
    154154static Atom clipAtomForX11Format(CLIPBACKEND *pCtx, CLIPX11FORMAT format)
    155155{
     156    LogFlowFunc(("format=%u -> pcszAtom=%s\n", format, g_aFormats[format].pcszAtom));
     157    AssertReturn(format <= RT_ELEMENTS(g_aFormats), 0);
    156158    return clipGetAtom(pCtx, g_aFormats[format].pcszAtom);
    157159}
     
    162164static CLIPFORMAT clipRealFormatForX11Format(CLIPX11FORMAT format)
    163165{
     166    AssertReturn(format <= RT_ELEMENTS(g_aFormats), INVALID);
    164167    return g_aFormats[format].enmFormat;
    165168}
     
    168171static uint32_t clipVBoxFormatForX11Format(CLIPX11FORMAT format)
    169172{
     173    AssertReturn(format <= RT_ELEMENTS(g_aFormats), VBOX_SHCL_FMT_NONE);
    170174    return g_aFormats[format].u32VBoxFormat;
    171175}
     
    251255    CLIPX11FORMAT X11URIListFormat;
    252256#endif
    253     /** What formats does VBox have on offer? */
     257    /** What kind of formats does VBox have to offer? */
    254258    SHCLFORMATS vboxFormats;
    255259    /** Cache of the last unicode data that we received */
     
    12721276        if (RT_SUCCESS(rc))
    12731277        {
     1278            AssertPtrReturn(pCtx->pvUnicodeCache, VERR_INVALID_POINTER);
     1279            AssertReturn   (pCtx->cbUnicodeCache, VERR_INVALID_PARAMETER);
     1280
    12741281            *ppv = RTMemDup(pCtx->pvUnicodeCache, pCtx->cbUnicodeCache);
    12751282            *pcb = pCtx->cbUnicodeCache;
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r81843 r81960  
    11931193}
    11941194
     1195/**
     1196 * Reports available VBox clipboard formats to the guest.
     1197 *
     1198 * @returns VBox status code.
     1199 * @param   pClient             Client to request to read data form.
     1200 * @param   pFormats            Formats to report.
     1201 */
    11951202int ShClSvcFormatsReport(PSHCLCLIENT pClient, PSHCLFORMATDATA pFormats)
    11961203{
     
    12001207    LogFlowFuncEnter();
    12011208
     1209    uint32_t fFormats = pFormats->Formats;
     1210    uint32_t fFlags   = pFormats->fFlags;
     1211
     1212#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     1213    /* If transfer mode is set to disabled, don't report the URI list format to the guest. */
     1214    if (!(g_fTransferMode & VBOX_SHCL_TRANSFER_MODE_ENABLED))
     1215        fFormats &= ~VBOX_SHCL_FMT_URI_LIST;
     1216#endif
     1217
     1218    LogFlowFunc(("fFormats=0x%x -> 0x%x\n", pFormats->Formats, fFormats));
     1219
     1220    /* Nothing to report? Bail out early. */
     1221    if (fFormats == VBOX_SHCL_FMT_NONE)
     1222        return VINF_SUCCESS;
     1223
     1224    LogRel2(("Shared Clipboard: Reporting formats 0x%x to guest\n", fFormats));
     1225
    12021226    int rc;
    12031227
     
    12091233        HGCMSvcSetU64(&pMsg->paParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
    12101234                                                                  pClient->Events.uID, uEvent));
    1211         HGCMSvcSetU32(&pMsg->paParms[1], pFormats->Formats);
    1212         HGCMSvcSetU32(&pMsg->paParms[2], 0 /* fFlags */);
     1235        HGCMSvcSetU32(&pMsg->paParms[1], fFormats);
     1236        HGCMSvcSetU32(&pMsg->paParms[2], fFlags);
    12131237
    12141238        rc = shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
     
    12161240        {
    12171241#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1218             /* If this is an URI list, create a transfer locally and also tell the guest to create
     1242            /* If we announce an URI list, create a transfer locally and also tell the guest to create
    12191243             * a transfer on the guest side. */
    1220             if (pFormats->Formats & VBOX_SHCL_FMT_URI_LIST)
     1244            if (fFormats & VBOX_SHCL_FMT_URI_LIST)
    12211245            {
    12221246                rc = shClSvcTransferStart(pClient, SHCLTRANSFERDIR_WRITE, SHCLSOURCE_LOCAL,
Note: See TracChangeset for help on using the changeset viewer.

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