VirtualBox

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


Ignore:
Timestamp:
Jun 4, 2024 4:06:02 PM (8 months ago)
Author:
vboxsync
Message:

Additions/Graphics: Implemented missing support for reporting the mouse cursor positions to the host within the XPDM + WDDM mini port drivers. bugref:10650

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPCommon.cpp

    r98103 r104836  
    131131    return RT_SUCCESS(rc);
    132132}
     133
     134/**
     135 * Reports the current mouse cursor position to the host and optionally retrieves the current position from the host.
     136 *
     137 * @returns VBox status code.
     138 * @param   pCommon             VBoxMP common context to use.
     139 * @param   pPos                Mouse position to report to the host.
     140 * @param   pxHost              X position reported from the host. Optional and can be NULL.
     141 * @param   pyHost              Y position reported from the host. Optional and can be NULL.
     142 */
     143int VBoxMPCmnReportCursorPositionEx(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_POSITION pPos, uint32_t *pxHost, uint32_t *pyHost)
     144{
     145    return VBoxHGSMIReportCursorPosition(&pCommon->guestCtx, true /* fReport */, pPos->Column, pPos->Row, pxHost, pyHost);
     146}
     147
     148/**
     149 * Reports the current mouse cursor position to the host.
     150 *
     151 * @returns VBox status code.
     152 * @param   pCommon             VBoxMP common context to use.
     153 * @param   pPos                Mouse position to report to the host.
     154 */
     155int VBoxMPCmnReportCursorPosition(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_POSITION pPos)
     156{
     157    return VBoxMPCmnReportCursorPositionEx(pCommon, pPos, NULL /* pxHost */, NULL /* pyHost */);
     158}
     159
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPCommon.h

    r99828 r104836  
    6666/* Pointer related */
    6767bool VBoxMPCmnUpdatePointerShape(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_ATTRIBUTES pAttrs, uint32_t cbLength);
     68int VBoxMPCmnReportCursorPositionEx(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_POSITION pPos, uint32_t *pxHost, uint32_t *pyHost);
     69int VBoxMPCmnReportCursorPosition(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_POSITION pPos);
    6870
    6971RT_C_DECLS_END
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h

    r99990 r104836  
    103103typedef struct _VBOXWDDM_GLOBAL_POINTER_INFO
    104104{
     105    /** Last updated X position. */
     106    uint32_t iLastPosX;
     107    /** Last updated Y position. */
     108    uint32_t iLastPosY;
    105109    uint32_t iLastReportedScreen;
    106110} VBOXWDDM_GLOBAL_POINTER_INFO, *PVBOXWDDM_GLOBAL_POINTER_INFO;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r100085 r104836  
    31313131}
    31323132
     3133/**
     3134 * Reports the current mouse cursor position to the host.
     3135 *
     3136 * @returns VBox status code.
     3137 * @param   pDevExt             Device extension to use.
     3138 * @param   xPos                X position to report to the host.
     3139 * @param   yPos                Y position to report to the host.
     3140 */
     3141static int vboxWddmReportCursorPosition(PVBOXMP_DEVEXT pDevExt, uint32_t xPos, uint32_t yPos)
     3142{
     3143    VIDEO_POINTER_POSITION Pos;
     3144    RT_ZERO(Pos);
     3145    Pos.Column = xPos;
     3146    Pos.Row    = yPos;
     3147
     3148    return VBoxMPCmnReportCursorPosition(VBoxCommonFromDeviceExt(pDevExt), &Pos);
     3149}
     3150
    31333151NTSTATUS
    31343152APIENTRY
     
    31693187    pGlobalPointerInfo->iLastReportedScreen = pSetPointerPosition->VidPnSourceId;
    31703188
    3171     if ((fVisStateChanged || fScreenChanged) && VBoxQueryHostWantsAbsolute())
     3189    const bool fWantsAbsolute = VBoxQueryHostWantsAbsolute();
     3190
     3191    if ((fVisStateChanged || fScreenChanged) && fWantsAbsolute)
    31723192    {
    31733193        if (fScreenChanged)
     
    31843204    }
    31853205
    3186 //    LOGF(("LEAVE, hAdapter(0x%x)", hAdapter));
     3206    /* Report the mouse cursor position to the host if changed. */
     3207    if (   fWantsAbsolute
     3208        && (   pGlobalPointerInfo->iLastPosX != (uint32_t)pSetPointerPosition->X
     3209            || pGlobalPointerInfo->iLastPosY != (uint32_t)pSetPointerPosition->Y))
     3210    {
     3211        vboxWddmReportCursorPosition(pDevExt, (uint32_t)pSetPointerPosition->X, (uint32_t)pSetPointerPosition->Y);
     3212
     3213        pGlobalPointerInfo->iLastPosX = (uint32_t)pSetPointerPosition->X;
     3214        pGlobalPointerInfo->iLastPosY = (uint32_t)pSetPointerPosition->Y;
     3215    }
     3216
     3217    //    LOGF(("LEAVE, hAdapter(0x%x)", hAdapter));
    31873218
    31883219    return STATUS_SUCCESS;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPDriver.cpp

    r99828 r104836  
    394394        }
    395395
    396         /* Sets pointer position, is called after IOCTL_VIDEO_ENABLE_POINTER. */
     396        /* Sets (reports) pointer position, is called after IOCTL_VIDEO_ENABLE_POINTER. */
    397397        case IOCTL_VIDEO_SET_POINTER_POSITION:
    398398        {
    399399            STARTIO_IN(VIDEO_POINTER_POSITION, pPos);
    400400
    401             NOREF(pPos); /** @todo set pointer position*/
    402             bResult = VBoxMPEnablePointer(pExt, TRUE, pStatus);
     401            bResult = VBoxMPReportCursorPosition(pExt, pPos, pStatus);
    403402            break;
    404403        }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPIOCTL.cpp

    r98103 r104836  
    346346}
    347347
    348 
     348/**
     349 * Called by IOCTL_VIDEO_SET_POINTER_POSITION to report the current mouse cursor position to the host.
     350 *
     351 * @returns \c TRUE on success, \c FALSE on failure.
     352 * @param   pExt                Device extension to use.
     353 * @param   pPos                Mouse pointer position to report.
     354 * @param   pStatus             Status to return.
     355 */
     356BOOLEAN VBoxMPReportCursorPosition(PVBOXMP_DEVEXT pExt, PVIDEO_POINTER_POSITION pPos, PSTATUS_BLOCK pStatus)
     357{
     358    LOGF_ENTER();
     359
     360    BOOLEAN fRc;
     361    if (VBoxQueryHostWantsAbsolute())
     362    {
     363        fRc = RT_SUCCESS(VBoxMPCmnReportCursorPosition(VBoxCommonFromDeviceExt(pExt), pPos));
     364    }
     365    else
     366    {
     367        LOG(("Fallback to sw pointer."));
     368        fRc = FALSE;
     369    }
     370
     371    if (!fRc)
     372        pStatus->Status = ERROR_INVALID_FUNCTION;
     373
     374    LOGF_LEAVE();
     375    return fRc;
     376}
    349377
    350378/* Called for IOCTL_VIDEO_ENABLE_POINTER/IOCTL_VIDEO_DISABLE_POINTER.
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPInternal.h

    r98103 r104836  
    6363BOOLEAN VBoxMPSetColorRegisters(PVBOXMP_DEVEXT pExt, PVIDEO_CLUT pClut, PSTATUS_BLOCK pStatus);
    6464BOOLEAN VBoxMPSetPointerAttr(PVBOXMP_DEVEXT pExt, PVIDEO_POINTER_ATTRIBUTES pPointerAttrs, uint32_t cbLen, PSTATUS_BLOCK pStatus);
     65BOOLEAN VBoxMPReportCursorPosition(PVBOXMP_DEVEXT pExt, PVIDEO_POINTER_POSITION pPos, PSTATUS_BLOCK pStatus);
    6566BOOLEAN VBoxMPEnablePointer(PVBOXMP_DEVEXT pExt, BOOLEAN bEnable, PSTATUS_BLOCK pStatus);
    6667BOOLEAN VBoxMPQueryPointerPosition(PVBOXMP_DEVEXT pExt, PVIDEO_POINTER_POSITION pPos, PSTATUS_BLOCK pStatus);
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