mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 06:51:26 +03:00
Initial conversion of netsurf gui to callback vtable
This commit is contained in:
parent
a856439afb
commit
d3c392c3d3
183
amiga/gui.c
183
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;
|
||||
}
|
||||
|
11
atari/gui.c
11
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");
|
||||
}
|
||||
|
248
beos/gui.cpp
248
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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -27,3 +27,5 @@ extern NSString * const kAlwaysCancelDownload;
|
||||
extern NSString * const kAlwaysCloseMultipleTabs;
|
||||
|
||||
void cocoa_autorelease( void );
|
||||
|
||||
extern struct gui_table *cocoa_gui_table;
|
||||
|
13
cocoa/gui.m
13
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;
|
||||
|
||||
|
@ -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))
|
||||
|
||||
|
@ -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);
|
||||
|
33
desktop/gui_factory.c
Normal file
33
desktop/gui_factory.c
Normal file
@ -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;
|
||||
}
|
30
desktop/gui_factory.h
Normal file
30
desktop/gui_factory.h
Normal file
@ -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
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
133
gtk/gui.c
133
gtk/gui.c
@ -541,69 +541,9 @@ static bool nslog_stream_configure(FILE *fptr)
|
||||
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;
|
||||
@ -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));
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -21,4 +21,6 @@
|
||||
|
||||
void monkey_prepare_input(void);
|
||||
|
||||
void monkey_poll(bool active);
|
||||
|
||||
#endif /* NETSURF_MONKEY_POLL_H */
|
||||
|
12
riscos/gui.c
12
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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user