VirtualBox

Ignore:
Timestamp:
Feb 21, 2014 7:31:53 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: 7016: Native fullscreen support: Fullscreen mode invalidation logic allowing to dynamically update multi-screen layout.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen
Files:
2 edited

Legend:

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

    r50535 r50536  
    3535UIMachineLogicFullscreen::UIMachineLogicFullscreen(QObject *pParent, UISession *pSession)
    3636    : UIMachineLogic(pParent, pSession, UIVisualStateType_Fullscreen)
     37#ifdef Q_WS_MAC
     38    , m_fIsFullscreenInvalidated(false)
     39#endif /* Q_WS_MAC */
    3740{
    3841    /* Create multiscreen layout: */
     
    137140    else
    138141    {
    139         /* Change visual-state to requested: */
    140         LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
    141                 "Machine-window(s) exited fullscreen, changing visual-state to requested...\n"));
    142         UIVisualStateType type = uisession()->requestedVisualState();
    143         if (type == UIVisualStateType_Invalid)
    144             type = UIVisualStateType_Normal;
    145         uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
    146         uisession()->changeVisualState(type);
     142        /* If fullscreen mode was just invalidated: */
     143        if (m_fIsFullscreenInvalidated)
     144        {
     145            /* Mark fullscreen mode valid again and re-enter it: */
     146            LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
     147                    "Machine-window(s) exited invalidated fullscreen, enter again...\n"));
     148            m_fIsFullscreenInvalidated = false;
     149            foreach (UIMachineWindow *pMachineWindow, machineWindows())
     150                pMachineWindow->showInNecessaryMode();
     151            foreach (UIMachineWindow *pMachineWindow, machineWindows())
     152                if (   (darwinScreensHaveSeparateSpaces() || pMachineWindow->screenId() == 0)
     153                    && !darwinIsInFullscreenMode(pMachineWindow))
     154                    darwinToggleFullscreenMode(pMachineWindow);
     155        }
     156        /* If fullscreen mode was manually exited: */
     157        else
     158        {
     159            /* Change visual-state to requested: */
     160            LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
     161                    "Machine-window(s) exited fullscreen, changing visual-state to requested...\n"));
     162            UIVisualStateType type = uisession()->requestedVisualState();
     163            if (type == UIVisualStateType_Invalid)
     164                type = UIVisualStateType_Normal;
     165            uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
     166            uisession()->changeVisualState(type);
     167        }
    147168    }
    148169}
     
    231252void UIMachineLogicFullscreen::sltScreenLayoutChanged()
    232253{
     254#ifdef Q_WS_MAC
     255    /* For Lion and previous: */
     256    if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
     257    {
     258        /* Update machine-window(s) location/size: */
     259        foreach (UIMachineWindow *pMachineWindow, machineWindows())
     260            pMachineWindow->showInNecessaryMode();
     261        /* Update 'presentation mode': */
     262        setPresentationModeEnabled(true);
     263    }
     264    /* For ML and next: */
     265    else
     266    {
     267        /* Invalidate and exit fullscreen mode: */
     268        m_fIsFullscreenInvalidated = true;
     269        foreach (UIMachineWindow *pMachineWindow, machineWindows())
     270            if (darwinIsInFullscreenMode(pMachineWindow))
     271                darwinToggleFullscreenMode(pMachineWindow);
     272    }
     273#else /* !Q_WS_MAC */
    233274    /* Update machine-window(s) location/size: */
    234275    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    235276        pMachineWindow->showInNecessaryMode();
    236 
    237 #ifdef Q_WS_MAC
    238     /* Update 'presentation mode' for Lion and previous: */
    239     if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
    240         setPresentationModeEnabled(true);
    241 #endif /* Q_WS_MAC */
     277#endif /* !Q_WS_MAC */
    242278}
    243279
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r50535 r50536  
    103103    /** Mac OS X: Contains machine-window(s) marked as 'fullscreen'. */
    104104    QSet<UIMachineWindow*> m_fullscreenMachineWindows;
     105    /** Mac OS X: Holds 'fullscreen' mode invalidation status. */
     106    bool m_fIsFullscreenInvalidated;
    105107#endif /* Q_WS_MAC */
    106108
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