VirtualBox

Changeset 44827 in vbox for trunk


Ignore:
Timestamp:
Feb 26, 2013 12:22:04 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83964
Message:

FE/Qt: Multi-screen support: Moving guest-display enable/disable logic into the appropriate place.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
4 edited

Legend:

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

    r44528 r44827  
    436436#endif /* Q_WS_MAC */
    437437
     438void UIMachineLogic::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect)
     439{
     440    /* Ignore KGuestMonitorChangedEventType_NewOrigin change event: */
     441    if (changeType == KGuestMonitorChangedEventType_NewOrigin)
     442        return;
     443    /* Ignore KGuestMonitorChangedEventType_Disabled event if there is only one window visible: */
     444    AssertMsg(uisession()->countOfVisibleWindows() > 0, ("All machine windows are hidden!"));
     445    if (   changeType == KGuestMonitorChangedEventType_Disabled
     446        && uisession()->countOfVisibleWindows() == 1
     447        && uisession()->isScreenVisible(uScreenId))
     448        return;
     449
     450    /* Process KGuestMonitorChangedEventType_Enabled change event: */
     451    if (   !uisession()->isScreenVisible(uScreenId)
     452        && changeType == KGuestMonitorChangedEventType_Enabled)
     453        uisession()->setScreenVisible(uScreenId, true);
     454    /* Process KGuestMonitorChangedEventType_Disabled change event: */
     455    else if (   uisession()->isScreenVisible(uScreenId)
     456             && changeType == KGuestMonitorChangedEventType_Disabled)
     457        uisession()->setScreenVisible(uScreenId, false);
     458
     459    /* Deliver event to corresponding machine-window: */
     460    if (uScreenId < (ulong)machineWindows().size())
     461        machineWindows()[uScreenId]->handleGuestMonitorChange();
     462}
     463
    438464UIMachineLogic::UIMachineLogic(QObject *pParent, UISession *pSession, UIVisualStateType visualStateType)
    439465    : QIWithRetranslateUI3<QObject>(pParent)
     
    563589    connect(uisession(), SIGNAL(sigShowWindows()), this, SLOT(sltShowWindows()));
    564590#endif /* Q_WS_MAC */
     591
     592    /* Guest monitor-change updater: */
     593    connect(uisession(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
     594            this, SLOT(sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)));
    565595}
    566596
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r43622 r44827  
    66
    77/*
    8  * Copyright (C) 2010-2012 Oracle Corporation
     8 * Copyright (C) 2010-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2626# include <VBox/dbggui.h>
    2727#endif /* VBOX_WITH_DEBUGGER_GUI */
     28
     29/* COM includes: */
     30#include "COMEnums.h"
    2831
    2932/* Forward declarations: */
     
    9497    virtual void sltShowWindows();
    9598#endif /* RT_OS_DARWIN */
     99    virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    96100
    97101protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r43918 r44827  
    77
    88/*
    9  * Copyright (C) 2010-2012 Oracle Corporation
     9 * Copyright (C) 2010-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    159159    /* Update window-title: */
    160160    updateAppearanceOf(UIVisualElement_WindowTitle);
    161 }
    162 
    163 void UIMachineWindow::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect /* screenGeo */)
    164 {
    165     /* Ignore change events for other screens: */
    166     if (uScreenId != m_uScreenId)
    167         return;
    168     /* Ignore KGuestMonitorChangedEventType_NewOrigin change event: */
    169     if (changeType == KGuestMonitorChangedEventType_NewOrigin)
    170         return;
    171     /* Ignore KGuestMonitorChangedEventType_Disabled event if there is only one window visible: */
    172     AssertMsg(uisession()->countOfVisibleWindows() > 0, ("All machine windows are hidden!"));
    173     if ((changeType == KGuestMonitorChangedEventType_Disabled) &&
    174         (uisession()->countOfVisibleWindows() == 1))
    175         return;
    176 
    177     /* Process KGuestMonitorChangedEventType_Enabled change event: */
    178     if (isHidden() && changeType == KGuestMonitorChangedEventType_Enabled)
    179         uisession()->setScreenVisible(m_uScreenId, true);
    180     /* Process KGuestMonitorChangedEventType_Disabled change event: */
    181     else if (!isHidden() && changeType == KGuestMonitorChangedEventType_Disabled)
    182         uisession()->setScreenVisible(m_uScreenId, false);
    183 
    184     /* Update screen visibility status: */
    185     showInNecessaryMode();
    186161}
    187162
     
    557532    /* Machine state-change updater: */
    558533    connect(uisession(), SIGNAL(sigMachineStateChange()), this, SLOT(sltMachineStateChanged()));
    559 
    560     /* Guest monitor-change updater: */
    561     connect(uisession(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
    562             this, SLOT(sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)));
    563534}
    564535
     
    632603    UIMachineView::destroy(m_pMachineView);
    633604    m_pMachineView = 0;
     605}
     606
     607void UIMachineWindow::handleGuestMonitorChange()
     608{
     609    showInNecessaryMode();
    634610}
    635611
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r41587 r44827  
    66
    77/*
    8  * Copyright (C) 2010-2012 Oracle Corporation
     8 * Copyright (C) 2010-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6666    /* Session event-handlers: */
    6767    virtual void sltMachineStateChanged();
    68     virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    6968
    7069protected:
     
    105104    virtual void cleanupSessionConnections() {}
    106105
     106    /* Visibility stuff: */
     107    void handleGuestMonitorChange();
     108
    107109    /* Update stuff: */
    108110    virtual void updateAppearanceOf(int iElement);
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