VirtualBox

Changeset 29069 in vbox for trunk


Ignore:
Timestamp:
May 5, 2010 12:07:15 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
61119
Message:

FE/Qt4-OSX: Be much more smarter in deciding when the presentation mode has to
be changed in fullscreen. Also update the state on host screen switch.

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

Legend:

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

    r28800 r29069  
    8888        /* Check if valid: */
    8989        if (!(   fOk /* Valid data */
    90                  && cScreen >= 0 && cScreen < m_cHostScreens /* In the host screen bounds? */
    91                  && m_pScreenMap->key(cScreen, -1) == -1)) /* Not taken already? */
     90              && cScreen >= 0 && cScreen < m_cHostScreens /* In the host screen bounds? */
     91              && m_pScreenMap->key(cScreen, -1) == -1)) /* Not taken already? */
    9292            /* If not, use one from the available screens */
    9393            cScreen = availableScreens.first();
     
    130130{
    131131    return memoryRequirements(m_pScreenMap);
     132}
     133
     134bool UIMultiScreenLayout::isHostTaskbarCovert() const
     135{
     136    /* Check for all screens which are in use if they have some
     137     * taskbar/menubar/dock on it. Its done by comparing the available with the
     138     * screen geometry. Only if they are the same for all screens, there are no
     139     * host area covert. This is a little bit ugly, but there seems no other
     140     * way to find out if we are on a screen where the taskbar/dock or whatever
     141     * is present. */
     142    QDesktopWidget *pDW = QApplication::desktop();
     143    for (int i = 0; i < m_pScreenMap->size(); ++i)
     144    {
     145        int hostScreen = m_pScreenMap->value(i);
     146        if (pDW->availableGeometry(hostScreen) != pDW->screenGeometry(hostScreen))
     147            return true;
     148    }
     149    return false;
    132150}
    133151
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h

    r28800 r29069  
    4343    int hostScreenForGuestScreen(int screenId) const;
    4444    quint64 memoryRequirements() const;
     45    bool isHostTaskbarCovert() const;
    4546
    4647signals:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r29062 r29069  
    199199
    200200#ifdef Q_WS_MAC
     201    /* If the user change the screen, we have to decide again if the
     202     * presentation mode should be changed. */
     203    connect(m_pScreenLayout, SIGNAL(screenLayoutChanged()),
     204            this, SLOT(sltScreenLayoutChanged()));
    201205    /* Note: Presentation mode has to be set *after* the windows are created. */
    202206    setPresentationModeEnabled(true);
     
    237241}
    238242
     243void UIMachineLogicFullscreen::sltScreenLayoutChanged()
     244{
     245    setPresentationModeEnabled(true);
     246}
     247
    239248void UIMachineLogicFullscreen::setPresentationModeEnabled(bool fEnabled)
    240249{
    241     if (fEnabled)
     250    /* First check if we are on a screen which contains the Dock or the
     251     * Menubar (which hasn't to be the same), only than the
     252     * presentation mode have to be changed. */
     253    if (   fEnabled
     254        && m_pScreenLayout->isHostTaskbarCovert())
    242255    {
    243         /* First check if we are on the primary screen, only than the
    244          * presentation mode have to be changed. */
    245         // TODO_NEW_CORE: we need some algorithm to decide which virtual screen
    246         // is on which physical host display. Than we can decide on the
    247         // presentation mode as well. */
    248 //        QDesktopWidget* pDesktop = QApplication::desktop();
    249 //        if (pDesktop->screenNumber(this) == pDesktop->primaryScreen())
    250         {
    251             QString testStr = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PresentationModeEnabled).toLower();
    252             /* Default to false if it is an empty value */
    253             if (testStr.isEmpty() || testStr == "false")
    254                 SetSystemUIMode(kUIModeAllHidden, 0);
    255             else
    256                 SetSystemUIMode(kUIModeAllSuppressed, 0);
    257         }
     256        QString testStr = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PresentationModeEnabled).toLower();
     257        /* Default to false if it is an empty value */
     258        if (testStr.isEmpty() || testStr == "false")
     259            SetSystemUIMode(kUIModeAllHidden, 0);
     260        else
     261            SetSystemUIMode(kUIModeAllSuppressed, 0);
    258262    }
    259263    else
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r28800 r29069  
    4747private slots:
    4848
    49 #ifdef Q_WS_MAC
     49#ifdef RT_OS_DARWIN
    5050    void sltChangePresentationMode(const VBoxChangePresentationModeEvent &event);
    51 #endif /* Q_WS_MAC */
     51    void sltScreenLayoutChanged();
     52#endif /* RT_OS_DARWIN */
    5253
    5354private:
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