Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp	(revision 61978)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp	(revision 61979)
@@ -34,4 +34,7 @@
 #  include <QWindow>
 # endif /* VBOX_WS_WIN */
+# if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#  include <QWindowStateChangeEvent>
+# endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
 
 /* GUI includes: */
@@ -422,4 +425,7 @@
     , m_pHoverLeaveTimer(0)
     , m_pAnimation(0)
+#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+    , m_fIsParentMinimized(false)
+#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
 {
     /* Prepare: */
@@ -833,4 +839,31 @@
     }
 
+#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+    /* If that's window event: */
+    if (pWatched == this)
+    {
+        switch (pEvent->type())
+        {
+            case QEvent::WindowStateChange:
+            {
+                /* Watch for window state changes: */
+                QWindowStateChangeEvent *pChangeEvent = static_cast<QWindowStateChangeEvent*>(pEvent);
+                LogRel2(("GUI: UIMiniToolBar::eventFilter: Window state changed from %d to %d\n",
+                         (int)pChangeEvent->oldState(), (int)windowState()));
+                if (   windowState() != Qt::WindowMinimized
+                    && pChangeEvent->oldState() == Qt::WindowMinimized)
+                {
+                    /* Asynchronously call for sltShow(): */
+                    LogRel2(("GUI: UIMiniToolBar::eventFilter: Window restored\n"));
+                    QMetaObject::invokeMethod(this, "sltShow", Qt::QueuedConnection);
+                }
+                break;
+            }
+            default:
+                break;
+        }
+    }
+#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+
     /* If that's parent window event: */
     if (pWatched == parent())
@@ -840,4 +873,9 @@
             case QEvent::Hide:
             {
+                /* Skip if parent or we are minimized: */
+                if (   isParentMinimized()
+                    || isMinimized())
+                    break;
+
                 /* Asynchronously call for sltHide(): */
                 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent hide event\n"));
@@ -847,4 +885,9 @@
             case QEvent::Show:
             {
+                /* Skip if parent or we are minimized: */
+                if (   isParentMinimized()
+                    || isMinimized())
+                    break;
+
                 /* Asynchronously call for sltShow(): */
                 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent show event\n"));
@@ -858,4 +901,8 @@
                 if (   !parentWidget()->isVisible()
                     || !isVisible())
+                    break;
+                /* Skip if parent or we are minimized: */
+                if (   isParentMinimized()
+                    || isMinimized())
                     break;
 
@@ -875,4 +922,27 @@
                 break;
             }
+#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+            case QEvent::WindowStateChange:
+            {
+                /* Watch for parent window state changes: */
+                QWindowStateChangeEvent *pChangeEvent = static_cast<QWindowStateChangeEvent*>(pEvent);
+                LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent window state changed from %d to %d\n",
+                         (int)pChangeEvent->oldState(), (int)parentWidget()->windowState()));
+                if (parentWidget()->windowState() & Qt::WindowMinimized)
+                {
+                    /* Mark parent window minimized, isMinimized() is not enough due to Qt5vsX11 fight: */
+                    LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent window minimized\n"));
+                    m_fIsParentMinimized = true;
+                }
+                else
+                if (parentWidget()->windowState() == Qt::WindowFullScreen)
+                {
+                    /* Mark parent window non-minimized, isMinimized() is not enough due to Qt5vsX11 fight: */
+                    LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent window is full-screen\n"));
+                    m_fIsParentMinimized = false;
+                }
+                break;
+            }
+#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
             default:
                 break;
@@ -917,4 +987,13 @@
 }
 
+bool UIMiniToolBar::isParentMinimized() const
+{
+#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+    return m_fIsParentMinimized;
+#else /* !VBOX_WS_X11 || QT_VERSION < 0x050000 */
+    return parentWidget()->isMinimized();
+#endif /* !VBOX_WS_X11 || QT_VERSION < 0x050000 */
+}
+
 #include "UIMiniToolBar.moc"
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h	(revision 61978)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h	(revision 61979)
@@ -153,4 +153,7 @@
     QPoint shownToolbarPosition() const { return m_shownToolbarPosition; }
 
+    /** Returns whether the parent is currently minimized. */
+    bool isParentMinimized() const;
+
     /** Holds the geometry type. */
     const GeometryType m_geometryType;
@@ -180,4 +183,10 @@
     /** Holds the animation framework object. */
     UIAnimation *m_pAnimation;
+
+#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+    /** Holds whether the parent is currently minimized.
+      * Used to restore full-screen state when the parent restored again. */
+    bool m_fIsParentMinimized;
+#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
 };
 
