Changeset 6508 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 25, 2008 10:28:07 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/xgraphics/vboxutils-new.c
r6497 r6508 1 1 /** @file 2 *3 2 * VirtualBox X11 Additions graphics driver utility functions 4 3 */ … … 37 36 #ifdef DEBUG_X 38 37 #define TRACE_ENTRY() for (;;) \ 39 { \40 ErrorF ("%s\n", __FUNCTION__); \41 break; \42 }38 { \ 39 ErrorF ("%s\n", __FUNCTION__); \ 40 break; \ 41 } 43 42 #define PUT_PIXEL(c) ErrorF ("%c", c) 44 43 #define dolog(...) ErrorF (__VA_ARGS__) … … 51 50 /** Macro to printf an error message and return from a function */ 52 51 #define RETERROR(scrnIndex, RetVal, ...) \ 53 do \54 { \55 xf86DrvMsg(scrnIndex, X_ERROR, __VA_ARGS__); \56 return RetVal; \57 } \58 while (0)52 do \ 53 { \ 54 xf86DrvMsg(scrnIndex, X_ERROR, __VA_ARGS__); \ 55 return RetVal; \ 56 } \ 57 while (0) 59 58 60 59 #ifdef DEBUG_X … … 108 107 if (VBOX_FAILURE(rc)) 109 108 RETERROR(scrnIndex, FALSE, 110 "Unable to determine whether the virtual machine supports mouse pointer integration - request initialization failed with return code %d\n", rc);109 "Unable to determine whether the virtual machine supports mouse pointer integration - request initialization failed with return code %d\n", rc); 111 110 112 111 return (fFeatures & VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER) ? FALSE : TRUE; … … 129 128 */ 130 129 #define DISABLE_VBVA_AND_RETURN(pScrn, ...) \ 131 do \132 { \133 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, __VA_ARGS__); \134 vboxDisableVbva(pScrn); \135 pVBox->useVbva = FALSE; \136 return; \137 } \138 while (0)130 do \ 131 { \ 132 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, __VA_ARGS__); \ 133 vboxDisableVbva(pScrn); \ 134 pVBox->useVbva = FALSE; \ 135 return; \ 136 } \ 137 while (0) 139 138 140 139 /** … … 244 243 memcpy(&pMem->au8RingBuffer[off32Free], &cmdHdr, u32First); 245 244 if (u32Second) 246 memcpy(&pMem->au8RingBuffer[0], (void *)pu8Second, u32Second);245 memcpy(&pMem->au8RingBuffer[0], pu8Second, u32Second); 247 246 pMem->off32Free = u32Second; 248 247 } … … 337 336 } 338 337 339 size = vmmdevGetRequestSize 338 size = vmmdevGetRequestSize(VMMDevReq_SetPointerShape); 340 339 p = xcalloc(1, size); 341 340 if (p) … … 366 365 pVBox->reqp->fFlags = 0; 367 366 rc = VbglR3SetPointerShape(0, pVBox->reqp->xHot, pVBox->reqp->yHot, pVBox->reqp->width, 368 pVBox->reqp->height, pVBox->reqp->pointerData,369 pVBox->reqp->header.size - pVBox->set_pointer_shape_size);367 pVBox->reqp->height, pVBox->reqp->pointerData, 368 pVBox->reqp->header.size - pVBox->set_pointer_shape_size); 370 369 if (RT_FAILURE(rc)) 371 370 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not hide the virtual mouse pointer.\n"); … … 378 377 pVBox->reqp->fFlags = VBOX_MOUSE_POINTER_VISIBLE; 379 378 rc = VbglR3SetPointerShape(VBOX_MOUSE_POINTER_VISIBLE, pVBox->reqp->xHot, pVBox->reqp->yHot, 380 pVBox->reqp->width, pVBox->reqp->height, pVBox->reqp->pointerData,381 pVBox->reqp->header.size - pVBox->set_pointer_shape_size);379 pVBox->reqp->width, pVBox->reqp->height, pVBox->reqp->pointerData, 380 pVBox->reqp->header.size - pVBox->set_pointer_shape_size); 382 381 if (RT_FAILURE(rc)) 383 382 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not unhide the virtual mouse pointer.\n"); … … 386 385 static void 387 386 vbox_vmm_load_cursor_image(ScrnInfoPtr pScrn, VBOXPtr pVBox, 388 387 unsigned char *image) 389 388 { 390 389 int rc; … … 398 397 399 398 rc = VbglR3SetPointerShape(reqp->fFlags, reqp->xHot, reqp->yHot, reqp->width, reqp->height, 400 reqp->pointerData, reqp->header.size - pVBox->set_pointer_shape_size);399 reqp->pointerData, reqp->header.size - pVBox->set_pointer_shape_size); 401 400 if (RT_FAILURE(rc)) 402 401 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to set the virtual mouse pointer image.\n"); … … 424 423 * since the mouse cursor is drawn by the host anyway */ 425 424 #if 0 426 if ( ((x < 0) || (x > pScrn->pScreen->width))427 || ( (y < 0) || (y > pScrn->pScreen->height)))425 if ( (x < 0 || x > pScrn->pScreen->width) 426 || (y < 0 || y > pScrn->pScreen->height)) 428 427 { 429 428 if (!pVBox->pointer_offscreen) … … 539 538 dolog ("w=%d h=%d sm=%d sr=%d p=%d\n", 540 539 w, h, (int) size_mask, (int) size_rgba, (int) dst_pitch); 541 dolog ("m=%p c=%p cp=%p\n", m, c, (void *)cp);540 dolog ("m=%p c=%p cp=%p\n", m, c, cp); 542 541 543 542 fc = color_to_byte (pCurs->foreBlue) … … 646 645 647 646 /* Mask must be generated for alpha cursors, that is required by VBox. */ 648 /* @note: (michael) the next struct must be 32bit aligned. */647 /* note: (michael) the next struct must be 32bit aligned. */ 649 648 mask_size = ((w + 7) / 8 * h + 3) & ~3; 650 649 … … 684 683 memset(pm, 0xFF, mask_size); 685 684 686 /* *685 /* 687 686 * The additions driver must provide the AND mask for alpha cursors. The host frontend 688 687 * which can handle alpha channel, will ignore the AND mask and draw an alpha cursor. … … 709 708 710 709 VbglR3SetPointerShape(VBOX_MOUSE_POINTER_SHAPE | VBOX_MOUSE_POINTER_ALPHA, bitsp->xhot, bitsp->yhot, w, h, 711 (void *)pm, reqp->header.size - pVBox->set_pointer_shape_size);710 pm, reqp->header.size - pVBox->set_pointer_shape_size); 712 711 xfree(p); 713 712 } … … 769 768 * 770 769 * @returns TRUE for success, FALSE for failure 771 * @param pScr eenPointer to a structure describing the X screen in use770 * @param pScrn Pointer to a structure describing the X screen in use 772 771 */ 773 772 Bool … … 780 779 if (pVBox->useVbva != TRUE) 781 780 return FALSE; 782 rc = VbglR3VideoAccelEnable( 1);781 rc = VbglR3VideoAccelEnable(true); 783 782 if (RT_FAILURE(rc)) 784 783 { … … 789 788 "You may be running an old version of VirtualBox.\n"); 790 789 pVBox->useVbva = FALSE; 791 VbglR3VideoAccelEnable( 0);790 VbglR3VideoAccelEnable(false); 792 791 return FALSE; 793 792 } … … 801 800 * 802 801 * @returns TRUE for success, FALSE for failure 803 * @param pScr eenPointer to a structure describing the X screen in use802 * @param pScrn Pointer to a structure describing the X screen in use 804 803 */ 805 804 Bool … … 812 811 if (pVBox->useVbva != TRUE) /* Ths function should not have been called */ 813 812 return FALSE; 814 rc = VbglR3VideoAccelEnable( 0);813 rc = VbglR3VideoAccelEnable(false); 815 814 if (RT_FAILURE(rc)) 816 815 { 817 816 xf86DrvMsg(scrnIndex, X_ERROR, 818 "Unable to disable VirtualBox graphics acceleration "819 "- the request to the virtual machine failed.\n");817 "Unable to disable VirtualBox graphics acceleration " 818 "- the request to the virtual machine failed.\n"); 820 819 } 821 820 else … … 827 826 * Query the last display change request. 828 827 * 829 * @returns iprt status value 830 * @retval xres horizontal pixel resolution (0 = do not change) 831 * @retval yres vertical pixel resolution (0 = do not change) 832 * @retval bpp bits per pixel (0 = do not change) 833 * @param eventAck Flag that the request is an acknowlegement for the 834 * VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST. 835 * Values: 836 * 0 - just querying, 837 * VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged. 838 * @param display 0 for primary display, 1 for the first secondary, etc. 828 * @returns boolean success indicator. 829 * @param pScrn Pointer to the X screen info structure. 830 * @param pcx Where to store the horizontal pixel resolution (0 = do not change). 831 * @param pcy Where to store the vertical pixel resolution (0 = do not change). 832 * @param pcBits Where to store the bits per pixel (0 = do not change). 833 * @param fEventAck Flag that the request is an acknowlegement for the 834 * VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST. 835 * Values: 836 * 0 - just querying, 837 * VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged. 838 * @param iDisplay 0 for primary display, 1 for the first secondary, etc. 839 839 */ 840 840 Bool 841 vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *px, uint32_t *py, 842 uint32_t *pbpp, uint32_t eventAck, uint32_t display) 843 { 844 int rc, scrnIndex = pScrn->scrnIndex; 845 rc = VbglR3GetDisplayChangeRequest(px, py, pbpp, eventAck, display); 841 vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy, 842 uint32_t *pcBits, uint32_t fEventAck, uint32_t iDisplay) 843 { 844 int rc = VbglR3GetDisplayChangeRequest(pcx, pcy, pcBits, fEventAck, iDisplay); 846 845 if (RT_SUCCESS(rc)) 847 846 return TRUE; 848 xf86DrvMsg( scrnIndex, X_ERROR, "Failed to request the last resolution requested from the guest, rc=%d.\n", rc);847 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to request the last resolution requested from the guest, rc=%d.\n", rc); 849 848 return FALSE; 850 849 } 850
Note:
See TracChangeset
for help on using the changeset viewer.