From 45565ca9bb92b6f6ba6bf46016659e791fcbdff1 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Thu, 15 Nov 2012 21:39:11 +0000 Subject: [PATCH] Fix the patch to include all the changes. --- .../netsurf/patches/netsurf-2.HEAD.patch | 279 ++++++++++++------ 1 file changed, 182 insertions(+), 97 deletions(-) diff --git a/www-client/netsurf/patches/netsurf-2.HEAD.patch b/www-client/netsurf/patches/netsurf-2.HEAD.patch index f9f4f0383..eff3b853d 100644 --- a/www-client/netsurf/patches/netsurf-2.HEAD.patch +++ b/www-client/netsurf/patches/netsurf-2.HEAD.patch @@ -1,3 +1,30 @@ +From a570d7727672a43af9e33e08367e379a5f99c7ae Mon Sep 17 00:00:00 2001 +From: Adrien Destugues - PulkoMandy +Date: Thu, 15 Nov 2012 22:34:42 +0100 +Subject: [PATCH] Update the BeOS/Haiku port * Toolbar use HVIF icons on + Haiku * Download window * Some tweaks to the event loop + to let network traffic happen + +--- + Makefile | 2 +- + beos/Makefile.target | 21 ++--- + beos/WindowStack.h | 45 +++++++++ + beos/download.cpp | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++ + beos/download.h | 18 ++++ + beos/fetch_rsrc.cpp | 8 +- + beos/gui.cpp | 111 +++++++---------------- + beos/login.cpp | 25 +++-- + beos/res.rdef | 41 +++++++++ + beos/scaffolding.cpp | 152 ++++++++++++++++++++++++++++--- + beos/scaffolding.h | 4 + + beos/schedule.cpp | 6 +- + beos/window.cpp | 62 ++++++++++--- + utils/config.h | 4 +- + 14 files changed, 616 insertions(+), 129 deletions(-) + create mode 100644 beos/WindowStack.h + create mode 100644 beos/download.cpp + create mode 100644 beos/download.h + diff --git a/Makefile b/Makefile index c80378c..428aa74 100644 --- a/Makefile @@ -12,14 +39,14 @@ index c80378c..428aa74 100644 $(Q)$(BEOS_MIMESET) $(EXETARGET) endif diff --git a/beos/Makefile.target b/beos/Makefile.target -index b1d1eaa..4df489a 100644 +index af7c939..f4b51ab 100644 --- a/beos/Makefile.target +++ b/beos/Makefile.target @@ -9,8 +9,10 @@ # for Haiku LDFLAGS += -L/boot/common/lib # some people do *not* have libm... -- LDFLAGS += -lxml2 -lcurl -liconv +- LDFLAGS += -lcurl -liconv - LDFLAGS += -lssl -lcrypto -lcss -ldom -lparserutils -lhubbub -lwapcaplet + LDFLAGS += -lssl -lcrypto -lcss + $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny))) @@ -28,7 +55,7 @@ index b1d1eaa..4df489a 100644 CFLAGS += -I. -O $(WARNFLAGS) -Dnsbeos \ -D_BSD_SOURCE -D_POSIX_C_SOURCE \ -@@ -61,9 +63,8 @@ +@@ -59,9 +61,8 @@ # cross: Haiku ? NETLDFLAGS := -lnetwork endif @@ -39,7 +66,7 @@ index b1d1eaa..4df489a 100644 ifeq ($(HOST),beos) CFLAGS += -I$(PREFIX)/include LDFLAGS += -L$(PREFIX)/lib -@@ -84,11 +85,9 @@ +@@ -82,11 +83,9 @@ # ---------------------------------------------------------------------------- # S_BEOS are sources purely for the BeOS build @@ -54,7 +81,7 @@ index b1d1eaa..4df489a 100644 window.cpp system_colour.cpp S_BEOS := $(addprefix beos/,$(S_BEOS)) -@@ -100,7 +99,7 @@ RDEF_IMP_BEOS := $(addprefix $(OBJROOT)/,$(subst /,_,$(RDEF_IMP_BEOS))) +@@ -98,7 +97,7 @@ RDEF_IMP_BEOS := $(addprefix $(OBJROOT)/,$(subst /,_,$(RDEF_IMP_BEOS))) RDEP_BEOS := \ adblock.css beosdefault.css default.css internal.css quirks.css \ @@ -63,7 +90,7 @@ index b1d1eaa..4df489a 100644 RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS)) \ $(wildcard beos/res/Icons/*.png) \ $(wildcard beos/res/throbber/throbber*.png) -@@ -128,7 +127,7 @@ install-beos: +@@ -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 @@ -72,21 +99,93 @@ index b1d1eaa..4df489a 100644 # ---------------------------------------------------------------------------- # 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 ++ ++ ++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 ++ * ++ * 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 . ++ */ ++ ++extern "C" { ++#include "desktop/gui.h" ++} ++#include "beos/download.h" ++ +#include +#include +#include +#include - #include - #include - ++#include ++#include ++ +class NSDownloadWindow: public BWindow +{ + public: @@ -106,18 +205,15 @@ index d7a848d..e1a0c8c 100644 +}; + + - struct gui_download_window { - download_context* ctx; -- BWindow* window; -- BStatusBar* bar; -- unsigned long progress; ++struct gui_download_window { ++ download_context* ctx; + NSDownloadWindow* window; + + BLocker* storageLock; + BDataIO* storage; - }; - - ++}; ++ ++ +NSDownloadWindow::NSDownloadWindow(download_context* ctx) + : BWindow(BRect(30, 30, 400, 200), "Downloads", B_TITLED_WINDOW, + B_NOT_RESIZABLE) @@ -237,99 +333,61 @@ index d7a848d..e1a0c8c 100644 +} + + - struct gui_download_window *gui_download_window_create(download_context *ctx, - struct gui_window *parent) - { -@@ -39,33 +182,24 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, - if (download == NULL) - return NULL; - ++struct gui_download_window *gui_download_window_create(download_context *ctx, ++ struct gui_window *parent) ++{ ++ struct gui_download_window *download = (struct gui_download_window*)malloc(sizeof *download); ++ if (download == NULL) ++ return NULL; ++ + download->storageLock = new BLocker("storage_lock"); + download->storage = new BMallocIO(); - download->ctx = ctx; - -- // TODO need to cancel the download (if not finished) on window close -- download->window = new BWindow(BRect(30, 30, 400, 200), "Downloads", -- B_TITLED_WINDOW, B_NOT_H_RESIZABLE); -- -- unsigned long dlsize = download_context_get_total_length(ctx); -- char buffer[256]; -- sprintf(buffer, "%lu bytes", dlsize); // TODO be smarter and add unit and all -- -- BRect rect = download->window->Bounds(); -- rect.InsetBy(3, 3); -- download->bar = new BStatusBar(rect, "progress", -- download_context_get_filename(ctx), buffer); -- download->bar->SetMaxValue(dlsize); -- -- BView* back = new BView(download->window->Bounds(), "back", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); -- back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); -- -- back->AddChild(download->bar); -- download->window->AddChild(back); ++ download->ctx = ctx; ++ + download->window = new NSDownloadWindow(ctx); - -- BRect size = download->bar->Bounds(); ++ + // Also ask the user where to save the file + // TODO inject the suggested name somehow + BMessage* msg = new BMessage(B_SAVE_REQUESTED); - -- download->window->ResizeTo(size.Width() + 6, size.Height() + 6); ++ + BFilePanel* panel = new BFilePanel(B_SAVE_PANEL, + new BMessenger(download->window), NULL, 0, false); - -- download->window->Show(); ++ + msg->AddPointer("source", panel); + msg->AddPointer("dw", download); + panel->SetMessage(msg); + + panel->Show(); - - return download; - } -@@ -74,18 +208,11 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, - nserror gui_download_window_data(struct gui_download_window *dw, - const char *data, unsigned int size) - { -- dw->progress += size; ++ ++ return download; ++} ++ ++ ++nserror gui_download_window_data(struct gui_download_window *dw, ++ const char *data, unsigned int size) ++{ + dw->window->Progress(size); - -- unsigned long dlsize = download_context_get_total_length(dw->ctx); -- char buffer[256]; -- sprintf(buffer, "%lu/", dw->progress); // TODO be smarter and add unit and all -- -- dw->bar->LockLooper(); -- dw->bar->Update(size, NULL, buffer); -- dw->bar->Invalidate(); -- dw->bar->UnlockLooper(); -- -- // TOOD actually buffer/save the data to disk ! ++ + dw->storageLock->Lock(); + dw->storage->Write(data, size); + dw->storageLock->Unlock(); - - return NSERROR_OK; - } -@@ -94,17 +221,26 @@ nserror gui_download_window_data(struct gui_download_window *dw, - void gui_download_window_error(struct gui_download_window *dw, - const char *error_msg) - { -- dw->bar->LockLooper(); -- dw->bar->Update(0, NULL, error_msg); -- dw->bar->SetBarColor(ui_color(B_FAILURE_COLOR)); -- dw->bar->UnlockLooper(); ++ ++ return NSERROR_OK; ++} ++ ++ ++void gui_download_window_error(struct gui_download_window *dw, ++ const char *error_msg) ++{ + dw->window->Failure(error_msg); + + delete dw->storageLock; + delete dw->storage; - } - - - void gui_download_window_done(struct gui_download_window *dw) - { -- dw->bar->LockLooper(); -- dw->bar->SetBarColor(ui_color(B_SUCCESS_COLOR)); -- dw->bar->UnlockLooper(); ++} ++ ++ ++void gui_download_window_done(struct gui_download_window *dw) ++{ + dw->window->Success(); + + dw->storageLock->Lock(); @@ -342,8 +400,32 @@ index d7a848d..e1a0c8c 100644 + delete dw->storageLock; + else + dw->storageLock->Unlock(); - } - ++} ++ +diff --git a/beos/download.h b/beos/download.h +new file mode 100644 +index 0000000..9c8d3ad +--- /dev/null ++++ b/beos/download.h +@@ -0,0 +1,18 @@ ++/* ++ * Copyright 2012 Adrien Destugues ++ * ++ * 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 . ++ */ ++ diff --git a/beos/fetch_rsrc.cpp b/beos/fetch_rsrc.cpp index 79dea4e..563f431 100644 --- a/beos/fetch_rsrc.cpp @@ -1192,3 +1274,6 @@ index bd2e303..1c1eef6 100644 #define HAVE_STRCASESTR #else #undef HAVE_STRCASESTR +-- +1.7.10.2 +