VirtualBox

Ignore:
Timestamp:
Sep 27, 2019 9:45:46 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133643
Message:

Additions/VBoxClient: Revamped and unified local logging infrastructure; cleaned up a lot of different logging styles / ways. Fixed logging memory leaks.

File:
1 edited

Legend:

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

    r76553 r81040  
    4646                                    const char *aPropName, unsigned long *nItems)
    4747{
    48     LogRelFlowFunc(("\n"));
     48    LogRelFlowFuncEnter();
    4949    Atom propNameAtom = XInternAtom (aDpy, aPropName,
    5050                                     True /* only_if_exists */);
     
    6565        return NULL;
    6666
    67     LogRelFlowFunc(("returning\n"));
     67    LogRelFlowFuncLeave();
    6868    return propVal;
    6969}
     
    7979    int rc = VINF_SUCCESS;
    8080
    81     LogRelFlowFunc(("\n"));
     81    LogRelFlowFuncEnter();
    8282    if (mHostCallback != NULL)  /* Assertion */
    8383    {
    84         LogRel(("VBoxClient: ERROR: attempt to initialise seamless guest object twice!\n"));
     84        VBClLogError("Attempting to initialise seamless guest object twice!\n");
    8585        return VERR_INTERNAL_ERROR;
    8686    }
    8787    if (!(mDisplay = XOpenDisplay(NULL)))
    8888    {
    89         LogRel(("VBoxClient: seamless guest object failed to acquire a connection to the display.\n"));
     89        VBClLogError("Seamless guest object failed to acquire a connection to the display\n");
    9090        return VERR_ACCESS_DENIED;
    9191    }
     
    9393    mEnabled = false;
    9494    unmonitorClientList();
    95     LogRelFlowFunc(("returning %Rrc\n", rc));
     95    LogRelFlowFuncLeaveRC(rc);
    9696    return rc;
    9797}
     
    111111    int error, event;
    112112
    113     LogRelFlowFunc(("\n"));
     113    LogRelFlowFuncEnter();
    114114    if (mEnabled)
    115115        return VINF_SUCCESS;
     
    118118    monitorClientList();
    119119    rebuildWindowTree();
    120     LogRelFlowFunc(("returning %Rrc\n", rc));
     120    LogRelFlowFuncLeaveRC(rc);
    121121    return rc;
    122122}
     
    126126void SeamlessX11::stop(void)
    127127{
    128     LogRelFlowFunc(("\n"));
     128    LogRelFlowFuncEnter();
    129129    if (!mEnabled)
    130130        return;
     
    132132    unmonitorClientList();
    133133    freeWindowTree();
    134     LogRelFlowFunc(("returning\n"));
     134    LogRelFlowFuncLeave();
    135135}
    136136
    137137void SeamlessX11::monitorClientList(void)
    138138{
    139     LogRelFlowFunc(("called\n"));
     139    LogRelFlowFuncEnter();
    140140    XSelectInput(mDisplay, DefaultRootWindow(mDisplay), PropertyChangeMask | SubstructureNotifyMask);
    141141}
     
    143143void SeamlessX11::unmonitorClientList(void)
    144144{
    145     LogRelFlowFunc(("called\n"));
     145    LogRelFlowFuncEnter();
    146146    XSelectInput(mDisplay, DefaultRootWindow(mDisplay), PropertyChangeMask);
    147147}
     
    153153void SeamlessX11::rebuildWindowTree(void)
    154154{
    155     LogRelFlowFunc(("called\n"));
     155    LogRelFlowFuncEnter();
    156156    freeWindowTree();
    157157    addClients(DefaultRootWindow(mDisplay));
     
    177177    unsigned cChildren;
    178178
    179     LogRelFlowFunc(("\n"));
     179    LogRelFlowFuncEnter();
    180180    if (!XQueryTree(mDisplay, hRoot, &hRealRoot, &hParent, &phChildrenRaw, &cChildren))
    181181        return;
     
    184184        addClientWindow(phChildren[i]);
    185185    XFree(phChildrenRaw);
    186     LogRelFlowFunc(("returning\n"));
     186    LogRelFlowFuncLeave();
    187187}
    188188
     
    190190void SeamlessX11::addClientWindow(const Window hWin)
    191191{
    192     LogRelFlowFunc(("\n"));
     192    LogRelFlowFuncEnter();
    193193    XWindowAttributes winAttrib;
    194194    bool fAddWin = true;
     
    199199    if (fAddWin && !XGetWindowAttributes(mDisplay, hWin, &winAttrib))
    200200    {
    201         LogRelFunc(("VBoxClient: Failed to get the window attributes for window %d\n", hWin));
     201        VBClLogError("Failed to get the window attributes for window %d\n", hWin);
    202202        fAddWin = false;
    203203    }
     
    211211                                       &dummyLong)))
    212212    {
    213         LogRelFlowFunc(("window %lu, client window %lu has no size hints\n",
    214                      hWin, hClient));
     213        LogRelFlowFunc(("window %lu, client window %lu has no size hints\n", hWin, hClient));
    215214        fAddWin = false;
    216215    }
     
    244243                                pRects);
    245244    }
    246     LogRelFlowFunc(("returning\n"));
     245    LogRelFlowFuncLeave();
    247246}
    248247
     
    260259    bool rc = false;
    261260
    262     LogRelFlowFunc(("\n"));
     261    LogRelFlowFuncEnter();
    263262    windowTypeRaw = XXGetProperty(mDisplay, hWin, XA_ATOM, WM_TYPE_PROP, &ulCount);
    264263    if (windowTypeRaw != NULL)
     
    290289{
    291290    /* We use post-increment in the operation to prevent the iterator from being invalidated. */
    292     LogRelFlowFunc(("\n"));
     291    LogRelFlowFuncEnter();
    293292    mGuestWindows.detachAll(VBoxGuestWinFree, mDisplay);
    294     LogRelFlowFunc(("returning\n"));
     293    LogRelFlowFuncLeave();
    295294}
    296295
     
    305304    XEvent event;
    306305
    307     LogRelFlowFunc(("\n"));
     306    LogRelFlowFuncEnter();
    308307    /* Start by sending information about the current window setup to the host.  We do this
    309308       here because we want to send all such information from a single thread. */
     
    341340            || event.xproperty.window != DefaultRootWindow(mDisplay))
    342341            break;
    343         LogRelFlowFunc(("_NET_CLIENT_LIST property event on root window.\n"));
     342        LogRelFlowFunc(("_NET_CLIENT_LIST property event on root window\n"));
    344343        rebuildWindowTree();
    345344        break;
     
    392391void SeamlessX11::doShapeEvent(Window hWin)
    393392{
    394     LogRelFlowFunc(("\n"));
     393    LogRelFlowFuncEnter();
    395394    VBoxGuestWinInfo *pInfo = mGuestWindows.find(hWin);
    396395    if (pInfo)
     
    410409        mChanged = true;
    411410    }
    412     LogRelFlowFunc(("returning\n"));
     411    LogRelFlowFuncLeave();
    413412}
    414413
     
    477476int SeamlessX11::updateRects(void)
    478477{
    479     LogRelFlowFunc(("\n"));
     478    LogRelFlowFuncEnter();
    480479    struct RectList rects = RTVEC_INITIALIZER;
    481480
     
    492491    mcRects = RectListSize(&rects);
    493492    mpRects = RectListDetach(&rects);
    494     LogRelFlowFunc(("returning\n"));
     493    LogRelFlowFuncLeave();
    495494    return VINF_SUCCESS;
    496495}
     
    506505    Display *pDisplay = XOpenDisplay(NULL);
    507506
    508     LogRelFlowFunc(("\n"));
     507    LogRelFlowFuncEnter();
    509508    if (pDisplay == NULL)
    510         VBClFatalError(("Failed to open X11 display.\n"));
     509        VBClLogFatalError("Failed to open X11 display\n");
    511510    /* Message contents set to zero. */
    512511    XClientMessageEvent clientMessage = { ClientMessage, 0, 0, 0, 0, 0, 8 };
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