VirtualBox

Ignore:
Timestamp:
Apr 21, 2011 10:42:33 PM (14 years ago)
Author:
vboxsync
Message:

Additions/x11/seamless: no more std::autoptr or std::vector, use the new STL-vector-in-C instead - forgotten

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp

    r28800 r36808  
    1515 */
    1616
    17 #include <iostream>
    1817#include <stdlib.h> /* exit() */
    1918
    2019#include <iprt/initterm.h>
    2120#include <iprt/semaphore.h>
     21#include <iprt/stream.h>
    2222#include <VBox/VBoxGuestLib.h>
    2323
     
    2828int VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects)
    2929{
    30     std::cout << "Received rectangle update (" << cRects << " rectangles):" << std::endl;
     30    RTPrintf("Received rectangle update (%u rectangles):\n", cRects);
    3131    for (unsigned i = 0; i < cRects; ++i)
    3232    {
    33         std::cout << "  xLeft: " << pRects[i].xLeft << "  yTop: " << pRects[i].yTop
    34                   << "  xRight: " << pRects[i].xRight << "  yBottom: " << pRects[i].yBottom
    35                   << std::endl;
     33        RTPrintf("  xLeft: %d  yTop: %d  xRight: %d  yBottom: %d\n",
     34                 pRects[i].xLeft, pRects[i].yTop, pRects[i].xRight,
     35                 pRects[i].yBottom);
    3636    }
    3737    return true;
     
    4040int VbglR3SeamlessSetCap(bool bState)
    4141{
    42     std::cout << (bState ? "Seamless capability set" : "Seamless capability unset")
    43               << std::endl;
     42    RTPrintf("%s\n", bState ? "Seamless capability set"
     43                            : "Seamless capability unset");
    4444    return true;
    4545}
     
    4747int VbglR3CtlFilterMask(uint32_t u32OrMask, uint32_t u32NotMask)
    4848{
    49     std::cout << "IRQ filter mask changed.  Or mask: 0x" << std::hex << u32OrMask
    50               << ".  Not mask: 0x" << u32NotMask << std::dec
    51               << std::endl;
     49    RTPrintf("IRQ filter mask changed.  Or mask: 0x%x.  Not mask: 0x%x\n",
     50             u32OrMask, u32NotMask);
    5251    return true;
    5352}
     
    8988    {
    9089        /* This can be triggered if a guest application destroys a window before we notice. */
    91         std::cout << "ignoring BadAtom error and returning" << std::endl;
     90        RTPrintf("ignoring BadAtom error and returning\n");
    9291        return 0;
    9392    }
    9493    XGetErrorText(pDisplay, pError->error_code, errorText, sizeof(errorText));
    95     std::cout << "An X Window protocol error occurred: " << errorText << std::endl
    96               << "  Request code: " << int(pError->request_code) << std::endl
    97               << "  Minor code: " << int(pError->minor_code) << std::endl
    98               << "  Serial number of the failed request: " << int(pError->serial)
    99               << std::endl;
    100     std::cout << std::endl << "exiting." << std::endl;
     94    RTPrintf("An X Window protocol error occurred: %s\n"
     95             "  Request code: %d\n"
     96             "  Minor code: %d\n"
     97             "  Serial number of the failed request: %d\n\n"
     98             "exiting.\n",
     99             errorText, (int)pError->request_code, (int)pError->minor_code,
     100             (int)pError->serial);
    101101    exit(1);
    102102}
     
    105105{
    106106    int rc = VINF_SUCCESS;
    107     std::string sTmp;
     107    char ach[2];
    108108
    109109    RTR3Init();
    110     std::cout << "VirtualBox guest additions X11 seamless mode testcase" << std::endl;
     110    RTPrintf("VirtualBox guest additions X11 seamless mode testcase\n");
    111111    if (0 == XInitThreads())
    112112    {
    113         std::cout << "Failed to initialise X11 threading, exiting." << std::endl;
     113        RTPrintf("Failed to initialise X11 threading, exiting.\n");
    114114        exit(1);
    115115    }
    116116    /* Set an X11 error handler, so that we don't die when we get unavoidable errors. */
    117117    XSetErrorHandler(vboxClientXLibErrorHandler);
    118     std::cout << std::endl << "Press <Enter> to exit..." << std::endl;
     118    RTPrintf("\nPress <Enter> to exit...\n");
    119119    RTSemEventCreate(&eventSem);
    120120    /** Our instance of the seamless class. */
    121121    VBoxGuestSeamless seamless;
    122     try
     122    LogRel(("Starting seamless Guest Additions...\n"));
     123    rc = seamless.init();
     124    if (rc != VINF_SUCCESS)
    123125    {
    124         LogRel(("Starting seamless Guest Additions...\n"));
    125         rc = seamless.init();
    126         if (rc != VINF_SUCCESS)
    127         {
    128             std::cout << "Failed to initialise seamless Additions, rc = " << rc << std::endl;
    129         }
     126        RTPrintf("Failed to initialise seamless Additions, rc = %d\n", rc);
    130127    }
    131     catch (std::exception e)
    132     {
    133         std::cout << "Failed to initialise seamless Additions - caught exception: " << e.what()
    134                   << std::endl;
    135         rc = VERR_UNRESOLVED_ERROR;
    136     }
    137     catch (...)
    138     {
    139         std::cout << "Failed to initialise seamless Additions - caught unknown exception.\n"
    140                   << std::endl;
    141         rc = VERR_UNRESOLVED_ERROR;
    142     }
    143     std::getline(std::cin, sTmp);
    144     try
    145     {
    146         seamless.uninit();
    147     }
    148     catch (std::exception e)
    149     {
    150         std::cout << "Error shutting down seamless Additions - caught exception: " << e.what()
    151                   << std::endl;
    152         rc = VERR_UNRESOLVED_ERROR;
    153     }
    154     catch (...)
    155     {
    156         std::cout << "Error shutting down seamless Additions - caught unknown exception.\n"
    157                   << std::endl;
    158         rc = VERR_UNRESOLVED_ERROR;
    159     }
     128    RTStrmGetLine(g_pStdIn, ach, sizeof(ach));
     129    seamless.uninit();
    160130    return rc;
    161131}
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