VirtualBox

Changeset 93321 in vbox for trunk


Ignore:
Timestamp:
Jan 18, 2022 3:20:39 PM (3 years ago)
Author:
vboxsync
Message:

Shared Clipboard/X11: Renamed mandatory (own) X11 callbacks to better point out the data flow, added some docs.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/SharedClipboard-x11.h

    r93115 r93321  
    161161/** @} */
    162162
    163 /** @name Shared Clipboard callbacks which have to be implemented the X11 backend and host service.
     163/** @name Shared Clipboard callbacks which have to be implemented by tools using the X11
     164 *        clipboard, e.g. VBoxClient (on guest side) or the X11 host service backend.
    164165 * @{
    165166 */
    166167/**
    167  * Callback for reading clipboard data from the guest.
     168 * Callback for reporting supported formats of current clipboard data from X11 to VBox.
     169 *
     170 * @note   Runs in Xt event thread.
     171 *
     172 * @param  pCtx                 Opaque context pointer for the glue code.
     173 * @param  fFormats             The formats available.
     174 */
     175DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS fFormats);
     176
     177/**
     178 * Callback for requesting clipboard data for X11.
    168179 * The function will be invoked for every single target the clipboard requests.
    169180 *
     
    178189 * @param   pcb                 Returns the amount of data read (in bytes) on success.
    179190 */
    180 DECLCALLBACK(int)  ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb);
    181 
    182 /**
    183  * Reports formats available in the X11 clipboard to VBox.
    184  *
    185  * @note   Runs in Xt event thread.
    186  *
    187  * @param  pCtx                 Opaque context pointer for the glue code.
    188  * @param  fFormats             The formats available.
    189  */
    190 DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS fFormats);
    191 
    192 /**
    193  * Called by the backend to tell us that a request for data from X11 has completed.
     191DECLCALLBACK(int) ShClX11RequestDataCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb);
     192
     193/**
     194 * Callback for reporting that clipboard data from X11 is available.
    194195 *
    195196 * @param  pCtx                 Our context information.
     
    200201 * @param  cb                   The size of the data in @a pv.
    201202 */
    202 DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rcCompletion,
    203                                                          CLIPREADCBREQ *pReq, void *pv, uint32_t cb);
     203DECLCALLBACK(void) ShClX11ReportDataCallback(PSHCLCONTEXT pCtx, int rcCompletion,
     204                                             CLIPREADCBREQ *pReq, void *pv, uint32_t cb);
    204205/** @} */
    205206
  • trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp

    r93115 r93321  
    5858
    5959
    60 DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
     60/** @copydoc ShClX11RequestDataCallback */
     61DECLCALLBACK(int) ShClX11RequestDataCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
    6162{
    6263    LogFlowFunc(("pCtx=%p, uFmt=%#x\n", pCtx, uFmt));
     
    143144};
    144145
     146/** @copydoc ShClX11ReportFormatsCallback */
    145147DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS fFormats)
    146148{
     
    154156}
    155157
    156 DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rcCompletion,
    157                                                          CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
     158/** @copydoc ShClX11ReportDataCallback */
     159DECLCALLBACK(void) ShClX11ReportDataCallback(PSHCLCONTEXT pCtx, int rcCompletion,
     160                                             CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    158161{
    159162    LogFlowFunc(("rcCompletion=%Rrc, Format=0x%x, pv=%p, cb=%RU32\n", rcCompletion, pReq->Format, pv, cb));
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r93314 r93321  
    14531453    {
    14541454        if (pCtx->pvUnicodeCache == NULL) /** @todo r=andy Using string cache here? */
    1455             rc = ShClX11RequestDataForX11Callback(pCtx->pFrontend, uFmt,
    1456                                                   &pCtx->pvUnicodeCache,
    1457                                                   &pCtx->cbUnicodeCache);
     1455            rc = ShClX11RequestDataCallback(pCtx->pFrontend, uFmt,
     1456                                            &pCtx->pvUnicodeCache,
     1457                                            &pCtx->cbUnicodeCache);
    14581458        if (RT_SUCCESS(rc))
    14591459        {
     
    14661466    }
    14671467    else
    1468         rc = ShClX11RequestDataForX11Callback(pCtx->pFrontend, uFmt, &pv, &cb);
     1468        rc = ShClX11RequestDataCallback(pCtx->pFrontend, uFmt, &pv, &cb);
    14691469
    14701470
     
    21512151                g_aFormats[pReq->idxFmtX11].pcszAtom, pReq->idxFmtX11, pReq->uFmtVBox, rc));
    21522152
    2153     ShClX11RequestFromX11CompleteCallback(pReq->pCtx->pFrontend, rc, pReq->pReq,
    2154                                           pvDst, cbDst);
     2153    ShClX11ReportDataCallback(pReq->pCtx->pFrontend, rc, pReq->pReq, pvDst, cbDst);
     2154
    21552155    RTMemFree(pvDst);
    21562156    RTMemFree(pReq);
     
    22742274        /* The clipboard callback was never scheduled, so we must signal
    22752275         * that the request processing is finished and clean up ourselves. */
    2276         ShClX11RequestFromX11CompleteCallback(pReq->pCtx->pFrontend, rc, pReq->pReq,
    2277                                               NULL /* pv */ ,0 /* cb */);
     2276        ShClX11ReportDataCallback(pReq->pCtx->pFrontend, rc, pReq->pReq,
     2277                                  NULL /* pv */ ,0 /* cb */);
    22782278        RTMemFree(pReq);
    22792279    }
  • trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardGH-X11.cpp

    r93315 r93321  
    119119}
    120120
    121 DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, uint32_t uFmt, void **ppv, uint32_t *pcb)
     121/** @copydoc ShClX11RequestDataCallback */
     122DECLCALLBACK(int) ShClX11RequestDataCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
    122123{
    123124    RT_NOREF(pCtx, uFmt);
     
    398399static char g_tst_abCompletedBuf[TESTCASE_MAX_BUF_SIZE];
    399400
    400 DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rcCompletion,
    401                                                          CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
     401DECLCALLBACK(void) ShClX11ReportDataCallback(PSHCLCONTEXT pCtx, int rcCompletion,
     402                                             CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    402403{
    403404    RT_NOREF(pCtx);
  • trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardGH-X11Smoke.cpp

    r93115 r93321  
    3131
    3232
    33 DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
     33/** @copydoc ShClX11RequestDataCallback */
     34DECLCALLBACK(int) ShClX11RequestDataCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
    3435{
    3536    RT_NOREF(pCtx, uFmt, ppv, pcb);
     
    3738}
    3839
     40/** @copydoc ShClX11ReportFormatsCallback */
    3941DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS fFormats)
    4042{
     
    4244}
    4345
    44 DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rcCompletion,
    45                                                          CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
     46/** @copydoc ShClX11ReportDataCallback */
     47DECLCALLBACK(void) ShClX11ReportDataCallback(PSHCLCONTEXT pCtx, int rcCompletion,
     48                                             CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    4649{
    4750    RT_NOREF(pCtx, rcCompletion, pReq, pv, cb);
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp

    r93115 r93321  
    307307}
    308308
    309 DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rcCompletion,
    310                                                          CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
     309/** @copydoc ShClX11ReportDataCallback */
     310DECLCALLBACK(void) ShClX11ReportDataCallback(PSHCLCONTEXT pCtx, int rcCompletion,
     311                                             CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    311312{
    312313    AssertPtrReturnVoid(pCtx);
     
    348349        RTMemFree(pReq);
    349350
    350     LogRel2(("Shared Clipboard: Request for clipboard data from X11 host completed with %Rrc\n", rcCompletion));
    351 }
    352 
    353 DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
     351    LogRel2(("Shared Clipboard: Reading X11 clipboard data from host completed with %Rrc\n", rcCompletion));
     352}
     353
     354/** @copydoc ShClX11RequestDataCallback */
     355DECLCALLBACK(int) ShClX11RequestDataCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
    354356{
    355357    LogFlowFunc(("pCtx=%p, uFmt=0x%x\n", pCtx, uFmt));
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