VirtualBox

Changeset 82157 in vbox


Ignore:
Timestamp:
Nov 25, 2019 8:59:10 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134967
Message:

Shared Clipboard: Build fix.

File:
1 edited

Legend:

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

    r82156 r82157  
    28862886     * Run the test.
    28872887     */
    2888     PSHCLX11CTX pCtx = ShClX11Init(NULL, false);
     2888    SHCLX11CTX X11Ctx;
     2889    rc = ShClX11Init(&X11Ctx, NULL, false);
     2890    AssertRCReturn(rc, 1);
    28892891    char *pc;
    28902892    uint32_t cbActual;
    28912893    CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq, *pReqRet = NULL;
    2892     rc = ShClX11ThreadStart(pCtx, false /* fGrab */);
     2894    rc = ShClX11ThreadStart(&X11Ctx, false /* fGrab */);
    28932895    AssertRCReturn(rc, 1);
    28942896
     
    28982900    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
    28992901                              sizeof("hello world"), 8);
    2900     tstStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);
     2902    tstStringFromX11(hTest, &X11Ctx, "hello world", VINF_SUCCESS);
    29012903    /* With an embedded carriage return */
    29022904    tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
    29032905                              "hello\nworld", sizeof("hello\nworld"), 8);
    2904     tstStringFromX11(hTest, pCtx, "hello\r\nworld", VINF_SUCCESS);
     2906    tstStringFromX11(hTest, &X11Ctx, "hello\r\nworld", VINF_SUCCESS);
    29052907    /* With an embedded CRLF */
    29062908    tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
    29072909                              "hello\r\nworld", sizeof("hello\r\nworld"), 8);
    2908     tstStringFromX11(hTest, pCtx, "hello\r\r\nworld", VINF_SUCCESS);
     2910    tstStringFromX11(hTest, &X11Ctx, "hello\r\r\nworld", VINF_SUCCESS);
    29092911    /* With an embedded LFCR */
    29102912    tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,
    29112913                              "hello\n\rworld", sizeof("hello\n\rworld"), 8);
    2912     tstStringFromX11(hTest, pCtx, "hello\r\n\rworld", VINF_SUCCESS);
     2914    tstStringFromX11(hTest, &X11Ctx, "hello\r\n\rworld", VINF_SUCCESS);
    29132915    /* An empty string */
    29142916    tstClipSetSelectionValues("text/plain;charset=utf-8", XA_STRING, "",
    29152917                              sizeof(""), 8);
    2916     tstStringFromX11(hTest, pCtx, "", VINF_SUCCESS);
     2918    tstStringFromX11(hTest, &X11Ctx, "", VINF_SUCCESS);
    29172919    /* With an embedded UTF-8 character. */
    29182920    tstClipSetSelectionValues("STRING", XA_STRING,
    29192921                              "100\xE2\x82\xAC" /* 100 Euro */,
    29202922                              sizeof("100\xE2\x82\xAC"), 8);
    2921     tstStringFromX11(hTest, pCtx, "100\xE2\x82\xAC", VINF_SUCCESS);
     2923    tstStringFromX11(hTest, &X11Ctx, "100\xE2\x82\xAC", VINF_SUCCESS);
    29222924    /* A non-zero-terminated string */
    29232925    tstClipSetSelectionValues("TEXT", XA_STRING,
    29242926                              "hello world", sizeof("hello world") - 1, 8);
    2925     tstStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);
     2927    tstStringFromX11(hTest, &X11Ctx, "hello world", VINF_SUCCESS);
    29262928
    29272929    /*** Latin1 from X11 ***/
     
    29302932    tstClipSetSelectionValues("STRING", XA_STRING, "Georges Dupr\xEA",
    29312933                              sizeof("Georges Dupr\xEA"), 8);
    2932     tstLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA", VINF_SUCCESS);
     2934    tstLatin1FromX11(hTest, &X11Ctx, "Georges Dupr\xEA", VINF_SUCCESS);
    29332935    /* With an embedded carriage return */
    29342936    tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\nDupr\xEA",
    29352937                              sizeof("Georges\nDupr\xEA"), 8);
    2936     tstLatin1FromX11(hTest, pCtx, "Georges\r\nDupr\xEA", VINF_SUCCESS);
     2938    tstLatin1FromX11(hTest, &X11Ctx, "Georges\r\nDupr\xEA", VINF_SUCCESS);
    29372939    /* With an embedded CRLF */
    29382940    tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\r\nDupr\xEA",
    29392941                              sizeof("Georges\r\nDupr\xEA"), 8);
    2940     tstLatin1FromX11(hTest, pCtx, "Georges\r\r\nDupr\xEA", VINF_SUCCESS);
     2942    tstLatin1FromX11(hTest, &X11Ctx, "Georges\r\r\nDupr\xEA", VINF_SUCCESS);
    29412943    /* With an embedded LFCR */
    29422944    tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\n\rDupr\xEA",
    29432945                              sizeof("Georges\n\rDupr\xEA"), 8);
    2944     tstLatin1FromX11(hTest, pCtx, "Georges\r\n\rDupr\xEA", VINF_SUCCESS);
     2946    tstLatin1FromX11(hTest, &X11Ctx, "Georges\r\n\rDupr\xEA", VINF_SUCCESS);
    29452947    /* A non-zero-terminated string */
    29462948    tstClipSetSelectionValues("text/plain", XA_STRING,
    29472949                              "Georges Dupr\xEA!",
    29482950                              sizeof("Georges Dupr\xEA!") - 1, 8);
    2949     tstLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA!", VINF_SUCCESS);
     2951    tstLatin1FromX11(hTest, &X11Ctx, "Georges Dupr\xEA!", VINF_SUCCESS);
    29502952
    29512953    /*** Unknown X11 format ***/
     
    29542956    tstClipSetSelectionValues("CLIPBOARD", XA_STRING, "Test",
    29552957                              sizeof("Test"), 8);
    2956     tstClipSendTargetUpdate(pCtx);
     2958    tstClipSendTargetUpdate(&X11Ctx);
    29572959    RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0,
    29582960                     (hTest, "Failed to send a format update notification\n"));
     
    29612963    RTTestSub(hTest, "X11 timeout");
    29622964    tstClipSetSelectionValues("UTF8_STRING", XT_CONVERT_FAIL, NULL,0, 8);
    2963     tstStringFromX11(hTest, pCtx, "", VERR_NO_DATA);
     2965    tstStringFromX11(hTest, &X11Ctx, "", VERR_NO_DATA);
    29642966
    29652967    /*** No data in X11 clipboard ***/
     
    29672969    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, NULL,
    29682970                              0, 8);
    2969     ShClX11ReadDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
     2971    ShClX11ReadDataFromX11(&X11Ctx, VBOX_SHCL_FMT_UNICODETEXT, pReq);
    29702972    tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    29712973    RTTEST_CHECK_MSG(hTest, rc == VERR_NO_DATA,
     
    29792981    RTTestSub(hTest, "notification of switch to X11 clipboard");
    29802982    tstClipInvalidateFormats();
    2981     clipReportEmptyX11CB(pCtx);
     2983    clipReportEmptyX11CB(&X11Ctx);
    29822984    RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0,
    29832985                     (hTest, "Failed to send a format update (release) notification\n"));
     
    29852987    /*** request for an invalid VBox format from X11 ***/
    29862988    RTTestSub(hTest, "a request for an invalid VBox format from X11");
    2987     ShClX11ReadDataFromX11(pCtx, 0xffff, pReq);
     2989    ShClX11ReadDataFromX11(&X11Ctx, 0xffff, pReq);
    29882990    tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);
    29892991    RTTEST_CHECK_MSG(hTest, rc == VERR_NOT_IMPLEMENTED,
     
    30023004    long unsigned int cLen = 0;
    30033005    int format = 8;
    3004     clipConvertX11TargetsCallback(NULL, (XtPointer) pCtx, NULL, &atom, NULL, &cLen,
     3006    clipConvertX11TargetsCallback(NULL, (XtPointer) &X11Ctx, NULL, &atom, NULL, &cLen,
    30053007                                  &format);
    30063008    RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0,
     
    30103012    /*** X11 text format conversion ***/
    30113013    RTTestSub(hTest, "handling of X11 selection targets");
    3012     RTTEST_CHECK_MSG(hTest, tstClipTextFormatConversion(pCtx),
     3014    RTTEST_CHECK_MSG(hTest, tstClipTextFormatConversion(&X11Ctx),
    30133015                     (hTest, "failed to select the right X11 text formats\n"));
    30143016
     
    30163018    RTTestSub(hTest, "reading UTF-8 from VBox");
    30173019    /* Simple test */
    3018     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
     3020    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "hello world",
    30193021                        sizeof("hello world") * 2);
    3020     tstStringFromVBox(hTest, pCtx, "UTF8_STRING",
    3021                       clipGetAtom(pCtx, "UTF8_STRING"), "hello world");
     3022    tstStringFromVBox(hTest, &X11Ctx, "UTF8_STRING",
     3023                      clipGetAtom(&X11Ctx, "UTF8_STRING"), "hello world");
    30223024    /* With an embedded carriage return */
    3023     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\nworld",
     3025    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "hello\r\nworld",
    30243026                        sizeof("hello\r\nworld") * 2);
    3025     tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
    3026                       clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
     3027    tstStringFromVBox(hTest, &X11Ctx, "text/plain;charset=UTF-8",
     3028                      clipGetAtom(&X11Ctx, "text/plain;charset=UTF-8"),
    30273029                      "hello\nworld");
    30283030    /* With an embedded CRCRLF */
    3029     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\r\nworld",
     3031    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "hello\r\r\nworld",
    30303032                        sizeof("hello\r\r\nworld") * 2);
    3031     tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
    3032                       clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
     3033    tstStringFromVBox(hTest, &X11Ctx, "text/plain;charset=UTF-8",
     3034                      clipGetAtom(&X11Ctx, "text/plain;charset=UTF-8"),
    30333035                      "hello\r\nworld");
    30343036    /* With an embedded CRLFCR */
    3035     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\n\rworld",
     3037    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "hello\r\n\rworld",
    30363038                        sizeof("hello\r\n\rworld") * 2);
    3037     tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",
    3038                       clipGetAtom(pCtx, "text/plain;charset=UTF-8"),
     3039    tstStringFromVBox(hTest, &X11Ctx, "text/plain;charset=UTF-8",
     3040                      clipGetAtom(&X11Ctx, "text/plain;charset=UTF-8"),
    30393041                      "hello\n\rworld");
    30403042    /* An empty string */
    3041     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);
    3042     tstStringFromVBox(hTest, pCtx, "text/plain;charset=utf-8",
    3043                       clipGetAtom(pCtx, "text/plain;charset=utf-8"), "");
     3043    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "", 2);
     3044    tstStringFromVBox(hTest, &X11Ctx, "text/plain;charset=utf-8",
     3045                      clipGetAtom(&X11Ctx, "text/plain;charset=utf-8"), "");
    30443046    /* With an embedded UTF-8 character. */
    3045     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "100\xE2\x82\xAC" /* 100 Euro */,
     3047    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "100\xE2\x82\xAC" /* 100 Euro */,
    30463048                        10);
    3047     tstStringFromVBox(hTest, pCtx, "STRING",
    3048                       clipGetAtom(pCtx, "STRING"), "100\xE2\x82\xAC");
     3049    tstStringFromVBox(hTest, &X11Ctx, "STRING",
     3050                      clipGetAtom(&X11Ctx, "STRING"), "100\xE2\x82\xAC");
    30493051    /* A non-zero-terminated string */
    3050     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
     3052    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "hello world",
    30513053                        sizeof("hello world") * 2 - 2);
    3052     tstStringFromVBox(hTest, pCtx, "TEXT", clipGetAtom(pCtx, "TEXT"),
     3054    tstStringFromVBox(hTest, &X11Ctx, "TEXT", clipGetAtom(&X11Ctx, "TEXT"),
    30533055                     "hello world");
    30543056
    30553057    /*** Timeout from VBox ***/
    30563058    RTTestSub(hTest, "reading from VBox with timeout");
    3057     tstClipEmptyVBox(pCtx, VERR_TIMEOUT);
    3058     tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
     3059    tstClipEmptyVBox(&X11Ctx, VERR_TIMEOUT);
     3060    tstStringFromVBoxFailed(hTest, &X11Ctx, "UTF8_STRING");
    30593061
    30603062    /*** No data in VBox clipboard ***/
    30613063    RTTestSub(hTest, "an empty VBox clipboard");
    30623064    tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
    3063     tstClipEmptyVBox(pCtx, VINF_SUCCESS);
     3065    tstClipEmptyVBox(&X11Ctx, VINF_SUCCESS);
    30643066    RTTEST_CHECK_MSG(hTest, g_ownsSel,
    30653067                     (hTest, "VBox grabbed the clipboard with no data and we ignored it\n"));
    3066     tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
     3068    tstStringFromVBoxFailed(hTest, &X11Ctx, "UTF8_STRING");
    30673069
    30683070    /*** An unknown VBox format ***/
    30693071    RTTestSub(hTest, "reading an unknown VBox format");
    30703072    tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
    3071     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);
    3072     ShClX11ReportFormatsToX11(pCtx, 0xa0000);
     3073    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "", 2);
     3074    ShClX11ReportFormatsToX11(&X11Ctx, 0xa0000);
    30733075    RTTEST_CHECK_MSG(hTest, g_ownsSel,
    30743076                     (hTest, "VBox grabbed the clipboard with unknown data and we ignored it\n"));
    3075     tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");
     3077    tstStringFromVBoxFailed(hTest, &X11Ctx, "UTF8_STRING");
    30763078
    30773079    /*** VBox requests a bad format ***/
    30783080    RTTestSub(hTest, "recovery from a bad format request");
    3079     tstBadFormatRequestFromHost(hTest, pCtx);
    3080 
    3081     rc = ShClX11ThreadStop(pCtx);
     3081    tstBadFormatRequestFromHost(hTest, &X11Ctx);
     3082
     3083    rc = ShClX11ThreadStop(&X11Ctx);
    30823084    AssertRCReturn(rc, 1);
    3083     ShClX11Destroy(pCtx);
     3085    ShClX11Destroy(&X11Ctx);
    30843086
    30853087    /*** Headless clipboard tests ***/
    30863088
    3087     pCtx = ShClX11Init(NULL, true);
    3088     rc = ShClX11ThreadStart(pCtx, false /* fGrab */);
     3089    rc = ShClX11Init(&X11Ctx, NULL, true);
     3090    AssertRCReturn(rc, 1);
     3091
     3092    rc = ShClX11ThreadStart(&X11Ctx, false /* fGrab */);
    30893093    AssertRCReturn(rc, 1);
    30903094
     
    30923096    RTTestSub(hTest, "reading from X11, headless clipboard");
    30933097    /* Simple test */
    3094     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "",
     3098    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "",
    30953099                        sizeof("") * 2);
    30963100    tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",
    30973101                              sizeof("hello world"), 8);
    3098     tstNoX11(pCtx, "reading from X11, headless clipboard");
     3102    tstNoX11(&X11Ctx, "reading from X11, headless clipboard");
    30993103
    31003104    /*** Read from VBox ***/
    31013105    RTTestSub(hTest, "reading from VBox, headless clipboard");
    31023106    /* Simple test */
    3103     tstClipEmptyVBox(pCtx, VERR_WRONG_ORDER);
     3107    tstClipEmptyVBox(&X11Ctx, VERR_WRONG_ORDER);
    31043108    tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);
    3105     tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
     3109    tstClipSetVBoxUtf16(&X11Ctx, VINF_SUCCESS, "hello world",
    31063110                        sizeof("hello world") * 2);
    3107     tstNoSelectionOwnership(pCtx, "reading from VBox, headless clipboard");
    3108 
    3109     rc = ShClX11ThreadStop(pCtx);
     3111    tstNoSelectionOwnership(&X11Ctx, "reading from VBox, headless clipboard");
     3112
     3113    rc = ShClX11ThreadStop(&X11Ctx);
    31103114    AssertRCReturn(rc, 1);
    3111     ShClX11Destroy(pCtx);
     3115
     3116    ShClX11Destroy(&X11Ctx);
    31123117
    31133118    return RTTestSummaryAndDestroy(hTest);
     
    31653170        return RTTestSummaryAndDestroy(hTest);
    31663171    }
    3167     PSHCLX11CTX pCtx = ShClX11Init(NULL, false);
    3168     AssertReturn(pCtx, 1);
    3169     rc = ShClX11ThreadStart(pCtx, false /* fGrab */);
     3172    SHCLX11CTX X11Ctx;
     3173    rc = ShClX11Init(&X11Ctx, NULL, false);
     3174    AssertRCReturn(rc, 1);
     3175    rc = ShClX11ThreadStart(&X11Ctx, false /* fGrab */);
    31703176    AssertRCReturn(rc, 1);
    31713177    /* Give the clipboard time to synchronise. */
    31723178    RTThreadSleep(500);
    3173     rc = ShClX11ThreadStop(pCtx);
     3179    rc = ShClX11ThreadStop(&X11Ctx);
    31743180    AssertRCReturn(rc, 1);
    3175     ShClX11Destroy(pCtx);
     3181    ShClX11Destroy(&X11Ctx);
    31763182    return RTTestSummaryAndDestroy(hTest);
    31773183}
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