VirtualBox

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


Ignore:
Timestamp:
Aug 15, 2013 12:39:09 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88016
Message:

Main/Mouse: add priorities to mouse devices so that the USB mouse is preferred over the PS/2 one when supported by the guest.

Location:
trunk/src/VBox/Main/src-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r47419 r47758  
    24602460                InsertConfigNode(pLunL1,   "Config", &pCfg);
    24612461                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
     2462                InsertConfigInteger(pCfg,  "Priority",   2);  /* Prefer over PS/2 */
    24622463            }
    24632464            if (   aPointingHID == PointingHIDType_USBTablet
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r47701 r47758  
    5959    /** The capabilities of this device. */
    6060    uint32_t                    u32DevCaps;
     61    /** The device priority. */
     62    uint32_t                    u32Priority;
    6163};
    6264
     
    975977     * Validate configuration.
    976978     */
    977     if (!CFGMR3AreValuesValid(pCfg, "Object\0"))
     979    if (!CFGMR3AreValuesValid(pCfg, "Object\0Priority\0"))
    978980        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    979981    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     
    10091011    }
    10101012    pThis->pMouse = (Mouse *)pv;        /** @todo Check this cast! */
     1013    /*
     1014     * Get the device priority.
     1015     */
     1016    rc = CFGMR3QueryU32Def(pCfg, "Priority", &pThis->u32Priority, 1);
     1017    if (RT_FAILURE(rc))
     1018    {
     1019        AssertMsgFailed(("Configuration error: Bad \"Priority\" value! rc=%Rrc\n", rc));
     1020        return rc;
     1021    }
    10111022    unsigned cDev;
    10121023    {
     1024        PDRVMAINMOUSE pObject = pThis;
    10131025        AutoReadLock mouseLock(pThis->pMouse COMMA_LOCKVAL_SRC_POS);
    10141026
    10151027        for (cDev = 0; cDev < MOUSE_MAX_DEVICES; ++cDev)
    1016             if (!pThis->pMouse->mpDrv[cDev])
     1028            if (pThis->pMouse->mpDrv[cDev])
    10171029            {
    1018                 pThis->pMouse->mpDrv[cDev] = pThis;
     1030                /* Fix priorities. */
     1031                if (   pThis->pMouse->mpDrv[cDev]->u32Priority
     1032                    <= pObject->u32Priority)
     1033                {
     1034                    PDRVMAINMOUSE pNewObject = pThis->pMouse->mpDrv[cDev];
     1035                    pThis->pMouse->mpDrv[cDev] = pObject;
     1036                    pObject = pNewObject;
     1037                }
     1038            }
     1039            else
     1040            {
     1041                pThis->pMouse->mpDrv[cDev] = pObject;
    10191042                break;
    10201043            }
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