VirtualBox

Ignore:
Timestamp:
Dec 10, 2020 10:01:11 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141862
Message:

Shared Clipboard: Simplified and cleaned up the X11 callback handling to actually do what they advertise in case no data is available. This also makes the surround code a lot easier to understand / follow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp

    r86889 r87082  
    325325 * Callback implementation for reading clipboard data from the guest.
    326326 *
    327  * @note   Runs in Xt event thread.
     327 * @note Runs in Xt event thread.
    328328 *
    329329 * @returns VBox status code. VERR_NO_DATA if no data available.
    330330 * @param   pCtx                Pointer to the host clipboard structure.
    331  * @param   fFormat             The format in which the data should be transferred
     331 * @param   uFmt                The format in which the data should be transferred
    332332 *                              (VBOX_SHCL_FMT_XXX).
    333  * @param   ppv                 On success and if pcb > 0, this will point to a buffer
    334  *                              to be freed with RTMemFree containing the data read.
    335  * @param   pcb                 On success, this contains the number of bytes of data returned.
    336  */
    337 DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT fFormat, void **ppv, uint32_t *pcb)
    338 {
    339     LogFlowFunc(("pCtx=%p, Format=0x%x\n", pCtx, fFormat));
     333 * @param   ppv                 Returns an allocated buffer with data read from the guest on success.
     334 *                              Needs to be free'd with RTMemFree() by the caller.
     335 * @param   pcb                 Returns the amount of data read (in bytes) on success.
     336 */
     337DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
     338{
     339    LogFlowFunc(("pCtx=%p, uFmt=0x%x\n", pCtx, uFmt));
    340340
    341341    if (pCtx->fShuttingDown)
     
    349349
    350350#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    351     if (fFormat == VBOX_SHCL_FMT_URI_LIST)
    352         rc = VINF_SUCCESS;
     351    if (uFmt == VBOX_SHCL_FMT_URI_LIST)
     352    {
     353        *ppv = NULL;
     354        *pcb = 0;
     355
     356        rc = VERR_NO_DATA;
     357    }
    353358    else
    354359#endif
     
    356361        /* Request data from the guest. */
    357362        SHCLEVENTID idEvent;
    358         rc = ShClSvcGuestDataRequest(pCtx->pClient, fFormat, &idEvent);
     363        rc = ShClSvcGuestDataRequest(pCtx->pClient, uFmt, &idEvent);
    359364        if (RT_SUCCESS(rc))
    360365        {
     
    381386
    382387    if (RT_FAILURE(rc))
    383         LogRel(("Shared Clipboard: Requesting data in format %#x for X11 host failed with %Rrc\n", fFormat, rc));
     388        LogRel(("Shared Clipboard: Requesting data in format %#x for X11 host failed with %Rrc\n", uFmt, rc));
    384389
    385390    LogFlowFuncLeaveRC(rc);
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