mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
split browser gui operations up
This commit is contained in:
parent
68eaec5cb4
commit
bd065d4a43
@ -433,11 +433,11 @@ BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG si
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
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 *amiga_gui_download_table = &gui_download_table;
|
||||
struct gui_download_table *amiga_download_table = &download_table;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "amiga/gui.h"
|
||||
|
||||
extern struct gui_download_table *amiga_gui_download_table;
|
||||
extern struct gui_download_table *amiga_download_table;
|
||||
|
||||
struct download_context;
|
||||
struct gui_download_window;
|
||||
|
23
amiga/gui.c
23
amiga/gui.c
@ -5085,7 +5085,7 @@ static void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
}
|
||||
}
|
||||
|
||||
static struct gui_window_table ami_window_table = {
|
||||
static struct gui_window_table amiga_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
@ -5117,19 +5117,19 @@ static struct gui_window_table ami_window_table = {
|
||||
.save_link = gui_window_save_link,
|
||||
};
|
||||
|
||||
static struct gui_clipboard_table amiga_clipboard_table = {
|
||||
.get = gui_get_clipboard,
|
||||
.set = gui_set_clipboard,
|
||||
};
|
||||
|
||||
static struct gui_table ami_gui_table = {
|
||||
static struct gui_browser_table amiga_browser_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
.set_search_ico = gui_set_search_ico,
|
||||
.get_resource_url = gui_get_resource_url,
|
||||
.launch_url = gui_launch_url,
|
||||
.create_form_select_menu = gui_create_form_select_menu,
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
.cert_verify = gui_cert_verify,
|
||||
|
||||
.window = &ami_window_table,
|
||||
};
|
||||
|
||||
/** Normal entry point from OS */
|
||||
@ -5143,6 +5143,12 @@ int main(int argc, char** argv)
|
||||
int32 user = 0;
|
||||
nserror ret;
|
||||
Object *splash_window = ami_gui_splash_open();
|
||||
struct gui_table amiga_gui_table = {
|
||||
.browser = &amiga_browser_table,
|
||||
.window = &amiga_window_table,
|
||||
.clipboard = &amiga_clipboard_table,
|
||||
.download = amiga_download_table,
|
||||
};
|
||||
|
||||
/* Open popupmenu.library just to check the version.
|
||||
* Versions older than 53.11 are dangerous, so we
|
||||
@ -5190,10 +5196,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (ami_locate_resource(messages, "Messages") == false)
|
||||
die("Cannot open Messages file");
|
||||
|
||||
ami_gui_table.download = amiga_gui_download_table;
|
||||
|
||||
ret = netsurf_init(messages, &ami_gui_table);
|
||||
ret = netsurf_init(messages, &amiga_gui_table);
|
||||
if (ret != NSERROR_OK) {
|
||||
die("NetSurf failed to initialise");
|
||||
}
|
||||
|
@ -455,12 +455,11 @@ static void gui_download_window_done(struct gui_download_window *dw)
|
||||
gui_window_set_status(input_window, messages_get("Done") );
|
||||
}
|
||||
|
||||
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 *atari_gui_download_table = &gui_download_table;
|
||||
|
||||
struct gui_download_table *atari_download_table = &download_table;
|
||||
|
@ -19,6 +19,8 @@
|
||||
#ifndef NS_ATARI_DOWNLOAD_H
|
||||
#define NS_ATARI_DOWNLOAD_H
|
||||
|
||||
extern struct gui_download_table *atari_download_table;
|
||||
|
||||
#define MAX_SLEN_LBL_DONE 64
|
||||
#define MAX_SLEN_LBL_PERCENT 5
|
||||
#define MAX_SLEN_LBL_SPEED 13
|
||||
@ -58,6 +60,4 @@ struct gui_download_window {
|
||||
bool close_on_finish;
|
||||
};
|
||||
|
||||
struct gui_download_table *atari_gui_download_table;
|
||||
|
||||
#endif
|
||||
|
22
atari/gui.c
22
atari/gui.c
@ -1045,15 +1045,16 @@ static struct gui_window_table atari_window_table = {
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table atari_gui_table = {
|
||||
static struct gui_clipboard_table atari_clipboard_table = {
|
||||
.get = gui_get_clipboard,
|
||||
.set = gui_set_clipboard,
|
||||
};
|
||||
|
||||
static struct gui_browser_table atari_browser_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
.get_resource_url = gui_get_resource_url,
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
.cert_verify = gui_cert_verify,
|
||||
|
||||
.window = &atari_window_table;
|
||||
};
|
||||
|
||||
/* #define WITH_DBG_LOGFILE 1 */
|
||||
@ -1071,6 +1072,12 @@ int main(int argc, char** argv)
|
||||
struct stat stat_buf;
|
||||
nsurl *url;
|
||||
nserror ret;
|
||||
struct gui_table atari_gui_table = {
|
||||
.browser = &atari_browser_table,
|
||||
.window = &atari_window_table,
|
||||
.clipboard = &atari_clipboard_table,
|
||||
.download = atari_download_table,
|
||||
};
|
||||
|
||||
/* @todo logging file descriptor update belongs in a nslog_init callback */
|
||||
setbuf(stderr, NULL);
|
||||
@ -1104,10 +1111,7 @@ int main(int argc, char** argv)
|
||||
|
||||
/* common initialisation */
|
||||
LOG(("Initialising core..."));
|
||||
|
||||
atari_gui_table.download = nsgtk_gui_download_table;
|
||||
|
||||
ret = netsurf_init(messages, atari_gui_table);
|
||||
ret = netsurf_init(messages, &atari_gui_table);
|
||||
if (ret != NSERROR_OK) {
|
||||
die("NetSurf failed to initialise");
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -16,4 +16,4 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
struct gui_download_table *beos_gui_download_table;
|
||||
struct gui_download_table *beos_download_table;
|
||||
|
32
beos/gui.cpp
32
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!
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -183,6 +183,12 @@ int main( int argc, char **argv )
|
||||
{
|
||||
nsurl *url;
|
||||
nserror error;
|
||||
struct gui_table cocoa_gui_table = {
|
||||
.browser = cocoa_browser_table,
|
||||
.window = cocoa_window_table,
|
||||
.clipboard = cocoa_clipboard_table,
|
||||
.download = cocoa_download_table,
|
||||
};
|
||||
|
||||
cocoa_autorelease();
|
||||
|
||||
@ -203,9 +209,7 @@ int main( int argc, char **argv )
|
||||
nsoption_commandline(&argc, argv, NULL);
|
||||
|
||||
/* common initialisation */
|
||||
cocoa_gui_table->download = cocoa_gui_download_table;
|
||||
|
||||
error = netsurf_init(messages, cocoa_gui_table);
|
||||
error = netsurf_init(messages, &cocoa_gui_table);
|
||||
if (error != NSERROR_OK) {
|
||||
die("NetSurf failed to initialise");
|
||||
}
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
extern struct gui_window_table *cocoa_window_table;
|
||||
extern struct gui_clipboard_table *cocoa_clipboard_table;
|
||||
extern struct gui_browser_table *cocoa_browser_table;
|
||||
|
||||
extern NSString * const kCookiesFileOption;
|
||||
extern NSString * const kURLsFileOption;
|
||||
extern NSString * const kHotlistFileOption;
|
||||
@ -27,5 +31,3 @@ extern NSString * const kAlwaysCancelDownload;
|
||||
extern NSString * const kAlwaysCloseMultipleTabs;
|
||||
|
||||
void cocoa_autorelease( void );
|
||||
|
||||
extern struct gui_table *cocoa_gui_table;
|
||||
|
23
cocoa/gui.m
23
cocoa/gui.m
@ -282,7 +282,7 @@ void gui_401login_open(nsurl *url, const char *realm,
|
||||
}
|
||||
|
||||
|
||||
static struct gui_window_table cocoa_window_table = {
|
||||
static struct gui_window_table window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
@ -304,18 +304,25 @@ static struct gui_window_table cocoa_window_table = {
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table gui_table = {
|
||||
struct gui_window_table *cocoa_window_table = &window_table;
|
||||
|
||||
|
||||
static struct gui_clipboard_table clipboard_table = {
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
};
|
||||
|
||||
struct gui_clipboard_table *cocoa_clipboard_table = &clipboard_table;
|
||||
|
||||
|
||||
static struct gui_browser_table browser_table = {
|
||||
.poll = gui_poll,
|
||||
.get_resource_url = gui_get_resource_url,
|
||||
.launch_url = gui_launch_url,
|
||||
.create_form_select_menu = gui_create_form_select_menu,
|
||||
.cert_verify = gui_cert_verify,
|
||||
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
|
||||
.window = &cocoa_window_table,
|
||||
};
|
||||
|
||||
struct gui_table *cocoa_gui_table = &gui_table;
|
||||
struct gui_browser_table *cocoa_browser_table = &browser_table;
|
||||
|
||||
|
||||
|
@ -207,7 +207,7 @@ static bool fetch_resource_initialise(lwc_string *scheme)
|
||||
}
|
||||
}
|
||||
|
||||
e->url = guit->get_resource_url(fetch_resource_paths[i]);
|
||||
e->url = guit->browser->get_resource_url(fetch_resource_paths[i]);
|
||||
if (e->url == NULL) {
|
||||
lwc_string_unref(e->path);
|
||||
} else {
|
||||
|
@ -814,7 +814,7 @@ browser_window_download(struct browser_window *bw,
|
||||
NULL, NULL, &l);
|
||||
if (error == NSERROR_NO_FETCH_HANDLER) {
|
||||
/* no internal handler for this type, call out to frontend */
|
||||
guit->launch_url(nsurl_access(url));
|
||||
guit->browser->launch_url(nsurl_access(url));
|
||||
} else if (error != NSERROR_OK) {
|
||||
LOG(("Failed to fetch download: %d", error));
|
||||
} else {
|
||||
@ -1873,7 +1873,7 @@ nserror browser_window_navigate(struct browser_window *bw,
|
||||
|
||||
case NSERROR_NO_FETCH_HANDLER: /* no handler for this type */
|
||||
/** @todo does this always try and download even unverifiable content? */
|
||||
guit->launch_url(nsurl_access(url));
|
||||
guit->browser->launch_url(nsurl_access(url));
|
||||
break;
|
||||
|
||||
default: /* report error to user */
|
||||
|
@ -264,20 +264,35 @@ struct gui_download_table {
|
||||
void (*done)(struct gui_download_window *dw);
|
||||
};
|
||||
|
||||
/** Graphical user interface function table
|
||||
*
|
||||
* function table implementing GUI interface to browser core
|
||||
/**
|
||||
* function table for clipboard operations
|
||||
*/
|
||||
struct gui_table {
|
||||
struct gui_clipboard_table {
|
||||
/**
|
||||
* Core asks front end for clipboard contents.
|
||||
*
|
||||
* \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
|
||||
* \param length Byte length of UTF-8 text in buffer
|
||||
*/
|
||||
void (*get)(char **buffer, size_t *length);
|
||||
|
||||
/* sub tables */
|
||||
|
||||
/** Window sub table */
|
||||
struct gui_window_table *window;
|
||||
|
||||
/** Downlaod sub table */
|
||||
struct gui_download_table *download;
|
||||
/**
|
||||
* Core tells front end to put given text in clipboard
|
||||
*
|
||||
* \param buffer UTF-8 text, owned by core
|
||||
* \param length Byte length of UTF-8 text in buffer
|
||||
* \param styles Array of styles given to text runs, owned by core, or NULL
|
||||
* \param n_styles Number of text run styles in array
|
||||
*/
|
||||
void (*set)(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
|
||||
};
|
||||
|
||||
/** Graphical user interface browser misc function table
|
||||
*
|
||||
* function table implementing GUI interface to miscelaneous browser
|
||||
* functionality
|
||||
*/
|
||||
struct gui_browser_table {
|
||||
/* Mandantory entries */
|
||||
|
||||
/**
|
||||
@ -318,30 +333,12 @@ struct gui_table {
|
||||
* core has no fetcher for url
|
||||
*/
|
||||
void (*launch_url)(const char *url);
|
||||
|
||||
|
||||
/**
|
||||
* create a form select menu
|
||||
*/
|
||||
void (*create_form_select_menu)(struct browser_window *bw, struct form_control *control);
|
||||
|
||||
/**
|
||||
* Core asks front end for clipboard contents.
|
||||
*
|
||||
* \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
|
||||
* \param length Byte length of UTF-8 text in buffer
|
||||
*/
|
||||
void (*get_clipboard)(char **buffer, size_t *length);
|
||||
|
||||
/**
|
||||
* Core tells front end to put given text in clipboard
|
||||
*
|
||||
* \param buffer UTF-8 text, owned by core
|
||||
* \param length Byte length of UTF-8 text in buffer
|
||||
* \param styles Array of styles given to text runs, owned by core, or NULL
|
||||
* \param n_styles Number of text run styles in array
|
||||
*/
|
||||
void (*set_clipboard)(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
|
||||
|
||||
/**
|
||||
* verify certificate
|
||||
*/
|
||||
@ -350,8 +347,24 @@ struct gui_table {
|
||||
};
|
||||
|
||||
|
||||
/** Graphical user interface function table
|
||||
*
|
||||
* function table implementing GUI interface to browser core
|
||||
*/
|
||||
struct gui_table {
|
||||
|
||||
/** Browser table */
|
||||
struct gui_browser_table *browser;
|
||||
|
||||
/** Window table */
|
||||
struct gui_window_table *window;
|
||||
|
||||
/** Download table */
|
||||
struct gui_download_table *download;
|
||||
|
||||
/** Clipboard table */
|
||||
struct gui_clipboard_table *clipboard;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -195,6 +195,7 @@ static nserror verify_window_register(struct gui_window_table *gwt)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct gui_download_window *
|
||||
gui_default_download_create(download_context *ctx, struct gui_window *parent)
|
||||
{
|
||||
@ -216,12 +217,6 @@ static void gui_default_download_done(struct gui_download_window *dw)
|
||||
{
|
||||
}
|
||||
|
||||
static struct gui_download_table default_download_table = {
|
||||
.create = gui_default_download_create,
|
||||
.data = gui_default_download_data,
|
||||
.error = gui_default_download_error,
|
||||
.done = gui_default_download_done,
|
||||
};
|
||||
|
||||
/** verify download window table is valid */
|
||||
static nserror verify_download_register(struct gui_download_table *gdt)
|
||||
@ -248,6 +243,35 @@ static nserror verify_download_register(struct gui_download_table *gdt)
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
static void gui_default_get_clipboard(char **buffer, size_t *length)
|
||||
{
|
||||
*buffer = NULL;
|
||||
*length = 0;
|
||||
}
|
||||
|
||||
static void gui_default_set_clipboard(const char *buffer, size_t length,
|
||||
nsclipboard_styles styles[], int n_styles)
|
||||
{
|
||||
}
|
||||
|
||||
static nserror verify_clipboard_register(struct gui_clipboard_table *gct)
|
||||
{
|
||||
/* check table is present */
|
||||
if (gct == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* optional operations */
|
||||
if (gct->get == NULL) {
|
||||
gct->get = gui_default_get_clipboard;
|
||||
}
|
||||
if (gct->set == NULL) {
|
||||
gct->set = gui_default_set_clipboard;
|
||||
}
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
static void gui_default_quit(void)
|
||||
{
|
||||
}
|
||||
@ -270,16 +294,6 @@ static void gui_default_create_form_select_menu(struct browser_window *bw,
|
||||
{
|
||||
}
|
||||
|
||||
static void gui_default_get_clipboard(char **buffer, size_t *length)
|
||||
{
|
||||
*buffer = NULL;
|
||||
*length = 0;
|
||||
}
|
||||
|
||||
static void gui_default_set_clipboard(const char *buffer, size_t length,
|
||||
nsclipboard_styles styles[], int n_styles)
|
||||
{
|
||||
}
|
||||
|
||||
static void gui_default_cert_verify(nsurl *url,
|
||||
const struct ssl_cert_info *certs,
|
||||
@ -290,6 +304,55 @@ static void gui_default_cert_verify(nsurl *url,
|
||||
cb(false, cbpw);
|
||||
}
|
||||
|
||||
|
||||
static nserror verify_browser_register(struct gui_browser_table *gbt)
|
||||
{
|
||||
/* check table is present */
|
||||
if (gbt == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* check the mandantory fields are set */
|
||||
if (gbt->poll == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* fill in the optional entries with defaults */
|
||||
if (gbt->quit == NULL) {
|
||||
gbt->quit = gui_default_quit;
|
||||
}
|
||||
if (gbt->set_search_ico == NULL) {
|
||||
gbt->set_search_ico = gui_default_set_search_ico;
|
||||
}
|
||||
if (gbt->get_resource_url == NULL) {
|
||||
gbt->get_resource_url = gui_default_get_resource_url;
|
||||
}
|
||||
if (gbt->launch_url == NULL) {
|
||||
gbt->launch_url = gui_default_launch_url;
|
||||
}
|
||||
if (gbt->create_form_select_menu == NULL) {
|
||||
gbt->create_form_select_menu = gui_default_create_form_select_menu;
|
||||
}
|
||||
if (gbt->cert_verify == NULL) {
|
||||
gbt->cert_verify = gui_default_cert_verify;
|
||||
}
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct gui_download_table default_download_table = {
|
||||
.create = gui_default_download_create,
|
||||
.data = gui_default_download_data,
|
||||
.error = gui_default_download_error,
|
||||
.done = gui_default_download_done,
|
||||
};
|
||||
|
||||
static struct gui_clipboard_table default_clipboard_table = {
|
||||
.get = gui_default_get_clipboard,
|
||||
.set = gui_default_set_clipboard,
|
||||
};
|
||||
|
||||
nserror gui_factory_register(struct gui_table *gt)
|
||||
{
|
||||
nserror err;
|
||||
@ -304,11 +367,19 @@ nserror gui_factory_register(struct gui_table *gt)
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* check subtables */
|
||||
/* browser table */
|
||||
err = verify_browser_register(gt->browser);
|
||||
if (err != NSERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* window table */
|
||||
err = verify_window_register(gt->window);
|
||||
if (err != NSERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* download table */
|
||||
if (gt->download == NULL) {
|
||||
/* set default download table */
|
||||
gt->download = &default_download_table;
|
||||
@ -318,35 +389,14 @@ nserror gui_factory_register(struct gui_table *gt)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* check the mandantory fields are set */
|
||||
if (gt->poll == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
/* clipboard table */
|
||||
if (gt->clipboard == NULL) {
|
||||
/* set default clipboard table */
|
||||
gt->clipboard = &default_clipboard_table;
|
||||
}
|
||||
|
||||
/* fill in the optional entries with defaults */
|
||||
if (gt->quit == NULL) {
|
||||
gt->quit = gui_default_quit;
|
||||
}
|
||||
if (gt->set_search_ico == NULL) {
|
||||
gt->set_search_ico = gui_default_set_search_ico;
|
||||
}
|
||||
if (gt->get_resource_url == NULL) {
|
||||
gt->get_resource_url = gui_default_get_resource_url;
|
||||
}
|
||||
if (gt->launch_url == NULL) {
|
||||
gt->launch_url = gui_default_launch_url;
|
||||
}
|
||||
if (gt->create_form_select_menu == NULL) {
|
||||
gt->create_form_select_menu = gui_default_create_form_select_menu;
|
||||
}
|
||||
if (gt->get_clipboard == NULL) {
|
||||
gt->get_clipboard = gui_default_get_clipboard;
|
||||
}
|
||||
if (gt->set_clipboard == NULL) {
|
||||
gt->set_clipboard = gui_default_set_clipboard;
|
||||
}
|
||||
if (gt->cert_verify == NULL) {
|
||||
gt->cert_verify = gui_default_cert_verify;
|
||||
err = verify_clipboard_register(gt->clipboard);
|
||||
if (err != NSERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
guit = gt;
|
||||
|
@ -103,7 +103,7 @@ static nserror netsurf_llcache_query_handler(const llcache_query *query,
|
||||
/* For now, do nothing, as this query type isn't emitted yet */
|
||||
break;
|
||||
case LLCACHE_QUERY_SSL:
|
||||
guit->cert_verify(query->url, query->data.ssl.certs,
|
||||
guit->browser->cert_verify(query->url, query->data.ssl.certs,
|
||||
query->data.ssl.num, cb, cbpw);
|
||||
break;
|
||||
}
|
||||
@ -234,7 +234,7 @@ nserror netsurf_init(const char *messages, struct gui_table *gt)
|
||||
int netsurf_main_loop(void)
|
||||
{
|
||||
while (!netsurf_quit) {
|
||||
guit->poll(fetch_active);
|
||||
guit->browser->poll(fetch_active);
|
||||
hlcache_poll();
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ void netsurf_exit(void)
|
||||
hlcache_stop();
|
||||
|
||||
LOG(("Closing GUI"));
|
||||
guit->quit();
|
||||
guit->browser->quit();
|
||||
|
||||
LOG(("Finalising JavaScript"));
|
||||
js_finalise();
|
||||
|
@ -308,7 +308,7 @@ nserror search_web_ico_callback(hlcache_handle *ico,
|
||||
|
||||
case CONTENT_MSG_DONE:
|
||||
LOG(("got favicon '%s'", nsurl_access(hlcache_handle_get_url(ico))));
|
||||
guit->set_search_ico(search_ico);
|
||||
guit->browser->set_search_ico(search_ico);
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_ERROR:
|
||||
|
@ -845,7 +845,7 @@ bool selection_copy_to_clipboard(struct selection *s)
|
||||
return false;
|
||||
}
|
||||
|
||||
guit->set_clipboard(sel_string.buffer, sel_string.length,
|
||||
guit->clipboard->set(sel_string.buffer, sel_string.length,
|
||||
sel_string.styles, sel_string.n_styles);
|
||||
|
||||
free(sel_string.buffer);
|
||||
|
@ -1419,7 +1419,7 @@ static bool textarea_replace_text_internal(struct textarea *ta, size_t b_start,
|
||||
|
||||
/* Place CUTs on clipboard */
|
||||
if (add_to_clipboard) {
|
||||
guit->set_clipboard(ta->show->data + b_start, b_end - b_start,
|
||||
guit->clipboard->set(ta->show->data + b_start, b_end - b_start,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
@ -2486,7 +2486,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
|
||||
if (readonly)
|
||||
break;
|
||||
|
||||
guit->get_clipboard(&clipboard, &clipboard_length);
|
||||
guit->clipboard->get(&clipboard, &clipboard_length);
|
||||
if (clipboard == NULL)
|
||||
return false;
|
||||
|
||||
|
@ -43,7 +43,7 @@ static struct gui_clipboard {
|
||||
* \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
|
||||
* \param length Byte length of UTF-8 text in buffer
|
||||
*/
|
||||
void gui_get_clipboard(char **buffer, size_t *length)
|
||||
static void gui_get_clipboard(char **buffer, size_t *length)
|
||||
{
|
||||
*buffer = NULL;
|
||||
*length = 0;
|
||||
@ -72,7 +72,7 @@ void gui_get_clipboard(char **buffer, size_t *length)
|
||||
* \param styles Array of styles given to text runs, owned by core, or NULL
|
||||
* \param n_styles Number of text run styles in array
|
||||
*/
|
||||
void gui_set_clipboard(const char *buffer, size_t length,
|
||||
static void gui_set_clipboard(const char *buffer, size_t length,
|
||||
nsclipboard_styles styles[], int n_styles)
|
||||
{
|
||||
if (gui_clipboard.buffer_len < length + 1) {
|
||||
@ -94,3 +94,9 @@ void gui_set_clipboard(const char *buffer, size_t length,
|
||||
gui_clipboard.buffer[gui_clipboard.length] = '\0';
|
||||
}
|
||||
|
||||
static struct gui_clipboard_table clipboard_table = {
|
||||
.get = gui_get_clipboard,
|
||||
.set = gui_set_clipboard,
|
||||
};
|
||||
|
||||
struct gui_clipboard_table *framebuffer_clipboard_table = &clipboard_table;
|
||||
|
@ -19,8 +19,6 @@
|
||||
#ifndef NETSURF_FB_CLIPBOARD_H
|
||||
#define NETSURF_FB_CLIPBOARD_H
|
||||
|
||||
void gui_get_clipboard(char **buffer, size_t *length);
|
||||
void gui_set_clipboard(const char *buffer, size_t length,
|
||||
nsclipboard_styles styles[], int n_styles);
|
||||
extern struct gui_clipboard_table *framebuffer_clipboard_table;
|
||||
|
||||
#endif
|
||||
|
@ -1768,7 +1768,7 @@ gui_window_remove_caret(struct gui_window *g)
|
||||
}
|
||||
|
||||
|
||||
static struct gui_window_table framebuffer_gui_window_table = {
|
||||
static struct gui_window_table framebuffer_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
@ -1787,14 +1787,10 @@ static struct gui_window_table framebuffer_gui_window_table = {
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table framebuffer_gui_table = {
|
||||
static struct gui_browser_table framebuffer_browser_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
.get_resource_url = gui_get_resource_url,
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
|
||||
.window = &framebuffer_gui_window_table,
|
||||
};
|
||||
|
||||
/** Entry point from OS.
|
||||
@ -1812,6 +1808,11 @@ main(int argc, char** argv)
|
||||
nsurl *url;
|
||||
nserror ret;
|
||||
nsfb_t *nsfb;
|
||||
struct gui_table framebuffer_gui_table = {
|
||||
.browser = &framebuffer_browser_table,
|
||||
.window = &framebuffer_window_table,
|
||||
.clipboard = framebuffer_clipboard_table,
|
||||
};
|
||||
|
||||
respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
|
||||
|
||||
|
@ -845,11 +845,11 @@ static void gui_download_window_done(struct gui_download_window *dw)
|
||||
}
|
||||
|
||||
|
||||
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 *nsgtk_gui_download_table = &gui_download_table;
|
||||
struct gui_download_table *nsgtk_download_table = &download_table;
|
||||
|
@ -21,12 +21,12 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
struct gui_download_table *nsgtk_download_table;
|
||||
|
||||
bool nsgtk_download_init(const char *glade_file_location);
|
||||
void nsgtk_download_destroy (void);
|
||||
bool nsgtk_check_for_downloads(GtkWindow *parent);
|
||||
void nsgtk_download_show(GtkWindow *parent);
|
||||
void nsgtk_download_add(gchar *url, gchar *destination);
|
||||
|
||||
struct gui_download_table *nsgtk_gui_download_table;
|
||||
|
||||
#endif
|
||||
|
19
gtk/gui.c
19
gtk/gui.c
@ -1128,17 +1128,18 @@ bool path_add_part(char *path, int length, const char *newpart)
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct gui_clipboard_table nsgtk_clipboard_table = {
|
||||
.get = gui_get_clipboard,
|
||||
.set = gui_set_clipboard,
|
||||
};
|
||||
|
||||
|
||||
static struct gui_table nsgtk_gui_table = {
|
||||
static struct gui_browser_table nsgtk_browser_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
.set_search_ico = gui_set_search_ico,
|
||||
.get_resource_url = gui_get_resource_url,
|
||||
.launch_url = gui_launch_url,
|
||||
.create_form_select_menu = gui_create_form_select_menu,
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
.cert_verify = gui_cert_verify,
|
||||
};
|
||||
|
||||
@ -1150,6 +1151,12 @@ int main(int argc, char** argv)
|
||||
char *messages;
|
||||
char *options;
|
||||
nserror ret;
|
||||
struct gui_table nsgtk_gui_table = {
|
||||
.browser = &nsgtk_browser_table,
|
||||
.window = nsgtk_window_table,
|
||||
.clipboard = &nsgtk_clipboard_table,
|
||||
.download = nsgtk_download_table,
|
||||
};
|
||||
|
||||
/* check home directory is available */
|
||||
nsgtk_check_homedir();
|
||||
@ -1178,10 +1185,6 @@ int main(int argc, char** argv)
|
||||
|
||||
/* common initialisation */
|
||||
messages = filepath_find(respaths, "Messages");
|
||||
|
||||
nsgtk_gui_table.window = nsgtk_gui_window_table;
|
||||
nsgtk_gui_table.download = nsgtk_gui_download_table;
|
||||
|
||||
ret = netsurf_init(messages, &nsgtk_gui_table);
|
||||
free(messages);
|
||||
if (ret != NSERROR_OK) {
|
||||
|
@ -1167,7 +1167,7 @@ gui_window_file_gadget_open(struct gui_window *g,
|
||||
gtk_widget_destroy(dialog);
|
||||
}
|
||||
|
||||
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,
|
||||
@ -1192,4 +1192,4 @@ static struct gui_window_table gui_window_table = {
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_window_table *nsgtk_gui_window_table = &gui_window_table;
|
||||
struct gui_window_table *nsgtk_window_table = &window_table;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "desktop/browser.h"
|
||||
#include "gtk/scaffolding.h"
|
||||
|
||||
extern struct gui_window_table *nsgtk_window_table;
|
||||
|
||||
typedef enum nsgtk_window_signals {
|
||||
NSGTK_WINDOW_SIGNAL_CLICK,
|
||||
@ -32,7 +33,6 @@ typedef enum nsgtk_window_signals {
|
||||
|
||||
extern struct gui_window *window_list;
|
||||
extern int temp_open_background;
|
||||
extern struct gui_window_table *nsgtk_gui_window_table;
|
||||
|
||||
struct browser_window *nsgtk_get_browser_window(struct gui_window *g);
|
||||
nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g);
|
||||
|
@ -503,7 +503,7 @@ monkey_window_handle_command(int argc, char **argv)
|
||||
|
||||
}
|
||||
|
||||
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,
|
||||
@ -529,4 +529,4 @@ static struct gui_window_table gui_window_table = {
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_window_table *monkey_gui_window_table = &gui_window_table;
|
||||
struct gui_window_table *monkey_window_table = &window_table;
|
||||
|
@ -22,6 +22,9 @@
|
||||
#include "desktop/browser.h"
|
||||
#include "content/hlcache.h"
|
||||
|
||||
extern struct gui_window_table *monkey_window_table;
|
||||
extern struct gui_download_table *monkey_download_table;
|
||||
|
||||
struct gui_window {
|
||||
struct gui_window *r_next;
|
||||
struct gui_window *r_prev;
|
||||
@ -36,9 +39,6 @@ struct gui_window {
|
||||
|
||||
};
|
||||
|
||||
extern struct gui_window_table *monkey_gui_window_table;
|
||||
extern struct gui_download_table *monkey_gui_download_table;
|
||||
|
||||
struct gui_window *monkey_find_window_by_num(uint32_t win_num);
|
||||
struct gui_window *monkey_find_window_by_content(hlcache_handle *content);
|
||||
void monkey_window_process_reformats(void);
|
||||
|
@ -78,11 +78,11 @@ gui_download_window_done(struct gui_download_window *dw)
|
||||
free(dw);
|
||||
}
|
||||
|
||||
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 *monkey_gui_download_table = &gui_download_table;
|
||||
struct gui_download_table *monkey_download_table = &download_table;
|
||||
|
@ -114,7 +114,7 @@ static bool nslog_stream_configure(FILE *fptr)
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct gui_table monkey_gui_table = {
|
||||
static struct gui_browser_table monkey_browser_table = {
|
||||
.poll = monkey_poll,
|
||||
.quit = monkey_quit,
|
||||
.get_resource_url = gui_get_resource_url,
|
||||
@ -129,6 +129,11 @@ main(int argc, char **argv)
|
||||
char *options;
|
||||
char buf[PATH_MAX];
|
||||
nserror ret;
|
||||
struct gui_table monkey_gui_table = {
|
||||
.browser = &monkey_browser_table,
|
||||
.window = monkey_window_table,
|
||||
.download = monkey_download_table,
|
||||
};
|
||||
|
||||
/* Unbuffer stdin/out/err */
|
||||
setbuf(stdin, NULL);
|
||||
@ -155,10 +160,6 @@ main(int argc, char **argv)
|
||||
|
||||
/* common initialisation */
|
||||
messages = filepath_find(respaths, "Messages");
|
||||
|
||||
monkey_gui_table.window = monkey_gui_window_table;
|
||||
monkey_gui_table.download = monkey_gui_download_table;
|
||||
|
||||
ret = netsurf_init(messages, &monkey_gui_table);
|
||||
free(messages);
|
||||
if (ret != NSERROR_OK) {
|
||||
|
@ -655,7 +655,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
|
||||
c);
|
||||
pointer = BROWSER_POINTER_DEFAULT;
|
||||
} else if (mouse & BROWSER_MOUSE_CLICK_1)
|
||||
guit->create_form_select_menu(bw, gadget);
|
||||
guit->browser->create_form_select_menu(bw, gadget);
|
||||
break;
|
||||
case GADGET_CHECKBOX:
|
||||
status = messages_get("FormCheckbox");
|
||||
|
@ -1632,11 +1632,11 @@ bool ro_gui_download_prequit(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
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 *riscos_gui_download_table = &gui_download_table;
|
||||
struct gui_download_table *riscos_download_table = &download_table;
|
||||
|
18
riscos/gui.c
18
riscos/gui.c
@ -2348,14 +2348,17 @@ bool path_add_part(char *path, int length, const char *newpart)
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct gui_table riscos_gui_table = {
|
||||
static struct gui_clipboard_table riscos_clipboard_table = {
|
||||
.get = gui_get_clipboard,
|
||||
.set = gui_set_clipboard,
|
||||
};
|
||||
|
||||
static struct gui_browser_table riscos_browser_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
.get_resource_url = gui_get_resource_url,
|
||||
.launch_url = gui_launch_url,
|
||||
.create_form_select_menu = gui_create_form_select_menu,
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
.cert_verify = gui_cert_verify,
|
||||
};
|
||||
|
||||
@ -2370,6 +2373,12 @@ int main(int argc, char** argv)
|
||||
int used = -1; /* slightly better with older OSLib versions */
|
||||
os_error *error;
|
||||
nserror ret;
|
||||
struct gui_table riscos_gui_table = {
|
||||
.browser = &riscos_browser_table,
|
||||
.window = riscos_window_table,
|
||||
.clipboard = &riscos_clipboard_table,
|
||||
.download = riscos_download_table,
|
||||
};
|
||||
|
||||
/* Consult NetSurf$Logging environment variable to decide if logging
|
||||
* is required. */
|
||||
@ -2414,9 +2423,6 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
/* common initialisation */
|
||||
riscos_gui_table.window = riscos_gui_window_table;
|
||||
riscos_gui_table.download = riscos_gui_download_table;
|
||||
|
||||
ret = netsurf_init(path, &riscos_gui_table);
|
||||
if (ret != NSERROR_OK) {
|
||||
die("NetSurf failed to initialise");
|
||||
|
@ -123,7 +123,7 @@ const char *ro_gui_default_language(void);
|
||||
void ro_gui_download_init(void);
|
||||
void ro_gui_download_datasave_ack(wimp_message *message);
|
||||
bool ro_gui_download_prequit(void);
|
||||
extern struct gui_download_table *riscos_gui_download_table;
|
||||
extern struct gui_download_table *riscos_download_table;
|
||||
|
||||
/* in 401login.c */
|
||||
void ro_gui_401login_init(void);
|
||||
|
@ -296,12 +296,12 @@ static void gui_download_window_done(struct gui_download_window *w)
|
||||
nsws_download_clear_data(w);
|
||||
}
|
||||
|
||||
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 *win32_gui_download_table = &gui_download_table;
|
||||
struct gui_download_table *win32_download_table = &download_table;
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <windows.h>
|
||||
#include "desktop/gui.h"
|
||||
|
||||
struct gui_download_table *win32_download_table;
|
||||
|
||||
typedef enum {
|
||||
DOWNLOAD_NONE,
|
||||
DOWNLOAD_WORKING,
|
||||
@ -60,6 +62,4 @@ struct gui_download_window {
|
||||
|
||||
void nsws_download_window_init(struct gui_window *);
|
||||
|
||||
struct gui_download_table *win32_gui_download_table;
|
||||
|
||||
#endif
|
||||
|
@ -1809,7 +1809,7 @@ nsws_create_main_class(HINSTANCE hinstance) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct gui_window_table win32_window_table = {
|
||||
static struct gui_window_table window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
@ -1829,12 +1829,17 @@ static struct gui_window_table win32_window_table = {
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table gui_table = {
|
||||
.poll = gui_poll,
|
||||
.get_clipboard = gui_get_clipboard,
|
||||
.set_clipboard = gui_set_clipboard,
|
||||
struct gui_window_table *win32_window_table = &window_table;
|
||||
|
||||
.window = &win32_window_table,
|
||||
static struct gui_clipboard_table clipboard_table = {
|
||||
.get = gui_get_clipboard,
|
||||
.set = gui_set_clipboard,
|
||||
};
|
||||
|
||||
struct gui_table *win32_gui_table = &gui_table;
|
||||
struct gui_clipboard_table *win32_clipboard_table = &clipboard_table;
|
||||
|
||||
static struct gui_table browser_table = {
|
||||
.poll = gui_poll,
|
||||
};
|
||||
|
||||
struct gui_browser_table *win32_browser_table = &browser_table;
|
||||
|
@ -24,7 +24,9 @@
|
||||
#include "desktop/gui.h"
|
||||
#include "windows/localhistory.h"
|
||||
|
||||
extern struct gui_table *win32_gui_table;
|
||||
extern struct gui_window_table *win32_window_table;
|
||||
extern struct gui_clipboard_table *win32_clipboard_table;
|
||||
extern struct gui_browser_table *win32_browser_table;
|
||||
|
||||
extern HINSTANCE hInstance;
|
||||
|
||||
|
@ -104,6 +104,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
|
||||
const char *addr;
|
||||
nsurl *url;
|
||||
nserror error;
|
||||
struct gui_table win32_gui_table = {
|
||||
.browser = win32_browser_table,
|
||||
.window = win32_window_table,
|
||||
.clipboard = win32_clipboard_table,
|
||||
.download = win32_download_table,
|
||||
};
|
||||
win32_gui_table->browser->get_resource_url = get_resource_url;
|
||||
|
||||
if (SLEN(lpcli) > 0) {
|
||||
argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
@ -150,11 +157,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
|
||||
|
||||
/* common initialisation */
|
||||
messages = filepath_find(respaths, "messages");
|
||||
|
||||
win32_gui_table->download = nsgtk_gui_download_table;
|
||||
win32_gui_table->get_resource_url = get_resource_url;
|
||||
|
||||
ret = netsurf_init(messages, win32_gui_table);
|
||||
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