summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amiga/gui.c183
-rw-r--r--atari/gui.c11
-rw-r--r--beos/gui.cpp246
-rw-r--r--beos/scaffolding.cpp4
-rw-r--r--cocoa/NetsurfApp.m2
-rw-r--r--cocoa/gui.h2
-rw-r--r--cocoa/gui.m13
-rw-r--r--desktop/Makefile2
-rw-r--r--desktop/gui.h36
-rw-r--r--desktop/gui_factory.c33
-rw-r--r--desktop/gui_factory.h30
-rw-r--r--desktop/netsurf.c12
-rw-r--r--desktop/netsurf.h4
-rw-r--r--framebuffer/gui.c202
-rw-r--r--gtk/gui.c207
-rw-r--r--monkey/main.c9
-rw-r--r--monkey/poll.c2
-rw-r--r--monkey/poll.h2
-rw-r--r--riscos/gui.c12
-rw-r--r--windows/main.c12
20 files changed, 573 insertions, 451 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 3140bb61e..2037ba41c 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -993,93 +993,6 @@ static void gui_init2(int argc, char** argv)
}
}
-/** Normal entry point from OS */
-int main(int argc, char** argv)
-{
- setbuf(stderr, NULL);
- char messages[100];
- char script[1024];
- char temp[1024];
- BPTR lock = 0;
- int32 user = 0;
- nserror ret;
- Object *splash_window = ami_gui_splash_open();
-
- /* Open popupmenu.library just to check the version.
- * Versions older than 53.11 are dangerous, so we
- * forcibly disable context menus if these are in use.
- */
- popupmenu_lib_ok = FALSE;
- if(PopupMenuBase = OpenLibrary("popupmenu.library", 53)) {
- LOG(("popupmenu.library v%d.%d",
- PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision));
- if(LIB_IS_AT_LEAST((struct Library *)PopupMenuBase, 53, 11))
- popupmenu_lib_ok = TRUE;
- CloseLibrary(PopupMenuBase);
- }
-
- user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
- current_user = ASPrintf("%s", (user == -1) ? "Default" : temp);
- current_user_dir = ASPrintf("PROGDIR:Users/%s", current_user);
-
- if(lock = CreateDirTree(current_user_dir))
- UnLock(lock);
-
- current_user_options = ASPrintf("%s/Choices", current_user_dir);
-
- ami_mime_init("PROGDIR:Resources/mimetypes");
- sprintf(temp, "%s/mimetypes.user", current_user_dir);
- ami_mime_init(temp);
- ami_schedule_open_timer();
- ami_schedule_create();
-
- amiga_plugin_hack_init();
- amiga_datatypes_init();
-
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(NULL, &argc, argv);
-
- /* user options setup */
- ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- die("Options failed to initialise");
- }
- nsoption_read(current_user_options, NULL);
- nsoption_commandline(&argc, argv, NULL);
-
- if(ami_locate_resource(messages, "Messages") == false)
- die("Cannot open Messages file");
-
- ret = netsurf_init(messages);
- if (ret != NSERROR_OK) {
- die("NetSurf failed to initialise");
- }
-
- amiga_icon_init();
-
- gui_init(argc, argv);
- gui_init2(argc, argv);
-
- ami_gui_splash_close(splash_window);
-
- strlcpy(script, nsoption_charp(arexx_dir), 1024);
- AddPart(script, nsoption_charp(arexx_startup), 1024);
- ami_arexx_execute(script);
-
- netsurf_main_loop();
-
- strlcpy(script, nsoption_charp(arexx_dir), 1024);
- AddPart(script, nsoption_charp(arexx_shutdown), 1024);
- ami_arexx_execute(script);
-
- netsurf_exit();
-
- ami_mime_free();
-
- return 0;
-}
void ami_gui_history(struct gui_window_2 *gwin, bool back)
{
@@ -2567,7 +2480,7 @@ static void ami_gui_fetch_callback(void *p)
*/
}
-void gui_poll(bool active)
+static void gui_poll(bool active)
{
if(active) schedule(0, ami_gui_fetch_callback, NULL);
ami_get_msg();
@@ -2749,7 +2662,7 @@ void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen)
CloseScreen(scrn);
}
-void gui_quit(void)
+static void gui_quit(void)
{
int i;
@@ -5177,3 +5090,95 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
}
}
+static struct gui_table ami_gui_table = {
+ .poll = &gui_poll,
+ .quit = &gui_quit,
+};
+
+/** Normal entry point from OS */
+int main(int argc, char** argv)
+{
+ setbuf(stderr, NULL);
+ char messages[100];
+ char script[1024];
+ char temp[1024];
+ BPTR lock = 0;
+ int32 user = 0;
+ nserror ret;
+ Object *splash_window = ami_gui_splash_open();
+
+ /* Open popupmenu.library just to check the version.
+ * Versions older than 53.11 are dangerous, so we
+ * forcibly disable context menus if these are in use.
+ */
+ popupmenu_lib_ok = FALSE;
+ if(PopupMenuBase = OpenLibrary("popupmenu.library", 53)) {
+ LOG(("popupmenu.library v%d.%d",
+ PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision));
+ if(LIB_IS_AT_LEAST((struct Library *)PopupMenuBase, 53, 11))
+ popupmenu_lib_ok = TRUE;
+ CloseLibrary(PopupMenuBase);
+ }
+
+ user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
+ current_user = ASPrintf("%s", (user == -1) ? "Default" : temp);
+ current_user_dir = ASPrintf("PROGDIR:Users/%s", current_user);
+
+ if(lock = CreateDirTree(current_user_dir))
+ UnLock(lock);
+
+ current_user_options = ASPrintf("%s/Choices", current_user_dir);
+
+ ami_mime_init("PROGDIR:Resources/mimetypes");
+ sprintf(temp, "%s/mimetypes.user", current_user_dir);
+ ami_mime_init(temp);
+ ami_schedule_open_timer();
+ ami_schedule_create();
+
+ amiga_plugin_hack_init();
+ amiga_datatypes_init();
+
+ /* initialise logging. Not fatal if it fails but not much we
+ * can do about it either.
+ */
+ nslog_init(NULL, &argc, argv);
+
+ /* user options setup */
+ ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ nsoption_read(current_user_options, NULL);
+ nsoption_commandline(&argc, argv, NULL);
+
+ if (ami_locate_resource(messages, "Messages") == false)
+ die("Cannot open Messages file");
+
+ ret = netsurf_init(messages, &ami_gui_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
+
+ amiga_icon_init();
+
+ gui_init(argc, argv);
+ gui_init2(argc, argv);
+
+ ami_gui_splash_close(splash_window);
+
+ strlcpy(script, nsoption_charp(arexx_dir), 1024);
+ AddPart(script, nsoption_charp(arexx_startup), 1024);
+ ami_arexx_execute(script);
+
+ netsurf_main_loop();
+
+ strlcpy(script, nsoption_charp(arexx_dir), 1024);
+ AddPart(script, nsoption_charp(arexx_shutdown), 1024);
+ ami_arexx_execute(script);
+
+ netsurf_exit();
+
+ ami_mime_free();
+
+ return 0;
+}
diff --git a/atari/gui.c b/atari/gui.c
index e02c5434a..a5657368c 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -115,7 +115,7 @@ short aes_msg_out[8];
-void gui_poll(bool active)
+static void gui_poll(bool active)
{
struct gui_window *tmp;
@@ -854,7 +854,7 @@ struct gui_window * gui_get_input_window(void)
return(input_window);
}
-void gui_quit(void)
+static void gui_quit(void)
{
LOG((""));
@@ -1105,6 +1105,11 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
+static struct gui_table atari_gui_table = {
+ .poll = &gui_poll,
+ .quit = &gui_quit,
+};
+
/* #define WITH_DBG_LOGFILE 1 */
/** Entry point from OS.
*
@@ -1153,7 +1158,7 @@ int main(int argc, char** argv)
/* common initialisation */
LOG(("Initialising core..."));
- ret = netsurf_init(messages);
+ ret = netsurf_init(messages, atari_gui_table);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 32bd3a2d5..486085de3 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -78,8 +78,6 @@ extern "C" {
static void *myrealloc(void *ptr, size_t len, void *pw);
-void gui_init(int argc, char** argv);
-
/* Where to search for shared resources. Must have trailing / */
#define RESPATH "/boot/apps/netsurf/res/"
@@ -367,42 +365,6 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
-static void gui_init2(int argc, char** argv)
-{
- const char *addr;
- nsurl *url;
- nserror error;
-
- if (argc > 1) {
- addr = argv[1];
- } else if (nsoption_charp(homepage_url) != NULL) {
- addr = nsoption_charp(homepage_url);
- } else {
- addr = NETSURF_HOMEPAGE;
- }
-
- /* create an initial browser window */
- error = nsurl_create(addr, &url);
- if (error == NSERROR_OK) {
- error = browser_window_create((browser_window_nav_flags)
- (BROWSER_WINDOW_VERIFIABLE | BROWSER_WINDOW_HISTORY),
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
- }
-
- if (gFirstRefsReceived) {
- // resend the refs we got before having a window to send them to
- be_app_messenger.SendMessage(gFirstRefsReceived);
- delete gFirstRefsReceived;
- gFirstRefsReceived = NULL;
- }
-}
#if !defined(__HAIKU__) && !defined(B_BEOS_VERSION_DANO)
@@ -532,91 +494,12 @@ static BPath get_messages_path()
return p;
}
-/** Normal entry point from OS */
-int main(int argc, char** argv)
-{
- nserror ret;
- BPath options;
- if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
- options.Append("x-vnd.NetSurf");
- }
-
- if (!replicated) {
- // create the Application object before trying to use messages
- // so we can open an alert in case of error.
- new NSBrowserApplication;
- }
-
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(nslog_stream_configure, &argc, argv);
-
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- die("Options failed to initialise");
- }
- nsoption_read(options.Path(), NULL);
- nsoption_commandline(&argc, argv, NULL);
-
- /* common initialisation */
- BPath messages = get_messages_path();
- ret = netsurf_init(messages.Path());
- if (ret != NSERROR_OK) {
- die("NetSurf failed to initialise");
- }
-
- gui_init(argc, argv);
- gui_init2(argc, argv);
-
- netsurf_main_loop();
-
- netsurf_exit();
-
- return 0;
-}
-
-/** called when replicated from NSBaseView::Instantiate() */
-int gui_init_replicant(int argc, char** argv)
-{
- nserror ret;
- BPath options;
- if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
- options.Append("x-vnd.NetSurf");
- }
-
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(nslog_stream_configure, &argc, argv);
-
- // FIXME: use options as readonly for replicants
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- // FIXME: must not die when in replicant!
- die("Options failed to initialise");
- }
- nsoption_read(options.Path(), NULL);
- nsoption_commandline(&argc, argv, NULL);
-
- /* common initialisation */
- BPath messages = get_messages_path();
- ret = netsurf_init(messages.Path());
- if (ret != NSERROR_OK) {
- // FIXME: must not die when in replicant!
- die("NetSurf failed to initialise");
- }
-
- gui_init(argc, argv);
- gui_init2(argc, argv);
-
- return 0;
-}
-void gui_init(int argc, char** argv)
+static void gui_init(int argc, char** argv)
{
+ const char *addr;
+ nsurl *url;
+ nserror error;
char buf[PATH_MAX];
if (pipe(sEventPipe) < 0)
@@ -746,6 +629,36 @@ void gui_init(int argc, char** argv)
if (!replicated)
be_app->Unlock();
+ if (argc > 1) {
+ addr = argv[1];
+ } else if (nsoption_charp(homepage_url) != NULL) {
+ addr = nsoption_charp(homepage_url);
+ } else {
+ addr = NETSURF_HOMEPAGE;
+ }
+
+ /* create an initial browser window */
+ error = nsurl_create(addr, &url);
+ if (error == NSERROR_OK) {
+ error = browser_window_create((browser_window_nav_flags)
+ (BROWSER_WINDOW_VERIFIABLE | BROWSER_WINDOW_HISTORY),
+ url,
+ NULL,
+ NULL,
+ NULL);
+ nsurl_unref(url);
+ }
+ if (error != NSERROR_OK) {
+ warn_user(messages_get_errorcode(error), 0);
+ }
+
+ if (gFirstRefsReceived) {
+ // resend the refs we got before having a window to send them to
+ be_app_messenger.SendMessage(gFirstRefsReceived);
+ delete gFirstRefsReceived;
+ gFirstRefsReceived = NULL;
+ }
+
}
@@ -783,7 +696,7 @@ void nsbeos_pipe_message_top(BMessage *message, BWindow *_this, struct beos_scaf
}
-void gui_poll(bool active)
+static void gui_poll(bool active)
{
CURLMcode code;
fd_set read_fd_set, write_fd_set, exc_fd_set;
@@ -858,7 +771,7 @@ void gui_poll(bool active)
}
-void gui_quit(void)
+static void gui_quit(void)
{
urldb_save_cookies(nsoption_charp(cookie_jar));
urldb_save(nsoption_charp(url_file));
@@ -1172,3 +1085,90 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
+
+static struct gui_table beos_gui_table = {
+ .poll = &gui_poll,
+ .quit = &gui_quit,
+};
+
+
+/** Normal entry point from OS */
+int main(int argc, char** argv)
+{
+ nserror ret;
+ BPath options;
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
+ options.Append("x-vnd.NetSurf");
+ }
+
+ if (!replicated) {
+ // create the Application object before trying to use messages
+ // so we can open an alert in case of error.
+ new NSBrowserApplication;
+ }
+
+ /* initialise logging. Not fatal if it fails but not much we
+ * can do about it either.
+ */
+ nslog_init(nslog_stream_configure, &argc, argv);
+
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ nsoption_read(options.Path(), NULL);
+ nsoption_commandline(&argc, argv, NULL);
+
+ /* common initialisation */
+ BPath messages = get_messages_path();
+ ret = netsurf_init(messages.Path(), &beos_gui_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
+
+ gui_init(argc, argv);
+
+ netsurf_main_loop();
+
+ netsurf_exit();
+
+ return 0;
+}
+
+/** called when replicated from NSBaseView::Instantiate() */
+int gui_init_replicant(int argc, char** argv)
+{
+ nserror ret;
+ BPath options;
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
+ options.Append("x-vnd.NetSurf");
+ }
+
+ /* initialise logging. Not fatal if it fails but not much we
+ * can do about it either.
+ */
+ nslog_init(nslog_stream_configure, &argc, argv);
+
+ // FIXME: use options as readonly for replicants
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ // FIXME: must not die when in replicant!
+ die("Options failed to initialise");
+ }
+ nsoption_read(options.Path(), NULL);
+ nsoption_commandline(&argc, argv, NULL);
+
+ /* common initialisation */
+ BPath messages = get_messages_path();
+ ret = netsurf_init(messages.Path(), &beos_gui_table);
+ if (ret != NSERROR_OK) {
+ // FIXME: must not die when in replicant!
+ die("NetSurf failed to initialise");
+ }
+
+ gui_init(argc, argv);
+
+ return 0;
+}
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 06184f24e..51235b6d0 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -558,10 +558,6 @@ NSBaseView::Instantiate(BMessage *archive)
replicated = true;
//TODO:FIXME: fix replicants
- // netsurf_init() needs different args now...
- //netsurf_init(2, info->args);
- //return NULL;
-
// do as much as possible in this thread to avoid deadlocks
gui_init_replicant(2, info->args);
diff --git a/cocoa/NetsurfApp.m b/cocoa/NetsurfApp.m
index 33e3bfa43..844904f1c 100644
--- a/cocoa/NetsurfApp.m
+++ b/cocoa/NetsurfApp.m
@@ -203,7 +203,7 @@ int main( int argc, char **argv )
nsoption_commandline(&argc, argv, NULL);
/* common initialisation */
- error = netsurf_init(messages);
+ error = netsurf_init(messages, cocoa_gui_table);
if (error != NSERROR_OK) {
die("NetSurf failed to initialise");
}
diff --git a/cocoa/gui.h b/cocoa/gui.h
index 413727fe6..6ceefa848 100644
--- a/cocoa/gui.h
+++ b/cocoa/gui.h
@@ -27,3 +27,5 @@ extern NSString * const kAlwaysCancelDownload;
extern NSString * const kAlwaysCloseMultipleTabs;
void cocoa_autorelease( void );
+
+extern struct gui_table *cocoa_gui_table;
diff --git a/cocoa/gui.m b/cocoa/gui.m
index 72f64bf04..425bd9cb7 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -55,7 +55,7 @@ nsurl *gui_get_resource_url(const char *path)
return url;
}
-void gui_poll(bool active)
+static void gui_poll(bool active)
{
cocoa_autorelease();
@@ -68,11 +68,6 @@ void gui_poll(bool active)
}
}
-void gui_quit(void)
-{
- // nothing to do
-}
-
struct browser_window;
struct gui_window *gui_create_browser_window(struct browser_window *bw,
@@ -332,3 +327,9 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
+static struct gui_table gui_table = {
+ .poll = &gui_poll,
+};
+
+struct gui_table *cocoa_gui_table = &gui_table;
+
diff --git a/desktop/Makefile b/desktop/Makefile
index f7020074e..0e2e460de 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -13,7 +13,7 @@ desktop/version.c: testament utils/testament.h
# S_BROWSER are sources related to full browsers but are common
# between RISC OS, GTK, BeOS and AmigaOS builds
S_BROWSER := browser.c download.c frames.c local_history.c netsurf.c \
- save_complete.c save_text.c selection.c textinput.c
+ save_complete.c save_text.c selection.c textinput.c gui_factory.c
S_BROWSER := $(addprefix desktop/,$(S_BROWSER))
diff --git a/desktop/gui.h b/desktop/gui.h
index 9317e8576..2bda996fd 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -24,6 +24,18 @@
#ifndef _NETSURF_DESKTOP_GUI_H_
#define _NETSURF_DESKTOP_GUI_H_
+#include <stdbool.h>
+
+#include <libwapcaplet/libwapcaplet.h>
+#include <libcss/libcss.h>
+
+#include "utils/config.h"
+#include "content/hlcache.h"
+#include "desktop/download.h"
+#include "desktop/mouse.h"
+#include "desktop/search.h"
+#include "utils/errors.h"
+
typedef enum {
GUI_SAVE_SOURCE,
GUI_SAVE_DRAW,
@@ -53,20 +65,22 @@ struct gui_download_window;
struct browser_window;
struct form_control;
-#include <stdbool.h>
+/** Graphical user interface function table
+ *
+ * function table implementing GUI interface to browser core
+ */
+struct gui_table {
+ /** called to let the frontend update its state and run any
+ * I/O operations.
+ */
+ void (*poll)(bool active); /* Mandantory */
-#include <libwapcaplet/libwapcaplet.h>
-#include <libcss/libcss.h>
+ /** called to allow the gui to cleanup */
+ void (*quit)(void); /* optional */
-#include "utils/config.h"
-#include "content/hlcache.h"
-#include "desktop/download.h"
-#include "desktop/mouse.h"
-#include "desktop/search.h"
-#include "utils/errors.h"
+};
-void gui_poll(bool active);
-void gui_quit(void);
+extern struct gui_table *guit; /* the gui vtable */
struct gui_window *gui_create_browser_window(struct browser_window *bw,
struct browser_window *clone, bool new_tab);
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
new file mode 100644
index 000000000..fe7536353
--- /dev/null
+++ b/desktop/gui_factory.c
@@ -0,0 +1,33 @@
+
+#include "desktop/gui.h"
+#include "desktop/gui_factory.h"
+
+struct gui_table *guit = NULL;
+
+
+static void gui_default_quit(void)
+{
+}
+
+nserror gui_factory_register(struct gui_table *gt)
+{
+ /* ensure not already initialised */
+ if (guit != NULL) {
+ return NSERROR_INIT_FAILED;
+ }
+
+ /* check the mandantory fields are set */
+
+ if (gt->poll == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* fill in the optional entries with defaults */
+ if (gt->quit == NULL) {
+ gt->quit = &gui_default_quit;
+ }
+
+ guit = gt;
+
+ return NSERROR_OK;
+}
diff --git a/desktop/gui_factory.h b/desktop/gui_factory.h
new file mode 100644
index 000000000..66303eac1
--- /dev/null
+++ b/desktop/gui_factory.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 vincent Sanders <vince@netsurf-browser.org>
+ *
+ * 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/>.
+ */
+
+/** \file
+ * Interface to gui interface factory
+ */
+
+#ifndef _NETSURF_DESKTOP_GUI_FACTORY_H_
+#define _NETSURF_DESKTOP_GUI_FACTORY_H_
+
+struct gui_table;
+
+nserror gui_factory_register(struct gui_table *gt);
+
+#endif
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index 36b0b589a..10dc7ba68 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -41,6 +41,7 @@
#include "desktop/browser.h"
#include "desktop/system_colour.h"
#include "desktop/gui.h"
+#include "desktop/gui_factory.h"
#include "utils/nsoption.h"
#include "desktop/searchweb.h"
@@ -116,7 +117,7 @@ static nserror netsurf_llcache_query_handler(const llcache_query *query,
* Initialise components used by gui NetSurf.
*/
-nserror netsurf_init(const char *messages)
+nserror netsurf_init(const char *messages, struct gui_table *gt)
{
nserror error;
struct utsname utsname;
@@ -150,6 +151,11 @@ nserror netsurf_init(const char *messages)
utsname.nodename, utsname.release,
utsname.version, utsname.machine));
+ /* register the gui handlers */
+ error = gui_factory_register(gt);
+ if (error != NSERROR_OK)
+ return error;
+
messages_load(messages);
/* corestrings init */
@@ -228,7 +234,7 @@ nserror netsurf_init(const char *messages)
int netsurf_main_loop(void)
{
while (!netsurf_quit) {
- gui_poll(fetch_active);
+ guit->poll(fetch_active);
hlcache_poll();
}
@@ -244,7 +250,7 @@ void netsurf_exit(void)
hlcache_stop();
LOG(("Closing GUI"));
- gui_quit();
+ guit->quit();
LOG(("Finalising JavaScript"));
js_finalise();
diff --git a/desktop/netsurf.h b/desktop/netsurf.h
index aa1796f7c..e6858ad66 100644
--- a/desktop/netsurf.h
+++ b/desktop/netsurf.h
@@ -28,8 +28,10 @@ extern const char * const netsurf_version;
extern const int netsurf_version_major;
extern const int netsurf_version_minor;
+struct gui_table;
+
/** Initialise netsurf core */
-nserror netsurf_init(const char *messages);
+nserror netsurf_init(const char *messages, struct gui_table *gt);
/** Run primary event loop */
extern int netsurf_main_loop(void);
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 08cb31318..1439c3c2d 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -555,104 +555,9 @@ static bool nslog_stream_configure(FILE *fptr)
return true;
}
-/** Entry point from OS.
- *
- * /param argc The number of arguments in the string vector.
- * /param argv The argument string vector.
- * /return The return code to the OS
- */
-int
-main(int argc, char** argv)
-{
- struct browser_window *bw;
- char *options;
- char *messages;
- nsurl *url;
- nserror ret;
- nsfb_t *nsfb;
-
- respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(nslog_stream_configure, &argc, argv);
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- die("Options failed to initialise");
- }
- options = filepath_find(respaths, "Choices");
- nsoption_read(options, nsoptions);
- free(options);
- nsoption_commandline(&argc, argv, nsoptions);
-
- /* common initialisation */
- messages = filepath_find(respaths, "Messages");
- ret = netsurf_init(messages);
- free(messages);
- if (ret != NSERROR_OK) {
- die("NetSurf failed to initialise");
- }
-
- /* Override, since we have no support for non-core SELECT menu */
- nsoption_set_bool(core_select_menu, true);
-
- if (process_cmdline(argc,argv) != true)
- die("unable to process command line.\n");
-
- nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
- if (nsfb == NULL)
- die("Unable to initialise framebuffer");
-
- framebuffer_set_cursor(&pointer_image);
-
- if (fb_font_init() == false)
- die("Unable to initialise the font system");
-
- fbtk = fbtk_init(nsfb);
-
- fbtk_enable_oskb(fbtk);
-
- urldb_load_cookies(nsoption_charp(cookie_file));
-
- /* create an initial browser window */
-
- LOG(("calling browser_window_create"));
-
- ret = nsurl_create(feurl, &url);
- if (ret == NSERROR_OK) {
- ret = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
- BROWSER_WINDOW_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
- nsurl_unref(url);
- }
- if (ret != NSERROR_OK) {
- warn_user(messages_get_errorcode(ret), 0);
- } else {
- netsurf_main_loop();
-
- browser_window_destroy(bw);
- }
-
- netsurf_exit();
-
- if (fb_font_finalise() == false)
- LOG(("Font finalisation failed."));
-
- /* finalise options */
- nsoption_finalise(nsoptions, nsoptions_default);
-
- return 0;
-}
-
-
-void
-gui_poll(bool active)
+static void gui_poll(bool active)
{
nsfb_event_t event;
int timeout; /* timeout in miliseconds */
@@ -678,8 +583,7 @@ gui_poll(bool active)
}
-void
-gui_quit(void)
+static void gui_quit(void)
{
LOG(("gui_quit"));
@@ -1995,6 +1899,108 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
+
+static struct gui_table framebuffer_gui_table = {
+ .poll = &gui_poll,
+ .quit = &gui_quit,
+};
+
+/** Entry point from OS.
+ *
+ * /param argc The number of arguments in the string vector.
+ * /param argv The argument string vector.
+ * /return The return code to the OS
+ */
+int
+main(int argc, char** argv)
+{
+ struct browser_window *bw;
+ char *options;
+ char *messages;
+ nsurl *url;
+ nserror ret;
+ nsfb_t *nsfb;
+
+ respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
+
+ /* initialise logging. Not fatal if it fails but not much we
+ * can do about it either.
+ */
+ nslog_init(nslog_stream_configure, &argc, argv);
+
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ options = filepath_find(respaths, "Choices");
+ nsoption_read(options, nsoptions);
+ free(options);
+ nsoption_commandline(&argc, argv, nsoptions);
+
+ /* common initialisation */
+ messages = filepath_find(respaths, "Messages");
+ ret = netsurf_init(messages, &framebuffer_gui_table);
+ free(messages);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
+
+ /* Override, since we have no support for non-core SELECT menu */
+ nsoption_set_bool(core_select_menu, true);
+
+ if (process_cmdline(argc,argv) != true)
+ die("unable to process command line.\n");
+
+ nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
+ if (nsfb == NULL)
+ die("Unable to initialise framebuffer");
+
+ framebuffer_set_cursor(&pointer_image);
+
+ if (fb_font_init() == false)
+ die("Unable to initialise the font system");
+
+ fbtk = fbtk_init(nsfb);
+
+ fbtk_enable_oskb(fbtk);
+
+ urldb_load_cookies(nsoption_charp(cookie_file));
+
+ /* create an initial browser window */
+
+ LOG(("calling browser_window_create"));
+
+ ret = nsurl_create(feurl, &url);
+ if (ret == NSERROR_OK) {
+ ret = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
+ BROWSER_WINDOW_HISTORY,
+ url,
+ NULL,
+ NULL,
+ &bw);
+ nsurl_unref(url);
+ }
+ if (ret != NSERROR_OK) {
+ warn_user(messages_get_errorcode(ret), 0);
+ } else {
+ netsurf_main_loop();
+
+ browser_window_destroy(bw);
+ }
+
+ netsurf_exit();
+
+ if (fb_font_finalise() == false)
+ LOG(("Font finalisation failed."));
+
+ /* finalise options */
+ nsoption_finalise(nsoptions, nsoptions_default);
+
+ return 0;
+}
+
+
/*
* Local Variables:
* c-basic-offset:8
diff --git a/gtk/gui.c b/gtk/gui.c
index 77b72f874..da602e189 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -183,7 +183,7 @@ nsgtk_new_ui(char **respath, const char *name, GtkBuilder **pglade)
filepath = filepath_find(respath, resname);
if (filepath == NULL) {
- snprintf(errorstr, NEW_GLADE_ERROR_SIZE,
+ snprintf(errorstr, NEW_GLADE_ERROR_SIZE,
"Unable to locate %s glade template file.\n", name);
die(errorstr);
}
@@ -192,7 +192,7 @@ nsgtk_new_ui(char **respath, const char *name, GtkBuilder **pglade)
if (!gtk_builder_add_from_file(builder, filepath, &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
- snprintf(errorstr, NEW_GLADE_ERROR_SIZE,
+ snprintf(errorstr, NEW_GLADE_ERROR_SIZE,
"Unable to load glade %s window definitions.\n", name);
die(errorstr);
@@ -212,7 +212,7 @@ nsgtk_new_ui(char **respath, const char *name, GtkBuilder **pglade)
/**
* Load definitions from glade files.
*/
-static void
+static void
nsgtk_init_glade(char **respath)
{
GtkBuilder *gladeWarning;
@@ -334,7 +334,7 @@ nsurl *gui_get_resource_url(const char *path)
/* favicon.ico -> favicon.png */
if (strcmp(path, "favicon.ico") == 0)
- path = "favicon.png";
+ path = "favicon.png";
raw = path_to_url(filepath_sfind(respaths, buf, path));
if (raw != NULL) {
@@ -357,32 +357,32 @@ static void gui_init(int argc, char** argv, char **respath)
nsurl *url;
nserror error;
- /* find the languages file */
+ /* find the languages file */
languages_file_location = filepath_find(respath, "languages");
- if ((languages_file_location == NULL) ||
+ if ((languages_file_location == NULL) ||
(strlen(languages_file_location) < 10)) {
- die("Unable to find resources.\n");
+ die("Unable to find resources.\n");
}
- /* find the theme list file */
+ /* find the theme list file */
themelist_file_location = filepath_find(respath, "themelist");
if ((themelist_file_location != NULL) &&
(strlen(themelist_file_location) < 10)) {
free(themelist_file_location);
themelist_file_location = NULL;
}
- if (themelist_file_location == NULL) {
+ if (themelist_file_location == NULL) {
LOG(("Unable to find themelist - disabling"));
}
- /* Obtain resources path location.
+ /* Obtain resources path location.
*
* Uses the directory the languages file was found in,
* @todo find and slaughter all references to this!
*/
res_dir_location = calloc(1, strlen(languages_file_location) - 8);
- memcpy(res_dir_location,
- languages_file_location,
+ memcpy(res_dir_location,
+ languages_file_location,
strlen(languages_file_location) - 9);
LOG(("Using '%s' for resource path", res_dir_location));
@@ -411,7 +411,7 @@ static void gui_init(int argc, char** argv, char **respath)
free(resource_filename);
if (favicon_pixbuf == NULL) {
favicon_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 16,16);
-
+
}
}
@@ -419,7 +419,7 @@ static void gui_init(int argc, char** argv, char **respath)
toolbar_indices_file_location = filepath_find(respath, "toolbarIndices");
LOG(("Using '%s' as custom toolbar settings file", toolbar_indices_file_location));
- /* load throbber images */
+ /* load throbber images */
if (nsgtk_throbber_init(respath, THROBBER_FRAMES) == false)
die("Unable to load throbber image.\n");
@@ -535,75 +535,15 @@ static void nsgtk_check_homedir(void)
*/
static bool nslog_stream_configure(FILE *fptr)
{
- /* set log stream to be non-buffering */
+ /* set log stream to be non-buffering */
setbuf(fptr, NULL);
return true;
}
-/**
- * Main entry point from OS.
- */
-int main(int argc, char** argv)
-{
- char *messages;
- char *options;
- nserror ret;
-
- /* check home directory is available */
- nsgtk_check_homedir();
-
- respaths = nsgtk_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"GTK_RESPATH":./gtk/res");
-
- gtk_init(&argc, &argv);
-
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(nslog_stream_configure, &argc, argv);
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- fprintf(stderr, "Options failed to initialise (%s)\n",
- messages_get_errorcode(ret));
- return 1;
- }
- options = filepath_find(respaths, "Choices");
- nsoption_read(options, nsoptions);
- free(options);
- nsoption_commandline(&argc, argv, nsoptions);
- check_options(respaths); /* check user options */
- /* common initialisation */
- messages = filepath_find(respaths, "Messages");
- ret = netsurf_init(messages);
- free(messages);
- if (ret != NSERROR_OK) {
- fprintf(stderr, "NetSurf core failed to initialise (%s)\n",
- messages_get_errorcode(ret));
- return 1;
- }
-
- /* run the browser */
- gui_init(argc, argv, respaths);
-
- /* Ensure all scaffoldings are destroyed before we go into exit */
- while (scaf_list != NULL) {
- nsgtk_scaffolding_destroy(scaf_list);
- }
-
- /* common finalisation */
- netsurf_exit();
-
- /* finalise options */
- nsoption_finalise(nsoptions, nsoptions_default);
-
- return 0;
-}
-
-
-void gui_poll(bool active)
+static void gui_poll(bool active)
{
CURLMcode code;
fd_set read_fd_set, write_fd_set, exc_fd_set;
@@ -613,7 +553,7 @@ void gui_poll(bool active)
bool block = true;
schedule_run();
-
+
if (browser_reformat_pending)
block = false;
@@ -666,8 +606,15 @@ void gui_poll(bool active)
}
-void gui_quit(void)
+static void gui_quit(void)
{
+ LOG(("Quitting GUI"));
+
+ /* Ensure all scaffoldings are destroyed before we go into exit */
+ while (scaf_list != NULL) {
+ nsgtk_scaffolding_destroy(scaf_list);
+ }
+
nsgtk_download_destroy();
urldb_save_cookies(nsoption_charp(cookie_jar));
urldb_save(nsoption_charp(url_file));
@@ -729,7 +676,7 @@ void gui_create_form_select_menu(struct browser_window *bw,
}
-void gui_window_save_link(struct gui_window *g, const char *url,
+void gui_window_save_link(struct gui_window *g, const char *url,
const char *title)
{
}
@@ -772,11 +719,11 @@ void die(const char * const error)
}
-void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
+void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
unsigned long num, nserror (*cb)(bool proceed, void *pw),
void *cbpw)
-{
- static struct nsgtk_treeview *ssl_window;
+{
+ static struct nsgtk_treeview *ssl_window;
struct sslcert_session_data *data;
GtkButton *accept, *reject;
void **session;
@@ -784,7 +731,7 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
GtkScrolledWindow *scrolled;
GtkDrawingArea *drawing_area;
GError* error = NULL;
- GtkBuilder* builder;
+ GtkBuilder* builder;
builder = gtk_builder_new ();
if (!gtk_builder_add_from_file(builder, glade_file_location->ssl, &error)) {
@@ -808,28 +755,28 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
ssl_window = nsgtk_treeview_create(TREE_SSLCERT, window, scrolled,
drawing_area);
-
+
if (ssl_window == NULL) {
free(session);
return;
}
-
+
accept = GTK_BUTTON(gtk_builder_get_object(builder, "sslaccept"));
- reject = GTK_BUTTON(gtk_builder_get_object(builder, "sslreject"));
+ reject = GTK_BUTTON(gtk_builder_get_object(builder, "sslreject"));
session[0] = builder;
session[1] = ssl_window;
session[2] = data;
-
+
#define CONNECT(obj, sig, callback, ptr) \
- g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
-
+ g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
+
CONNECT(accept, "clicked", nsgtk_ssl_accept, session);
CONNECT(reject, "clicked", nsgtk_ssl_reject, session);
CONNECT(window, "delete_event", G_CALLBACK(nsgtk_ssl_delete_event),
(gpointer)session);
-
- gtk_widget_show(GTK_WIDGET(window));
+
+ gtk_widget_show(GTK_WIDGET(window));
}
void nsgtk_ssl_accept(GtkButton *w, gpointer data)
@@ -840,7 +787,7 @@ void nsgtk_ssl_accept(GtkButton *w, gpointer data)
struct sslcert_session_data *ssl_data = session[2];
sslcert_viewer_accept(ssl_data);
-
+
nsgtk_treeview_destroy(wnd);
g_object_unref(G_OBJECT(x));
free(session);
@@ -854,7 +801,7 @@ void nsgtk_ssl_reject(GtkWidget *w, gpointer data)
struct sslcert_session_data *ssl_data = session[2];
sslcert_viewer_reject(ssl_data);
-
+
nsgtk_treeview_destroy(wnd);
g_object_unref(G_OBJECT(x));
free(session);
@@ -906,7 +853,7 @@ char *path_to_url(const char *path)
if (path == NULL) {
return NULL;
}
-
+
urllen = strlen(path) + FILE_SCHEME_PREFIX_LEN + 1;
url = malloc(urllen);
@@ -916,7 +863,7 @@ char *path_to_url(const char *path)
if (*path == '/') {
path++; /* file: paths are already absolute */
- }
+ }
snprintf(url, urllen, "%s%s", FILE_SCHEME_PREFIX, path);
@@ -1057,7 +1004,7 @@ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
* now. I hope.
*/
switch (key->keyval) {
-
+
case GDK_KEY(Tab):
return KEY_TAB;
@@ -1137,12 +1084,12 @@ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
case GDK_KEY(Super_L):
case GDK_KEY(Super_R):
case GDK_KEY(Hyper_L):
- case GDK_KEY(Hyper_R):
+ case GDK_KEY(Hyper_R):
return 0;
- default:
+ default:
return gdk_keyval_to_unicode(key->keyval);
- }
+ }
}
/**
@@ -1183,3 +1130,65 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
+
+
+static struct gui_table nsgtk_gui_table = {
+ .poll = &gui_poll,
+ .quit = &gui_quit,
+};
+
+/**
+ * Main entry point from OS.
+ */
+int main(int argc, char** argv)
+{
+ char *messages;
+ char *options;
+ nserror ret;
+
+ /* check home directory is available */
+ nsgtk_check_homedir();
+
+ respaths = nsgtk_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"GTK_RESPATH":./gtk/res");
+
+ gtk_init(&argc, &argv);
+
+ /* initialise logging. Not fatal if it fails but not much we
+ * can do about it either.
+ */
+ nslog_init(nslog_stream_configure, &argc, argv);
+
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ fprintf(stderr, "Options failed to initialise (%s)\n",
+ messages_get_errorcode(ret));
+ return 1;
+ }
+ options = filepath_find(respaths, "Choices");
+ nsoption_read(options, nsoptions);
+ free(options);
+ nsoption_commandline(&argc, argv, nsoptions);
+ check_options(respaths); /* check user options */
+
+ /* common initialisation */
+ messages = filepath_find(respaths, "Messages");
+ ret = netsurf_init(messages, &nsgtk_gui_table);
+ free(messages);
+ if (ret != NSERROR_OK) {
+ fprintf(stderr, "NetSurf core failed to initialise (%s)\n",
+ messages_get_errorcode(ret));
+ return 1;
+ }
+
+ /* run the browser */
+ gui_init(argc, argv, respaths);
+
+ /* common finalisation */
+ netsurf_exit();
+
+ /* finalise options */
+ nsoption_finalise(nsoptions, nsoptions_default);
+
+ return 0;
+}
diff --git a/monkey/main.c b/monkey/main.c
index 95432e3c7..2e23f55d6 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -55,7 +55,7 @@ nsmonkey_init_resource(const char *resource_path)
return respath;
}
-void gui_quit(void)
+static void gui_quit(void)
{
urldb_save_cookies(nsoption_charp(cookie_jar));
urldb_save(nsoption_charp(url_file));
@@ -113,6 +113,11 @@ static bool nslog_stream_configure(FILE *fptr)
return true;
}
+static struct gui_table monkey_gui_table = {
+ .poll = &monkey_poll,
+ .quit = &gui_quit,
+};
+
int
main(int argc, char **argv)
{
@@ -146,7 +151,7 @@ main(int argc, char **argv)
/* common initialisation */
messages = filepath_find(respaths, "Messages");
- ret = netsurf_init(messages);
+ ret = netsurf_init(messages, &monkey_gui_table);
free(messages);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
diff --git a/monkey/poll.c b/monkey/poll.c
index 024005b89..414d458bd 100644
--- a/monkey/poll.c
+++ b/monkey/poll.c
@@ -88,7 +88,7 @@ monkey_prepare_input(void)
}
void
-gui_poll(bool active)
+monkey_poll(bool active)
{
CURLMcode code;
fd_set read_fd_set, write_fd_set, exc_fd_set;
diff --git a/monkey/poll.h b/monkey/poll.h
index 1aebe6856..4195958c9 100644
--- a/monkey/poll.h
+++ b/monkey/poll.h
@@ -21,4 +21,6 @@
void monkey_prepare_input(void);
+void monkey_poll(bool active);
+
#endif /* NETSURF_MONKEY_POLL_H */
diff --git a/riscos/gui.c b/riscos/gui.c
index ae5ea383e..5a6668bfd 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -837,6 +837,12 @@ static bool nslog_stream_configure(FILE *fptr)
return true;
}
+static struct gui_table riscos_gui_table = {
+ .poll = &gui_poll,
+ .quit = &gui_quit,
+};
+
+
/** Normal entry point from OS */
int main(int argc, char** argv)
{
@@ -891,7 +897,7 @@ int main(int argc, char** argv)
}
/* common initialisation */
- ret = netsurf_init(path);
+ ret = netsurf_init(path, &riscos_gui_table);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
@@ -919,7 +925,7 @@ int main(int argc, char** argv)
* Close down the gui (RISC OS).
*/
-void gui_quit(void)
+static void gui_quit(void)
{
urldb_save_cookies(nsoption_charp(cookie_jar));
urldb_save(nsoption_charp(url_save));
@@ -1024,7 +1030,7 @@ void ro_gui_cleanup(void)
* \param active return as soon as possible
*/
-void gui_poll(bool active)
+static void gui_poll(bool active)
{
wimp_event_no event;
wimp_block block;
diff --git a/windows/main.c b/windows/main.c
index 69a152d9b..320c7e4fb 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -60,11 +60,6 @@ void gui_launch_url(const char *url)
{
}
-void gui_quit(void)
-{
- LOG(("gui_quit"));
-}
-
/**
* Ensures output logging stream is available
*/
@@ -96,6 +91,11 @@ static nserror set_defaults(struct nsoption_s *defaults)
return NSERROR_OK;
}
+static struct gui_table win32_gui_table = {
+ .poll = &gui_poll,
+};
+
+
/**
* Entry point from operating system
**/
@@ -157,7 +157,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
/* common initialisation */
messages = filepath_find(respaths, "messages");
- ret = netsurf_init(messages);
+ ret = netsurf_init(messages, &win32_gui_table);
free(messages);
if (ret != NSERROR_OK) {
free(options_file_location);