VirtualBox

Changeset 81747 in vbox


Ignore:
Timestamp:
Nov 8, 2019 8:31:57 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134534
Message:

Shared Clipboard/Transfers: Build fix, forgot some files.

Location:
trunk
Files:
3 edited

Legend:

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

    r81444 r81747  
    119119/** Defines a pointer to a session ID. */
    120120typedef SHCLSESSIONID *PSHCLSESSIONID;
     121/** Defines a NIL session ID. */
     122#define NIL_SHCLSESSIONID                        UINT16_MAX
     123
     124/** Defines a transfer ID. */
     125typedef uint16_t     SHCLTRANSFERID;
     126/** Defines a pointer to a transfer ID. */
     127typedef SHCLTRANSFERID *PSHCLTRANSFERID;
     128/** Defines a NIL transfer ID. */
     129#define NIL_SHCLTRANSFERID                       UINT16_MAX
     130
    121131/** Defines an event ID. */
    122132typedef uint32_t     SHCLEVENTID;
    123133/** Defines a pointer to a event source ID. */
    124134typedef SHCLEVENTID *PSHCLEVENTID;
     135/** Defines a NIL event ID. */
     136#define NIL_SHCLEVENTID                          UINT32_MAX
    125137
    126138/** Maximum number of concurrent Shared Clipboard client sessions a VM can have. */
    127 #define VBOX_SHCL_MAX_SESSIONS                   UINT16_MAX
     139#define VBOX_SHCL_MAX_SESSIONS                   UINT16_MAX - 1
    128140/** Maximum number of concurrent Shared Clipboard transfers a single
    129141 *  client can have. */
    130 #define VBOX_SHCL_MAX_TRANSFERS                  UINT16_MAX
     142#define VBOX_SHCL_MAX_TRANSFERS                  UINT16_MAX - 1
    131143/** Maximum number of events a single Shared Clipboard transfer can have. */
    132 #define VBOX_SHCL_MAX_EVENTS                     UINT32_MAX
     144#define VBOX_SHCL_MAX_EVENTS                     UINT32_MAX - 1
    133145
    134146/**
  • trunk/include/VBox/HostServices/VBoxClipboardSvc.h

    r81559 r81747  
    11681168} SHCLERRORDATA, *PSHCLERRORDATA;
    11691169
     1170/** Opaque client structure for API access. */
     1171struct _SHCLCLIENT;
     1172typedef struct _SHCLCLIENT SHCLCLIENT, *PSHCLCLIENT;
     1173
     1174/** Opaque client structure for API access. */
     1175struct _SHCLCLIENTCMDCTX;
     1176typedef struct _SHCLCLIENTCMDCTX SHCLCLIENTCMDCTX, *PSHCLCLIENTCMDCTX;
     1177
     1178/** @name Public service functions, accessible by the backends.
     1179 *        Locking is between the (host) service thread and the platform-dependent (window) thread.
     1180 * @{
     1181 */
     1182int ShClSvcDataReadRequest(PSHCLCLIENT pClient, PSHCLDATAREQ pDataReq, PSHCLEVENTID puEvent);
     1183int ShClSvcDataReadSignal(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData);
     1184int ShClSvcFormatsReport(PSHCLCLIENT pClient, PSHCLFORMATDATA pFormats);
     1185/** @} */
     1186
    11701187uint32_t ShClSvcGetMode(void);
    11711188bool ShClSvcGetHeadless(void);
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r81701 r81747  
    5353#include <iprt/utf16.h>
    5454
     55#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     56# include <iprt/cpp/list.h>
     57# include <iprt/cpp/ministring.h>
     58#endif
     59
    5560#include <VBox/log.h>
    5661#include <VBox/version.h>
     
    7479    INVALID = 0,
    7580    TARGETS,
    76     TEXT,  /* Treat this as Utf8, but it may really be ascii */
     81    TEXT,  /* Treat this as UTF-8, but it may really be ascii */
    7782    UTF8,
    7883    BMP,
     
    364369
    365370#ifdef TESTCASE
    366 static void testQueueToEventThread(void (*proc)(void *, void *),
    367                                    void *client_data);
     371static void tstClipQueueToEventThread(void (*proc)(void *, void *),
     372                                      void *client_data);
    368373#endif
    369374
     
    393398#else
    394399    RT_NOREF(pCtx);
    395     testQueueToEventThread(proc, client_data);
     400    tstClipQueueToEventThread(proc, client_data);
    396401#endif
    397402
     
    402407/**
    403408 * Reports the formats currently supported by the X11 clipboard to VBox.
     409 *
     410 * @note    Runs in Xt event thread.
    404411 *
    405412 * @param   pCtx                The clipboard backend context to use.
     
    442449}
    443450
    444 /** Tells VBox that X11 currently has nothing in its clipboard. */
     451/**
     452 * Tells VBox that X11 currently has nothing in its clipboard.
     453 *
     454 * @param  pCtx                 The clipboard backend context to use.
     455 */
    445456static void clipReportEmptyX11CB(CLIPBACKEND *pCtx)
    446457{
     
    452463 * Go through an array of X11 clipboard targets to see if they contain a text
    453464 * format we can support, and if so choose the ones we prefer (e.g. we like
    454  * Utf8 better than plain text).
     465 * UTF-8 better than plain text).
    455466 *
    456467 * @return Supported X clipboard format.
     
    485496
    486497#ifdef TESTCASE
    487 static bool clipTestTextFormatConversion(CLIPBACKEND *pCtx)
     498static bool tstClipTextFormatConversion(CLIPBACKEND *pCtx)
    488499{
    489500    bool fSuccess = true;
     
    644655}
    645656
    646 static void clipQueryX11CBFormats(CLIPBACKEND *pCtx);
     657static void clipQueryX11FormatsCallback(CLIPBACKEND *pCtx);
    647658
    648659/**
     
    673684 * "targets" information obtained from the X11 clipboard.
    674685 *
    675  * @note  Callback for XtGetSelectionValue.
     686 * @note  Callback for XtGetSelectionValue().
    676687 * @note  This function is treated as API glue, and as such is not part of any
    677688 *        unit test.  So keep it simple, be paranoid and log everything.
    678689 */
    679 static void clipConvertX11Targets(Widget widget, XtPointer pClient,
    680                                   Atom * /* selection */, Atom *atomType,
    681                                   XtPointer pValue, long unsigned int *pcLen,
    682                                   int *piFormat)
     690static DECLCALLBACK(void) clipConvertX11TargetsCallback(Widget widget, XtPointer pClient,
     691                                                        Atom * /* selection */, Atom *atomType,
     692                                                        XtPointer pValue, long unsigned int *pcLen,
     693                                                        int *piFormat)
    683694{
    684695    RT_NOREF(piFormat);
     
    742753
    743754#ifdef TESTCASE
    744     void testRequestTargets(CLIPBACKEND *pCtx);
     755    void tstRequestTargets(CLIPBACKEND *pCtx);
    745756#endif
    746757
     
    750761 * @param   pCtx                The clipboard backend context to use.
    751762 */
    752 static void clipQueryX11CBFormats(CLIPBACKEND *pCtx)
     763static DECLCALLBACK(void) clipQueryX11FormatsCallback(CLIPBACKEND *pCtx)
    753764{
    754765    LogFlowFuncEnter();
     
    758769                        clipGetAtom(pCtx, "CLIPBOARD"),
    759770                        clipGetAtom(pCtx, "TARGETS"),
    760                         clipConvertX11Targets, pCtx,
     771                        clipConvertX11TargetsCallback, pCtx,
    761772                        CurrentTime);
    762773#else
    763     testRequestTargets(pCtx);
     774    tstRequestTargets(pCtx);
    764775#endif
    765776}
     
    802813            if (   (event.fixes.subtype == 0  /* XFixesSetSelectionOwnerNotify */)
    803814                && (event.fixes.owner != 0))
    804                 clipQueryX11CBFormats(pCtx);
     815                clipQueryX11FormatsCallback(pCtx);
    805816            else
    806817                clipReportEmptyX11CB(pCtx);
     
    810821
    811822/**
    812  * The main loop of our clipboard reader.
     823 * The main loop of our X11 event thread.
    813824 *
    814825 * @note  X11 backend code.
     
    817828{
    818829    RT_NOREF(hThreadSelf);
    819     LogRel(("Shared Clipboard: Starting event thread\n"));
     830
     831    LogRel(("Shared Clipboard: Starting X11 event thread\n"));
    820832
    821833    CLIPBACKEND *pCtx = (CLIPBACKEND *)pvUser;
    822834
    823835    if (pCtx->fGrabClipboardOnStart)
    824         clipQueryX11CBFormats(pCtx);
     836        clipQueryX11FormatsCallback(pCtx);
     837
    825838    while (XtAppGetExitFlag(pCtx->appContext) == FALSE)
    826839    {
     
    828841        XtAppProcessEvent(pCtx->appContext, XtIMAll);
    829842    }
    830     LogRel(("Shared Clipboard: Event thread terminated successfully\n"));
     843
     844    LogRel(("Shared Clipboard: X11 event thread terminated successfully\n"));
    831845    return VINF_SUCCESS;
    832846}
    833 #endif
     847#endif /* !TESTCASE */
    834848
    835849/**
     
    933947    return rc;
    934948}
    935 #endif
     949#endif /* !TESTCASE */
    936950
    937951/**
     
    11161130    {
    11171131        rc = RTThreadCreate(&pCtx->thread, clipEventThread, pCtx, 0,
    1118                             RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLIP");
     1132                            RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLX11");
    11191133        if (RT_FAILURE(rc))
    11201134        {
    1121             LogRel(("Shared Clipboard: Failed to start the shared clipboard thread\n"));
     1135            LogRel(("Shared Clipboard: Failed to start the X11 event thread with %Rrc\n", rc));
    11221136            clipUninit(pCtx);
    11231137        }
     
    11531167    /* Write to the "stop" pipe */
    11541168    clipQueueToEventThread(pCtx, clipStopEventThreadWorker, (XtPointer) pCtx);
     1169
    11551170#ifndef TESTCASE
    11561171    do
     
    12821297
    12831298/**
    1284  * Converts text from Windows format (UCS-2 with CRLF line endings) to standard Utf-8.
     1299 * Converts text from Windows format (UCS-2 with CRLF line endings) to standard UTF-8.
    12851300 *
    12861301 * @returns VBox status code.
     
    13141329        rc = ShClUtf16WinToLin(pwszSrc, cwSrc, pwszTmp, cwTmp);
    13151330    if (RT_SUCCESS(rc))
    1316         /* Convert the Utf16 string to Utf8. */
     1331    {
     1332        /* Convert the UTF-16 string to Utf8. */
    13171333        rc = RTUtf16ToUtf8Ex(pwszTmp + 1, cwTmp - 1, &pszBuf, cbBuf,
    13181334                             &cbDest);
     1335    }
    13191336    RTMemFree(reinterpret_cast<void *>(pwszTmp));
    13201337    if (pcbActual)
     
    13291346
    13301347/**
    1331  * Satisfies a request from X11 to convert the clipboard text to Utf-8.  We
     1348 * Satisfies a request from X11 to convert the clipboard text to UTF-8.  We
    13321349 * return null-terminated text, but can cope with non-null-terminated input.
    13331350 *
     
    13621379    if (RT_SUCCESS(rc))
    13631380    {
    1364         char *pszDest = (char *)XtMalloc(cbDest);
     1381        char  *pszDest = (char *)XtMalloc(cbDest);
    13651382        size_t cbActual = 0;
    13661383        if (pszDest)
    1367             rc = clipWinTxtToUtf8(pwszSrc, cbSrc, pszDest, cbDest,
    1368                                   &cbActual);
     1384        {
     1385            rc = clipWinTxtToUtf8(pwszSrc, cbSrc, pszDest, cbDest, &cbActual);
     1386        }
     1387        else
     1388            rc = VERR_NO_MEMORY;
     1389
    13691390        if (RT_SUCCESS(rc))
    13701391        {
     
    13791400
    13801401/**
    1381  * Satisfies a request from X11 to convert the clipboard HTML fragment to Utf-8.  We
     1402 * Satisfies a request from X11 to convert the clipboard HTML fragment to UTF-8.  We
    13821403 * return null-terminated text, but can cope with non-null-terminated input.
    13831404 *
     
    14061427
    14071428    /* This may slightly overestimate the space needed. */
    1408     LogFlowFunc(("source: %s", pszSrc));
     1429    LogFlowFunc(("Source: %s", pszSrc));
    14091430
    14101431    char *pszDest = (char *)XtMalloc(cbSrc);
    1411     if(pszDest == NULL)
     1432    if (pszDest == NULL)
    14121433        return VERR_NO_MEMORY;
    14131434
     
    14681489        && (pCtx->vboxFormats & VBOX_SHCL_FMT_UNICODETEXT))
    14691490    {
    1470         void *pv = NULL;
     1491        void    *pv = NULL;
    14711492        uint32_t cb = 0;
    14721493        rc = clipReadVBoxShCl(pCtx, VBOX_SHCL_FMT_UNICODETEXT, &pv, &cb);
     
    14801501        if (RT_SUCCESS(rc))
    14811502            clipTrimTrailingNul(*(XtPointer *)pValReturn, pcLenReturn, format);
     1503
    14821504        RTMemFree(pv);
    14831505    }
     
    14851507             && (pCtx->vboxFormats & VBOX_SHCL_FMT_BITMAP))
    14861508    {
    1487         void *pv = NULL;
     1509        void    *pv = NULL;
    14881510        uint32_t cb = 0;
    1489         rc = clipReadVBoxShCl(pCtx,
    1490                                    VBOX_SHCL_FMT_BITMAP,
    1491                                    &pv, &cb);
     1511        rc = clipReadVBoxShCl(pCtx, VBOX_SHCL_FMT_BITMAP, &pv, &cb);
    14921512        if (RT_SUCCESS(rc) && (cb == 0))
    14931513            rc = VERR_NO_DATA;
     
    15061526            *piFormatReturn = 8;
    15071527        }
     1528
    15081529        RTMemFree(pv);
    15091530    }
    1510     else if ( (format == HTML)
     1531    else if (  (format == HTML)
    15111532            && (pCtx->vboxFormats & VBOX_SHCL_FMT_HTML))
    15121533    {
    1513         void *pv = NULL;
     1534        void    *pv = NULL;
    15141535        uint32_t cb = 0;
    1515         rc = clipReadVBoxShCl(pCtx,
    1516                                    VBOX_SHCL_FMT_HTML,
    1517                                    &pv, &cb);
     1536        rc = clipReadVBoxShCl(pCtx, VBOX_SHCL_FMT_HTML, &pv, &cb);
    15181537        if (RT_SUCCESS(rc) && (cb == 0))
    15191538            rc = VERR_NO_DATA;
     
    15211540        {
    15221541            /*
    1523             * The common VBox HTML encoding will be - Utf8
    1524             * becuase it more general for HTML formats then UTF16
    1525             * X11 clipboard returns UTF16, so before sending it we should
    1526             * convert it to UTF8
    1527             * It's very strange but here we get utf16 from x11 clipboard
    1528             * in same time we send utf8 to x11 clipboard and it's work
    1529             */
     1542             * The common VBox HTML encoding will be - Utf8
     1543             * because it more general for HTML formats then UTF16
     1544             * X11 clipboard returns UTF-16, so before sending it we should
     1545             * convert it to UTF8.
     1546             * It's very strange but here we get UTF-16 from x11 clipboard
     1547             * in same time we send UTF-8 to x11 clipboard and it's work.
     1548             */
    15301549            rc = clipWinHTMLToUtf8ForX11CB(XtDisplay(pCtx->widget),
    1531                 (const char*)pv, cb, atomTarget,
    1532                 atomTypeReturn, pValReturn,
    1533                 pcLenReturn, piFormatReturn);
    1534 
    1535 
     1550                                           (const char*)pv, cb, atomTarget,
     1551                                           atomTypeReturn, pValReturn,
     1552                                           pcLenReturn, piFormatReturn);
    15361553            if (RT_SUCCESS(rc))
    15371554                clipTrimTrailingNul(*(XtPointer *)pValReturn, pcLenReturn, format);
     1555
    15381556            RTMemFree(pv);
    15391557        }
     
    15801598}
    15811599
    1582 /** Structure used to pass information about formats that VBox supports */
     1600/**
     1601 * Structure used to pass information about formats that VBox supports.
     1602 */
    15831603typedef struct _CLIPNEWVBOXFORMATS
    15841604{
    1585     /** Context information for the X11 clipboard */
     1605    /** Context information for the X11 clipboard. */
    15861606    CLIPBACKEND *pCtx;
    1587     /** Formats supported by VBox */
    1588     uint32_t formats;
     1607    /** Formats supported by VBox. */
     1608    SHCLFORMATS formats;
    15891609} CLIPNEWVBOXFORMATS, *PCLIPNEWVBOXFORMATS;
    15901610
     
    16521672
    16531673/**
    1654  * VBox is taking possession of the shared clipboard.
    1655  *
    1656  * @param                       u32Formats Clipboard formats that VBox is offering.
     1674 * VBox is taking possession of the Shared Clipboard.
     1675 *
     1676 * @param                       u32Formats clipboard formats that VBox is offering.
    16571677 * @note  X11 backend code
    16581678 */
     
    16851705
    16861706/**
    1687  * Massages generic Utf16 with CR end-of-lines into the format Windows expects
     1707 * Massages generic UTF-16 with CR end-of-lines into the format Windows expects
    16881708 * and return the result in a RTMemAlloc allocated buffer.
    16891709 *
    16901710 * @returns VBox status code.
    1691  * @param  pwcSrc               The source as Utf16.
     1711 * @param  pwcSrc               The source as UTF-16.
    16921712 * @param  cwcSrc               The number of 16bit elements in @a pwcSrc, not counting
    16931713 *                              the terminating zero.
     
    17081728
    17091729    PRTUTF16 pwszDest = NULL;
    1710     size_t cwcDest;
     1730    size_t   cwcDest;
    17111731    int rc = ShClUtf16GetWinSize(pwcSrc, cwcSrc + 1, &cwcDest);
    17121732    if (RT_SUCCESS(rc))
     
    17371757
    17381758/**
    1739  * Converts Utf-8 text with CR end-of-lines into Utf-16 as Windows expects it
     1759 * Converts UTF-8 text with CR end-of-lines into UTF-16 as Windows expects it
    17401760 * and return the result in a RTMemAlloc allocated buffer.
    17411761 *
    17421762 * @returns VBox status code.
    1743  * @param  pcSrc                The source Utf-8.
     1763 * @param  pcSrc                The source UTF-8.
    17441764 * @param  cbSrc                The size of the source in bytes, not counting the
    17451765 *                              terminating zero.
     
    17591779        *pcbDest = 0;
    17601780
    1761     /* Intermediate conversion to UTF16. */
    1762     size_t cwcTmp;
     1781    /* Intermediate conversion to UTF-16. */
     1782    size_t   cwcTmp;
    17631783    PRTUTF16 pwcTmp = NULL;
    17641784    int rc = RTStrToUtf16Ex(pcSrc, cbSrc, &pwcTmp, 0, &cwcTmp);
     
    17731793
    17741794/**
    1775  * Converts Latin-1 text with CR end-of-lines into Utf-16 as Windows expects
     1795 * Converts Latin-1 text with CR end-of-lines into UTF-16 as Windows expects
    17761796 * it and return the result in a RTMemAlloc allocated buffer.
    17771797 *
     
    18151835
    18161836    /* And do the conversion, bearing in mind that Latin-1 expands "naturally"
    1817      * to Utf-16. */
     1837     * to UTF-16. */
    18181838    if (RT_SUCCESS(rc))
    18191839    {
     
    18471867
    18481868/**
    1849 * Converts Utf16 text into UTF8 as Windows expects
     1869* Converts UTF-16 text into UTF-8 as Windows expects
    18501870* it and return the result in a RTMemAlloc allocated buffer.
    18511871*
     
    18931913
    18941914        /* append new substring */
    1895         char *pchNew = (char*)RTMemRealloc(pchRes, cRes + cch + 1);
     1915        char *pchNew = (char *)RTMemRealloc(pchRes, cRes + cch + 1);
    18961916        if (!pchNew)
    18971917        {
     
    19261946{
    19271947    /** The format VBox would like the data in */
    1928     uint32_t mFormat;
     1948    SHCLFORMAT       mFormat;
     1949    /** @todo Put the following variables in an union or just use one for all formats? */
    19291950    /** The text format we requested from X11 if we requested text */
    1930     CLIPX11FORMAT mTextFormat;
     1951    CLIPX11FORMAT    mTextFormat;
    19311952    /** The bitmap format we requested from X11 if we requested bitmap */
    1932     CLIPX11FORMAT mBitmapFormat;
     1953    CLIPX11FORMAT    mBitmapFormat;
    19331954    /** The HTML format we requested from X11 if we requested HTML */
    1934     CLIPX11FORMAT mHtmlFormat;
     1955    CLIPX11FORMAT    mHtmlFormat;
    19351956#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    19361957    /** The URI list format we requested from X11 if we requested URI lists. */
    1937     CLIPX11FORMAT mURIListFormat;
     1958    CLIPX11FORMAT    mURIListFormat;
    19381959#endif
    19391960    /** The clipboard context this request is associated with */
    1940     CLIPBACKEND *mCtx;
     1961    CLIPBACKEND     *mpCtx;
    19411962    /** The request structure passed in from the backend. */
    1942     CLIPREADCBREQ *mReq;
     1963    CLIPREADCBREQ   *mpReq;
    19431964};
    19441965
     
    19551976 *        the X11 clipboard contains a format we understand.
    19561977 */
    1957 static void clipConvertX11CB(void *pClient, void *pvSrc, unsigned cbSrc)
    1958 {
    1959     CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *) pClient;
    1960 
    1961     LogFlowFunc(("pReq->mFormat=%02X, pReq->mTextFormat=%u, "
    1962                  "pReq->mBitmapFormat=%u, pReq->mHtmlFormat=%u, pReq->mCtx=%p\n",
    1963                  pReq->mFormat, pReq->mTextFormat, pReq->mBitmapFormat,
    1964                  pReq->mHtmlFormat, pReq->mCtx));
    1965 
    1966     AssertPtr(pReq->mCtx);
    1967     Assert(pReq->mFormat != 0);  /* sanity */
     1978static void clipConvertDataFromX11CallbackWorker(void *pClient, void *pvSrc, unsigned cbSrc)
     1979{
     1980    CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pClient;
     1981
     1982    LogFlowFunc(("pReq->mFormat=%02X, pReq->mTextFormat=%u, pReq->mBitmapFormat=%u, pReq->mHtmlFormat=%u, pReq->mCtx=%p\n",
     1983                 pReq->mFormat, pReq->mTextFormat, pReq->mBitmapFormat, pReq->mHtmlFormat, pReq->mpCtx));
     1984
     1985#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     1986    LogFlowFunc(("pReq->mURIListFormat=%u\n", pReq->mURIListFormat));
     1987#endif
     1988
     1989    AssertPtr(pReq->mpCtx);
     1990    Assert(pReq->mFormat != VBOX_SHCL_FMT_NONE); /* Sanity. */
    19681991
    19691992    int rc = VINF_SUCCESS;
    19701993
    1971     void *pvDest = NULL;
    1972     uint32_t cbDest = 0;
     1994    void    *pvDst = NULL;
     1995    uint32_t cbDst = 0;
    19731996
    19741997    if (pvSrc == NULL)
     
    19832006        {
    19842007            case UTF8:
     2008                RT_FALL_THROUGH();
    19852009            case TEXT:
    19862010            {
    1987                 /* If we are given broken Utf-8, we treat it as Latin1.  Is
    1988                  * this acceptable? */
    1989                 if (RT_SUCCESS(RTStrValidateEncodingEx((char *)pvSrc, cbSrc,
    1990                                                        0)))
     2011                /* If we are given broken UTF-8, we treat it as Latin1. */ /** @todo Is this acceptable? */
     2012                if (RT_SUCCESS(RTStrValidateEncodingEx((char *)pvSrc, cbSrc, 0)))
     2013                {
    19912014                    rc = clipUtf8ToWinTxt((const char *)pvSrc, cbSrc,
    1992                                           (PRTUTF16 *) &pvDest, &cbDest);
     2015                                          (PRTUTF16 *)&pvDst, &cbDst);
     2016                }
    19932017                else
    1994                     rc = clipLatin1ToWinTxt((char *) pvSrc, cbSrc,
    1995                                             (PRTUTF16 *) &pvDest, &cbDest);
     2018                {
     2019                    rc = clipLatin1ToWinTxt((char *)pvSrc, cbSrc,
     2020                                            (PRTUTF16 *)&pvDst, &cbDst);
     2021                }
    19962022                break;
    19972023            }
     2024
    19982025            default:
     2026            {
    19992027                rc = VERR_INVALID_PARAMETER;
     2028                break;
     2029            }
    20002030        }
    20012031    }
     
    20132043                if (RT_SUCCESS(rc))
    20142044                {
    2015                     pvDest = RTMemAlloc(cbDibSize);
    2016                     if (!pvDest)
     2045                    pvDst = RTMemAlloc(cbDibSize);
     2046                    if (!pvDst)
    20172047                        rc = VERR_NO_MEMORY;
    20182048                    else
    20192049                    {
    2020                         memcpy(pvDest, pDib, cbDibSize);
    2021                         cbDest = cbDibSize;
     2050                        memcpy(pvDst, pDib, cbDibSize);
     2051                        cbDst = cbDibSize;
    20222052                    }
    20232053                }
    20242054                break;
    20252055            }
     2056
    20262057            default:
     2058            {
    20272059                rc = VERR_INVALID_PARAMETER;
    2028         }
    2029     }
    2030     else if(pReq->mFormat == VBOX_SHCL_FMT_HTML)
     2060                break;
     2061            }
     2062        }
     2063    }
     2064    else if (pReq->mFormat == VBOX_SHCL_FMT_HTML)
    20312065    {
    20322066        /* In which format is the clipboard data? */
     
    20352069            case HTML:
    20362070            {
    2037                 /* The common VBox HTML encoding will be - Utf8
    2038                 * becuase it more general for HTML formats then UTF16
    2039                 * X11 clipboard returns UTF16, so before sending it we should
    2040                 * convert it to UTF8
    2041                 */
    2042                 pvDest = NULL;
    2043                 cbDest = 0;
    2044                 /* Some applications sends data in utf16, some in itf8,
     2071                /*
     2072                 * The common VBox HTML encoding will be - UTF-8
     2073                 * because it more general for HTML formats then UTF-16
     2074                 * X11 clipboard returns UTF-16, so before sending it we should
     2075                 * convert it to UTF-8.
     2076                 */
     2077                pvDst = NULL;
     2078                cbDst = 0;
     2079
     2080                /*
     2081                 * Some applications sends data in UTF-16, some in UTF-8,
    20452082                 * without indication it in MIME.
    2046                  * But in case of utf16, at least an OpenOffice adds Byte Order Mark - 0xfeff
    2047                  * at start of clipboard data
     2083                 * But in case of UTF-16, at least an OpenOffice adds Byte Order Mark - 0xfeff
     2084                 * at start of clipboard data.
    20482085                 */
    20492086                if (   cbSrc >= sizeof(RTUTF16)
     
    20512088                {
    20522089                    LogFlowFunc((" \n"));
    2053                     rc = clipUTF16ToWinHTML((RTUTF16*)pvSrc, cbSrc,
    2054                         (char**)&pvDest, &cbDest);
     2090                    rc = clipUTF16ToWinHTML((RTUTF16 *)pvSrc, cbSrc,
     2091                                            (char**)&pvDst, &cbDst);
    20552092                }
    20562093                else
    20572094                {
    2058                    pvDest = RTMemAlloc(cbSrc);
    2059                    if(pvDest)
     2095                   pvDst = RTMemAlloc(cbSrc);
     2096                   if(pvDst)
    20602097                   {
    2061                         memcpy(pvDest, pvSrc, cbSrc);
    2062                         cbDest = cbSrc;
     2098                        memcpy(pvDst, pvSrc, cbSrc);
     2099                        cbDst = cbSrc;
    20632100                   }
    20642101                   else
     
    20702107
    20712108                LogFlowFunc(("Source unicode %ls, cbSrc = %d\n, Byte Order Mark = %hx", pvSrc, cbSrc, ((PRTUTF16)pvSrc)[0]));
    2072                 LogFlowFunc(("converted to win unicode %s, cbDest = %d, rc = %Rrc\n", pvDest, cbDest, rc));
     2109                LogFlowFunc(("converted to win unicode %s, cbDest = %d, rc = %Rrc\n", pvDst, cbDst, rc));
    20732110                rc = VINF_SUCCESS;
    20742111                break;
    20752112            }
     2113
    20762114            default:
    20772115            {
    20782116                rc = VERR_INVALID_PARAMETER;
     2117                break;
    20792118            }
    20802119        }
    20812120    }
     2121#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     2122    else if (pReq->mFormat == VBOX_SHCL_FMT_URI_LIST)
     2123    {
     2124        /* In which format is the clipboard data? */
     2125        switch (clipRealFormatForX11Format(pReq->mURIListFormat))
     2126        {
     2127            case URI_LIST:
     2128            {
     2129                /* For URI lists we only accept valid UTF-8 encodings. */
     2130                if (RT_SUCCESS(RTStrValidateEncodingEx((char *)pvSrc, cbSrc, 0)))
     2131                {
     2132                    /* URI lists on X are string separated with "\r\n". */
     2133                    RTCList<RTCString> lstRootEntries = RTCString((char *)pvSrc, cbSrc - 1).split("\r\n");
     2134                    for (size_t i = 0; i < lstRootEntries.size(); ++i)
     2135                    {
     2136                        const char *pcszEntry = lstRootEntries.at(i).c_str();
     2137                        AssertPtrBreakStmt(pcszEntry, VERR_INVALID_POINTER);
     2138
     2139                        rc = RTStrAAppend((char **)&pvDst, pcszEntry);
     2140                        AssertRCBreakStmt(rc, VERR_NO_MEMORY);
     2141                        cbDst += (uint32_t)strlen(pcszEntry);
     2142
     2143                        rc = RTStrAAppend((char **)&pvDst, "\r\n");
     2144                        AssertRCBreakStmt(rc, VERR_NO_MEMORY);
     2145                        cbDst += (uint32_t)strlen("\r\n");
     2146                    }
     2147
     2148                    if (cbDst)
     2149                        cbDst++; /* Include final (zero) termination. */
     2150
     2151                    LogFlowFunc(("URI list: cbDst=%RU32\n", cbDst));
     2152                }
     2153                else
     2154                    rc = VERR_INVALID_PARAMETER;
     2155                break;
     2156            }
     2157
     2158            default:
     2159            {
     2160                rc = VERR_INVALID_PARAMETER;
     2161                break;
     2162            }
     2163        }
     2164    }
     2165#endif
    20822166    else
    2083         rc = VERR_NOT_IMPLEMENTED;
    2084 
    2085     ClipRequestFromX11CompleteCallback(pReq->mCtx->pFrontend, rc, pReq->mReq,
    2086                                        pvDest, cbDest);
    2087     RTMemFree(pvDest);
     2167        rc = VERR_NOT_SUPPORTED;
     2168
     2169    ClipRequestFromX11CompleteCallback(pReq->mpCtx->pFrontend, rc, pReq->mpReq,
     2170                                       pvDst, cbDst);
     2171    RTMemFree(pvDst);
    20882172    RTMemFree(pReq);
    20892173
     
    20992183 * Converts full BMP data to DIB format.
    21002184 *
    2101  * @note  X11 backend code, callback for XtGetSelectionValue, for use when
     2185 * @note  X11 backend code, callback for XtGetSelectionValue(), for use when
    21022186 *        the X11 clipboard contains a format we understand.
    21032187 */
    2104 static void cbConvertX11CB(Widget widget, XtPointer pClient,
    2105                            Atom * /* selection */, Atom *atomType,
    2106                            XtPointer pvSrc, long unsigned int *pcLen,
    2107                            int *piFormat)
     2188static void clipConvertDataFromX11Callback(Widget widget, XtPointer pClient,
     2189                                           Atom * /* selection */, Atom *atomType,
     2190                                           XtPointer pvSrc, long unsigned int *pcLen,
     2191                                           int *piFormat)
    21082192{
    21092193    RT_NOREF(widget);
    21102194    if (*atomType == XT_CONVERT_FAIL) /* Xt timeout */
    2111         clipConvertX11CB(pClient, NULL, 0);
     2195        clipConvertDataFromX11CallbackWorker(pClient, NULL, 0);
    21122196    else
    2113         clipConvertX11CB(pClient, pvSrc, (*pcLen) * (*piFormat) / 8);
     2197        clipConvertDataFromX11CallbackWorker(pClient, pvSrc, (*pcLen) * (*piFormat) / 8);
    21142198
    21152199    XtFree((char *)pvSrc);
     
    21182202
    21192203#ifdef TESTCASE
    2120 static void testRequestData(CLIPBACKEND* pCtx, CLIPX11FORMAT target,
    2121                             void *closure);
     2204static void tstClipRequestData(CLIPBACKEND* pCtx, CLIPX11FORMAT target,
     2205                               void *closure);
    21222206#endif
    21232207
    2124 static int getSelectionValue(CLIPBACKEND *pCtx, CLIPX11FORMAT format,
    2125                              CLIPREADX11CBREQ *pReq)
     2208static int clipGetSelectionValue(CLIPBACKEND *pCtx, CLIPX11FORMAT format,
     2209                                 CLIPREADX11CBREQ *pReq)
    21262210{
    21272211#ifndef TESTCASE
    21282212    XtGetSelectionValue(pCtx->widget, clipGetAtom(pCtx, "CLIPBOARD"),
    21292213                        clipAtomForX11Format(pCtx, format),
    2130                         cbConvertX11CB,
     2214                        clipConvertDataFromX11Callback,
    21312215                        reinterpret_cast<XtPointer>(pReq),
    21322216                        CurrentTime);
    21332217#else
    2134     testRequestData(pCtx, format, (void *)pReq);
     2218    tstClipRequestData(pCtx, format, (void *)pReq);
    21352219#endif
    21362220
     
    21412225 * Worker function for ClipRequestDataFromX11 which runs on the event thread.
    21422226 */
    2143 static void vboxClipboardReadX11Worker(void *pUserData,
    2144                                        void * /* interval */)
    2145 {
    2146     AssertPtrReturnVoid(pUserData);
    2147 
    2148     CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pUserData;
    2149     CLIPBACKEND      *pCtx = pReq->mCtx;
     2227static void clipReadX11Worker(void *pvUserData, void * /* interval */)
     2228{
     2229    AssertPtrReturnVoid(pvUserData);
     2230
     2231    CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pvUserData;
     2232    CLIPBACKEND      *pCtx = pReq->mpCtx;
    21502233
    21512234    LogFlowFunc(("pReq->mFormat = %02X\n", pReq->mFormat));
     
    21592242        {
    21602243            /* Send out a request for the data to the current clipboard owner. */
    2161             rc = getSelectionValue(pCtx, pCtx->X11TextFormat, pReq);
     2244            rc = clipGetSelectionValue(pCtx, pCtx->X11TextFormat, pReq);
    21622245        }
    21632246    }
     
    21682251        {
    21692252            /* Send out a request for the data to the current clipboard owner. */
    2170             rc = getSelectionValue(pCtx, pCtx->X11BitmapFormat, pReq);
     2253            rc = clipGetSelectionValue(pCtx, pCtx->X11BitmapFormat, pReq);
    21712254        }
    21722255    }
     
    21772260        {
    21782261            /* Send out a request for the data to the current clipboard owner. */
    2179             rc = getSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq);
     2262            rc = clipGetSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq);
    21802263        }
    21812264    }
     
    21872270        {
    21882271            /* Send out a request for the data to the current clipboard owner. */
    2189             rc = getSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq);
     2272            rc = clipGetSelectionValue(pCtx, pCtx->X11URIListFormat, pReq);
    21902273        }
    21912274    }
     
    22002283        /* The clipboard callback was never scheduled, so we must signal
    22012284         * that the request processing is finished and clean up ourselves. */
    2202         ClipRequestFromX11CompleteCallback(pReq->mCtx->pFrontend, rc, pReq->mReq,
    2203                                            NULL, 0);
     2285        ClipRequestFromX11CompleteCallback(pReq->mpCtx->pFrontend, rc, pReq->mpReq,
     2286                                           NULL /* pv */ ,0 /* cb */);
    22042287        RTMemFree(pReq);
    22052288    }
     
    22342317    {
    22352318        pX11Req->mFormat = u32Format;
    2236         pX11Req->mCtx = pCtx;
    2237         pX11Req->mReq = pReq;
     2319        pX11Req->mpCtx  = pCtx;
     2320        pX11Req->mpReq  = pReq;
    22382321
    22392322        /* We use this to schedule a worker function on the event thread. */
    2240         clipQueueToEventThread(pCtx, vboxClipboardReadX11Worker, (XtPointer) pX11Req);
     2323        rc = clipQueueToEventThread(pCtx, clipReadX11Worker, (XtPointer)pX11Req);
    22412324    }
    22422325    else
    22432326        rc = VERR_NO_MEMORY;
    22442327
     2328    LogFlowFuncLeaveRC(rc);
    22452329    return rc;
    22462330}
     
    22612345/* For the purpose of the test case, we just execute the procedure to be
    22622346 * scheduled, as we are running single threaded. */
    2263 void testQueueToEventThread(void (*proc)(void *, void *),
    2264                             void *client_data)
     2347void tstClipQueueToEventThread(void (*proc)(void *, void *),
     2348                               void *client_data)
    22652349{
    22662350    proc(client_data, NULL);
     
    22682352
    22692353void XtFree(char *ptr)
    2270 { RTMemFree((void *) ptr); }
    2271 
    2272 /* The data in the simulated VBox clipboard */
    2273 static int g_vboxDataRC = VINF_SUCCESS;
    2274 static void *g_vboxDatapv = NULL;
    2275 static uint32_t g_vboxDatacb = 0;
     2354{
     2355    RTMemFree((void *)ptr);
     2356}
     2357
     2358/* The data in the simulated VBox clipboard. */
     2359static int g_tstVBoxDataRC = VINF_SUCCESS;
     2360static void *g_tstVBoxDataPv = NULL;
     2361static uint32_t g_tstVBoxDataCb = 0;
    22762362
    22772363/* Set empty data in the simulated VBox clipboard. */
    2278 static void clipEmptyVBox(CLIPBACKEND *pCtx, int retval)
    2279 {
    2280     g_vboxDataRC = retval;
    2281     RTMemFree(g_vboxDatapv);
    2282     g_vboxDatapv = NULL;
    2283     g_vboxDatacb = 0;
     2364static void tstClipEmptyVBox(CLIPBACKEND *pCtx, int retval)
     2365{
     2366    g_tstVBoxDataRC = retval;
     2367    RTMemFree(g_tstVBoxDataPv);
     2368    g_tstVBoxDataPv = NULL;
     2369    g_tstVBoxDataCb = 0;
    22842370    ClipAnnounceFormatToX11(pCtx, 0);
    22852371}
    22862372
    22872373/* Set the data in the simulated VBox clipboard. */
    2288 static int clipSetVBoxUtf16(CLIPBACKEND *pCtx, int retval,
    2289                             const char *pcszData, size_t cb)
     2374static int tstClipSetVBoxUtf16(CLIPBACKEND *pCtx, int retval,
     2375                               const char *pcszData, size_t cb)
    22902376{
    22912377    PRTUTF16 pwszData = NULL;
     
    22992385    if (pv == NULL)
    23002386        return VERR_NO_MEMORY;
    2301     if (g_vboxDatapv)
    2302         RTMemFree(g_vboxDatapv);
    2303     g_vboxDataRC = retval;
    2304     g_vboxDatapv = pv;
    2305     g_vboxDatacb = cb;
    2306     ClipAnnounceFormatToX11(pCtx,
    2307                                        VBOX_SHCL_FMT_UNICODETEXT);
     2387    if (g_tstVBoxDataPv)
     2388        RTMemFree(g_tstVBoxDataPv);
     2389    g_tstVBoxDataRC = retval;
     2390    g_tstVBoxDataPv = pv;
     2391    g_tstVBoxDataCb = cb;
     2392    ClipAnnounceFormatToX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT);
    23082393    return VINF_SUCCESS;
    23092394}
     
    23132398{
    23142399    RT_NOREF(pCtx, u32Format);
    2315     *pcb = g_vboxDatacb;
    2316     if (g_vboxDatapv != NULL)
    2317     {
    2318         void *pv = RTMemDup(g_vboxDatapv, g_vboxDatacb);
     2400    *pcb = g_tstVBoxDataCb;
     2401    if (g_tstVBoxDataPv != NULL)
     2402    {
     2403        void *pv = RTMemDup(g_tstVBoxDataPv, g_tstVBoxDataCb);
    23192404        *ppv = pv;
    2320         return pv != NULL ? g_vboxDataRC : VERR_NO_MEMORY;
     2405        return pv != NULL ? g_tstVBoxDataRC : VERR_NO_MEMORY;
    23212406    }
    23222407    *ppv = NULL;
    2323     return g_vboxDataRC;
    2324 }
    2325 
    2326 Display *XtDisplay(Widget w)
    2327 { NOREF(w); return (Display *) 0xffff; }
     2408    return g_tstVBoxDataRC;
     2409}
     2410
     2411Display *XtDisplay(Widget w) { NOREF(w); return (Display *) 0xffff; }
    23282412
    23292413void XtAppSetExitFlag(XtAppContext app_context) { NOREF(app_context); }
     
    23682452
    23692453/* Atoms we need other than the formats we support. */
    2370 static const char *g_apszSupAtoms[] =
     2454static const char *g_tstapszSupAtoms[] =
    23712455{
    23722456    "PRIMARY", "CLIPBOARD", "TARGETS", "MULTIPLE", "TIMESTAMP"
     
    23812465        if (!strcmp(pcsz, g_aFormats[i].pcszAtom))
    23822466            atom = (Atom) (i + 0x1000);
    2383     for (unsigned i = 0; i < RT_ELEMENTS(g_apszSupAtoms); ++i)
    2384         if (!strcmp(pcsz, g_apszSupAtoms[i]))
     2467    for (unsigned i = 0; i < RT_ELEMENTS(g_tstapszSupAtoms); ++i)
     2468        if (!strcmp(pcsz, g_tstapszSupAtoms[i]))
    23852469            atom = (Atom) (i + 0x2000);
    23862470    Assert(atom);  /* Have we missed any atoms? */
     
    23922476static size_t g_cTargets = 0;
    23932477
    2394 void testRequestTargets(CLIPBACKEND* pCtx)
     2478void tstRequestTargets(CLIPBACKEND* pCtx)
    23952479{
    23962480    clipUpdateX11Targets(pCtx, g_selTargets, g_cTargets);
     
    24042488static int g_selFormat = 0;
    24052489
    2406 void testRequestData(CLIPBACKEND *pCtx, CLIPX11FORMAT target, void *closure)
     2490void tstClipRequestData(CLIPBACKEND *pCtx, CLIPX11FORMAT target, void *closure)
    24072491{
    24082492    RT_NOREF(pCtx);
     
    24112495    if (target != g_selTargets[0])
    24122496    {
    2413         clipConvertX11CB(closure, NULL, 0); /* Could not convert to target. */
     2497        clipConvertDataFromX11CallbackWorker(closure, NULL, 0); /* Could not convert to target. */
    24142498        return;
    24152499    }
     
    24232507        format = 0;
    24242508    }
    2425     clipConvertX11CB(closure, pValue, count * format / 8);
     2509    clipConvertDataFromX11CallbackWorker(closure, pValue, count * format / 8);
    24262510    if (pValue)
    24272511        RTMemFree(pValue);
     
    24372521}
    24382522
    2439 static uint32_t clipQueryFormats()
     2523static uint32_t tstClipQueryFormats(void)
    24402524{
    24412525    return g_fX11Formats;
    24422526}
    24432527
    2444 static void clipInvalidateFormats()
     2528static void tstClipInvalidateFormats(void)
    24452529{
    24462530    g_fX11Formats = ~0;
     
    24822566
    24832567/* Request the shared clipboard to convert its data to a given format. */
    2484 static bool clipConvertSelection(const char *pcszTarget, Atom *type,
    2485                                  XtPointer *value, unsigned long *length,
    2486                                  int *format)
     2568static bool tstClipConvertSelection(const char *pcszTarget, Atom *type,
     2569                                    XtPointer *value, unsigned long *length,
     2570                                    int *format)
    24872571{
    24882572    Atom target = XInternAtom(NULL, pcszTarget, 0);
     
    25082592
    25092593/* Set the current X selection data */
    2510 static void clipSetSelectionValues(const char *pcszTarget, Atom type,
    2511                                    const void *data,
    2512                                    unsigned long count, int format)
     2594static void tstClipSetSelectionValues(const char *pcszTarget, Atom type,
     2595                                      const void *data,
     2596                                      unsigned long count, int format)
    25132597{
    25142598    Atom clipAtom = XInternAtom(NULL, "CLIPBOARD", 0);
     
    25242608}
    25252609
    2526 static void clipSendTargetUpdate(CLIPBACKEND *pCtx)
    2527 {
    2528     clipQueryX11CBFormats(pCtx);
    2529 }
    2530 
    2531 /* Configure if and how the X11 TARGETS clipboard target will fail */
    2532 static void clipSetTargetsFailure(void)
     2610static void tstClipSendTargetUpdate(CLIPBACKEND *pCtx)
     2611{
     2612    clipQueryX11FormatsCallback(pCtx);
     2613}
     2614
     2615/* Configure if and how the X11 TARGETS clipboard target will fail. */
     2616static void tstClipSetTargetsFailure(void)
    25332617{
    25342618    g_cTargets = 0;
     
    25532637    {
    25542638        unsigned index = atom - 0x2000;
    2555         AssertReturn(index < RT_ELEMENTS(g_apszSupAtoms), NULL);
    2556         pcszName = g_apszSupAtoms[index];
     2639        AssertReturn(index < RT_ELEMENTS(g_tstapszSupAtoms), NULL);
     2640        pcszName = g_tstapszSupAtoms[index];
    25572641    }
    25582642    return (char *)RTMemDup(pcszName, sizeof(pcszName) + 1);
     
    25942678}
    25952679
    2596 static void clipGetCompletedRequest(int *prc, char ** ppc, uint32_t *pcb, CLIPREADCBREQ **ppReq)
     2680static void tstClipGetCompletedRequest(int *prc, char ** ppc, uint32_t *pcb, CLIPREADCBREQ **ppReq)
    25972681{
    25982682    *prc = g_completedRC;
     
    26202704#endif
    26212705
    2622 static void testStringFromX11(RTTEST hTest, CLIPBACKEND *pCtx,
    2623                               const char *pcszExp, int rcExp)
     2706static void tstStringFromX11(RTTEST hTest, CLIPBACKEND *pCtx,
     2707                             const char *pcszExp, int rcExp)
    26242708{
    26252709    bool retval = true;
    2626     clipSendTargetUpdate(pCtx);
    2627     if (clipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)
     2710    tstClipSendTargetUpdate(pCtx);
     2711    if (tstClipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)
    26282712        RTTestFailed(hTest, "Wrong targets reported: %02X\n",
    2629                      clipQueryFormats());
     2713                     tstClipQueryFormats());
    26302714    else
    26312715    {
     
    26352719        int rc = VINF_SUCCESS;
    26362720        uint32_t cbActual = 0;
    2637         clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
     2721        tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    26382722        if (rc != rcExp)
    26392723            RTTestFailed(hTest, "Wrong return code, expected %Rrc, got %Rrc\n",
     
    26772761}
    26782762
    2679 static void testLatin1FromX11(RTTEST hTest, CLIPBACKEND *pCtx,
    2680                               const char *pcszExp, int rcExp)
     2763static void tstLatin1FromX11(RTTEST hTest, CLIPBACKEND *pCtx,
     2764                             const char *pcszExp, int rcExp)
    26812765{
    26822766    bool retval = false;
    2683     clipSendTargetUpdate(pCtx);
    2684     if (clipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)
     2767    tstClipSendTargetUpdate(pCtx);
     2768    if (tstClipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)
    26852769        RTTestFailed(hTest, "Wrong targets reported: %02X\n",
    2686                      clipQueryFormats());
     2770                     tstClipQueryFormats());
    26872771    else
    26882772    {
     
    26922776        int rc = VINF_SUCCESS;
    26932777        uint32_t cbActual = 0;
    2694         clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
     2778        tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    26952779        if (rc != rcExp)
    26962780            RTTestFailed(hTest, "Wrong return code, expected %Rrc, got %Rrc\n",
     
    27302814}
    27312815
    2732 static void testStringFromVBox(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget, Atom typeExp,  const char *valueExp)
     2816static void tstStringFromVBox(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget, Atom typeExp,  const char *valueExp)
    27332817{
    27342818    RT_NOREF(pCtx);
     
    27392823    int format;
    27402824    size_t lenExp = strlen(valueExp);
    2741     if (clipConvertSelection(pcszTarget, &type, &value, &length, &format))
     2825    if (tstClipConvertSelection(pcszTarget, &type, &value, &length, &format))
    27422826    {
    27432827        if (   type != typeExp
     
    27622846}
    27632847
    2764 static void testNoX11(CLIPBACKEND *pCtx, const char *pcszTestCtx)
     2848static void tstNoX11(CLIPBACKEND *pCtx, const char *pcszTestCtx)
    27652849{
    27662850    CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq;
     
    27692853}
    27702854
    2771 static void testStringFromVBoxFailed(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget)
     2855static void tstStringFromVBoxFailed(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget)
    27722856{
    27732857    RT_NOREF(pCtx);
     
    27762860    unsigned long length;
    27772861    int format;
    2778     RTTEST_CHECK_MSG(hTest, !clipConvertSelection(pcszTarget, &type, &value,
    2779                                                   &length, &format),
     2862    RTTEST_CHECK_MSG(hTest, !tstClipConvertSelection(pcszTarget, &type, &value,
     2863                                                     &length, &format),
    27802864                     (hTest, "Conversion to target %s, should have failed but didn't, returned type %d, length %u, format %d, value \"%.*s\"\n",
    27812865                      pcszTarget, type, length, format, RT_MIN(length, 20),
     
    27842868}
    27852869
    2786 static void testNoSelectionOwnership(CLIPBACKEND *pCtx, const char *pcszTestCtx)
     2870static void tstNoSelectionOwnership(CLIPBACKEND *pCtx, const char *pcszTestCtx)
    27872871{
    27882872    RT_NOREF(pCtx);
     
    27902874}
    27912875
    2792 static void testBadFormatRequestFromHost(RTTEST hTest, CLIPBACKEND *pCtx)
    2793 {
    2794     clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
     2876static void tstBadFormatRequestFromHost(RTTEST hTest, CLIPBACKEND *pCtx)
     2877{
     2878    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
    27952879                           sizeof("hello world"), 8);
    2796     clipSendTargetUpdate(pCtx);
    2797     if (clipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)
     2880    tstClipSendTargetUpdate(pCtx);
     2881    if (tstClipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)
    27982882        RTTestFailed(hTest, "Wrong targets reported: %02X\n",
    2799                      clipQueryFormats());
     2883                     tstClipQueryFormats());
    28002884    else
    28012885    {
     
    28052889        int rc = VINF_SUCCESS;
    28062890        uint32_t cbActual = 0;
    2807         clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
     2891        tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    28082892        if (rc != VERR_NOT_IMPLEMENTED)
    28092893            RTTestFailed(hTest, "Wrong return code, expected VERR_NOT_IMPLEMENTED, got %Rrc\n",
    28102894                         rc);
    2811         clipSetSelectionValues("", XA_STRING, "", sizeof(""), 8);
    2812         clipSendTargetUpdate(pCtx);
    2813         if (clipQueryFormats() == VBOX_SHCL_FMT_UNICODETEXT)
     2895        tstClipSetSelectionValues("", XA_STRING, "", sizeof(""), 8);
     2896        tstClipSendTargetUpdate(pCtx);
     2897        if (tstClipQueryFormats() == VBOX_SHCL_FMT_UNICODETEXT)
    28142898            RTTestFailed(hTest, "Failed to report targets after bad host request.\n");
    28152899    }
     
    28372921    AssertRCReturn(rc, 1);
    28382922
    2839     /*** Utf-8 from X11 ***/
    2840     RTTestSub(hTest, "reading Utf-8 from X11");
     2923    /*** UTF-8 from X11 ***/
     2924    RTTestSub(hTest, "reading UTF-8 from X11");
    28412925    /* Simple test */
    2842     clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
    2843                            sizeof("hello world"), 8);
    2844     testStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);
     2926    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
     2927                              sizeof("hello world"), 8);
     2928    tstStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);
    28452929    /* With an embedded carriage return */
    2846     clipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
    2847                            "hello\nworld", sizeof("hello\nworld"), 8);
    2848     testStringFromX11(hTest, pCtx, "hello\r\nworld", VINF_SUCCESS);
     2930    tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
     2931                              "hello\nworld", sizeof("hello\nworld"), 8);
     2932    tstStringFromX11(hTest, pCtx, "hello\r\nworld", VINF_SUCCESS);
    28492933    /* With an embedded CRLF */
    2850     clipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
    2851                            "hello\r\nworld", sizeof("hello\r\nworld"), 8);
    2852     testStringFromX11(hTest, pCtx, "hello\r\r\nworld", VINF_SUCCESS);
     2934    tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
     2935                              "hello\r\nworld", sizeof("hello\r\nworld"), 8);
     2936    tstStringFromX11(hTest, pCtx, "hello\r\r\nworld", VINF_SUCCESS);
    28532937    /* With an embedded LFCR */
    2854     clipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
    2855                            "hello\n\rworld", sizeof("hello\n\rworld"), 8);
    2856     testStringFromX11(hTest, pCtx, "hello\r\n\rworld", VINF_SUCCESS);
     2938    tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
     2939                              "hello\n\rworld", sizeof("hello\n\rworld"), 8);
     2940    tstStringFromX11(hTest, pCtx, "hello\r\n\rworld", VINF_SUCCESS);
    28572941    /* An empty string */
    2858     clipSetSelectionValues("text/plain;charset=utf-8", XA_STRING, "",
    2859                            sizeof(""), 8);
    2860     testStringFromX11(hTest, pCtx, "", VINF_SUCCESS);
    2861     /* With an embedded Utf-8 character. */
    2862     clipSetSelectionValues("STRING", XA_STRING,
    2863                            "100\xE2\x82\xAC" /* 100 Euro */,
    2864                            sizeof("100\xE2\x82\xAC"), 8);
    2865     testStringFromX11(hTest, pCtx, "100\xE2\x82\xAC", VINF_SUCCESS);
     2942    tstClipSetSelectionValues("text/plain;charset=utf-8", XA_STRING, "",
     2943                              sizeof(""), 8);
     2944    tstStringFromX11(hTest, pCtx, "", VINF_SUCCESS);
     2945    /* With an embedded UTF-8 character. */
     2946    tstClipSetSelectionValues("STRING", XA_STRING,
     2947                              "100\xE2\x82\xAC" /* 100 Euro */,
     2948                              sizeof("100\xE2\x82\xAC"), 8);
     2949    tstStringFromX11(hTest, pCtx, "100\xE2\x82\xAC", VINF_SUCCESS);
    28662950    /* A non-zero-terminated string */
    2867     clipSetSelectionValues("TEXT", XA_STRING,
    2868                            "hello world", sizeof("hello world") - 1, 8);
    2869     testStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);
     2951    tstClipSetSelectionValues("TEXT", XA_STRING,
     2952                              "hello world", sizeof("hello world") - 1, 8);
     2953    tstStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);
    28702954
    28712955    /*** Latin1 from X11 ***/
    28722956    RTTestSub(hTest, "reading Latin1 from X11");
    28732957    /* Simple test */
    2874     clipSetSelectionValues("STRING", XA_STRING, "Georges Dupr\xEA",
    2875                            sizeof("Georges Dupr\xEA"), 8);
    2876     testLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA", VINF_SUCCESS);
     2958    tstClipSetSelectionValues("STRING", XA_STRING, "Georges Dupr\xEA",
     2959                              sizeof("Georges Dupr\xEA"), 8);
     2960    tstLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA", VINF_SUCCESS);
    28772961    /* With an embedded carriage return */
    2878     clipSetSelectionValues("TEXT", XA_STRING, "Georges\nDupr\xEA",
    2879                            sizeof("Georges\nDupr\xEA"), 8);
    2880     testLatin1FromX11(hTest, pCtx, "Georges\r\nDupr\xEA", VINF_SUCCESS);
     2962    tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\nDupr\xEA",
     2963                              sizeof("Georges\nDupr\xEA"), 8);
     2964    tstLatin1FromX11(hTest, pCtx, "Georges\r\nDupr\xEA", VINF_SUCCESS);
    28812965    /* With an embedded CRLF */
    2882     clipSetSelectionValues("TEXT", XA_STRING, "Georges\r\nDupr\xEA",
    2883                            sizeof("Georges\r\nDupr\xEA"), 8);
    2884     testLatin1FromX11(hTest, pCtx, "Georges\r\r\nDupr\xEA", VINF_SUCCESS);
     2966    tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\r\nDupr\xEA",
     2967                              sizeof("Georges\r\nDupr\xEA"), 8);
     2968    tstLatin1FromX11(hTest, pCtx, "Georges\r\r\nDupr\xEA", VINF_SUCCESS);
    28852969    /* With an embedded LFCR */
    2886     clipSetSelectionValues("TEXT", XA_STRING, "Georges\n\rDupr\xEA",
    2887                            sizeof("Georges\n\rDupr\xEA"), 8);
    2888     testLatin1FromX11(hTest, pCtx, "Georges\r\n\rDupr\xEA", VINF_SUCCESS);
     2970    tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\n\rDupr\xEA",
     2971                              sizeof("Georges\n\rDupr\xEA"), 8);
     2972    tstLatin1FromX11(hTest, pCtx, "Georges\r\n\rDupr\xEA", VINF_SUCCESS);
    28892973    /* A non-zero-terminated string */
    2890     clipSetSelectionValues("text/plain", XA_STRING,
    2891                            "Georges Dupr\xEA!",
    2892                            sizeof("Georges Dupr\xEA!") - 1, 8);
    2893     testLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA!", VINF_SUCCESS);
     2974    tstClipSetSelectionValues("text/plain", XA_STRING,
     2975                              "Georges Dupr\xEA!",
     2976                              sizeof("Georges Dupr\xEA!") - 1, 8);
     2977    tstLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA!", VINF_SUCCESS);
    28942978
    28952979    /*** Unknown X11 format ***/
    28962980    RTTestSub(hTest, "handling of an unknown X11 format");
    2897     clipInvalidateFormats();
    2898     clipSetSelectionValues("CLIPBOARD", XA_STRING, "Test",
    2899                            sizeof("Test"), 8);
    2900     clipSendTargetUpdate(pCtx);
    2901     RTTEST_CHECK_MSG(hTest, clipQueryFormats() == 0,
     2981    tstClipInvalidateFormats();
     2982    tstClipSetSelectionValues("CLIPBOARD", XA_STRING, "Test",
     2983                              sizeof("Test"), 8);
     2984    tstClipSendTargetUpdate(pCtx);
     2985    RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0,
    29022986                     (hTest, "Failed to send a format update notification\n"));
    29032987
    29042988    /*** Timeout from X11 ***/
    29052989    RTTestSub(hTest, "X11 timeout");
    2906     clipSetSelectionValues("UTF8_STRING", XT_CONVERT_FAIL, NULL,0, 8);
    2907     testStringFromX11(hTest, pCtx, "", VERR_NO_DATA);
     2990    tstClipSetSelectionValues("UTF8_STRING", XT_CONVERT_FAIL, NULL,0, 8);
     2991    tstStringFromX11(hTest, pCtx, "", VERR_NO_DATA);
    29082992
    29092993    /*** No data in X11 clipboard ***/
    29102994    RTTestSub(hTest, "a data request from an empty X11 clipboard");
    2911     clipSetSelectionValues("UTF8_STRING", XA_STRING, NULL,
    2912                            0, 8);
     2995    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, NULL,
     2996                              0, 8);
    29132997    ClipRequestDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
    2914     clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
     2998    tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    29152999    RTTEST_CHECK_MSG(hTest, rc == VERR_NO_DATA,
    29163000                     (hTest, "Returned %Rrc instead of VERR_NO_DATA\n",
     
    29223006    /*** Ensure that VBox is notified when we return the CB to X11 ***/
    29233007    RTTestSub(hTest, "notification of switch to X11 clipboard");
    2924     clipInvalidateFormats();
     3008    tstClipInvalidateFormats();
    29253009    clipReportEmptyX11CB(pCtx);
    2926     RTTEST_CHECK_MSG(hTest, clipQueryFormats() == 0,
     3010    RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0,
    29273011                     (hTest, "Failed to send a format update (release) notification\n"));
    29283012
     
    29303014    RTTestSub(hTest, "a request for an invalid VBox format from X11");
    29313015    ClipRequestDataFromX11(pCtx, 0xffff, pReq);
    2932     clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
     3016    tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    29333017    RTTEST_CHECK_MSG(hTest, rc == VERR_NOT_IMPLEMENTED,
    29343018                     (hTest, "Returned %Rrc instead of VERR_NOT_IMPLEMENTED\n",
     
    29403024    /*** Targets failure from X11 ***/
    29413025    RTTestSub(hTest, "X11 targets conversion failure");
    2942     clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
    2943                            sizeof("hello world"), 8);
    2944     clipSetTargetsFailure();
     3026    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
     3027                              sizeof("hello world"), 8);
     3028    tstClipSetTargetsFailure();
    29453029    Atom atom = XA_STRING;
    29463030    long unsigned int cLen = 0;
    29473031    int format = 8;
    2948     clipConvertX11Targets(NULL, (XtPointer) pCtx, NULL, &atom, NULL, &cLen,
     3032    clipConvertX11TargetsCallback(NULL, (XtPointer) pCtx, NULL, &atom, NULL, &cLen,
    29493033                          &format);
    2950     RTTEST_CHECK_MSG(hTest, clipQueryFormats() == 0,
     3034    RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0,
    29513035                     (hTest, "Wrong targets reported: %02X\n",
    2952                       clipQueryFormats()));
     3036                      tstClipQueryFormats()));
    29533037
    29543038    /*** X11 text format conversion ***/
    29553039    RTTestSub(hTest, "handling of X11 selection targets");
    2956     RTTEST_CHECK_MSG(hTest, clipTestTextFormatConversion(pCtx),
     3040    RTTEST_CHECK_MSG(hTest, tstClipTextFormatConversion(pCtx),
    29573041                     (hTest, "failed to select the right X11 text formats\n"));
    29583042
    2959     /*** Utf-8 from VBox ***/
    2960     RTTestSub(hTest, "reading Utf-8 from VBox");
     3043    /*** UTF-8 from VBox ***/
     3044    RTTestSub(hTest, "reading UTF-8 from VBox");
    29613045    /* Simple test */
    2962     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
    2963                      sizeof("hello world") * 2);
    2964     testStringFromVBox(hTest, pCtx, "UTF8_STRING",
    2965                        clipGetAtom(pCtx, "UTF8_STRING"), "hello world");
     3046    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
     3047                        sizeof("hello world") * 2);
     3048    tstStringFromVBox(hTest, pCtx, "UTF8_STRING",
     3049                      clipGetAtom(pCtx, "UTF8_STRING"), "hello world");
    29663050    /* With an embedded carriage return */
    2967     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\nworld",
    2968                      sizeof("hello\r\nworld") * 2);
    2969     testStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
    2970                        clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
    2971                        "hello\nworld");
     3051    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\nworld",
     3052                        sizeof("hello\r\nworld") * 2);
     3053    tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
     3054                      clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
     3055                      "hello\nworld");
    29723056    /* With an embedded CRCRLF */
    2973     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\r\nworld",
    2974                      sizeof("hello\r\r\nworld") * 2);
    2975     testStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
    2976                        clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
    2977                        "hello\r\nworld");
     3057    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\r\nworld",
     3058                        sizeof("hello\r\r\nworld") * 2);
     3059    tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
     3060                      clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
     3061                      "hello\r\nworld");
    29783062    /* With an embedded CRLFCR */
    2979     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\n\rworld",
    2980                      sizeof("hello\r\n\rworld") * 2);
    2981     testStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
    2982                        clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
    2983                        "hello\n\rworld");
     3063    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\n\rworld",
     3064                        sizeof("hello\r\n\rworld") * 2);
     3065    tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
     3066                      clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
     3067                      "hello\n\rworld");
    29843068    /* An empty string */
    2985     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);
    2986     testStringFromVBox(hTest, pCtx, "text/plain;charset=utf-8",
    2987                        clipGetAtom(pCtx, "text/plain;charset=utf-8"), "");
    2988     /* With an embedded Utf-8 character. */
    2989     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "100\xE2\x82\xAC" /* 100 Euro */,
    2990                      10);
    2991     testStringFromVBox(hTest, pCtx, "STRING",
    2992                        clipGetAtom(pCtx, "STRING"), "100\xE2\x82\xAC");
     3069    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);
     3070    tstStringFromVBox(hTest, pCtx, "text/plain;charset=utf-8",
     3071                      clipGetAtom(pCtx, "text/plain;charset=utf-8"), "");
     3072    /* With an embedded UTF-8 character. */
     3073    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "100\xE2\x82\xAC" /* 100 Euro */,
     3074                        10);
     3075    tstStringFromVBox(hTest, pCtx, "STRING",
     3076                      clipGetAtom(pCtx, "STRING"), "100\xE2\x82\xAC");
    29933077    /* A non-zero-terminated string */
    2994     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
    2995                      sizeof("hello world") * 2 - 2);
    2996     testStringFromVBox(hTest, pCtx, "TEXT", clipGetAtom(pCtx, "TEXT"),
    2997                        "hello world");
     3078    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
     3079                        sizeof("hello world") * 2 - 2);
     3080    tstStringFromVBox(hTest, pCtx, "TEXT", clipGetAtom(pCtx, "TEXT"),
     3081                     "hello world");
    29983082
    29993083    /*** Timeout from VBox ***/
    30003084    RTTestSub(hTest, "reading from VBox with timeout");
    3001     clipEmptyVBox(pCtx, VERR_TIMEOUT);
    3002     testStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
     3085    tstClipEmptyVBox(pCtx, VERR_TIMEOUT);
     3086    tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
    30033087
    30043088    /*** No data in VBox clipboard ***/
    30053089    RTTestSub(hTest, "an empty VBox clipboard");
    3006     clipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
    3007     clipEmptyVBox(pCtx, VINF_SUCCESS);
     3090    tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
     3091    tstClipEmptyVBox(pCtx, VINF_SUCCESS);
    30083092    RTTEST_CHECK_MSG(hTest, g_ownsSel,
    30093093                     (hTest, "VBox grabbed the clipboard with no data and we ignored it\n"));
    3010     testStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
     3094    tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
    30113095
    30123096    /*** An unknown VBox format ***/
    30133097    RTTestSub(hTest, "reading an unknown VBox format");
    3014     clipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
    3015     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);
     3098    tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
     3099    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);
    30163100    ClipAnnounceFormatToX11(pCtx, 0xa0000);
    30173101    RTTEST_CHECK_MSG(hTest, g_ownsSel,
    30183102                     (hTest, "VBox grabbed the clipboard with unknown data and we ignored it\n"));
    3019     testStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
     3103    tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
    30203104
    30213105    /*** VBox requests a bad format ***/
    30223106    RTTestSub(hTest, "recovery from a bad format request");
    3023     testBadFormatRequestFromHost(hTest, pCtx);
     3107    tstBadFormatRequestFromHost(hTest, pCtx);
    30243108
    30253109    rc = ClipStopX11(pCtx);
     
    30363120    RTTestSub(hTest, "reading from X11, headless clipboard");
    30373121    /* Simple test */
    3038     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "",
    3039                      sizeof("") * 2);
    3040     clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
    3041                            sizeof("hello world"), 8);
    3042     testNoX11(pCtx, "reading from X11, headless clipboard");
     3122    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "",
     3123                        sizeof("") * 2);
     3124    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
     3125                              sizeof("hello world"), 8);
     3126    tstNoX11(pCtx, "reading from X11, headless clipboard");
    30433127
    30443128    /*** Read from VBox ***/
    30453129    RTTestSub(hTest, "reading from VBox, headless clipboard");
    30463130    /* Simple test */
    3047     clipEmptyVBox(pCtx, VERR_WRONG_ORDER);
    3048     clipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
    3049     clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
    3050                      sizeof("hello world") * 2);
    3051     testNoSelectionOwnership(pCtx, "reading from VBox, headless clipboard");
     3131    tstClipEmptyVBox(pCtx, VERR_WRONG_ORDER);
     3132    tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
     3133    tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
     3134                        sizeof("hello world") * 2);
     3135    tstNoSelectionOwnership(pCtx, "reading from VBox, headless clipboard");
    30523136
    30533137    rc = ClipStopX11(pCtx);
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