From bd065d4a434755e67642a071e255cba596de8d1e Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 15 Jan 2014 19:37:05 +0000 Subject: split browser gui operations up --- beos/download.cpp | 4 ++-- beos/download.h | 2 +- beos/gui.cpp | 32 ++++++++++++++++++++------------ beos/window.cpp | 4 ++-- beos/window.h | 2 +- 5 files changed, 26 insertions(+), 18 deletions(-) (limited to 'beos') diff --git a/beos/download.cpp b/beos/download.cpp index b62ab2ffb..2e259bccf 100644 --- a/beos/download.cpp +++ b/beos/download.cpp @@ -248,12 +248,12 @@ static void gui_download_window_done(struct gui_download_window *dw) dw->storageLock->Unlock(); } -static struct gui_download_table gui_download_table = { +static struct gui_download_table download_table = { .create = gui_download_window_create, .data = gui_download_window_data, .error = gui_download_window_error, .done = gui_download_window_done, }; -struct gui_download_table *beos_gui_download_table = &gui_download_table; +struct gui_download_table *beos_download_table = &download_table; diff --git a/beos/download.h b/beos/download.h index 962f3b7d9..245ee8641 100644 --- a/beos/download.h +++ b/beos/download.h @@ -16,4 +16,4 @@ * along with this program. If not, see . */ -struct gui_download_table *beos_gui_download_table; +struct gui_download_table *beos_download_table; diff --git a/beos/gui.cpp b/beos/gui.cpp index 33337d8ff..3ee47c9e9 100644 --- a/beos/gui.cpp +++ b/beos/gui.cpp @@ -1059,15 +1059,17 @@ bool path_add_part(char *path, int length, const char *newpart) return true; } -static struct gui_table beos_gui_table = { +static struct gui_clipboard_table beos_clipboard_table = { + .get = gui_get_clipboard, + .set = gui_set_clipboard, +}; + +static struct gui_browser_table beos_browser_table = { .poll = gui_poll, .quit = gui_quit, .get_resource_url = gui_get_resource_url, .launch_url = gui_launch_url, - - .get_clipboard = gui_get_clipboard, - .set_clipboard = gui_set_clipboard, }; @@ -1076,6 +1078,13 @@ int main(int argc, char** argv) { nserror ret; BPath options; + struct gui_table beos_gui_table = { + .browser = &beos_browser_table, + .window = beos_window_table, + .clipboard = &beos_clipboard_table, + .download = beos_download_table, + }; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); } @@ -1101,10 +1110,6 @@ int main(int argc, char** argv) /* common initialisation */ BPath messages = get_messages_path(); - - beos_gui_table.window = beos_gui_window_table; - beos_gui_table.download = beos_gui_download_table; - ret = netsurf_init(messages.Path(), &beos_gui_table); if (ret != NSERROR_OK) { die("NetSurf failed to initialise"); @@ -1124,6 +1129,13 @@ int gui_init_replicant(int argc, char** argv) { nserror ret; BPath options; + struct gui_table beos_gui_table = { + .browser = &beos_browser_table, + .window = beos_window_table, + .clipboard = &beos_clipboard_table, + .download = beos_download_table, + }; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); } @@ -1145,10 +1157,6 @@ int gui_init_replicant(int argc, char** argv) /* common initialisation */ BPath messages = get_messages_path(); - - beos_gui_table.window = beos_gui_window_table; - beos_gui_table.download = beos_gui_download_table; - ret = netsurf_init(messages.Path(), &beos_gui_table); if (ret != NSERROR_OK) { // FIXME: must not die when in replicant! diff --git a/beos/window.cpp b/beos/window.cpp index a7bdf411e..fc46eba96 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -1347,7 +1347,7 @@ static void gui_window_get_dimensions(struct gui_window *g, int *width, int *hei } } -static struct gui_window_table gui_window_table = { +static struct gui_window_table window_table = { .create = gui_window_create, .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, @@ -1372,4 +1372,4 @@ static struct gui_window_table gui_window_table = { .stop_throbber = gui_window_stop_throbber, }; -struct gui_window_table *beos_gui_window_table = &gui_window_table; +struct gui_window_table *beos_window_table = &window_table; diff --git a/beos/window.h b/beos/window.h index 8e98841c7..fb67517d2 100644 --- a/beos/window.h +++ b/beos/window.h @@ -25,7 +25,7 @@ extern "C" { } #include "beos/scaffolding.h" -extern struct gui_window_table *beos_gui_window_table; +extern struct gui_window_table *beos_window_table; class NSBrowserFrameView : public BView { public: -- cgit v1.2.3