Binary files 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Additions/common/crOpenGL/entrypoints.pyc and VirtualBox-4.1.0_OSE_BETA2/src//VBox/Additions/common/crOpenGL/entrypoints.pyc differ
diff -uNr 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
--- 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	2011-07-15 16:49:08.000000000 -0400
+++ VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	2011-07-15 18:49:16.000000000 -0400
@@ -4171,6 +4171,7 @@
         }
     }
 
+    XMapWindow (dpy, aWId);
     Bool ok = XXSendClientMessage (dpy, aWId, "_NET_ACTIVE_WINDOW");
     result &= !!ok;
 
@@ -4192,6 +4193,46 @@
 }
 
 /**
+ * Hides the specified window.
+ *
+ * @note On X11, it is implied that @a aWid represents a window of the same
+ * display the application was started on.
+ *
+ * @param aWId              Window ID to activate.
+ * @param aSwitchDesktop    @c true to switch to the window's desktop before
+ *                          activation.
+ *
+ * @return @c true on success and @c false otherwise.
+ */
+/* static */
+bool VBoxGlobal::hideWindow (WId aWId)
+{
+    bool result = true;
+
+#if defined (Q_WS_WIN32)
+
+    result = false;
+
+#elif defined (Q_WS_X11)
+
+    Display *dpy = QX11Info::display();
+
+    Bool ok = XUnmapWindow (dpy, aWId);
+    result &= !!ok;
+
+#else
+
+    result = false;
+
+#endif
+
+    if (!result)
+        LogWarningFunc (("Couldn't hide aWId=%08X\n", aWId));
+
+    return result;
+}
+
+/**
  *  Removes the accelerator mark (the ampersand symbol) from the given string
  *  and returns the result. The string is supposed to be a menu item's text
  *  that may (or may not) contain the accelerator mark.
@@ -5508,6 +5549,25 @@
     mAction->setText (text);
 }
 
+bool VBoxGlobal::hideMachineWindow(CMachine &machine)
+{
+#ifdef Q_WS_MAC
+    ULONG64 id = machine.ShowConsoleWindow();
+#else
+    WId id = (WId) machine.ShowConsoleWindow();
+#endif
+    AssertWrapperOk(machine);
+    if (!machine.isOk())
+        return false;
+
+    /* winId = 0 it means the console window was activated, 
+     * instead of being hidden. */
+    if (id == 0)
+        return false;
+
+    return vboxGlobal().hideWindow(id);
+}
+
 bool VBoxGlobal::switchToMachine(CMachine &machine)
 {
 #ifdef Q_WS_MAC
diff -uNr 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
--- 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h	2011-07-15 16:49:08.000000000 -0400
+++ VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h	2011-07-15 18:38:21.000000000 -0400
@@ -157,6 +157,7 @@
 
     bool processArgs();
 
+    bool hideMachineWindow(CMachine &machine);
     bool switchToMachine(CMachine &machine);
     bool launchMachine(CMachine &machine);
 
@@ -676,6 +677,7 @@
     static QString systemLanguageId();
 
     static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
+    static bool hideWindow (WId aWId);
 
     static QString removeAccelMark (const QString &aText);
 
diff -uNr 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
--- 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	2011-07-15 16:49:08.000000000 -0400
+++ VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	2011-07-15 18:25:36.000000000 -0400
@@ -154,6 +154,11 @@
         QSize(32, 32), QSize(16, 16),
         ":/vm_start_32px.png", ":/start_16px.png",
         ":/vm_start_disabled_32px.png", ":/start_dis_16px.png"));
