Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 50535)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 50536)
@@ -35,4 +35,7 @@
 UIMachineLogicFullscreen::UIMachineLogicFullscreen(QObject *pParent, UISession *pSession)
     : UIMachineLogic(pParent, pSession, UIVisualStateType_Fullscreen)
+#ifdef Q_WS_MAC
+    , m_fIsFullscreenInvalidated(false)
+#endif /* Q_WS_MAC */
 {
     /* Create multiscreen layout: */
@@ -137,12 +140,30 @@
     else
     {
-        /* Change visual-state to requested: */
-        LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
-                "Machine-window(s) exited fullscreen, changing visual-state to requested...\n"));
-        UIVisualStateType type = uisession()->requestedVisualState();
-        if (type == UIVisualStateType_Invalid)
-            type = UIVisualStateType_Normal;
-        uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
-        uisession()->changeVisualState(type);
+        /* If fullscreen mode was just invalidated: */
+        if (m_fIsFullscreenInvalidated)
+        {
+            /* Mark fullscreen mode valid again and re-enter it: */
+            LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
+                    "Machine-window(s) exited invalidated fullscreen, enter again...\n"));
+            m_fIsFullscreenInvalidated = false;
+            foreach (UIMachineWindow *pMachineWindow, machineWindows())
+                pMachineWindow->showInNecessaryMode();
+            foreach (UIMachineWindow *pMachineWindow, machineWindows())
+                if (   (darwinScreensHaveSeparateSpaces() || pMachineWindow->screenId() == 0)
+                    && !darwinIsInFullscreenMode(pMachineWindow))
+                    darwinToggleFullscreenMode(pMachineWindow);
+        }
+        /* If fullscreen mode was manually exited: */
+        else
+        {
+            /* Change visual-state to requested: */
+            LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
+                    "Machine-window(s) exited fullscreen, changing visual-state to requested...\n"));
+            UIVisualStateType type = uisession()->requestedVisualState();
+            if (type == UIVisualStateType_Invalid)
+                type = UIVisualStateType_Normal;
+            uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
+            uisession()->changeVisualState(type);
+        }
     }
 }
@@ -231,13 +252,28 @@
 void UIMachineLogicFullscreen::sltScreenLayoutChanged()
 {
+#ifdef Q_WS_MAC
+    /* For Lion and previous: */
+    if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
+    {
+        /* Update machine-window(s) location/size: */
+        foreach (UIMachineWindow *pMachineWindow, machineWindows())
+            pMachineWindow->showInNecessaryMode();
+        /* Update 'presentation mode': */
+        setPresentationModeEnabled(true);
+    }
+    /* For ML and next: */
+    else
+    {
+        /* Invalidate and exit fullscreen mode: */
+        m_fIsFullscreenInvalidated = true;
+        foreach (UIMachineWindow *pMachineWindow, machineWindows())
+            if (darwinIsInFullscreenMode(pMachineWindow))
+                darwinToggleFullscreenMode(pMachineWindow);
+    }
+#else /* !Q_WS_MAC */
     /* Update machine-window(s) location/size: */
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
         pMachineWindow->showInNecessaryMode();
-
-#ifdef Q_WS_MAC
-    /* Update 'presentation mode' for Lion and previous: */
-    if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
-        setPresentationModeEnabled(true);
-#endif /* Q_WS_MAC */
+#endif /* !Q_WS_MAC */
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h	(revision 50535)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h	(revision 50536)
@@ -103,4 +103,6 @@
     /** Mac OS X: Contains machine-window(s) marked as 'fullscreen'. */
     QSet<UIMachineWindow*> m_fullscreenMachineWindows;
+    /** Mac OS X: Holds 'fullscreen' mode invalidation status. */
+    bool m_fIsFullscreenInvalidated;
 #endif /* Q_WS_MAC */
 
