VirtualBox

Ignore:
Timestamp:
Apr 25, 2012 12:48:17 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: 5820: Show/hide VM windows when the count changes within the guest.

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

Legend:

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

    r37712 r41051  
    3939    qRegisterMetaType<CUSBDevice>("CUSBDevice");
    4040    qRegisterMetaType<CVirtualBoxErrorInfo>("CVirtualBoxErrorInfo");
     41    qRegisterMetaType<KGuestMonitorChangedEventType>("KGuestMonitorChangedEventType");
    4142}
    4243
     
    225226            break;
    226227        }
     228        case KVBoxEventType_OnGuestMonitorChanged:
     229        {
     230            CGuestMonitorChangedEvent es(pEvent);
     231            emit sigGuestMonitorChange(es.GetChangeType(), es.GetScreenId(),
     232                                       QRect(es.GetOriginX(), es.GetOriginY(), es.GetWidth(), es.GetHeight()));
     233            break;
     234        }
    227235        default: break;
    228236    }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h

    r37712 r41051  
    7676    void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */
    7777    void sigCPUExecutionCapChange();
     78    void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    7879};
    7980
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp

    r37712 r41051  
    8080        << KVBoxEventType_OnCanShowWindow
    8181        << KVBoxEventType_OnShowWindow
    82         << KVBoxEventType_OnCPUExecutionCapChanged;
     82        << KVBoxEventType_OnCPUExecutionCapChanged
     83        << KVBoxEventType_OnGuestMonitorChanged;
    8384
    8485    const CConsole &console = m_pSession->session().GetConsole();
     
    149150            this, SIGNAL(sigCPUExecutionCapChange()),
    150151            Qt::QueuedConnection);
     152
     153    connect(pListener->getWrapped(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
     154            this, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
     155            Qt::QueuedConnection);
    151156}
    152157
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h

    r37712 r41051  
    5151#endif /* RT_OS_DARWIN */
    5252    void sigCPUExecutionCapChange();
     53    void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    5354
    5455private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r38900 r41051  
    446446    /* Machine state-change updater: */
    447447    QObject::connect(uisession(), SIGNAL(sigMachineStateChange()), machineWindow(), SLOT(sltMachineStateChanged()));
     448
     449    /* Guest monitor change updater: */
     450    QObject::connect(uisession(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
     451                     machineWindow(), SLOT(sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)));
    448452}
    449453
     
    531535}
    532536
     537void UIMachineWindow::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect /* screenGeo */)
     538{
     539    /* Ignore change events for other screens: */
     540    if (uScreenId != m_uScreenId)
     541        return;
     542
     543    /* Ignore KGuestMonitorChangedEventType_NewOrigin change event: */
     544    if (changeType == KGuestMonitorChangedEventType_NewOrigin)
     545        return;
     546
     547    /* Process KGuestMonitorChangedEventType_Enabled change event: */
     548    if (machineWindow()->isHidden() && changeType == KGuestMonitorChangedEventType_Enabled)
     549        showInNecessaryMode();
     550    /* Process KGuestMonitorChangedEventType_Disabled change event: */
     551    else if (!machineWindow()->isHidden() && changeType == KGuestMonitorChangedEventType_Disabled)
     552        machineWindow()->hide();
     553}
     554
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r30636 r41051  
    2222/* Local includes */
    2323#include "UIMachineDefs.h"
     24#include "COMDefs.h"
    2425
    2526/* Global forwards */
     
    9798    /* Protected slots: */
    9899    virtual void sltMachineStateChanged();
     100    virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
     101
     102    /* Show routine: */
     103    virtual void showInNecessaryMode() = 0;
    99104
    100105    /* Protected variables: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r40870 r41051  
    138138            this, SIGNAL(sigCPUExecutionCapChange()));
    139139
     140    connect(gConsoleEvents, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
     141            this, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)));
     142
    140143    /* Prepare framebuffers: */
    141144    prepareFramebuffers();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r40273 r41051  
    173173#endif /* RT_OS_DARWIN */
    174174    void sigCPUExecutionCapChange();
     175    void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    175176
    176177    /* Session signals: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r38348 r41051  
    7575    updateAppearanceOf(UIVisualElement_AllStuff);
    7676
    77     /* Make sure the window is placed on valid screen
    78      * before we are show fullscreen window: */
    79     sltPlaceOnScreen();
    80 
    8177    /* Show fullscreen window: */
    82     showFullScreen();
    83 
    84     /* Make sure the window is placed on valid screen again
    85      * after window is shown & window's decorations applied.
    86      * That is required due to X11 Window Geometry Rules. */
    87     sltPlaceOnScreen();
    88 
    89 #ifdef Q_WS_MAC
    90     /* Make sure it is really on the right place (especially on the Mac) */
    91     QRect r = QApplication::desktop()->screenGeometry(static_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId));
    92     move(r.topLeft());
    93 #endif /* Q_WS_MAC */
     78    showInNecessaryMode();
    9479}
    9580
     
    129114{
    130115    UIMachineWindow::sltMachineStateChanged();
     116}
     117
     118void UIMachineWindowFullscreen::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
     119{
     120    UIMachineWindow::sltGuestMonitorChange(changeType, uScreenId, screenGeo);
    131121}
    132122
     
    293283}
    294284
     285void UIMachineWindowFullscreen::showInNecessaryMode()
     286{
     287    /* Make sure we really have to show window: */
     288    BOOL fEnabled = true;
     289    ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
     290    session().GetMachine().QuerySavedGuestScreenInfo(m_uScreenId, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
     291    if (fEnabled)
     292    {
     293        /* Make sure the window is placed on valid screen
     294         * before we are show fullscreen window: */
     295        sltPlaceOnScreen();
     296
     297        /* Show window fullscreen: */
     298        showFullScreen();
     299
     300        /* Make sure the window is placed on valid screen again
     301         * after window is shown & window's decorations applied.
     302         * That is required due to X11 Window Geometry Rules. */
     303        sltPlaceOnScreen();
     304
     305#ifdef Q_WS_MAC
     306        /* Make sure it is really on the right place (especially on the Mac): */
     307        QRect r = QApplication::desktop()->screenGeometry(static_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId));
     308        move(r.topLeft());
     309#endif /* Q_WS_MAC */
     310    }
     311}
     312
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r31284 r41051  
    4848    /* Console callback handlers: */
    4949    void sltMachineStateChanged();
     50    void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    5051
    5152    /* Popup main menu: */
     
    8182    void updateAppearanceOf(int iElement);
    8283
     84    /* Other members: */
     85    void showInNecessaryMode();
     86
    8387    /* Private variables: */
    8488    QMenu *m_pMainMenu;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r39932 r41051  
    104104#endif /* Q_WS_MAC */
    105105
    106     /* Show window: */
    107     showSimple();
     106    /* Show normal window: */
     107    showInNecessaryMode();
    108108}
    109109
     
    163163{
    164164    updateAppearanceOf(UIVisualElement_VirtualizationStuff);
     165}
     166
     167void UIMachineWindowNormal::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
     168{
     169    UIMachineWindow::sltGuestMonitorChange(changeType, uScreenId, screenGeo);
    165170}
    166171
     
    370375    connect(machineLogic()->uisession(), SIGNAL(sigCPUExecutionCapChange()),
    371376            this, SLOT(sltCPUExecutionCapChange()));
    372 
    373377}
    374378
     
    672676}
    673677
    674 void UIMachineWindowNormal::showSimple()
    675 {
    676     /* Just show window: */
    677     show();
     678void UIMachineWindowNormal::showInNecessaryMode()
     679{
     680    /* Make sure we really have to show window: */
     681    BOOL fEnabled = true;
     682    ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
     683    session().GetMachine().QuerySavedGuestScreenInfo(m_uScreenId, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
     684    if (fEnabled)
     685        show();
    678686}
    679687
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r39932 r41051  
    2727#include "QIWithRetranslateUI.h"
    2828#include "UIMachineWindow.h"
    29 #include "COMDefs.h"
    3029#include "UINetworkDefs.h"
    3130
     
    5554    void sltSharedFolderChange();
    5655    void sltCPUExecutionCapChange();
     56    void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    5757
    5858    /* LED connections: */
     
    104104
    105105    /* Other members: */
    106     void showSimple();
     106    void showInNecessaryMode();
    107107    bool isMaximizedChecked();
    108108    void updateIndicatorState(QIStateIndicator *pIndicator, KDeviceType deviceType);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp

    r38348 r41051  
    8787#endif /* Q_WS_MAC */
    8888
    89     /* Show window: */
    90     showSimple();
     89    /* Show scaled window: */
     90    showInNecessaryMode();
    9191}
    9292
     
    111111{
    112112    UIMachineWindow::sltMachineStateChanged();
     113}
     114
     115void UIMachineWindowScale::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
     116{
     117    UIMachineWindow::sltGuestMonitorChange(changeType, uScreenId, screenGeo);
    113118}
    114119
     
    360365}
    361366
    362 void UIMachineWindowScale::showSimple()
    363 {
    364     /* Just show window: */
    365     show();
     367void UIMachineWindowScale::showInNecessaryMode()
     368{
     369    /* Make sure we really have to show window: */
     370    BOOL fEnabled = true;
     371    ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
     372    session().GetMachine().QuerySavedGuestScreenInfo(m_uScreenId, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
     373    if (fEnabled)
     374        show();
    366375}
    367376
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h

    r35351 r41051  
    4141    /* Console callback handlers: */
    4242    void sltMachineStateChanged();
     43    void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    4344
    4445    /* Popup main menu: */
     
    7677
    7778    /* Other members: */
    78     void showSimple();
     79    void showInNecessaryMode();
    7980    bool isMaximizedChecked();
    8081
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r39408 r41051  
    9393    updateAppearanceOf(UIVisualElement_AllStuff);
    9494
    95     /* Show window: */
    96     showSeamless();
     95    /* Show seamless window: */
     96    showInNecessaryMode();
    9797}
    9898
     
    134134{
    135135    UIMachineWindow::sltMachineStateChanged();
     136}
     137
     138void UIMachineWindowSeamless::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
     139{
     140    UIMachineWindow::sltGuestMonitorChange(changeType, uScreenId, screenGeo);
    136141}
    137142
     
    359364}
    360365
    361 void UIMachineWindowSeamless::showSeamless()
    362 {
    363     /* Show manually maximized window: */
    364     sltPlaceOnScreen();
    365     show();
    366 
    367 #ifdef Q_WS_MAC
    368     /* Make sure it is really on the right place (especially on the Mac): */
    369     int iScreen = static_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
    370     QRect r = vboxGlobal().availableGeometry(iScreen);
    371     move(r.topLeft());
    372 #endif /* Q_WS_MAC */
     366void UIMachineWindowSeamless::showInNecessaryMode()
     367{
     368    /* Make sure we really have to show window: */
     369    BOOL fEnabled = true;
     370    ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
     371    session().GetMachine().QuerySavedGuestScreenInfo(m_uScreenId, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
     372    if (fEnabled)
     373    {
     374        /* Show manually maximized window: */
     375        sltPlaceOnScreen();
     376
     377        /* Show normal window: */
     378        show();
     379
     380#ifdef Q_WS_MAC
     381        /* Make sure it is really on the right place (especially on the Mac): */
     382        int iScreen = static_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
     383        QRect r = vboxGlobal().availableGeometry(iScreen);
     384        move(r.topLeft());
     385#endif /* Q_WS_MAC */
     386    }
    373387}
    374388
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r31284 r41051  
    4848    /* Console callback handlers: */
    4949    void sltMachineStateChanged();
     50    void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    5051
    5152    /* Popup main menu: */
     
    9899
    99100    /* Other members: */
    100     void showSeamless();
     101    void showInNecessaryMode();
    101102    void setMask(const QRegion &region);
    102103
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