VirtualBox

Ignore:
Timestamp:
Sep 6, 2019 10:05:11 AM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard: Removed old protocol handling cruft on the host side and added message translation support for serving older Guest Additions. Updated docs / protocol changelog.

Location:
trunk/src/VBox/GuestHost/SharedClipboard
Files:
2 edited

Legend:

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

    r80468 r80623  
    183183        RTMemFree(pEvIt);
    184184    }
     185
     186    pSource->uID          = 0;
     187    pSource->uEventIDNext = 0;
    185188}
    186189
     
    216219
    217220    return NULL;
     221}
     222
     223/**
     224 * Returns the last (newest) event ID which has been registered for an event source.
     225 *
     226 * @returns Last registered event ID, or 0 if not found.
     227 * @param   pSource             Event source to get last registered event from.
     228 */
     229VBOXCLIPBOARDEVENTID SharedClipboardEventGetLast(PSHAREDCLIPBOARDEVENTSOURCE pSource)
     230{
     231    AssertPtrReturn(pSource, 0);
     232    PSHAREDCLIPBOARDEVENT pEvent = RTListGetLast(&pSource->lstEvents, SHAREDCLIPBOARDEVENT, Node);
     233    if (pEvent)
     234        return pEvent->uID;
     235
     236    return 0;
    218237}
    219238
     
    281300        LogFlowFunc(("Event %RU16\n", pEvent->uID));
    282301
     302        RTListNodeRemove(&pEvent->Node);
     303
    283304        SharedClipboardEventDestroy(pEvent);
     305
    284306        RTMemFree(pEvent);
    285 
    286         RTListNodeRemove(&pEvent->Node);
     307        pEvent = NULL;
    287308
    288309        rc = VINF_SUCCESS;
     
    290311    else
    291312        rc = VERR_NOT_FOUND;
    292 
    293     AssertRC(rc);
    294313
    295314    LogFlowFuncLeaveRC(rc);
     
    362381    else
    363382        rc = VERR_NOT_FOUND;
    364 
    365 #ifdef DEBUG_andy
    366     AssertRC(rc);
    367 #endif
    368383
    369384    LogFlowFuncLeaveRC(rc);
     
    787802        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT);
    788803        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA);
    789         RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS_WRITE);
     804        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS_REPORT);
    790805        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_TRANSFER_START);
    791806        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ);
     
    820835    {
    821836        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG_OLD);
    822         RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_FORMATS_WRITE);
     837        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_FORMATS_REPORT);
    823838        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_DATA_READ);
    824839        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_DATA_WRITE);
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r80444 r80623  
    18931893    else
    18941894        rc = VERR_NOT_IMPLEMENTED;
    1895     ClipCompleteDataRequestFromX11(pReq->mCtx->pFrontend, rc, pReq->mReq,
    1896                                    pvDest, cbDest);
     1895    ClipRequestFromX11CompleteCallback(pReq->mCtx->pFrontend, rc, pReq->mReq,
     1896                                       pvDest, cbDest);
    18971897    RTMemFree(pvDest);
    18981898    RTMemFree(pReq);
     
    20102010        /* The clipboard callback was never scheduled, so we must signal
    20112011         * that the request processing is finished and clean up ourselves. */
    2012         ClipCompleteDataRequestFromX11(pReq->mCtx->pFrontend, rc, pReq->mReq,
    2013                                        NULL, 0);
     2012        ClipRequestFromX11CompleteCallback(pReq->mCtx->pFrontend, rc, pReq->mReq,
     2013                                           NULL, 0);
    20142014        RTMemFree(pReq);
    20152015    }
     
    20372037    if (!pCtx->fHaveX11)
    20382038        return VERR_NO_DATA;
     2039
    20392040    int rc = VINF_SUCCESS;
    2040     CLIPREADX11CBREQ *pX11Req;
    2041     pX11Req = (CLIPREADX11CBREQ *)RTMemAllocZ(sizeof(*pX11Req));
    2042     if (!pX11Req)
    2043         rc = VERR_NO_MEMORY;
    2044     else
     2041
     2042    CLIPREADX11CBREQ *pX11Req = (CLIPREADX11CBREQ *)RTMemAllocZ(sizeof(CLIPREADX11CBREQ));
     2043    if (pX11Req)
    20452044    {
    20462045        pX11Req->mFormat = u32Format;
    20472046        pX11Req->mCtx = pCtx;
    20482047        pX11Req->mReq = pReq;
     2048
    20492049        /* We use this to schedule a worker function on the event thread. */
    2050         clipQueueToEventThread(pCtx, vboxClipboardReadX11Worker,
    2051                                (XtPointer) pX11Req);
    2052     }
     2050        clipQueueToEventThread(pCtx, vboxClipboardReadX11Worker, (XtPointer) pX11Req);
     2051    }
     2052    else
     2053        rc = VERR_NO_MEMORY;
     2054
    20532055    return rc;
    20542056}
     
    23872389static char g_completedBuf[MAX_BUF_SIZE];
    23882390
    2389 void ClipCompleteDataRequestFromX11(VBOXCLIPBOARDCONTEXT *pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
     2391void ClipRequestFromX11CompleteCallback(VBOXCLIPBOARDCONTEXT *pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    23902392{
    23912393    RT_NOREF1(pCtx);
     
    26462648    uint32_t cbActual;
    26472649    CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq, *pReqRet = NULL;
    2648     rc = ClipStartX11(pCtx);
     2650    rc = ClipStartX11(pCtx, false /* fGrab */);
    26492651    AssertRCReturn(rc, 1);
    26502652
     
    28432845
    28442846    pCtx = ClipConstructX11(NULL, true);
    2845     rc = ClipStartX11(pCtx);
     2847    rc = ClipStartX11(pCtx, false /* fGrab */);
    28462848    AssertRCReturn(rc, 1);
    28472849
     
    28942896}
    28952897
    2896 void ClipCompleteDataRequestFromX11(VBOXCLIPBOARDCONTEXT *pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
     2898void ClipRequestFromX11CompleteCallback(VBOXCLIPBOARDCONTEXT *pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    28972899{
    28982900    RT_NOREF5(pCtx, rc, pReq, pv, cb);
     
    29242926    CLIPBACKEND *pCtx = ClipConstructX11(NULL, false);
    29252927    AssertReturn(pCtx, 1);
    2926     rc = ClipStartX11(pCtx);
     2928    rc = ClipStartX11(pCtx, false /* fGrab */);
    29272929    AssertRCReturn(rc, 1);
    29282930    /* Give the clipboard time to synchronise. */
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