VirtualBox

Ignore:
Timestamp:
Jul 9, 2009 11:16:58 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49817
Message:

GuestHost/SharedClipboard: make sure that we also notify when a format is found that we don't support and test for this

File:
1 edited

Legend:

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

    r21425 r21429  
    10651065
    10661066/**
     1067 * Notify VBox that we have returned the clipboard to X11.
     1068 */
     1069static void clipReleaseCB(CLIPBACKEND *pCtx)
     1070{
     1071    LogFlowFunc (("\n"));
     1072    /* The formats should be set to the right values as soon as we start
     1073     * polling */
     1074    clipReportEmptyX11CB(pCtx);
     1075    pCtx->fOwnsClipboard = false;
     1076}
     1077
     1078/**
    10671079 * This is called by the X toolkit intrinsics to let us know that another
    10681080 * X11 client has taken the clipboard.  In this case we notify VBox that
    1069  * we want ownership of the clipboard.
     1081 * X11 wants ownership of the clipboard.
    10701082 * @note  X11 backend code, callback for XtOwnSelection
    10711083 */
     
    10741086    CLIPBACKEND *pCtx = clipLookupContext(widget);
    10751087    LogFlowFunc (("\n"));
    1076     /* These should be set to the right values as soon as we start polling */
    1077     clipResetX11Formats(pCtx);
    1078     pCtx->fOwnsClipboard = false;
     1088    clipReleaseCB(pCtx);
    10791089}
    10801090
     
    18641874{
    18651875    return g_fX11Formats;
     1876}
     1877
     1878static void clipInvalidateFormats()
     1879{
     1880    g_fX11Formats = ~0;
    18661881}
    18671882
     
    23152330        ++cErrs;
    23162331
     2332    /*** Unknown X11 format ***/
     2333    RTPrintf(TEST_NAME ": TESTING handling of an unknown X11 format\n");
     2334    clipInvalidateFormats();
     2335    clipSetSelectionValues("CLIPBOARD", XA_STRING, "Test",
     2336                           sizeof("Test"), 8);
     2337    if (!clipPollTargets())
     2338    {
     2339        RTPrintf("Failed to poll for targets\n");
     2340        ++cErrs;
     2341    }
     2342    else if (clipQueryFormats() != 0)
     2343    {
     2344        RTPrintf("Failed to send a format update notification\n");
     2345        ++cErrs;
     2346    }
    23172347
    23182348    /*** Timeout from X11 ***/
     
    23392369        RTPrintf("Wrong returned request data, expected %p, got %p\n",
    23402370                 pReq, pReqRet);
     2371        ++cErrs;
     2372    }
     2373
     2374    /*** Ensure that VBox is notified when we return the CB to X11 ***/
     2375    RTPrintf(TEST_NAME ": TESTING notification of switch to X11 clipboard\n");
     2376    clipInvalidateFormats();
     2377    clipReleaseCB(pCtx);
     2378    if (clipQueryFormats() != 0)
     2379    {
     2380        RTPrintf("Failed to send a format update (release) notification\n");
    23412381        ++cErrs;
    23422382    }
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