Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp	(revision 38978)
@@ -33,4 +33,5 @@
 const char* VBoxDefs::GUI_LastWindowState_Max = "max";
 const char* VBoxDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint";
+const char* VBoxDefs::GUI_LastGuestSizeHintWasFullscreen = "GUI/LastGuestSizeHintWasFullscreen";
 const char* VBoxDefs::GUI_Toolbar = "GUI/Toolbar";
 const char* VBoxDefs::GUI_Statusbar = "GUI/Statusbar";
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h	(revision 38978)
@@ -116,4 +116,5 @@
     static const char* GUI_Statusbar;
     static const char* GUI_LastGuestSizeHint;
+    static const char* GUI_LastGuestSizeHintWasFullscreen;
     static const char* GUI_Fullscreen;
     static const char* GUI_Seamless;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 38978)
@@ -113,4 +113,5 @@
 #endif /* VBOX_WITH_VIDEOHWACCEL */
                                                        );
+            pMachineView->m_fIsFullscreen = true;
             break;
         case UIVisualStateType_Seamless:
@@ -121,4 +122,5 @@
 #endif /* VBOX_WITH_VIDEOHWACCEL */
                                                      );
+            pMachineView->m_fIsFullscreen = true;
             break;
         case UIVisualStateType_Scale:
@@ -160,4 +162,8 @@
     /* Send new size-hint to the guest: */
     session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId());
+    /* And track whether we have had a "normal" resize since the last
+     * fullscreen resize hint was sent: */
+    machine.SetExtraData(VBoxDefs::GUI_LastGuestSizeHintWasFullscreen,
+                         m_fIsFullscreen ? "true" : "");
 }
 
@@ -226,4 +232,5 @@
                              )
     : QAbstractScrollArea(pMachineWindow->machineWindow())
+    , m_fIsFullscreen(false)
     , m_pMachineWindow(pMachineWindow)
     , m_uScreenId(uScreenId)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 38978)
@@ -71,4 +71,9 @@
     /* Utility signals: */
     void resizeHintDone();
+
+private:
+
+    /** Is this a fullscreen-type view? */
+    bool m_fIsFullscreen;
 
 protected slots:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp	(revision 38978)
@@ -52,5 +52,4 @@
                     )
     , m_bIsGuestAutoresizeEnabled(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->isChecked())
-    , m_pSyncBlocker(0)
 {
     /* Load machine view settings: */
@@ -72,7 +71,4 @@
     prepareConsoleConnections();
 
-    /* Prepare fullscreen: */
-    prepareFullscreen();
-
     /* Initialization: */
     sltMachineStateChanged();
@@ -81,7 +77,4 @@
 UIMachineViewFullscreen::~UIMachineViewFullscreen()
 {
-    /* Cleanup fullscreen: */
-    cleanupFullscreen();
-
     /* Cleanup frame buffer: */
     cleanupFrameBuffer();
@@ -153,8 +146,4 @@
             emit resizeHintDone();
 
-            /* Unlock after processing guest resize event: */
-            if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
-                m_pSyncBlocker->quit();
-
             pEvent->accept();
             return true;
@@ -181,4 +170,6 @@
                 /* Send guest-resize hint only if top window resizing to required dimension: */
                 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
+                /** @todo why is this here?  If it is a workaround
+                 * for some situation that should be documented. */
                 if (pResizeEvent->size() != workingArea().size())
                     break;
@@ -239,29 +230,4 @@
 }
 
-void UIMachineViewFullscreen::prepareFullscreen()
-{
-    /* Create sync-blocker: */
-    m_pSyncBlocker = new UIMachineViewBlocker;
-}
-
-void UIMachineViewFullscreen::cleanupFullscreen()
-{
-    /* If machine still running: */
-    if (uisession()->isRunning())
-    {
-        /* And guest supports advanced graphics management which is enabled: */
-        if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
-        {
-            /* Rollback seamless frame-buffer size to normal: */
-            machineWindowWrapper()->machineWindow()->hide();
-            sltPerformGuestResize(guestSizeHint());
-            m_pSyncBlocker->exec();
-
-            /* Request to delete sync-blocker: */
-            m_pSyncBlocker->deleteLater();
-        }
-    }
-}
-
 void UIMachineViewFullscreen::setGuestAutoresizeEnabled(bool fEnabled)
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h	(revision 38978)
@@ -58,8 +58,6 @@
     void prepareConnections();
     void prepareConsoleConnections();
-    void prepareFullscreen();
 
     /* Cleanup routines: */
-    void cleanupFullscreen();
     //void cleanupConsoleConnections() {}
     //void cleanupConnections() {}
@@ -78,5 +76,4 @@
     /* Private variables: */
     bool m_bIsGuestAutoresizeEnabled : 1;
-    UIMachineViewBlocker *m_pSyncBlocker;
 
     /* Friend classes: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp	(revision 38978)
@@ -88,4 +88,10 @@
     /* Check if we should restrict minimum size: */
     maybeRestrictMinimumSize();
+
+    /* Resend the last resize hint if there was a fullscreen or
+     * seamless transition previously.  If we were not in graphical
+     * mode initially after the transition this happens when we
+     * switch. */
+    maybeResendResizeHint();
 }
 
@@ -253,4 +259,19 @@
 }
 
+void UIMachineViewNormal::maybeResendResizeHint()
+{
+    if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
+    {
+        /* Get the current machine: */
+        CMachine machine = session().GetMachine();
+
+        /* We send a guest size hint if needed to reverse a transition
+         * to fullscreen or seamless. */
+        QString strHintSent = machine.GetExtraData(VBoxDefs::GUI_LastGuestSizeHintWasFullscreen);
+        if (!strHintSent.isEmpty())
+            sltPerformGuestResize(guestSizeHint());
+    }
+}
+
 void UIMachineViewNormal::saveMachineViewSettings()
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h	(revision 38978)
@@ -65,4 +65,5 @@
     void prepareConsoleConnections();
     //void loadMachineViewSettings();
+    void maybeResendResizeHint();
 
     /* Cleanup helpers: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp	(revision 38978)
@@ -50,5 +50,4 @@
 #endif
                     )
-    , m_pSyncBlocker(0)
 {
     /* Load machine view settings: */
@@ -160,8 +159,4 @@
             /* Emit a signal about guest was resized: */
             emit resizeHintDone();
-
-            /* Unlock after processing guest resize event: */
-            if (m_pSyncBlocker && m_pSyncBlocker->isRunning())
-                m_pSyncBlocker->quit();
 
             pEvent->accept();
@@ -251,6 +246,4 @@
     /* Set seamless feature flag to the guest: */
     session().GetConsole().GetDisplay().SetSeamlessMode(true);
-    /* Create sync-blocker: */
-    m_pSyncBlocker = new UIMachineViewBlocker;
 }
 
@@ -259,16 +252,6 @@
     /* If machine still running: */
     if (uisession()->isRunning())
-    {
         /* Reset seamless feature flag of the guest: */
         session().GetConsole().GetDisplay().SetSeamlessMode(false);
-
-        /* Rollback seamless frame-buffer size to normal: */
-        machineWindowWrapper()->machineWindow()->hide();
-        sltPerformGuestResize(guestSizeHint());
-        m_pSyncBlocker->exec();
-
-        /* Delete sync-blocker: */
-        m_pSyncBlocker->deleteLater();
-    }
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h	(revision 38977)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h	(revision 38978)
@@ -80,5 +80,4 @@
     /* Private variables: */
     QRegion m_lastVisibleRegion;
-    UIMachineViewBlocker *m_pSyncBlocker;
 
     /* Friend classes: */
