  
  # ----------------------------------------------------------------------------
  # Package target
+diff --git a/beos/WindowStack.h b/beos/WindowStack.h
+new file mode 100644
+index 0000000..947b143
+--- /dev/null
++++ b/beos/WindowStack.h
+@@ -0,0 +1,45 @@
++/*
++ * Copyright 2010, Haiku, Inc. All rights reserved.
++ * Distributed under the terms of the MIT License.
++ */
++#ifndef WINDOW_STACK_H
++#define WINDOW_STACK_H
++
++
++#include <Window.h>
++
++
++class BWindowStack {
++public:
++								BWindowStack(BWindow* window);
++								~BWindowStack();
++
++			status_t			AddWindow(const BWindow* window);
++			status_t			AddWindow(const BMessenger& window);
++			status_t			AddWindowAt(const BWindow* window,
++									int32 position);
++			status_t			AddWindowAt(const BMessenger& window,
++									int32 position);
++
++			status_t			RemoveWindow(const BWindow* window);
++			status_t			RemoveWindow(const BMessenger& window);
++			status_t			RemoveWindowAt(int32 position,
++									BMessenger* window = NULL);
++
++			int32				CountWindows();
++
++			status_t			WindowAt(int32 position,
++								BMessenger& messenger);
++			bool				HasWindow(const BWindow* window);
++			bool				HasWindow(const BMessenger& window);
++
++private:
++			status_t			_AttachMessenger(const BMessenger& window);
++			status_t			_ReadMessenger(BMessenger& window);
++			status_t			_StartMessage(int32 what);
++
++			BPrivate::PortLink*	fLink;
++};
++
++
++#endif
 diff --git a/beos/download.cpp b/beos/download.cpp
-index d7a848d..e1a0c8c 100644
---- a/beos/download.cpp
+new file mode 100644
+index 0000000..e1a0c8c
+--- /dev/null
 +++ b/beos/download.cpp
-@@ -21,17 +21,160 @@ extern "C" {
- }
- #include "beos/download.h"
- 
+@@ -0,0 +1,246 @@
++/*
++ * Copyright 2012 Adrien Destugues <pulkomandy@pulkomandy.tk>
++ *
++ * This file is part of NetSurf, http://www.netsurf-browser.org/
++ *
++ * NetSurf is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; version 2 of the License.
++ *
++ * NetSurf is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++extern "C" {
++#include "desktop/gui.h"
++}
++#include "beos/download.h"
++
 +#include <File.h>
 +#include <FilePanel.h>
 +#include <Locker.h>
 +#include <Messenger.h>
- #include <StatusBar.h>
- #include <Window.h>
- 
++#include <StatusBar.h>
++#include <Window.h>
++
 +class NSDownloadWindow: public BWindow
 +{
 +	public:

+		delete dw->storageLock;
+	else
+		dw->storageLock->Unlock();
 }
 
diff --git a/beos/fetch_rsrc.cpp b/beos/fetch_rsrc.cpp
index 79dea4e..563f431 100644
--- a/beos/fetch_rsrc.cpp

 RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS))			\
 	$(wildcard beos/res/Icons/*.png)				\
 	$(wildcard beos/res/throbber/throbber*.png)
@@ -126,7 +125,7 @@ install-beos:
 	@cp -vRL beos/res/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
 	@cp -vRL gtk/res/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
 #	@cp -vRL beos/res/throbber/*.png $(DESTDIR)$(NETSURF_BEOS_RESOURCES)throbber