+    mVmHideAction = new QAction(this);
+    mVmHideAction->setIcon(UIIconPool::iconSetFull(
+        QSize(32, 32), QSize(16, 16),
+        ":/vm_discard_32px.png", ":/discard_16px.png",
+        ":/vm_discard_disabled_32px.png", ":/discard_dis_16px.png"));
     mVmDiscardAction = new QAction(this);
     mVmDiscardAction->setIcon(UIIconPool::iconSetFull(
         QSize(32, 32), QSize(16, 16),
@@ -295,6 +300,7 @@
     mVMMenu->addAction(mVmDeleteAction);
     mVMMenu->addSeparator();
     mVMMenu->addAction(mVmStartAction);
+    mVMMenu->addAction(mVmHideAction);
     mVMMenu->addAction(mVmDiscardAction);
     mVMMenu->addAction(mVmPauseAction);
     mVMMenu->addSeparator();
@@ -314,6 +320,7 @@
     mVMCtxtMenu->addAction(mVmDeleteAction);
     mVMCtxtMenu->addSeparator();
     mVMCtxtMenu->addAction(mVmStartAction);
+    mVMCtxtMenu->addAction(mVmHideAction);
     mVMCtxtMenu->addAction(mVmDiscardAction);
     mVMCtxtMenu->addAction(mVmPauseAction);
     mVMCtxtMenu->addSeparator();
@@ -443,6 +450,7 @@
     connect(mVmCloneAction, SIGNAL(triggered()), this, SLOT(vmClone()));
     connect(mVmDeleteAction, SIGNAL(triggered()), this, SLOT(vmDelete()));
     connect(mVmStartAction, SIGNAL(triggered()), this, SLOT(vmStart()));
+    connect(mVmHideAction, SIGNAL(triggered()), this, SLOT(vmHide()));
     connect(mVmDiscardAction, SIGNAL(triggered()), this, SLOT(vmDiscard()));
     connect(mVmPauseAction, SIGNAL(toggled(bool)), this, SLOT(vmPause(bool)));
     connect(mVmRefreshAction, SIGNAL(triggered()), this, SLOT(vmRefresh()));
@@ -807,6 +815,27 @@
     vboxGlobal().launchMachine(machine);
 }
 
+void VBoxSelectorWnd::vmHide(const QString &aUuid /* = QString::null */)
+{
+    QUuid uuid(aUuid);
+    UIVMItem *item = uuid.isNull() ? mVMListView->selectedItem() :
+                       mVMModel->itemById(aUuid);
+
+    AssertMsgReturnVoid(item, ("Item must be always selected here"));
+
+    /* Are we called from the mVMListView's activated() signal? */
+    if (uuid.isNull())
+    {
+        /* We always get here when mVMListView emits the activated() signal,
+         * so we must explicitly check if the action is enabled or not. */
+        if (!mVmHideAction->isEnabled())
+            return;
+    }
+
+    CMachine machine = item->machine();
+    vboxGlobal().hideMachineWindow(machine);
+}
+
 void VBoxSelectorWnd::vmDiscard(const QString &aUuid /* = QString::null */)
 {
     UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() :
@@ -1229,6 +1258,10 @@
 
     /* Note: mVmStartAction text is set up in vmListViewCurrentChanged() */
 
+    mVmHideAction->setText(tr("&Hide"));
+    mVmHideAction->setStatusTip(
+        tr("Hide the window of the virtual machine"));
+    
     mVmDiscardAction->setIconText(tr("Discard"));
     mVmDiscardAction->setText(tr("D&iscard Saved State"));
     mVmDiscardAction->setShortcut(gSS->keySequence(UISelectorShortcuts::DiscardVMShortcut));
@@ -1362,6 +1395,7 @@
                 tr("Start the selected virtual machine"));
 
             mVmStartAction->setEnabled(!running);
+            mVmHideAction->setEnabled(false);
         }
         else
         {
@@ -1378,7 +1412,8 @@
 #endif /* QT_MAC_USE_COCOA */
             mVmStartAction->setStatusTip(
                 tr("Switch to the window of the selected virtual machine"));
-
+                
+            mVmHideAction->setEnabled(item->canSwitchTo());
             mVmStartAction->setEnabled(item->canSwitchTo());
         }
 
@@ -1463,6 +1498,7 @@
         mVmConfigAction->setEnabled(false);
         mVmCloneAction->setEnabled(false);
         mVmDeleteAction->setEnabled(item != NULL);
+        mVmHideAction->setEnabled(false);
         mVmDiscardAction->setEnabled(false);
         mVmPauseAction->setEnabled(false);
 
diff -uNr 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.h VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.h
--- 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.h	2011-07-15 16:49:08.000000000 -0400
+++ VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.h	2011-07-15 18:51:08.000000000 -0400
@@ -73,6 +73,7 @@
     void vmClone(const QString & = QString::null);
     void vmDelete(const QString & = QString::null);
     void vmStart(const QString & = QString::null);
+    void vmHide(const QString & = QString::null);
     void vmDiscard(const QString & = QString::null);
     void vmPause(bool, const QString & = QString::null);
     void vmRefresh(const QString & = QString::null);
@@ -98,6 +99,7 @@
     const QAction *vmCloneAction() const { return mVmCloneAction; }
     const QAction *vmDeleteAction() const { return mVmDeleteAction; }
     const QAction *vmStartAction() const { return mVmStartAction; }
+    const QAction *vmHideAction() const { return mVmHideAction; }
     const QAction *vmDiscardAction() const { return mVmDiscardAction; }
     const QAction *vmPauseAction() const { return mVmPauseAction; }
     const QAction *vmRefreshAction() const { return mVmRefreshAction; }
@@ -169,6 +171,7 @@
     QAction *mVmCloneAction;
     QAction *mVmDeleteAction;
     QAction *mVmStartAction;
