VirtualBox

Changeset 32692 in vbox


Ignore:
Timestamp:
Sep 22, 2010 10:30:34 AM (14 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: some more simplification

Location:
trunk/src/VBox/Additions/x11/vboxvideo
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c

    r32164 r32692  
    173173    TRACE_ENTRY();
    174174
    175     free (pVBox->reqp);
    176     pVBox->reqp = NULL;
     175    xf86DestroyCursorInfoRec(pVBox->pCurs);
     176    pVBox->pCurs = NULL;
    177177    TRACE_EXIT();
    178178}
     
    419419vbox_open(ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox)
    420420{
    421     int rc;
    422     void *p;
    423     size_t size;
    424     int scrnIndex = pScrn->scrnIndex;
    425 
    426421    TRACE_ENTRY();
    427422
    428423    if (!pVBox->useDevice)
    429424        return FALSE;
    430 
    431     if (pVBox->reqp)
    432     {
    433         /* still open, just re-enable VBVA after CloseScreen was called */
    434         pVBox->useVbva = vboxInitVbva(scrnIndex, pScreen, pVBox);
    435         return TRUE;
    436     }
    437 
    438     size = vmmdevGetRequestSize(VMMDevReq_SetPointerShape);
    439     p = calloc(1, size);
    440     if (p)
    441     {
    442         rc = vmmdevInitRequest(p, VMMDevReq_SetPointerShape);
    443         if (RT_SUCCESS(rc))
    444         {
    445             pVBox->reqp = p;
    446             pVBox->pCurs = NULL;
    447             pVBox->pointerHeaderSize = size;
    448             pVBox->useVbva = vboxInitVbva(scrnIndex, pScreen, pVBox);
    449             return TRUE;
    450         }
    451         xf86DrvMsg(scrnIndex, X_ERROR, "Could not init VMM request: rc = %d\n", rc);
    452         free(p);
    453     }
    454     xf86DrvMsg(scrnIndex, X_ERROR, "Could not allocate %lu bytes for VMM request\n", (unsigned long)size);
    455     return FALSE;
     425    pVBox->useVbva = vboxInitVbva(pScrn->scrnIndex, pScreen, pVBox);
     426    return TRUE;
    456427}
    457428
     
    467438    int rc;
    468439
    469     pVBox->reqp->fFlags = 0;
    470     rc = VbglR3SetPointerShapeReq(pVBox->reqp);
     440    rc = VbglR3SetPointerShape(0, 0, 0, 0, 0, NULL, 0);
    471441    if (RT_FAILURE(rc))
    472442    {
    473         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not hide the virtual mouse pointer.\n");
     443        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not hide the virtual mouse pointer, VBox error %d.\n", rc);
    474444        /* Play safe, and disable the hardware cursor until the next mode
    475445         * switch, since obviously something happened that we didn't
     
    484454    int rc;
    485455
    486     if (vbox_host_uses_hwcursor(pScrn)) {
    487         pVBox->reqp->fFlags = VBOX_MOUSE_POINTER_VISIBLE;
    488         rc = VbglR3SetPointerShapeReq(pVBox->reqp);
    489         if (RT_FAILURE(rc)) {
    490             xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not unhide the virtual mouse pointer.\n");
    491             /* Play safe, and disable the hardware cursor until the next mode
    492              * switch, since obviously something happened that we didn't
    493              * anticipate. */
    494             pVBox->forceSWCursor = TRUE;
    495         }
     456    if (!vbox_host_uses_hwcursor(pScrn))
     457        return;
     458    rc = VbglR3SetPointerShape(VBOX_MOUSE_POINTER_VISIBLE, 0, 0, 0, 0, NULL, 0);
     459    if (RT_FAILURE(rc)) {
     460        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not unhide the virtual mouse pointer.\n");
     461        /* Play safe, and disable the hardware cursor until the next mode
     462         * switch, since obviously something happened that we didn't
     463         * anticipate. */
     464        pVBox->forceSWCursor = TRUE;
    496465    }
    497466}
     
    606575    sizeMask = ((dstPitch * h) + 3) & (size_t) ~3;
    607576    sizeRgba = w * h * 4;
    608     pVBox->pointerSize = sizeMask + sizeRgba;
    609     sizeRequest = pVBox->pointerSize + pVBox->pointerHeaderSize;
     577    sizeRequest = sizeMask + sizeRgba + sizeof(VMMDevReqMousePointer);
    610578
    611579    p = c = calloc (1, sizeRequest);
     
    740708    unsigned char *pm;
    741709    CARD32 *pc;
    742     size_t sizeRequest, sizeMask;
     710    size_t sizeData, sizeMask;
    743711    CARD8 *p;
    744712    int scrnIndex;
     713    uint32_t fFlags =   VBOX_MOUSE_POINTER_VISIBLE | VBOX_MOUSE_POINTER_SHAPE
     714                      | VBOX_MOUSE_POINTER_ALPHA;
     715    int rc;
    745716
    746717    TRACE_ENTRY();
     
    764735                 bitsp->xhot, bitsp->yhot, w, h);
    765736
    766     pVBox->pointerSize = w * h * 4 + sizeMask;
    767     sizeRequest = pVBox->pointerSize + pVBox->pointerHeaderSize;
    768     p = calloc(1, sizeRequest);
     737    sizeData = w * h * 4 + sizeMask;
     738    p = calloc(1, sizeData);
    769739    if (!p)
    770740        RETERROR(scrnIndex, ,
    771741                 "Error failed to alloc %lu bytes for cursor\n",
    772                  (unsigned long)sizeRequest);
    773 
    774     reqp = (VMMDevReqMousePointer *)p;
    775     *reqp = *pVBox->reqp;
    776     reqp->width  = w;
    777     reqp->height = h;
    778     reqp->xHot   = bitsp->xhot;
    779     reqp->yHot   = bitsp->yhot;
    780     reqp->fFlags =   VBOX_MOUSE_POINTER_VISIBLE | VBOX_MOUSE_POINTER_SHAPE
    781                    | VBOX_MOUSE_POINTER_ALPHA;
    782     reqp->header.size = sizeRequest;
    783 
    784     memcpy(p + offsetof(VMMDevReqMousePointer, pointerData) + sizeMask, bitsp->argb, w * h * 4);
     742                 (unsigned long)sizeData);
     743
     744    memcpy(p + sizeMask, bitsp->argb, w * h * 4);
    785745
    786746    /* Emulate the AND mask. */
    787     pm = p + offsetof(VMMDevReqMousePointer, pointerData);
     747    pm = p;
    788748    pc = bitsp->argb;
    789749
     
    815775    }
    816776
    817     VbglR3SetPointerShapeReq(reqp);
     777    rc = VbglR3SetPointerShape(fFlags, bitsp->xhot, bitsp->yhot, w, h, p, sizeData);
     778    TRACE_LOG(": leaving, returning %d\n", rc);
    818779    free(p);
    819780}
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h

    r32495 r32692  
    207207    Bool accessEnabled;
    208208    OptionInfoPtr Options;
    209     VMMDevReqMousePointer *reqp;  /** @todo get rid of this */
    210     size_t pointerHeaderSize;
    211     size_t pointerSize;
     209    /** @todo we never actually free this */
    212210    xf86CursorInfoPtr pCurs;
    213211    Bool useDevice;
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c

    r32495 r32692  
    10681068    vgaHWFreeHWRec(pScrn);
    10691069
     1070    /* And do additional bits which are separate for historical reasons */
     1071    vbox_close(pScrn, pVBox);
     1072
    10701073    /* Remove our observer functions from the X server call chains. */
    10711074    pScrn->EnableDisableFBAccess = pVBox->EnableDisableFBAccess;
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_70.c

    r32495 r32692  
    865865    vgaHWFreeHWRec(pScrn);
    866866
     867    /* And do additional bits which are separate for historical reasons */
     868    vbox_close(pScrn, pVBox);
     869
    867870    pScreen->CloseScreen = pVBox->CloseScreen;
    868871    return pScreen->CloseScreen(scrnIndex, pScreen);
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