VirtualBox

Changeset 37173 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
May 21, 2011 8:45:49 PM (14 years ago)
Author:
vboxsync
Message:

Additions/x11/VBoxClient: fixed a couple of problems in the un-STL-ified code

Location:
trunk/src/VBox/Additions/x11/VBoxClient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp

    r36806 r37173  
    418418{
    419419    LogRelFlowFunc(("\n"));
    420     VBoxGuestWinFree(mGuestWindows.removeWindow(hWin), NULL);
    421     mChanged = true;
     420    VBoxGuestWinInfo *pInfo = mGuestWindows.removeWindow(hWin);
     421    if (pInfo)
     422    {
     423        VBoxGuestWinFree(pInfo, mDisplay);
     424        mChanged = true;
     425    }
    422426    LogRelFlowFunc(("returning\n"));
    423427}
  • trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp

    r36809 r37173  
    11/** @file
    22 * Automated test of the X11 seamless Additions code.
     3 * @todo Better separate test data from implementation details!
    34 */
    45
     
    6768Atom XInternAtom(Display *display, const char *atom_name, Bool only_if_exists)
    6869{
     70    Assert(display == TEST_DISPLAY);
    6971    if (!RTStrCmp(atom_name, WM_TYPE_PROP))
    7072        return (Atom) ATOM_PROP;
     
    9597                       unsigned char **prop_return)
    9698{
    97     Atom atomType = XInternAtom (NULL, WM_TYPE_PROP, true);
    98     Atom atomTypeDesktop = XInternAtom (NULL, WM_TYPE_DESKTOP_PROP, true);
     99    Assert(display == TEST_DISPLAY);
     100    Atom atomType = XInternAtom (display, WM_TYPE_PROP, true);
     101    Atom atomTypeDesktop = XInternAtom (display, WM_TYPE_DESKTOP_PROP, true);
    99102    /* We only handle things we expect. */
    100103    AssertReturn((req_type == XA_ATOM) || (req_type == AnyPropertyType),
     
    130133Bool XShapeQueryExtension (Display *dpy, int *event_basep, int *error_basep)
    131134{
     135    Assert(dpy == TEST_DISPLAY);
    132136    return true;
    133137}
     
    137141int XSelectInput(Display *display, Window w, long event_mask)
    138142{
     143    Assert(display == TEST_DISPLAY);
    139144    return 0;
    140145}
     
    144149                                  unsigned long event_mask);
    145150void XShapeSelectInput(Display *display, Window w, unsigned long event_mask)
    146 {}
     151{
     152    Assert(display == TEST_DISPLAY);
     153}
    147154
    148155extern "C" Window XDefaultRootWindow(Display *display);
    149156Window XDefaultRootWindow(Display *display)
    150157{
     158    Assert(display == TEST_DISPLAY);
    151159    return TEST_ROOT;
    152160}
     
    164172                  unsigned int *nchildren_return)
    165173{
     174    Assert(display == TEST_DISPLAY);
    166175    AssertReturn(w == TEST_ROOT, False);  /* We support nothing else */
    167176    AssertPtrReturn(children_return, False);
     
    181190Window XmuClientWindow(Display *dpy, Window win)
    182191{
     192    Assert(dpy == TEST_DISPLAY);
    183193    return win;
    184194}
     
    189199                            XWindowAttributes *window_attributes_return)
    190200{
     201    Assert(display == TEST_DISPLAY);
    191202    AssertPtrReturn(window_attributes_return, 1);
    192203    for (unsigned i = 0; i < g_cSmlsWindows; ++i)
     
    206217                         XSizeHints *hints_return, long *supplied_return)
    207218{
     219    Assert(display == TEST_DISPLAY);
    208220    return 1;
    209221}
     
    229241                                 int *count, int *ordering)
    230242{
     243    Assert(dpy == TEST_DISPLAY);
    231244    if ((window != g_SmlsShapedWindow) || (window == 0))
    232245        return NULL;  /* Probably not correct, but works for us. */
     
    253266int XNextEvent(Display *display, XEvent *event_return)
    254267{
     268    Assert(display == TEST_DISPLAY);
    255269    event_return->xany.type = g_SmlsEventType;
    256270    event_return->xany.window = g_SmlsEventWindow;
     
    271285                  long event_mask, XEvent *event_send)
    272286{
     287    Assert(display == TEST_DISPLAY);
    273288    AssertFailedReturn(0);
    274289}
     
    278293int XFlush(Display *display)
    279294{
     295    Assert(display == TEST_DISPLAY);
    280296    AssertFailedReturn(0);
    281297}
     
    349365    /** The event to delivered */
    350366    int x11EventType;
    351     /** The windows for which the event in @enmEvent is delivered */
     367    /** The window for which the event in @enmEvent is delivered */
    352368    Window hEventWindow;
    353369    /** The number of windows expected to be reported at the end of the
     
    471487};
    472488
    473 /*** Test fixture to test the code against X11 unmap events ***/
     489/*** Test fixtures to test the code against X11 unmap events ***/
    474490
    475491static XWindowAttributes g_aAttrib4After[] =
     
    499515    0,
    500516    NULL
     517};
     518
     519/*** A window we are not monitoring has been unmapped.  Nothing should
     520 *** happen, especially nothing bad. ***/
     521
     522static RTRECT g_aRects2[] =
     523{
     524    { 100, 200, 150, 250 },
     525    { 150, 250, 300, 500 }
     526};
     527
     528static SMLSFIXTURE g_testUnmapOther =
     529{
     530    RT_ELEMENTS(g_ahWin1),
     531    g_ahWin1,
     532    g_aAttrib1Before,
     533    g_apszNames1,
     534    20,
     535    RT_ELEMENTS(g_aRectangle1),
     536    g_aRectangle1,
     537    RT_ELEMENTS(g_ahWin1),
     538    g_ahWin1,
     539    g_aAttrib1Before,
     540    g_apszNames1,
     541    20,
     542    RT_ELEMENTS(g_aRectangle1),
     543    g_aRectangle1,
     544    UnmapNotify,
     545    21,
     546    RT_ELEMENTS(g_aRects2),
     547    g_aRects2
    501548};
    502549
     
    650697    cErrs += smlsDoFixture(&g_testMap, "MapNotify event");
    651698    cErrs += smlsDoFixture(&g_testUnmap, "UnmapNotify event");
     699    cErrs += smlsDoFixture(&g_testUnmapOther,
     700                           "UnmapNotify event for unmonitored window");
    652701    cErrs += smlsDoFixture(&g_testShape, "ShapeNotify event");
    653702    if (cErrs > 0)
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