VirtualBox

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


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

Additions/x11/seamless: allow for the possibility that nothing is visible on-screen

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp

    r31384 r37174  
    137137 *       to copy our rectangle and header data into a single structure and perform an
    138138 *       additional allocation.
     139 * @todo Would that really gain us much, given that the rectangles may not
     140 *       be grouped at all, or in the format we need?  Keeping the memory
     141 *       for our "single structure" around (re-alloc-ing it if necessary)
     142 *       sounds like a simpler optimisation if we need it.
    139143 */
    140144VBGLR3DECL(int) VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects)
     
    143147    int rc;
    144148
    145     if (!cRects || !pRects)
    146         return VINF_SUCCESS;
     149    AssertReturn(pRects || (cRects == 0), VERR_INVALID_PARAMETER);
    147150    rc = vbglR3GRAlloc((VMMDevRequestHeader **)&pReq,
    148                        sizeof(VMMDevVideoSetVisibleRegion) + (cRects - 1) * sizeof(RTRECT),
     151                         sizeof(VMMDevVideoSetVisibleRegion)
     152                       + cRects * sizeof(RTRECT) - sizeof(RTRECT),
    149153                       VMMDevReq_VideoSetVisibleRegion);
    150154    if (RT_SUCCESS(rc))
    151155    {
    152156        pReq->cRect = cRects;
    153         memcpy(&pReq->Rect, pRects, cRects * sizeof(RTRECT));
     157        if (cRects)
     158            memcpy(&pReq->Rect, pRects, cRects * sizeof(RTRECT));
     159        /* This will fail harmlessly for cRect == 0 and older host code */
    154160        rc = vbglR3GRPerform(&pReq->header);
     161        LogFunc(("Visible region request returned %Rrc, internal %Rrc.\n",
     162                 rc, pReq->header.rc));
    155163        if (RT_SUCCESS(rc))
    156164            rc = pReq->header.rc;
    157165        vbglR3GRFree(&pReq->header);
    158166    }
     167    LogFunc(("Sending %u rectangles to the host: %Rrc\n", cRects, rc));
    159168    return rc;
    160169}
  • trunk/src/VBox/Additions/x11/VBoxClient/seamless-host.cpp

    r36806 r37174  
    137137{
    138138    LogRelFlowFunc(("\n"));
    139     if (!pRects)  /* Assertion */
     139    if (cRects && !pRects)  /* Assertion */
    140140    {
    141141        LogRelThisFunc(("ERROR: called with null pointer!\n"));
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