VirtualBox

Changeset 44859 in vbox


Ignore:
Timestamp:
Feb 28, 2013 10:38:28 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Multi-screen support: Make sure disabled guest-screens are hidden, enabled guest-screens are being rebuilt before shown.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r44827 r44859  
    131131    /* Friend classes: */
    132132    friend class UIMachineLogic;
     133    friend class UIMachineLogicFullscreen;
     134    friend class UIMachineLogicSeamless;
    133135};
    134136
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r44848 r44859  
    106106}
    107107
     108bool UIMachineLogicFullscreen::hasHostScreenForGuestScreen(int iScreenId) const
     109{
     110    return m_pScreenLayout->hasHostScreenForGuestScreen(iScreenId);
     111}
     112
    108113#ifdef Q_WS_MAC
    109114void UIMachineLogicFullscreen::sltChangePresentationMode(bool /* fEnabled */)
     
    165170    for (int i = 0; i < machineWindows().size(); ++i)
    166171        connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()),
    167                 static_cast<UIMachineWindowFullscreen*>(machineWindows()[i]), SLOT(sltPlaceOnScreen()));
     172                static_cast<UIMachineWindowFullscreen*>(machineWindows()[i]), SLOT(sltShowInNecessaryMode()));
    168173
    169174#ifdef Q_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r44848 r44859  
    4545    /* Multi-screen stuff: */
    4646    int hostScreenForGuestScreen(int iScreenId) const;
     47    bool hasHostScreenForGuestScreen(int iScreenId) const;
    4748
    4849private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r43666 r44859  
    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
     
    5252    /* Update mini-toolbar: */
    5353    updateAppearanceOf(UIVisualElement_MiniToolBar);
    54 }
    55 
    56 void UIMachineWindowFullscreen::sltPlaceOnScreen()
    57 {
    58     /* Get corresponding screen: */
    59     int iScreen = qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
    60     /* Calculate working area: */
    61     QRect workingArea = QApplication::desktop()->screenGeometry(iScreen);
    62     /* Move to the appropriate position: */
    63     move(workingArea.topLeft());
    64     /* Resize to the appropriate size: */
    65     resize(workingArea.size());
    66     /* Process pending move & resize events: */
    67     qApp->processEvents();
    6854}
    6955
     
    168154}
    169155
     156void UIMachineWindowFullscreen::placeOnScreen()
     157{
     158    /* Get corresponding screen: */
     159    int iScreen = qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
     160    /* Calculate working area: */
     161    QRect workingArea = QApplication::desktop()->screenGeometry(iScreen);
     162    /* Move to the appropriate position: */
     163    move(workingArea.topLeft());
     164    /* Resize to the appropriate size: */
     165    resize(workingArea.size());
     166    /* Process pending move & resize events: */
     167    qApp->processEvents();
     168}
     169
    170170void UIMachineWindowFullscreen::showInNecessaryMode()
    171171{
    172     /* Show window if we have to: */
     172    /* Should we show window?: */
    173173    if (uisession()->isScreenVisible(m_uScreenId))
    174174    {
    175         /* Make sure the window is placed on valid screen
    176          * before we are show fullscreen window: */
    177         sltPlaceOnScreen();
     175        /* Do we have the seamless logic? */
     176        if (UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic()))
     177        {
     178            /* Is this guest screen has own host screen? */
     179            if (pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
     180            {
     181                /* Make sure the window is placed on valid screen
     182                 * before we are show fullscreen window: */
     183                placeOnScreen();
    178184
    179185#ifdef Q_WS_WIN
    180         /* On Windows we should activate main window first,
    181          * because entering fullscreen there doesn't means window will be auto-activated,
    182          * so no window-activation event will be received
    183          * and no keyboard-hook created otherwise... */
    184         if (m_uScreenId == 0)
    185             setWindowState(windowState() | Qt::WindowActive);
     186                /* On Windows we should activate main window first,
     187                 * because entering fullscreen there doesn't means window will be auto-activated,
     188                 * so no window-activation event will be received
     189                 * and no keyboard-hook created otherwise... */
     190                if (m_uScreenId == 0)
     191                    setWindowState(windowState() | Qt::WindowActive);
    186192#endif /* Q_WS_WIN */
    187193
    188         /* Show window fullscreen: */
    189         showFullScreen();
    190 
    191         /* Make sure the window is placed on valid screen again
    192          * after window is shown & window's decorations applied.
    193          * That is required due to X11 Window Geometry Rules. */
    194         sltPlaceOnScreen();
     194                /* Show window fullscreen: */
     195                showFullScreen();
     196
     197                /* Make sure the window is placed on valid screen again
     198                 * after window is shown & window's decorations applied.
     199                 * That is required due to X11 Window Geometry Rules. */
     200                placeOnScreen();
    195201
    196202#ifdef Q_WS_MAC
    197         /* Make sure it is really on the right place (especially on the Mac): */
    198         QRect r = QApplication::desktop()->screenGeometry(qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId));
    199         move(r.topLeft());
     203                /* Make sure it is really on the right place (especially on the Mac): */
     204                QRect r = QApplication::desktop()->screenGeometry(qobject_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId));
     205                move(r.topLeft());
    200206#endif /* Q_WS_MAC */
     207
     208                /* Return early: */
     209                return;
     210            }
     211        }
    201212    }
    202     /* Else hide window: */
    203     else hide();
     213    /* Hide in other cases: */
     214    hide();
    204215}
    205216
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r41114 r44859  
    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
     
    4141    void sltMachineStateChanged();
    4242
    43     /* Places window on screen: */
    44     void sltPlaceOnScreen();
     43    /* Show in necessary mode: */
     44    void sltShowInNecessaryMode() { showInNecessaryMode(); }
    4545
    4646    /* Popup main-menu: */
     
    6060
    6161    /* Show stuff: */
     62    void placeOnScreen();
    6263    void showInNecessaryMode();
    6364
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r44848 r44859  
    9292}
    9393
     94bool UIMachineLogicSeamless::hasHostScreenForGuestScreen(int iScreenId) const
     95{
     96    return m_pScreenLayout->hasHostScreenForGuestScreen(iScreenId);
     97}
     98
    9499void UIMachineLogicSeamless::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
    95100{
     
    145150    for (int i = 0; i < machineWindows().size(); ++i)
    146151        connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()),
    147                 static_cast<UIMachineWindowSeamless*>(machineWindows()[i]), SLOT(sltPlaceOnScreen()));
     152                static_cast<UIMachineWindowSeamless*>(machineWindows()[i]), SLOT(sltShowInNecessaryMode()));
    148153
    149154    /* Remember what machine window(s) created: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h

    r44848 r44859  
    4242    /* Multi-screen stuff: */
    4343    int hostScreenForGuestScreen(int iScreenId) const;
     44    bool hasHostScreenForGuestScreen(int iScreenId) const;
    4445
    4546private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r41689 r44859  
    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
     
    6262}
    6363#endif /* !Q_WS_MAC */
    64 
    65 void UIMachineWindowSeamless::sltPlaceOnScreen()
    66 {
    67     /* Get corresponding screen: */
    68     int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
    69     /* Calculate working area: */
    70     QRect workingArea = vboxGlobal().availableGeometry(iScreen);
    71     /* Move to the appropriate position: */
    72     move(workingArea.topLeft());
    73     /* Resize to the appropriate size: */
    74     resize(workingArea.size());
    75     /* Process pending move & resize events: */
    76     qApp->processEvents();
    77 }
    7864
    7965void UIMachineWindowSeamless::sltPopupMainMenu()
     
    220206}
    221207
     208void UIMachineWindowSeamless::placeOnScreen()
     209{
     210    /* Get corresponding screen: */
     211    int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
     212    /* Calculate working area: */
     213    QRect workingArea = vboxGlobal().availableGeometry(iScreen);
     214    /* Move to the appropriate position: */
     215    move(workingArea.topLeft());
     216    /* Resize to the appropriate size: */
     217    resize(workingArea.size());
     218    /* Process pending move & resize events: */
     219    qApp->processEvents();
     220}
     221
    222222void UIMachineWindowSeamless::showInNecessaryMode()
    223223{
    224     /* Show window if we have to: */
     224    /* Should we show window?: */
    225225    if (uisession()->isScreenVisible(m_uScreenId))
    226226    {
    227         /* Show manually maximized window: */
    228         sltPlaceOnScreen();
    229 
    230         /* Show normal window: */
    231         show();
    232 
    233 #ifdef Q_WS_MAC
    234         /* Make sure it is really on the right place (especially on the Mac): */
    235         int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
    236         QRect r = vboxGlobal().availableGeometry(iScreen);
    237         move(r.topLeft());
    238 #endif /* Q_WS_MAC */
    239     }
    240     /* Else hide window: */
    241     else hide();
     227        /* Do we have the seamless logic? */
     228        if (UIMachineLogicSeamless *pSeamlessLogic = qobject_cast<UIMachineLogicSeamless*>(machineLogic()))
     229        {
     230            /* Is this guest screen has own host screen? */
     231            if (pSeamlessLogic->hasHostScreenForGuestScreen(m_uScreenId))
     232            {
     233                /* Show manually maximized window: */
     234                placeOnScreen();
     235
     236                /* Show normal window: */
     237                show();
     238
     239#ifdef Q_WS_MAC
     240                /* Make sure it is really on the right place (especially on the Mac): */
     241                QRect r = vboxGlobal().availableGeometry(qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId));
     242                move(r.topLeft());
     243#endif /* Q_WS_MAC */
     244
     245                /* Return early: */
     246                return;
     247            }
     248        }
     249    }
     250    /* Hide in other cases: */
     251    hide();
    242252}
    243253
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r41115 r44859  
    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
     
    4343#endif /* !Q_WS_MAC */
    4444
    45     /* Places window on screen: */
    46     void sltPlaceOnScreen();
     45    /* Show in necessary mode: */
     46    void sltShowInNecessaryMode() { showInNecessaryMode(); }
    4747
    4848    /* Popup main menu: */
     
    7979
    8080    /* Show stuff: */
     81    void placeOnScreen();
    8182    void showInNecessaryMode();
    8283
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