void DesktopManager::RemoveDesktop(Desktop * desk)
{
   /* remove from the list */
   vector<Desktop*>::iterator it = find(m_desks.begin(), m_desks.end(), desk);
   if (it != m_desks.end())
      m_desks.erase(it);

   /* remove from the registry */
   desk->Remove();

   /* Change the current desktop, if needed */
   if (m_currentDesktop == desk)
   {
      //Ensure there is still at least one desktop
      if (m_desks.empty())
         AddDesktop();

      m_currentDesktop = m_desks.front();
      m_currentDesktop->Activate();
   }

   /* Move all windows from this desktop to the currently active one */
   for(WindowsManager::Iterator it = winMan->GetIterator(); it; it++)
   {
      Window * win = it;

      if (win->GetDesk() == desk)
         win->MoveToDesktop(m_currentDesktop);
   }

   /* Update the desktops layout */
   UpdateLayout();

   /* and remove the object from memory */
   delete desk;
}