VirtualBox

Changeset 89921 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Jun 25, 2021 6:47:30 PM (4 years ago)
Author:
vboxsync
Message:

Main/Console: Correctly handle mouse and keyboard type of None, which in principle was always allowed but still added the hardware.

Frontends/VBoxManage: For modifyvm, allow configuring a VM to have no mouse and/or keyboard.
So far undocumented because it needs more testing, but should be safe.

File:
1 edited

Legend:

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

    r89868 r89921  
    16911691        InsertConfigNode(pInst,    "Config", &pCfg);
    16921692
    1693         InsertConfigNode(pInst,    "LUN#0", &pLunL0);
    1694         InsertConfigString(pLunL0, "Driver",               "KeyboardQueue");
    1695         InsertConfigNode(pLunL0,   "Config", &pCfg);
    1696         InsertConfigInteger(pCfg,  "QueueSize",            64);
    1697 
    1698         InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
    1699         InsertConfigString(pLunL1, "Driver",               "MainKeyboard");
    1700         InsertConfigNode(pLunL1,   "Config", &pCfg);
    1701         Keyboard *pKeyboard = mKeyboard;
    1702         InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
    1703 
    1704         Mouse *pMouse = mMouse;
     1693        KeyboardHIDType_T aKbdHID;
     1694        hrc = pMachine->COMGETTER(KeyboardHIDType)(&aKbdHID);                               H();
     1695        if (aKbdHID != KeyboardHIDType_None)
     1696        {
     1697            InsertConfigNode(pInst,    "LUN#0", &pLunL0);
     1698            InsertConfigString(pLunL0, "Driver",               "KeyboardQueue");
     1699            InsertConfigNode(pLunL0,   "Config", &pCfg);
     1700            InsertConfigInteger(pCfg,  "QueueSize",            64);
     1701
     1702            InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
     1703            InsertConfigString(pLunL1, "Driver",               "MainKeyboard");
     1704            InsertConfigNode(pLunL1,   "Config", &pCfg);
     1705            Keyboard *pKeyboard = mKeyboard;
     1706            InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
     1707        }
     1708
    17051709        PointingHIDType_T aPointingHID;
    17061710        hrc = pMachine->COMGETTER(PointingHIDType)(&aPointingHID);                          H();
    1707         InsertConfigNode(pInst,    "LUN#1", &pLunL0);
    1708         InsertConfigString(pLunL0, "Driver",               "MouseQueue");
    1709         InsertConfigNode(pLunL0,   "Config", &pCfg);
    1710         InsertConfigInteger(pCfg, "QueueSize",            128);
    1711 
    1712         InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
    1713         InsertConfigString(pLunL1, "Driver",               "MainMouse");
    1714         InsertConfigNode(pLunL1,   "Config", &pCfg);
    1715         InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
     1711        if (aPointingHID != PointingHIDType_None)
     1712        {
     1713            InsertConfigNode(pInst,    "LUN#1", &pLunL0);
     1714            InsertConfigString(pLunL0, "Driver",               "MouseQueue");
     1715            InsertConfigNode(pLunL0,   "Config", &pCfg);
     1716            InsertConfigInteger(pCfg, "QueueSize",            128);
     1717
     1718            InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
     1719            InsertConfigString(pLunL1, "Driver",               "MainMouse");
     1720            InsertConfigNode(pLunL1,   "Config", &pCfg);
     1721            Mouse *pMouse = mMouse;
     1722            InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
     1723        }
    17161724
    17171725        /*
     
    22282236                InsertConfigString(pLunL1, "Driver",        "MainMouse");
    22292237                InsertConfigNode(pLunL1,   "Config", &pCfg);
     2238                Mouse *pMouse = mMouse;
    22302239                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
    22312240            }
     
    22442253                InsertConfigString(pLunL1, "Driver",        "MainMouse");
    22452254                InsertConfigNode(pLunL1,   "Config", &pCfg);
     2255                Mouse *pMouse = mMouse;
    22462256                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
    22472257            }
    22482258
    22492259            /* Virtual USB Keyboard */
    2250             KeyboardHIDType_T aKbdHID;
    2251             hrc = pMachine->COMGETTER(KeyboardHIDType)(&aKbdHID);                       H();
    22522260            if (aKbdHID == KeyboardHIDType_USBKeyboard)
    22532261            {
     
    22642272                InsertConfigString(pLunL1, "Driver",               "MainKeyboard");
    22652273                InsertConfigNode(pLunL1,   "Config", &pCfg);
    2266                 pKeyboard = mKeyboard;
     2274                Keyboard *pKeyboard = mKeyboard;
    22672275                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
    22682276            }
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