VirtualBox

Changeset 45402 in vbox


Ignore:
Timestamp:
Apr 8, 2013 12:32:55 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Multi-screen support: Seamless/Fullscreen: Auto mounting/unmounting guest-screens when necessary.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp

    r45374 r45402  
    6161const char* UIDefs::GUI_VirtualScreenToHostScreen = "GUI/VirtualScreenToHostScreen";
    6262const char* UIDefs::GUI_AutoresizeGuest = "GUI/AutoresizeGuest";
     63const char* UIDefs::GUI_AutomountGuestScreens = "GUI/AutomountGuestScreens";
    6364const char* UIDefs::GUI_SaveMountedAtRuntime = "GUI/SaveMountedAtRuntime";
    6465const char* UIDefs::GUI_PassCAD = "GUI/PassCAD";
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r45374 r45402  
    138138    extern const char* GUI_VirtualScreenToHostScreen;
    139139    extern const char* GUI_AutoresizeGuest;
     140    extern const char* GUI_AutomountGuestScreens;
    140141    extern const char* GUI_SaveMountedAtRuntime;
    141142    extern const char* GUI_PassCAD;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r45377 r45402  
    37353735    /* 'true' if hiding is not approved by the extra-data: */
    37363736    return !isApprovedByExtraData(machine, GUI_HideDetails);
     3737}
     3738
     3739/* static */
     3740bool VBoxGlobal::shouldWeAutoMountGuestScreens(CMachine &machine,
     3741                                               bool fIncludingSanityCheck /*= true*/)
     3742{
     3743    if (fIncludingSanityCheck)
     3744    {
     3745        /* 'false' for null machines,
     3746         * there is nothing to start anyway: */
     3747        if (machine.isNull())
     3748            return false;
     3749
     3750        /* 'false' for inaccessible machines,
     3751         * we can't start them anyway: */
     3752        if (!machine.GetAccessible())
     3753            return false;
     3754    }
     3755
     3756    /* 'true' if guest-screen auto-mounting approved by the extra-data: */
     3757    return isApprovedByExtraData(machine, GUI_AutomountGuestScreens);
    37373758}
    37383759
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r45377 r45402  
    379379    static bool shouldWeShowDetails(CMachine &machine,
    380380                                    bool fIncludingMachineGeneralCheck = false);
     381    static bool shouldWeAutoMountGuestScreens(CMachine &machine, bool fIncludingSanityCheck = true);
    381382
    382383#ifdef RT_OS_LINUX
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r45333 r45402  
    3030#include "UISession.h"
    3131#include "UIMessageCenter.h"
     32#include "VBoxGlobal.h"
    3233
    3334/* COM includes: */
     
    7576     * and all guests screens need there own host screen. */
    7677    CMachine machine = m_pMachineLogic->session().GetMachine();
     78    CDisplay display = m_pMachineLogic->session().GetConsole().GetDisplay();
     79    bool fShouldWeAutoMountGuestScreens = VBoxGlobal::shouldWeAutoMountGuestScreens(machine, false);
    7780    QDesktopWidget *pDW = QApplication::desktop();
    7881    foreach (int iGuestScreen, m_guestScreens)
     
    135138            availableScreens.removeOne(iHostScreen);
    136139        }
     140        /* Do we have opinion about what to do with excessive guest-screen? */
     141        else if (fShouldWeAutoMountGuestScreens)
     142        {
     143            /* Then we have to disable excessive guest-screen: */
     144            display.SetVideoModeHint(iGuestScreen, false, false, 0, 0, 0, 0, 0);
     145        }
     146    }
     147
     148    /* Are we still have available host-screens
     149     * and have opinion about what to do with disabled guest-screens? */
     150    if (!availableScreens.isEmpty() && fShouldWeAutoMountGuestScreens)
     151    {
     152        /* How many excessive host-screens do we have? */
     153        int cExcessiveHostScreens = availableScreens.size();
     154        /* How many disabled guest-screens do we have? */
     155        int cDisabledGuestScreens = m_disabledGuestScreens.size();
     156        /* We have to try to enable disabled guest-screens if any: */
     157        int cGuestScreensToEnable = qMin(cExcessiveHostScreens, cDisabledGuestScreens);
     158        for (int iGuestScreenIndex = 0; iGuestScreenIndex < cGuestScreensToEnable; ++iGuestScreenIndex)
     159        {
     160            /* Get corresponding guest-screen: */
     161            int iGuestScreen = m_disabledGuestScreens[iGuestScreenIndex];
     162            /* Re-enable guest-screen with the old arguments: */
     163            ULONG iWidth, iHeight, iBpp;
     164            display.GetScreenResolution(iGuestScreen, iWidth, iHeight, iBpp);
     165            display.SetVideoModeHint(iGuestScreen, true, false, 0, 0, iWidth, iHeight, iBpp);
     166        }
    137167    }
    138168
     
    254284    /* Get machine: */
    255285    CMachine machine = m_pMachineLogic->session().GetMachine();
    256     /* Enumerate all the visible guest screens: */
     286    /* Enumerate all the guest screens: */
    257287    m_guestScreens.clear();
     288    m_disabledGuestScreens.clear();
    258289    for (uint iGuestScreen = 0; iGuestScreen < machine.GetMonitorCount(); ++iGuestScreen)
    259290        if (m_pMachineLogic->uisession()->isScreenVisible(iGuestScreen))
    260291            m_guestScreens << iGuestScreen;
     292        else
     293            m_disabledGuestScreens << iGuestScreen;
    261294}
    262295
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h

    r44839 r45402  
    8282    UIMachineLogic *m_pMachineLogic;
    8383    QList<int> m_guestScreens;
     84    QList<int> m_disabledGuestScreens;
    8485    int m_cHostScreens;
    8586    QMap<int, int> m_screenMap;
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