VirtualBox

Changeset 44834 in vbox


Ignore:
Timestamp:
Feb 26, 2013 4:58:48 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83974
Message:

FE/Qt: Multi-screen support: Cleanup multi-screen layout (part 6).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r44833 r44834  
    6363void UIMultiScreenLayout::update()
    6464{
    65     CMachine machine = m_pMachineLogic->session().GetMachine();
    66     /* Make a pool of available host screens. */
     65    /* Make a pool of available host screens: */
    6766    QList<int> availableScreens;
    6867    for (int i = 0; i < m_cHostScreens; ++i)
    6968        availableScreens << i;
    70     /* Load all combinations stored in the settings file. We have to make sure
    71      * they are valid, which means there have to be unique combinations and all
    72      * guests screens need there own host screen. */
     69
     70    /* Load all combinations stored in the settings file.
     71     * We have to make sure they are valid, which means there have to be unique combinations
     72     * and all guests screens need there own host screen. */
     73    CMachine machine = m_pMachineLogic->session().GetMachine();
    7374    QDesktopWidget *pDW = QApplication::desktop();
    7475    for (int i = 0; i < m_cGuestScreens; ++i)
     
    8485        {
    8586            /* If not, check the position of the guest window in normal mode.
    86              * This makes sure that on first use the window opens on the same
    87              * screen as the normal window was before. This even works with
    88              * multi-screen. The user just have to move all the normal windows
    89              * to the target screens and they will magically open there in
    90              * seamless/fullscreen also. */
     87             * This makes sure that on first use the window opens on the same screen as the normal window was before.
     88             * This even works with multi-screen. The user just have to move all the normal windows to the target screens
     89             * and they will magically open there in seamless/fullscreen also. */
    9190            QString strTest1 = machine.GetExtraData(GUI_LastNormalWindowPosition + (i > 0 ? QString::number(i): ""));
    9291            QRegExp posParser("(-?\\d+),(-?\\d+),(-?\\d+),(-?\\d+)");
    9392            if (posParser.exactMatch(strTest1))
    9493            {
    95                 /* If parsing was successfully, convert it to a position. */
     94                /* If parsing was successfully, convert it to a position: */
    9695                bool fOk1, fOk2;
    9796                QPoint p(posParser.cap(1).toInt(&fOk1), posParser.cap(2).toInt(&fOk2));
    98                 /* Check to which screen the position belongs. */
     97                /* Check to which screen the position belongs: */
    9998                cScreen = pDW->screenNumber(p);
    10099                if (!(   fOk1 /* Valid data */
     
    102101                      && cScreen >= 0 && cScreen < m_cHostScreens /* In the host screen bounds? */
    103102                      && m_screenMap.key(cScreen, -1) == -1)) /* Not taken already? */
    104                     /* If not, simply pick the next one of the still available
    105                      * host screens. */
     103                    /* If not, simply pick the next one of the still available host screens: */
    106104                    cScreen = availableScreens.first();
    107105            }
    108106            else
    109                 /* If not, simply pick the next one of the still available host
    110                  * screens. */
     107                /* If not, simply pick the next one of the still available host screens: */
    111108                cScreen = availableScreens.first();
    112109        }
    113110        m_screenMap.insert(i, cScreen);
    114         /* Remove the just selected screen from the list of available screens. */
     111        /* Remove the just selected screen from the list of available: */
    115112        availableScreens.removeOne(cScreen);
    116113    }
     
    160157void UIMultiScreenLayout::sltScreenLayoutChanged(QAction *pAction)
    161158{
     159    /* Parse incoming information: */
    162160    int a = pAction->data().toInt();
    163161    int cGuestScreen = RT_LOWORD(a);
    164162    int cHostScreen = RT_HIWORD(a);
    165163
    166     CMachine machine = m_pMachineLogic->session().GetMachine();
    167     QMap<int,int> tmpMap(m_screenMap);
    168164    /* Search for the virtual screen which is currently displayed on the
    169165     * requested host screen. When there is one found, we swap both. */
     166    QMap<int,int> tmpMap(m_screenMap);
    170167    int r = tmpMap.key(cHostScreen, -1);
    171168    if (r != -1)
     
    174171    tmpMap.insert(cGuestScreen, cHostScreen);
    175172
     173    /* Check the memory requirements first: */
    176174    bool fSuccess = true;
     175    CMachine machine = m_pMachineLogic->session().GetMachine();
    177176    if (m_pMachineLogic->uisession()->isGuestAdditionsActive())
    178177    {
     
    181180            * 8; /* to bits */
    182181        quint64 usedBits = memoryRequirements(tmpMap);
    183 
    184182        fSuccess = availBits >= usedBits;
    185183        if (!fSuccess)
    186184        {
    187             /* We have to little video memory for the new layout, so say it to the
    188              * user and revert all changes. */
     185            /* We have too little video memory for the new layout, so say it to the user and revert all the changes: */
    189186            if (m_pMachineLogic->visualStateType() == UIVisualStateType_Seamless)
    190187                msgCenter().cannotSwitchScreenInSeamless((((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
     
    218215void UIMultiScreenLayout::calculateGuestScreenCount()
    219216{
     217    /* Get machine: */
    220218    CMachine machine = m_pMachineLogic->session().GetMachine();
     219    /* Get the amount of the guest screens: */
    221220    m_cGuestScreens = machine.GetMonitorCount();
    222221}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette