Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm	(revision 51247)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm	(revision 51248)
@@ -191,8 +191,9 @@
 
     /* Define known notification names: */
-    NSString *spstrWillEnterFullscreenNotification = @"NSWindowWillEnterFullScreenNotification";
-    NSString *spstrDidEnterFullscreenNotification  = @"NSWindowDidEnterFullScreenNotification";
-    NSString *spstrWillExitFullscreenNotification  = @"NSWindowWillExitFullScreenNotification";
-    NSString *spstrDidExitFullscreenNotification   = @"NSWindowDidExitFullScreenNotification";
+    NSString *spstrWillEnterFullscreenNotification      = @"NSWindowWillEnterFullScreenNotification";
+    NSString *spstrDidEnterFullscreenNotification       = @"NSWindowDidEnterFullScreenNotification";
+    NSString *spstrWillExitFullscreenNotification       = @"NSWindowWillExitFullScreenNotification";
+    NSString *spstrDidExitFullscreenNotification        = @"NSWindowDidExitFullScreenNotification";
+    NSString *spstrDidFailToEnterFullScreenNotification = @"NSWindowDidFailToEnterFullScreenNotification";
 
     /* Redirect known notifications to UICocoaApplication instance: */
@@ -200,5 +201,6 @@
         || [pstrName isEqualToString :spstrDidEnterFullscreenNotification]
         || [pstrName isEqualToString :spstrWillExitFullscreenNotification]
-        || [pstrName isEqualToString :spstrDidExitFullscreenNotification])
+        || [pstrName isEqualToString :spstrDidExitFullscreenNotification]
+        || [pstrName isEqualToString :spstrDidFailToEnterFullScreenNotification])
         UICocoaApplication::instance()->nativeNotificationProxy(pstrName, [notification object]);
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 51247)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 51248)
@@ -163,6 +163,11 @@
     /* Remove machine-window from corresponding set: */
     bool fResult = m_fullscreenMachineWindows.remove(pMachineWindow);
-    AssertReturnVoid(fResult && !m_fullscreenMachineWindows.contains(pMachineWindow));
-    Q_UNUSED(fResult);
+    AssertReturnVoid(!m_fullscreenMachineWindows.contains(pMachineWindow));
+
+    /* We have same signal if window did fail to enter native fullscreen.
+     * In that case window missed in m_fullscreenMachineWindows,
+     * ignore this signal silently: */
+    if (!fResult)
+        return;
 
     /* If that window was invalidated: */
@@ -210,4 +215,39 @@
 }
 
+void UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter()
+{
+    /* Make sure this method is only used for ML and next: */
+    AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion);
+
+    /* Get sender machine-window: */
+    UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender());
+    AssertReturnVoid(pMachineWindow);
+
+    /* Make sure this window is not registered somewhere: */
+    AssertReturnVoid(!m_fullscreenMachineWindows.remove(pMachineWindow));
+    AssertReturnVoid(!m_invalidFullscreenMachineWindows.remove(pMachineWindow));
+
+    /* If there are 'fullscreen' windows: */
+    if (!m_fullscreenMachineWindows.isEmpty())
+    {
+        LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter: "
+                "Machine-window #%d failed to enter native fullscreen, asking others to exit...\n",
+                (int)pMachineWindow->screenId()));
+
+        /* Ask window(s) to exit 'fullscreen' mode: */
+        emit sigNotifyAboutNativeFullscreenShouldBeExited();
+    }
+    /* If there are no 'fullscreen' windows: */
+    else
+    {
+        LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter: "
+                "Machine-window #%d failed to enter native fullscreen, requesting change visual-state to normal...\n",
+                (int)pMachineWindow->screenId()));
+
+        /* Ask session to change 'fullscreen' mode to 'normal': */
+        uisession()->setRequestedVisualState(UIVisualStateType_Normal);
+    }
+}
+
 void UIMachineLogicFullscreen::sltChangeVisualStateToNormal()
 {
@@ -252,4 +292,27 @@
         /* Ask window(s) to exit 'fullscreen' mode: */
         emit sigNotifyAboutNativeFullscreenShouldBeExited();
+    }
+}
+
+void UIMachineLogicFullscreen::sltCheckForRequestedVisualStateType()
+{
+    /* Do not try to change visual-state type if machine was not started yet: */
+    if (!uisession()->isRunning() && !uisession()->isPaused())
+        return;
+
+    /* Check requested visual-state types: */
+    switch (uisession()->requestedVisualState())
+    {
+        /* If 'normal' visual-state type is requested: */
+        case UIVisualStateType_Normal:
+        {
+            LogRel(("UIMachineLogicFullscreen::sltCheckForRequestedVisualStateType: "
+                    "Going 'normal' as requested...\n"));
+            uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
+            uisession()->changeVisualState(UIVisualStateType_Normal);
+            break;
+        }
+        default:
+            break;
     }
 }
@@ -450,4 +513,7 @@
                     this, SLOT(sltHandleNativeFullscreenDidExit()),
                     Qt::QueuedConnection);
+            connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenFailToEnter()),
+                    this, SLOT(sltHandleNativeFullscreenFailToEnter()),
+                    Qt::QueuedConnection);
         }
         /* Revalidate 'fullscreen' windows: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h	(revision 51247)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h	(revision 51248)
@@ -67,4 +67,6 @@
     /** Mac OS X: Handles native notification about 'fullscreen' exited. */
     void sltHandleNativeFullscreenDidExit();
+    /** Mac OS X: Handles native notification about 'fullscreen' fail to enter. */
+    void sltHandleNativeFullscreenFailToEnter();
 
     /** Mac OS X: Requests visual-state change from 'fullscreen' to 'normal' (window). */
@@ -74,4 +76,7 @@
     /** Mac OS X: Requests visual-state change from 'fullscreen' to 'scale'. */
     void sltChangeVisualStateToScale();
+
+    /** Mac OS X: Checks if some visual-state type was requested. */
+    void sltCheckForRequestedVisualStateType();
 #endif /* RT_OS_DARWIN */
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp	(revision 51247)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp	(revision 51248)
@@ -92,4 +92,13 @@
                 "Native fullscreen mode exited, notifying listener...\n"));
         emit sigNotifyAboutNativeFullscreenDidExit();
+    }
+    /* Handle 'NSWindowDidFailToEnterFullScreenNotification' notification: */
+    else if (strNativeNotificationName == "NSWindowDidFailToEnterFullScreenNotification")
+    {
+        /* Mark window transition complete: */
+        m_fIsInFullscreenTransition = false;
+        LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
+                "Native fullscreen mode fail to enter, notifying listener...\n"));
+        emit sigNotifyAboutNativeFullscreenFailToEnter();
     }
 }
@@ -216,4 +225,6 @@
                                                                      UIMachineWindow::handleNativeNotification);
         UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidExitFullScreenNotification", this,
+                                                                     UIMachineWindow::handleNativeNotification);
+        UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidFailToEnterFullScreenNotification", this,
                                                                      UIMachineWindow::handleNativeNotification);
     }
@@ -281,4 +292,5 @@
         UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowWillExitFullScreenNotification", this);
         UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidExitFullScreenNotification", this);
+        UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidFailToEnterFullScreenNotification", this);
     }
 #endif /* Q_WS_MAC */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h	(revision 51247)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h	(revision 51248)
@@ -41,4 +41,6 @@
     /** Mac OS X: Notifies listener about native 'fullscreen' exited. */
     void sigNotifyAboutNativeFullscreenDidExit();
+    /** Mac OS X: Notifies listener about native 'fullscreen' fail to enter. */
+    void sigNotifyAboutNativeFullscreenFailToEnter();
 #endif /* RT_OS_DARWIN */
 
