Changeset 32692 in vbox
- Timestamp:
- Sep 22, 2010 10:30:34 AM (14 years ago)
- Location:
- trunk/src/VBox/Additions/x11/vboxvideo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c
r32164 r32692 173 173 TRACE_ENTRY(); 174 174 175 free (pVBox->reqp);176 pVBox-> reqp= NULL;175 xf86DestroyCursorInfoRec(pVBox->pCurs); 176 pVBox->pCurs = NULL; 177 177 TRACE_EXIT(); 178 178 } … … 419 419 vbox_open(ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox) 420 420 { 421 int rc;422 void *p;423 size_t size;424 int scrnIndex = pScrn->scrnIndex;425 426 421 TRACE_ENTRY(); 427 422 428 423 if (!pVBox->useDevice) 429 424 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; 456 427 } 457 428 … … 467 438 int rc; 468 439 469 pVBox->reqp->fFlags = 0; 470 rc = VbglR3SetPointerShapeReq(pVBox->reqp); 440 rc = VbglR3SetPointerShape(0, 0, 0, 0, 0, NULL, 0); 471 441 if (RT_FAILURE(rc)) 472 442 { 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); 474 444 /* Play safe, and disable the hardware cursor until the next mode 475 445 * switch, since obviously something happened that we didn't … … 484 454 int rc; 485 455 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; 496 465 } 497 466 } … … 606 575 sizeMask = ((dstPitch * h) + 3) & (size_t) ~3; 607 576 sizeRgba = w * h * 4; 608 pVBox->pointerSize = sizeMask + sizeRgba; 609 sizeRequest = pVBox->pointerSize + pVBox->pointerHeaderSize; 577 sizeRequest = sizeMask + sizeRgba + sizeof(VMMDevReqMousePointer); 610 578 611 579 p = c = calloc (1, sizeRequest); … … 740 708 unsigned char *pm; 741 709 CARD32 *pc; 742 size_t size Request, sizeMask;710 size_t sizeData, sizeMask; 743 711 CARD8 *p; 744 712 int scrnIndex; 713 uint32_t fFlags = VBOX_MOUSE_POINTER_VISIBLE | VBOX_MOUSE_POINTER_SHAPE 714 | VBOX_MOUSE_POINTER_ALPHA; 715 int rc; 745 716 746 717 TRACE_ENTRY(); … … 764 735 bitsp->xhot, bitsp->yhot, w, h); 765 736 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); 769 739 if (!p) 770 740 RETERROR(scrnIndex, , 771 741 "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); 785 745 786 746 /* Emulate the AND mask. */ 787 pm = p + offsetof(VMMDevReqMousePointer, pointerData);747 pm = p; 788 748 pc = bitsp->argb; 789 749 … … 815 775 } 816 776 817 VbglR3SetPointerShapeReq(reqp); 777 rc = VbglR3SetPointerShape(fFlags, bitsp->xhot, bitsp->yhot, w, h, p, sizeData); 778 TRACE_LOG(": leaving, returning %d\n", rc); 818 779 free(p); 819 780 } -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
r32495 r32692 207 207 Bool accessEnabled; 208 208 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 */ 212 210 xf86CursorInfoPtr pCurs; 213 211 Bool useDevice; -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c
r32495 r32692 1068 1068 vgaHWFreeHWRec(pScrn); 1069 1069 1070 /* And do additional bits which are separate for historical reasons */ 1071 vbox_close(pScrn, pVBox); 1072 1070 1073 /* Remove our observer functions from the X server call chains. */ 1071 1074 pScrn->EnableDisableFBAccess = pVBox->EnableDisableFBAccess; -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_70.c
r32495 r32692 865 865 vgaHWFreeHWRec(pScrn); 866 866 867 /* And do additional bits which are separate for historical reasons */ 868 vbox_close(pScrn, pVBox); 869 867 870 pScreen->CloseScreen = pVBox->CloseScreen; 868 871 return pScreen->CloseScreen(scrnIndex, pScreen);
Note:
See TracChangeset
for help on using the changeset viewer.