VirtualBox

Changeset 26650 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Feb 19, 2010 1:42:35 PM (15 years ago)
Author:
vboxsync
Message:

pdmifs,DevPS2,DrvMouseQueue,MouseImpl: hungarian changes and some other cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MouseImpl.cpp

    r26638 r26650  
    4646} DRVMAINMOUSE, *PDRVMAINMOUSE;
    4747
    48 /** Converts a PDMIMOUSECONNECTOR pointer to a DRVMAINMOUSE pointer. */
    49 #define PPDMIMOUSECONNECTOR_2_MAINMOUSE(pInterface) ( (PDRVMAINMOUSE) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINMOUSE, IConnector)) )
    5048
    5149// constructor / destructor
     
    403401                                          LONG buttonState)
    404402{
    405     HRESULT rc = S_OK;
    406 
    407403    AutoCaller autoCaller(this);
    408404    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     
    414410
    415411    uint32_t mouseXAbs;
    416     rc = convertDisplayWidth(x, &mouseXAbs);
     412    HRESULT rc = convertDisplayWidth(x, &mouseXAbs);
    417413    ComAssertComRCRet(rc, rc);
    418414    if (mouseXAbs > 0xffff)
    419415        mouseXAbs = mLastAbsX;
     416
    420417    uint32_t mouseYAbs;
    421418    rc = convertDisplayHeight(y, &mouseYAbs);
     
    423420    if (mouseYAbs > 0xffff)
    424421        mouseYAbs = mLastAbsY;
     422
    425423    uint32_t fButtons = mouseButtonsToPDM(buttonState);
     424
    426425    /* Older guest additions rely on a small phony movement event on the
    427426     * PS/2 device to notice absolute events. */
     
    435434        rc = getVMMDevMouseCaps(&mouseCaps);
    436435        ComAssertComRCRet(rc, rc);
     436
    437437        /*
    438438         * This method being called implies that the host wants
     
    449449        fNeedsJiggle = !(mouseCaps & VMMDEV_MOUSE_GUEST_USES_VMMDEV);
    450450    }
    451     ComAssertComRCRet (rc, rc);
     451    ComAssertComRCRet(rc, rc);
     452
    452453    mLastAbsX = mouseXAbs;
    453454    mLastAbsY = mouseYAbs;
     455
    454456    if (!(uDevCaps & MOUSE_DEVCAP_ABSOLUTE))
    455457    {
     
    460462         * the way. */
    461463        if (fNeedsJiggle || fButtons != mLastButtons || dz || dw)
     464        {
    462465            rc = reportRelEventToMouseDev(fNeedsJiggle ? 1 : 0, 0, dz, dw,
    463466                                          fButtons);
    464         ComAssertComRCRet (rc, rc);
     467            ComAssertComRCRet(rc, rc);
     468        }
    465469    }
    466470    mLastButtons = fButtons;
     
    471475/////////////////////////////////////////////////////////////////////////////
    472476
    473 /**
    474  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    475  */
    476 DECLCALLBACK(void *)  Mouse::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    477 {
    478     PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    479     PDRVMAINMOUSE   pDrv    = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
    480 
    481     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
    482     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUSECONNECTOR, &pDrv->IConnector);
    483     return NULL;
    484 }
    485 
    486 
    487 /**
    488  * Destruct a mouse driver instance.
    489  *
    490  * @returns VBox status.
    491  * @param   pDrvIns     The driver instance data.
    492  */
    493 DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns)
    494 {
    495     PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
    496     LogFlow(("Mouse::drvDestruct: iInstance=%d\n", pDrvIns->iInstance));
    497     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
    498 
    499     if (pData->pMouse)
    500     {
    501         AutoWriteLock mouseLock(pData->pMouse COMMA_LOCKVAL_SRC_POS);
    502         pData->pMouse->mpDrv = NULL;
    503     }
    504 }
    505 
    506 
    507 DECLCALLBACK(void) Mouse::mouseAbsModeChange (PPDMIMOUSECONNECTOR pInterface, bool fAbs)
    508 {
    509     PDRVMAINMOUSE pDrv = PPDMIMOUSECONNECTOR_2_MAINMOUSE (pInterface);
    510     if (fAbs)
     477
     478/**
     479 * @interface_method_impl{PDMIMOUSECONNECTOR,pfnAbsModeChange}
     480 */
     481DECLCALLBACK(void) Mouse::mouseAbsModeChange(PPDMIMOUSECONNECTOR pInterface, bool fEnabled)
     482{
     483    PDRVMAINMOUSE pDrv = RT_FROM_MEMBER(pInterface, DRVMAINMOUSE, IConnector);
     484    if (fEnabled)
    511485        pDrv->pMouse->uDevCaps |= MOUSE_DEVCAP_ABSOLUTE;
    512486    else
    513487        pDrv->pMouse->uDevCaps &= ~MOUSE_DEVCAP_ABSOLUTE;
     488
    514489    /** @todo we have to hack around the fact that VMMDev may not be
    515490     * initialised too close to startup.  The real fix is to change the
     
    523498        rc = pDrv->pMouse->getVMMDevMouseCaps(&fMouseCaps);
    524499    AssertComRCReturnVoid(rc);
    525     pDrv->pMouse->getParent()->onMouseCapabilityChange (fAbs, fMouseCaps & VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR);
     500    pDrv->pMouse->getParent()->onMouseCapabilityChange(fEnabled, fMouseCaps & VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR);
     501}
     502
     503
     504/**
     505 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     506 */
     507DECLCALLBACK(void *)  Mouse::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     508{
     509    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     510    PDRVMAINMOUSE   pDrv    = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
     511
     512    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
     513    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUSECONNECTOR, &pDrv->IConnector);
     514    return NULL;
     515}
     516
     517
     518/**
     519 * Destruct a mouse driver instance.
     520 *
     521 * @returns VBox status.
     522 * @param   pDrvIns     The driver instance data.
     523 */
     524DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns)
     525{
     526    PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
     527    LogFlow(("Mouse::drvDestruct: iInstance=%d\n", pDrvIns->iInstance));
     528    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     529
     530    if (pData->pMouse)
     531    {
     532        AutoWriteLock mouseLock(pData->pMouse COMMA_LOCKVAL_SRC_POS);
     533        pData->pMouse->mpDrv = NULL;
     534    }
    526535}
    527536
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