VirtualBox

Changeset 82216 in vbox


Ignore:
Timestamp:
Nov 26, 2019 9:28:21 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135030
Message:

Shared Clipboard/VBoxClient: Re-added code removed in r134460, as this still is needed for various software products. Thank you, Andrew Caldwell!

Location:
trunk
Files:
2 edited

Legend:

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

    r82161 r82216  
    7777    bool fGrabClipboardOnStart;
    7878
    79     /** The best text format X11 has to offer, as an index into the formats
    80      * table */
     79    /** The best text format X11 has to offer, as an index into the formats table. */
    8180    CLIPX11FORMAT X11TextFormat;
    82     /** The best bitmap format X11 has to offer, as an index into the formats
    83      * table */
     81    /** The best bitmap format X11 has to offer, as an index into the formats table. */
    8482    CLIPX11FORMAT X11BitmapFormat;
    85     /** The best HTML format X11 has to offer, as an index into the formats
    86      * table */
     83    /** The best HTML format X11 has to offer, as an index into the formats table. */
    8784    CLIPX11FORMAT X11HTMLFormat;
    8885#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    89     /** The best HTML format X11 has to offer, as an index into the formats
    90      * table */
     86    /** The best HTML format X11 has to offer, as an index into the formats table. */
    9187    CLIPX11FORMAT X11URIListFormat;
    9288#endif
    9389    /** What kind of formats does VBox have to offer? */
    9490    SHCLFORMATS vboxFormats;
    95     /** Cache of the last unicode data that we received */
     91    /** Cache of the last unicode data that we received. */
    9692    void *pvUnicodeCache;
    97     /** Size of the unicode data in the cache */
     93    /** Size of the unicode data in the cache. */
    9894    uint32_t cbUnicodeCache;
    9995    /** When we wish the clipboard to exit, we have to wake up the event
     
    10197     * the end that another thread can write to. */
    10298    int wakeupPipeWrite;
    103     /** The reader end of the pipe */
     99    /** The reader end of the pipe. */
    104100    int wakeupPipeRead;
    105     /** A pointer to the XFixesSelectSelectionInput function */
     101    /** A pointer to the XFixesSelectSelectionInput function. */
    106102    void (*fixesSelectInput)(Display *, Window, Atom, unsigned long);
    107     /** The first XFixes event number */
     103    /** The first XFixes event number. */
    108104    int fixesEventBase;
     105    /** XtGetSelectionValue on some versions of libXt isn't re-entrant
     106     * so block overlapping requests on this flag. */
     107    bool fXtBusy;
     108    /** If a request is blocked on the previous flag, set this flag to request
     109     * an update later - the first callback should check and clear this flag
     110     * before processing the callback event. */
     111    bool fXtNeedsUpdate;
    109112} SHCLX11CTX, *PSHCLX11CTX;
    110113
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r82157 r82216  
    640640    PSHCLX11CTX pCtx = reinterpret_cast<SHCLX11CTX *>(pClient);
    641641
     642    LogFlowFunc(("fXtNeedsUpdate=%RTbool, fXtBusy=%RTbool\n", pCtx->fXtNeedsUpdate, pCtx->fXtBusy));
     643
     644    if (pCtx->fXtNeedsUpdate)
     645    {
     646        // The data from this callback is already out of date.  Refresh it.
     647        pCtx->fXtNeedsUpdate = false;
     648        XtGetSelectionValue(pCtx->widget,
     649                            clipGetAtom(pCtx, "CLIPBOARD"),
     650                            clipGetAtom(pCtx, "TARGETS"),
     651                            clipConvertX11TargetsCallback, pCtx,
     652                            CurrentTime);
     653        return;
     654    }
     655    else
     656    {
     657        pCtx->fXtBusy = false;
     658    }
     659
    642660    Atom *pAtoms = (Atom *)pValue;
    643661    unsigned i, j;
     
    711729
    712730#ifndef TESTCASE
    713     XtGetSelectionValue(pCtx->widget,
    714                         clipGetAtom(pCtx, "CLIPBOARD"),
    715                         clipGetAtom(pCtx, "TARGETS"),
    716                         clipConvertX11TargetsCallback, pCtx,
    717                         CurrentTime);
     731    LogFlowFunc(("fXtBusy=%RTbool\n", pCtx->fXtBusy));
     732
     733    if (pCtx->fXtBusy)
     734    {
     735        pCtx->fXtNeedsUpdate = true;
     736    }
     737    else
     738    {
     739        pCtx->fXtBusy = true;
     740        XtGetSelectionValue(pCtx->widget,
     741                            clipGetAtom(pCtx, "CLIPBOARD"),
     742                            clipGetAtom(pCtx, "TARGETS"),
     743                            clipConvertX11TargetsCallback, pCtx,
     744                            CurrentTime);
     745    }
    718746#else
    719747    tstRequestTargets(pCtx);
     
    10251053    }
    10261054
    1027     pCtx->fHaveX11  = !fHeadless;
    1028     pCtx->pFrontend = pParent;
     1055    pCtx->fHaveX11       = !fHeadless;
     1056    pCtx->pFrontend      = pParent;
     1057
     1058    pCtx->fXtBusy        = false;
     1059    pCtx->fXtNeedsUpdate = false;
    10291060
    10301061    LogFlowFuncLeaveRC(VINF_SUCCESS);
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