+    QAction *mVmHideAction;
     QAction *mVmDiscardAction;
     QAction *mVmPauseAction;
     QAction *mVmRefreshAction;
diff -uNr 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.cpp VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.cpp
--- 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.cpp	2011-07-15 16:49:08.000000000 -0400
+++ VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.cpp	2011-07-15 18:19:39.000000000 -0400
@@ -54,6 +54,10 @@
     Assert (mVmStartAction);
     mVmStartAction->setIcon (mParent->vmStartAction()->icon());
 
+    mVmHideAction = new QAction (this);
+    Assert (mVmHideAction);
+    mVmHideAction->setIcon (mParent->vmHideAction()->icon());
+
     mVmDiscardAction = new QAction (this);
     Assert (mVmDiscardAction);
     mVmDiscardAction->setIcon (mParent->vmDiscardAction()->icon());
@@ -116,6 +120,9 @@
     mVmPauseAction->setText (mParent->vmPauseAction()->text());
     mVmPauseAction->setStatusTip (mParent->vmPauseAction()->statusTip());
 
+    mVmHideAction->setText (mParent->vmHideAction()->text());
+    mVmHideAction->setStatusTip (mParent->vmHideAction()->statusTip());
+    
     mVmDiscardAction->setText (mParent->vmDiscardAction()->text());
     mVmDiscardAction->setStatusTip (mParent->vmDiscardAction()->statusTip());
 
@@ -141,6 +148,7 @@
 
     mVmConfigAction->setData (vID);
     mVmDeleteAction->setData (vID);
+    mVmHideAction->setData (vID);
     mVmDiscardAction->setData (vID);
     mVmStartAction->setData (vID);
     mVmPauseAction->setData (vID);
@@ -217,6 +225,7 @@
         /* Disconnect old slot which maybe was connected from another selected sub menu. */
         disconnect (mVmConfigAction, SIGNAL (triggered()), this, SLOT (vmSettings()));
         disconnect (mVmDeleteAction, SIGNAL (triggered()), this, SLOT (vmDelete()));
+        disconnect (mVmHideAction, SIGNAL (triggered()), this, SLOT (vmHide()));
         disconnect (mVmDiscardAction, SIGNAL (triggered()), this, SLOT (vmDiscard()));
         disconnect (mVmStartAction, SIGNAL (triggered()), this, SLOT (vmStart()));
         disconnect (mVmPauseAction, SIGNAL (toggled (bool)), this, SLOT (vmPause (bool)));
@@ -225,6 +234,7 @@
         /* Connect new sub menu with slots. */
         connect (mVmConfigAction, SIGNAL (triggered()), this, SLOT (vmSettings()));
         connect (mVmDeleteAction, SIGNAL (triggered()), this, SLOT (vmDelete()));
+        connect (mVmHideAction, SIGNAL (triggered()), this, SLOT (vmHide()));
         connect (mVmDiscardAction, SIGNAL (triggered()), this, SLOT (vmDiscard()));
         connect (mVmStartAction, SIGNAL (triggered()), this, SLOT (vmStart()));
         connect (mVmPauseAction, SIGNAL (toggled (bool)), this, SLOT (vmPause (bool)));
diff -uNr 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.h VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.h
--- 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.h	2011-07-15 16:49:08.000000000 -0400
+++ VirtualBox-4.1.0_OSE_BETA2/src//VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.h	2011-07-15 18:15:59.000000000 -0400
@@ -81,6 +81,7 @@
     QAction *mVmConfigAction;
     QAction *mVmDeleteAction;
     QAction *mVmStartAction;
+    QAction *mVmHideAction;
     QAction *mVmDiscardAction;
     QAction *mVmPauseAction;
     QAction *mVmRefreshAction;
Binary files 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/GuestHost/OpenGL/glapi_parser/apiutil.pyc and VirtualBox-4.1.0_OSE_BETA2/src//VBox/GuestHost/OpenGL/glapi_parser/apiutil.pyc differ
Binary files 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/GuestHost/OpenGL/packer/pack_currenttypes.pyc and VirtualBox-4.1.0_OSE_BETA2/src//VBox/GuestHost/OpenGL/packer/pack_currenttypes.pyc differ
Binary files 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/GuestHost/OpenGL/state_tracker/convert.pyc and VirtualBox-4.1.0_OSE_BETA2/src//VBox/GuestHost/OpenGL/state_tracker/convert.pyc differ
Binary files 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/HostServices/SharedOpenGL/crserverlib/get_components.pyc and VirtualBox-4.1.0_OSE_BETA2/src//VBox/HostServices/SharedOpenGL/crserverlib/get_components.pyc differ
Binary files 1/VirtualBox-4.1.0_OSE_BETA2/src//VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.pyc and VirtualBox-4.1.0_OSE_BETA2/src//VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.pyc differ
