mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-27 14:29:42 +03:00
split gui operations into core and window and move more operations into tables
This commit is contained in:
parent
56bb9582b1
commit
b7736bae2f
@ -36,4 +36,7 @@ void ami_download_window_abort(struct gui_download_window *dw);
|
||||
BOOL ami_download_window_event(struct gui_download_window *dw);
|
||||
void ami_free_download_list(struct List *dllist);
|
||||
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size);
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url, const char *title);
|
||||
|
||||
#endif
|
||||
|
157
amiga/gui.c
157
amiga/gui.c
@ -1318,6 +1318,69 @@ void ami_gui_menu_update_all(void)
|
||||
} while(node = nnode);
|
||||
}
|
||||
|
||||
/**
|
||||
* function to add retrieved favicon to gui
|
||||
*/
|
||||
static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
struct BitMap *bm = NULL;
|
||||
struct IBox *bbox;
|
||||
ULONG cur_tab = 0;
|
||||
struct bitmap *icon_bitmap;
|
||||
|
||||
if(nsoption_bool(kiosk_mode) == true) return;
|
||||
if(!g) return;
|
||||
|
||||
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
||||
g->shared->objects[GID_TABS],
|
||||
(ULONG *)&cur_tab);
|
||||
|
||||
if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) != NULL))
|
||||
{
|
||||
bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
|
||||
g->shared->win->RPort->BitMap);
|
||||
}
|
||||
|
||||
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
||||
{
|
||||
GetAttr(SPACE_AreaBox, g->shared->objects[GID_ICON], (ULONG *)&bbox);
|
||||
|
||||
RefreshGList((struct Gadget *)g->shared->objects[GID_ICON],
|
||||
g->shared->win, NULL, 1);
|
||||
|
||||
if(bm)
|
||||
{
|
||||
ULONG tag, tag_data, minterm;
|
||||
|
||||
if(ami_plot_screen_is_palettemapped() == false) {
|
||||
tag = BLITA_UseSrcAlpha;
|
||||
tag_data = !icon_bitmap->opaque;
|
||||
minterm = 0xc0;
|
||||
} else {
|
||||
tag = BLITA_MaskPlane;
|
||||
tag_data = (ULONG)ami_bitmap_get_mask(icon_bitmap, 16, 16, bm);
|
||||
minterm = (ABC|ABNC|ANBC);
|
||||
}
|
||||
|
||||
BltBitMapTags(BLITA_SrcX, 0,
|
||||
BLITA_SrcY, 0,
|
||||
BLITA_DestX, bbox->Left,
|
||||
BLITA_DestY, bbox->Top,
|
||||
BLITA_Width, 16,
|
||||
BLITA_Height, 16,
|
||||
BLITA_Source, bm,
|
||||
BLITA_Dest, g->shared->win->RPort,
|
||||
BLITA_SrcType, BLITT_BITMAP,
|
||||
BLITA_DestType, BLITT_RASTPORT,
|
||||
BLITA_Minterm, minterm,
|
||||
tag, tag_data,
|
||||
TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
g->favicon = icon;
|
||||
}
|
||||
|
||||
void ami_handle_msg(void)
|
||||
{
|
||||
struct IntuiMessage *message = NULL;
|
||||
@ -2166,7 +2229,7 @@ void ami_handle_msg(void)
|
||||
|
||||
if(refresh_search_ico)
|
||||
{
|
||||
gui_window_set_search_ico(NULL);
|
||||
gui_set_search_ico(NULL);
|
||||
refresh_search_ico = FALSE;
|
||||
}
|
||||
|
||||
@ -4611,68 +4674,6 @@ static void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
ami_update_buttons(g->shared);
|
||||
}
|
||||
|
||||
/**
|
||||
* function to add retrieved favicon to gui
|
||||
*/
|
||||
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
struct BitMap *bm = NULL;
|
||||
struct IBox *bbox;
|
||||
ULONG cur_tab = 0;
|
||||
struct bitmap *icon_bitmap;
|
||||
|
||||
if(nsoption_bool(kiosk_mode) == true) return;
|
||||
if(!g) return;
|
||||
|
||||
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
||||
g->shared->objects[GID_TABS],
|
||||
(ULONG *)&cur_tab);
|
||||
|
||||
if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) != NULL))
|
||||
{
|
||||
bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
|
||||
g->shared->win->RPort->BitMap);
|
||||
}
|
||||
|
||||
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
||||
{
|
||||
GetAttr(SPACE_AreaBox, g->shared->objects[GID_ICON], (ULONG *)&bbox);
|
||||
|
||||
RefreshGList((struct Gadget *)g->shared->objects[GID_ICON],
|
||||
g->shared->win, NULL, 1);
|
||||
|
||||
if(bm)
|
||||
{
|
||||
ULONG tag, tag_data, minterm;
|
||||
|
||||
if(ami_plot_screen_is_palettemapped() == false) {
|
||||
tag = BLITA_UseSrcAlpha;
|
||||
tag_data = !icon_bitmap->opaque;
|
||||
minterm = 0xc0;
|
||||
} else {
|
||||
tag = BLITA_MaskPlane;
|
||||
tag_data = (ULONG)ami_bitmap_get_mask(icon_bitmap, 16, 16, bm);
|
||||
minterm = (ABC|ABNC|ANBC);
|
||||
}
|
||||
|
||||
BltBitMapTags(BLITA_SrcX, 0,
|
||||
BLITA_SrcY, 0,
|
||||
BLITA_DestX, bbox->Left,
|
||||
BLITA_DestY, bbox->Top,
|
||||
BLITA_Width, 16,
|
||||
BLITA_Height, 16,
|
||||
BLITA_Source, bm,
|
||||
BLITA_Dest, g->shared->win->RPort,
|
||||
BLITA_SrcType, BLITT_BITMAP,
|
||||
BLITA_DestType, BLITT_RASTPORT,
|
||||
BLITA_Minterm, minterm,
|
||||
tag, tag_data,
|
||||
TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
g->favicon = icon;
|
||||
}
|
||||
|
||||
static uint32 ami_set_favicon_render_hook(struct Hook *hook, APTR space,
|
||||
struct gpRender *msg)
|
||||
@ -4687,7 +4688,7 @@ static uint32 ami_set_favicon_render_hook(struct Hook *hook, APTR space,
|
||||
* \param ico may be NULL for local calls; then access current cache from
|
||||
* search_web_ico()
|
||||
*/
|
||||
void gui_window_set_search_ico(hlcache_handle *ico)
|
||||
static void gui_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
struct BitMap *bm = NULL;
|
||||
struct IBox *bbox;
|
||||
@ -4849,7 +4850,7 @@ bool gui_window_scroll_start(struct gui_window *g)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
g->shared->drag_op = type;
|
||||
@ -5092,17 +5093,29 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
}
|
||||
}
|
||||
|
||||
static struct gui_window_table ami_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_icon = gui_window_set_icon,
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
|
||||
.drag_start = gui_window_drag_start,
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
|
||||
/* from download */
|
||||
.save_link = gui_window_save_link,
|
||||
};
|
||||
|
||||
|
||||
static struct gui_table ami_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
.set_search_ico = gui_set_search_ico,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
.window = &ami_window_table,
|
||||
};
|
||||
|
||||
/** Normal entry point from OS */
|
||||
|
41
atari/gui.c
41
atari/gui.c
@ -646,7 +646,7 @@ gui_window_remove_caret(struct gui_window *w)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
struct bitmap *bmp_icon;
|
||||
@ -658,12 +658,6 @@ gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
TODO();
|
||||
}
|
||||
|
||||
void gui_window_new_content(struct gui_window *w)
|
||||
{
|
||||
struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win);
|
||||
@ -679,19 +673,6 @@ bool gui_window_scroll_start(struct gui_window *w)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
TODO();
|
||||
return true;
|
||||
}
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
{
|
||||
LOG(("%s -> %s", title, url ));
|
||||
TODO();
|
||||
}
|
||||
|
||||
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
|
||||
struct gui_window *w)
|
||||
@ -1105,17 +1086,23 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
|
||||
}
|
||||
|
||||
static struct gui_window_table atari_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
.set_icon = gui_window_set_icon,
|
||||
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table atari_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
.window = &atari_window_table;
|
||||
};
|
||||
|
||||
/* #define WITH_DBG_LOGFILE 1 */
|
||||
|
17
beos/gui.cpp
17
beos/gui.cpp
@ -791,11 +791,6 @@ void gui_create_form_select_menu(struct browser_window *bw,
|
||||
CALLED();
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_save_link(struct gui_window *g, const char *url, const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the source of a content to a text editor.
|
||||
*/
|
||||
@ -1089,15 +1084,6 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
static struct gui_table beos_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -1131,6 +1117,9 @@ int main(int argc, char** argv)
|
||||
|
||||
/* common initialisation */
|
||||
BPath messages = get_messages_path();
|
||||
|
||||
beos_gui_table.window = beos_gui_window_table;
|
||||
|
||||
ret = netsurf_init(messages.Path(), &beos_gui_table);
|
||||
if (ret != NSERROR_OK) {
|
||||
die("NetSurf failed to initialise");
|
||||
|
@ -2194,15 +2194,6 @@ void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon)
|
||||
g->top_view->UnlockLooper();
|
||||
}
|
||||
|
||||
/**
|
||||
* set gui display of a retrieved favicon representing the search provider
|
||||
* \param ico may be NULL for local calls; then access current cache from
|
||||
* search_web_ico()
|
||||
*/
|
||||
void gui_window_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void nsbeos_scaffolding_popup_menu(nsbeos_scaffolding *g, BPoint where)
|
||||
{
|
||||
|
@ -204,6 +204,6 @@ void gui_window_set_title(struct gui_window *_g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *_g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window* _g);
|
||||
void gui_window_stop_throbber(struct gui_window* _g);
|
||||
|
||||
void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon);
|
||||
|
||||
#endif /* NETSURF_BEOS_SCAFFOLDING_H */
|
||||
|
@ -335,7 +335,7 @@ float nsbeos_get_scale_for_gui(struct gui_window *g)
|
||||
}
|
||||
|
||||
/* Create a gui_window */
|
||||
struct gui_window *gui_window_create(struct browser_window *bw,
|
||||
static struct gui_window *gui_window_create(struct browser_window *bw,
|
||||
struct browser_window *clone,
|
||||
bool new_tab)
|
||||
{
|
||||
@ -957,7 +957,7 @@ void nsbeos_window_destroy_browser(struct gui_window *g)
|
||||
browser_window_destroy(g->bw);
|
||||
}
|
||||
|
||||
void gui_window_destroy(struct gui_window *g)
|
||||
static void gui_window_destroy(struct gui_window *g)
|
||||
{
|
||||
if (!g)
|
||||
return;
|
||||
@ -1284,11 +1284,6 @@ bool gui_window_scroll_start(struct gui_window *g)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
|
||||
struct gui_window *g)
|
||||
@ -1384,3 +1379,16 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
|
||||
}
|
||||
}
|
||||
|
||||
static struct gui_window_table gui_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
/* from scaffold */
|
||||
.set_icon = gui_window_set_icon,
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_window_table *beos_gui_window_table = &gui_window_table;
|
||||
|
@ -25,6 +25,8 @@ extern "C" {
|
||||
}
|
||||
#include "beos/scaffolding.h"
|
||||
|
||||
extern struct gui_window_table *beos_gui_window_table;
|
||||
|
||||
class NSBrowserFrameView : public BView {
|
||||
public:
|
||||
NSBrowserFrameView(BRect frame, struct gui_window *gui);
|
||||
@ -48,7 +50,6 @@ private:
|
||||
void nsbeos_dispatch_event(BMessage *message);
|
||||
|
||||
|
||||
|
||||
void nsbeos_reflow_all_windows(void);
|
||||
void nsbeos_window_process_reformats(void);
|
||||
|
||||
@ -61,10 +62,4 @@ void nsbeos_window_destroy_browser(struct gui_window *g);
|
||||
|
||||
struct browser_window *nsbeos_get_browser_window(struct gui_window *g);
|
||||
|
||||
|
||||
struct gui_window *gui_window_create(struct browser_window *bw,
|
||||
struct browser_window *clone,
|
||||
bool new_tab);
|
||||
void gui_window_destroy(struct gui_window *g);
|
||||
|
||||
#endif /* NETSURF_BEOS_WINDOW_H */
|
||||
|
39
cocoa/gui.m
39
cocoa/gui.m
@ -226,7 +226,7 @@ static void gui_window_stop_throbber(struct gui_window *g)
|
||||
[(BrowserViewController *)g updateBackForward];
|
||||
}
|
||||
|
||||
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
NSBitmapImageRep *bmp = icon != NULL ? (NSBitmapImageRep *)content_get_bitmap( icon ) : NULL;
|
||||
|
||||
@ -243,11 +243,6 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
[image release];
|
||||
}
|
||||
|
||||
void gui_window_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
UNIMPL();
|
||||
}
|
||||
|
||||
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
|
||||
const struct rect *clip)
|
||||
{
|
||||
@ -270,18 +265,6 @@ bool gui_window_scroll_start(struct gui_window *g)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
{
|
||||
UNIMPL();
|
||||
}
|
||||
|
||||
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
|
||||
struct gui_window *g)
|
||||
{
|
||||
@ -328,16 +311,22 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
|
||||
}
|
||||
|
||||
static struct gui_window_table cocoa_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
.set_icon = gui_window_set_icon,
|
||||
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table gui_table = {
|
||||
.poll = &gui_poll,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
.window = &cocoa_window_table,
|
||||
};
|
||||
|
||||
struct gui_table *cocoa_gui_table = &gui_table;
|
||||
|
@ -391,7 +391,7 @@ void browser_window_set_drag_type(struct browser_window *bw,
|
||||
break;
|
||||
}
|
||||
|
||||
gui_window_drag_start(top_bw->window, gtype, rect);
|
||||
guit->window->drag_start(top_bw->window, gtype, rect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -732,7 +732,7 @@ browser_window_create(enum browser_window_nav_flags flags,
|
||||
* so find that. */
|
||||
top = browser_window_get_root(clone);
|
||||
|
||||
bw->window = guit->window_create(bw, top, ((flags & BROWSER_WINDOW_TAB) != 0));
|
||||
bw->window = guit->window->create(bw, top, ((flags & BROWSER_WINDOW_TAB) != 0));
|
||||
|
||||
if (bw->window == NULL) {
|
||||
browser_window_destroy(bw);
|
||||
@ -866,7 +866,7 @@ static void browser_window_start_throbber(struct browser_window *bw)
|
||||
while (bw->parent)
|
||||
bw = bw->parent;
|
||||
|
||||
guit->window_start_throbber(bw->window);
|
||||
guit->window->start_throbber(bw->window);
|
||||
}
|
||||
|
||||
|
||||
@ -884,7 +884,7 @@ static void browser_window_stop_throbber(struct browser_window *bw)
|
||||
bw = bw->parent;
|
||||
|
||||
if (!browser_window_check_throbber(bw)) {
|
||||
guit->window_stop_throbber(bw->window);
|
||||
guit->window->stop_throbber(bw->window);
|
||||
}
|
||||
}
|
||||
|
||||
@ -918,7 +918,7 @@ static nserror browser_window_favicon_callback(hlcache_handle *c,
|
||||
/* content_get_bitmap on the hlcache_handle should give
|
||||
* us the favicon bitmap at this point
|
||||
*/
|
||||
gui_window_set_icon(bw->window, c);
|
||||
guit->window->set_icon(bw->window, c);
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_ERROR:
|
||||
@ -1507,7 +1507,7 @@ static nserror browser_window_callback(hlcache_handle *c,
|
||||
{
|
||||
/* Content wants a link to be saved */
|
||||
struct browser_window *root = browser_window_get_root(bw);
|
||||
gui_window_save_link(root->window,
|
||||
guit->window->save_link(root->window,
|
||||
event->data.savelink.url,
|
||||
event->data.savelink.title);
|
||||
}
|
||||
@ -1643,7 +1643,7 @@ void browser_window_destroy_internal(struct browser_window *bw)
|
||||
|
||||
if (bw->window) {
|
||||
/* Only the root window has a GUI window */
|
||||
guit->window_destroy(bw->window);
|
||||
guit->window->destroy(bw->window);
|
||||
}
|
||||
|
||||
if (bw->loading_content != NULL) {
|
||||
@ -1959,7 +1959,7 @@ void browser_window_update(struct browser_window *bw, bool scroll_to_top)
|
||||
|
||||
case BROWSER_WINDOW_NORMAL:
|
||||
/* Root browser window, constituting a front end window/tab */
|
||||
guit->window_set_title(bw->window,
|
||||
guit->window->set_title(bw->window,
|
||||
content_get_title(bw->current_content));
|
||||
|
||||
browser_window_update_extent(bw);
|
||||
@ -2359,7 +2359,7 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
|
||||
/* With no fragment, we may as well pass url straight through
|
||||
* saving a malloc, copy, free cycle.
|
||||
*/
|
||||
guit->window_set_url(bw->window, nsurl_access(url));
|
||||
guit->window->set_url(bw->window, nsurl_access(url));
|
||||
} else {
|
||||
nsurl *display_url;
|
||||
nserror error;
|
||||
@ -2370,7 +2370,7 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
|
||||
return;
|
||||
}
|
||||
|
||||
guit->window_set_url(bw->window, nsurl_access(display_url));
|
||||
guit->window->set_url(bw->window, nsurl_access(display_url));
|
||||
nsurl_unref(display_url);
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,45 @@ struct gui_download_window;
|
||||
struct browser_window;
|
||||
struct form_control;
|
||||
|
||||
/** Graphical user interface window function table
|
||||
*
|
||||
* function table implementing window operations
|
||||
*/
|
||||
struct gui_window_table {
|
||||
|
||||
/* Mandantory entries */
|
||||
|
||||
/** create a gui window for a browsing context */
|
||||
struct gui_window *(*create)(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
|
||||
/** destroy previously created gui window */
|
||||
void (*destroy)(struct gui_window *g);
|
||||
|
||||
|
||||
/* Optional entries */
|
||||
|
||||
/** set the window title. */
|
||||
void (*set_title)(struct gui_window *g, const char *title);
|
||||
|
||||
/** set the navigation url. */
|
||||
void (*set_url)(struct gui_window *g, const char *url);
|
||||
|
||||
/** start the navigation throbber. */
|
||||
void (*start_throbber)(struct gui_window *g);
|
||||
|
||||
/** stop the navigation throbber. */
|
||||
void (*stop_throbber)(struct gui_window *g);
|
||||
|
||||
/** start a drag operation within a window */
|
||||
bool (*drag_start)(struct gui_window *g, gui_drag_type type, const struct rect *rect);
|
||||
|
||||
/** save link operation */
|
||||
void (*save_link)(struct gui_window *g, const char *url, const char *title);
|
||||
|
||||
/** set favicon */
|
||||
void (*set_icon)(struct gui_window *g, hlcache_handle *icon);
|
||||
};
|
||||
|
||||
/** Graphical user interface function table
|
||||
*
|
||||
* function table implementing GUI interface to browser core
|
||||
@ -73,35 +112,28 @@ struct gui_table {
|
||||
|
||||
/* Mandantory entries */
|
||||
|
||||
/* sub tables */
|
||||
struct gui_window_table *window; /* window sub table */
|
||||
|
||||
/** called to let the frontend update its state and run any
|
||||
* I/O operations.
|
||||
*/
|
||||
void (*poll)(bool active);
|
||||
|
||||
/** create a gui window for a browsing context */
|
||||
struct gui_window *(*window_create)(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
|
||||
/** destroy previously created gui window */
|
||||
void (*window_destroy)(struct gui_window *g);
|
||||
|
||||
|
||||
/* Optional entries */
|
||||
|
||||
/** called to allow the gui to cleanup */
|
||||
void (*quit)(void);
|
||||
|
||||
/** set the window title. */
|
||||
void (*window_set_title)(struct gui_window *g, const char *title);
|
||||
|
||||
/** set the navigation url. */
|
||||
void (*window_set_url)(struct gui_window *g, const char *url);
|
||||
|
||||
/** start the navigation throbber. */
|
||||
void (*window_start_throbber)(struct gui_window *g);
|
||||
|
||||
/** stop the navigation throbber. */
|
||||
void (*window_stop_throbber)(struct gui_window *g);
|
||||
|
||||
/**
|
||||
* set gui display of a retrieved favicon representing the
|
||||
* search provider
|
||||
*
|
||||
* \param ico may be NULL for local calls; then access current
|
||||
* cache from search_web_ico()
|
||||
*/
|
||||
void (*set_search_ico)(hlcache_handle *ico);
|
||||
};
|
||||
|
||||
extern struct gui_table *guit; /* the gui vtable */
|
||||
@ -119,19 +151,12 @@ void gui_window_update_extent(struct gui_window *g);
|
||||
void gui_window_set_status(struct gui_window *g, const char *text);
|
||||
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
|
||||
void gui_window_hide_pointer(struct gui_window *g);
|
||||
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon);
|
||||
void gui_window_set_search_ico(hlcache_handle *ico);
|
||||
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
|
||||
const struct rect *clip);
|
||||
void gui_window_remove_caret(struct gui_window *g);
|
||||
void gui_window_new_content(struct gui_window *g);
|
||||
bool gui_window_scroll_start(struct gui_window *g);
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect);
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title);
|
||||
|
||||
struct gui_download_window *gui_download_window_create(download_context *ctx,
|
||||
struct gui_window *parent);
|
||||
@ -150,6 +175,8 @@ void gui_clear_selection(struct gui_window *g);
|
||||
void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
struct form_control *gadget);
|
||||
|
||||
void gui_launch_url(const char *url);
|
||||
|
||||
/**
|
||||
* Core asks front end for clipboard contents.
|
||||
*
|
||||
@ -179,7 +206,6 @@ void gui_set_clipboard(const char *buffer, size_t length,
|
||||
void gui_create_form_select_menu(struct browser_window *bw,
|
||||
struct form_control *control);
|
||||
|
||||
void gui_launch_url(const char *url);
|
||||
|
||||
struct ssl_cert_info;
|
||||
|
||||
|
@ -25,41 +25,104 @@ static void gui_default_window_stop_throbber(struct gui_window *g)
|
||||
{
|
||||
}
|
||||
|
||||
static bool
|
||||
gui_default_window_drag_start(struct gui_window *g,
|
||||
gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
gui_default_window_save_link(struct gui_window *g,
|
||||
const char *url,
|
||||
const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gui_default_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gui_default_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
}
|
||||
|
||||
/** verify window table is valid */
|
||||
static nserror verify_window_register(struct gui_window_table *gwt)
|
||||
{
|
||||
/* check table is present */
|
||||
if (gwt == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* check the mandantory fields are set */
|
||||
if (gwt->create == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
if (gwt->destroy == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* fill in the optional entries with defaults */
|
||||
if (gwt->set_title == NULL) {
|
||||
gwt->set_title = gui_default_window_set_title;
|
||||
}
|
||||
if (gwt->set_url == NULL) {
|
||||
gwt->set_url = gui_default_window_set_url;
|
||||
}
|
||||
if (gwt->start_throbber == NULL) {
|
||||
gwt->start_throbber = gui_default_window_start_throbber;
|
||||
}
|
||||
if (gwt->stop_throbber == NULL) {
|
||||
gwt->stop_throbber = gui_default_window_stop_throbber;
|
||||
}
|
||||
if (gwt->drag_start == NULL) {
|
||||
gwt->drag_start = gui_default_window_drag_start;
|
||||
}
|
||||
if (gwt->save_link == NULL) {
|
||||
gwt->save_link = gui_default_window_save_link;
|
||||
}
|
||||
if (gwt->set_icon == NULL) {
|
||||
gwt->set_icon = gui_default_window_set_icon;
|
||||
}
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
nserror gui_factory_register(struct gui_table *gt)
|
||||
{
|
||||
nserror err;
|
||||
|
||||
/* ensure not already initialised */
|
||||
if (guit != NULL) {
|
||||
return NSERROR_INIT_FAILED;
|
||||
}
|
||||
|
||||
/* check table is present */
|
||||
if (gt == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* check subtables */
|
||||
err = verify_window_register(gt->window);
|
||||
if (err != NSERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* check the mandantory fields are set */
|
||||
if (gt->poll == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
if (gt->window_create == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
if (gt->window_destroy == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
/* fill in the optional entries with defaults */
|
||||
if (gt->quit == NULL) {
|
||||
gt->quit = gui_default_quit;
|
||||
}
|
||||
if (gt->window_set_title == NULL) {
|
||||
gt->window_set_title = gui_default_window_set_title;
|
||||
}
|
||||
if (gt->window_set_url == NULL) {
|
||||
gt->window_set_url = gui_default_window_set_url;
|
||||
}
|
||||
if (gt->window_start_throbber == NULL) {
|
||||
gt->window_start_throbber = gui_default_window_start_throbber;
|
||||
}
|
||||
if (gt->window_stop_throbber == NULL) {
|
||||
gt->window_stop_throbber = gui_default_window_stop_throbber;
|
||||
if (gt->set_search_ico == NULL) {
|
||||
gt->set_search_ico = gui_default_set_search_ico;
|
||||
}
|
||||
|
||||
guit = gt;
|
||||
|
@ -307,7 +307,7 @@ nserror search_web_ico_callback(hlcache_handle *ico,
|
||||
|
||||
case CONTENT_MSG_DONE:
|
||||
LOG(("got favicon '%s'", nsurl_access(hlcache_handle_get_url(ico))));
|
||||
gui_window_set_search_ico(search_ico);
|
||||
guit->set_search_ico(search_ico);
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_ERROR:
|
||||
|
@ -1788,35 +1788,6 @@ gui_window_scroll_start(struct gui_window *g)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_save_link(struct gui_window *g, const char *url, const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* set favicon
|
||||
*/
|
||||
void
|
||||
gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* set gui display of a retrieved favicon representing the search provider
|
||||
* \param ico may be NULL for local calls; then access current cache from
|
||||
* search_web_ico()
|
||||
*/
|
||||
void
|
||||
gui_window_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
}
|
||||
|
||||
struct gui_download_window *
|
||||
gui_download_window_create(download_context *ctx, struct gui_window *parent)
|
||||
@ -1893,17 +1864,20 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
|
||||
}
|
||||
|
||||
static struct gui_window_table framebuffer_gui_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_url = gui_window_set_url,
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table framebuffer_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
.window = &framebuffer_gui_window_table,
|
||||
};
|
||||
|
||||
/** Entry point from OS.
|
||||
|
@ -944,9 +944,7 @@ nsgtk_preferences_comboSearch_changed(GtkComboBox *widget, struct ppref *priv)
|
||||
search_web_retrieve_ico(false);
|
||||
|
||||
/* callback may handle changing gui */
|
||||
if (search_web_ico() != NULL) {
|
||||
gui_window_set_search_ico(search_web_ico());
|
||||
}
|
||||
gui_set_search_ico(search_web_ico());
|
||||
|
||||
/* set entry */
|
||||
name = search_web_provider_name();
|
||||
|
18
gtk/gui.c
18
gtk/gui.c
@ -676,11 +676,6 @@ void gui_create_form_select_menu(struct browser_window *bw,
|
||||
|
||||
}
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
void gui_launch_url(const char *url)
|
||||
{
|
||||
gboolean ok;
|
||||
@ -1132,17 +1127,11 @@ bool path_add_part(char *path, int length, const char *newpart)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct gui_table nsgtk_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
.set_search_ico = gui_set_search_ico,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1181,6 +1170,9 @@ int main(int argc, char** argv)
|
||||
|
||||
/* common initialisation */
|
||||
messages = filepath_find(respaths, "Messages");
|
||||
|
||||
nsgtk_gui_table.window = nsgtk_gui_window_table;
|
||||
|
||||
ret = netsurf_init(messages, &nsgtk_gui_table);
|
||||
free(messages);
|
||||
if (ret != NSERROR_OK) {
|
||||
|
@ -2147,8 +2147,7 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
|
||||
nsgtk_theme_implement(g);
|
||||
|
||||
/* set web search ico */
|
||||
if (search_web_ico() != NULL)
|
||||
gui_window_set_search_ico(search_web_ico());
|
||||
gui_set_search_ico(search_web_ico());
|
||||
|
||||
/* finally, show the window. */
|
||||
gtk_widget_show(GTK_WIDGET(g->window));
|
||||
@ -2261,7 +2260,7 @@ nsgtk_scaffolding_set_icon(struct gui_window *gw)
|
||||
gtk_widget_show_all(GTK_WIDGET(sc->buttons[URL_BAR_ITEM]->button));
|
||||
}
|
||||
|
||||
void gui_window_set_search_ico(hlcache_handle *ico)
|
||||
void gui_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
struct bitmap *srch_bitmap;
|
||||
nsgtk_scaffolding *current;
|
||||
|
@ -182,6 +182,6 @@ void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
void gui_set_search_ico(hlcache_handle *ico);
|
||||
|
||||
#endif /* NETSURF_GTK_SCAFFOLDING_H */
|
||||
|
@ -449,8 +449,8 @@ void nsgtk_toolbar_close(nsgtk_scaffolding *g)
|
||||
TRUE);
|
||||
/* update favicon etc */
|
||||
nsgtk_scaffolding_set_top_level(nsgtk_scaffolding_top_level(g));
|
||||
if (search_web_ico())
|
||||
gui_window_set_search_ico(search_web_ico());
|
||||
|
||||
gui_set_search_ico(search_web_ico());
|
||||
}
|
||||
|
||||
/**
|
||||
|
26
gtk/window.c
26
gtk/window.c
@ -656,7 +656,7 @@ static void window_destroy(GtkWidget *widget, gpointer data)
|
||||
}
|
||||
|
||||
/* Core interface documented in desktop/gui.h to create a gui_window */
|
||||
struct gui_window *
|
||||
static struct gui_window *
|
||||
gui_window_create(struct browser_window *bw,
|
||||
struct browser_window *clone,
|
||||
bool new_tab)
|
||||
@ -838,7 +838,7 @@ void nsgtk_window_destroy_browser(struct gui_window *gw)
|
||||
gtk_widget_destroy(gw->container);
|
||||
}
|
||||
|
||||
void gui_window_destroy(struct gui_window *g)
|
||||
static void gui_window_destroy(struct gui_window *g)
|
||||
{
|
||||
LOG(("gui_window: %p", g));
|
||||
assert(g != NULL);
|
||||
@ -861,7 +861,7 @@ void gui_window_destroy(struct gui_window *g)
|
||||
/**
|
||||
* set favicon
|
||||
*/
|
||||
void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon)
|
||||
static void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon)
|
||||
{
|
||||
struct bitmap *icon_bitmap = NULL;
|
||||
|
||||
@ -1128,11 +1128,6 @@ bool gui_window_scroll_start(struct gui_window *g)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
|
||||
struct gui_window *g)
|
||||
@ -1195,3 +1190,18 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
|
||||
gtk_widget_destroy(dialog);
|
||||
}
|
||||
|
||||
static struct gui_window_table gui_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_icon = gui_window_set_icon,
|
||||
|
||||
/* from scaffold */
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_window_table *nsgtk_gui_window_table = &gui_window_table;
|
||||
|
@ -32,7 +32,7 @@ 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);
|
||||
@ -48,7 +48,4 @@ struct gui_window *nsgtk_window_iterate(struct gui_window *g);
|
||||
GtkWidget *nsgtk_window_get_tab(struct gui_window *g);
|
||||
void nsgtk_window_set_tab(struct gui_window *g, GtkWidget *w);
|
||||
|
||||
struct gui_window *gui_window_create(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
void gui_window_destroy(struct gui_window *g);
|
||||
|
||||
#endif /* NETSURF_GTK_WINDOW_H */
|
||||
|
@ -87,7 +87,7 @@ monkey_kill_browser_windows(void)
|
||||
}
|
||||
}
|
||||
|
||||
struct gui_window *
|
||||
static struct gui_window *
|
||||
gui_window_create(struct browser_window *bw,
|
||||
struct browser_window *clone,
|
||||
bool new_tab)
|
||||
@ -112,7 +112,7 @@ gui_window_create(struct browser_window *bw,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_destroy(struct gui_window *g)
|
||||
{
|
||||
fprintf(stdout, "WINDOW DESTROY WIN %u\n", g->win_num);
|
||||
@ -120,7 +120,7 @@ gui_window_destroy(struct gui_window *g)
|
||||
free(g);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_set_title(struct gui_window *g, const char *title)
|
||||
{
|
||||
fprintf(stdout, "WINDOW TITLE WIN %u STR %s\n", g->win_num, title);
|
||||
@ -148,19 +148,19 @@ gui_window_new_content(struct gui_window *g)
|
||||
fprintf(stdout, "WINDOW NEW_CONTENT WIN %u\n", g->win_num);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
fprintf(stdout, "WINDOW NEW_ICON WIN %u\n", g->win_num);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_start_throbber(struct gui_window *g)
|
||||
{
|
||||
fprintf(stdout, "WINDOW START_THROBBER WIN %u\n", g->win_num);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_stop_throbber(struct gui_window *g)
|
||||
{
|
||||
fprintf(stdout, "WINDOW STOP_THROBBER WIN %u\n", g->win_num);
|
||||
@ -270,7 +270,7 @@ gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
|
||||
fprintf(stdout, "WINDOW SET_POINTER WIN %u POINTER %s\n", g->win_num, ptr_name);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_set_url(struct gui_window *g, const char *url)
|
||||
{
|
||||
fprintf(stdout, "WINDOW SET_URL WIN %u URL %s\n", g->win_num, url);
|
||||
@ -301,11 +301,6 @@ gui_window_scroll_start(struct gui_window *g)
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
|
||||
int x1, int y1)
|
||||
@ -367,7 +362,7 @@ gui_window_remove_caret(struct gui_window *g)
|
||||
fprintf(stdout, "WINDOW REMOVE_CARET WIN %u\n", g->win_num);
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
@ -383,7 +378,7 @@ gui_create_form_select_menu(struct browser_window *bw,
|
||||
bw->window->win_num);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
{
|
||||
@ -567,3 +562,19 @@ monkey_window_handle_command(int argc, char **argv)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static struct gui_window_table gui_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
.set_icon = gui_window_set_icon,
|
||||
|
||||
.drag_start = gui_window_drag_start,
|
||||
.save_link = gui_window_save_link,
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_window_table *monkey_gui_window_table = &gui_window_table;
|
||||
|
@ -36,6 +36,8 @@ struct gui_window {
|
||||
|
||||
};
|
||||
|
||||
extern struct gui_window_table *monkey_gui_window_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);
|
||||
@ -43,12 +45,4 @@ void monkey_window_process_reformats(void);
|
||||
void monkey_window_handle_command(int argc, char **argv);
|
||||
void monkey_kill_browser_windows(void);
|
||||
|
||||
|
||||
struct gui_window *gui_window_create(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
void gui_window_destroy(struct gui_window *g);
|
||||
void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
#endif /* NETSURF_MONKEY_BROWSER_H */
|
||||
|
@ -116,14 +116,6 @@ static bool nslog_stream_configure(FILE *fptr)
|
||||
static struct gui_table monkey_gui_table = {
|
||||
.poll = monkey_poll,
|
||||
.quit = monkey_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
int
|
||||
@ -159,6 +151,9 @@ main(int argc, char **argv)
|
||||
|
||||
/* common initialisation */
|
||||
messages = filepath_find(respaths, "Messages");
|
||||
|
||||
monkey_gui_table.window = monkey_gui_window_table;
|
||||
|
||||
ret = netsurf_init(messages, &monkey_gui_table);
|
||||
free(messages);
|
||||
if (ret != NSERROR_OK) {
|
||||
|
10
riscos/gui.c
10
riscos/gui.c
@ -840,14 +840,6 @@ static bool nslog_stream_configure(FILE *fptr)
|
||||
static struct gui_table riscos_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
|
||||
@ -905,6 +897,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
/* common initialisation */
|
||||
riscos_gui_table.window = riscos_gui_window_table;
|
||||
|
||||
ret = netsurf_init(path, &riscos_gui_table);
|
||||
if (ret != NSERROR_OK) {
|
||||
die("NetSurf failed to initialise");
|
||||
|
@ -379,7 +379,7 @@ void ro_gui_window_initialise(void)
|
||||
* \return gui_window, or 0 on error and error reported
|
||||
*/
|
||||
|
||||
struct gui_window *gui_window_create(struct browser_window *bw,
|
||||
static struct gui_window *gui_window_create(struct browser_window *bw,
|
||||
struct browser_window *clone, bool new_tab)
|
||||
{
|
||||
int screen_width, screen_height, win_width, win_height, scroll_width;
|
||||
@ -600,7 +600,7 @@ struct gui_window *gui_window_create(struct browser_window *bw,
|
||||
* \param g gui_window to destroy
|
||||
*/
|
||||
|
||||
void gui_window_destroy(struct gui_window *g)
|
||||
static void gui_window_destroy(struct gui_window *g)
|
||||
{
|
||||
os_error *error;
|
||||
wimp_w w;
|
||||
@ -651,7 +651,7 @@ void gui_window_destroy(struct gui_window *g)
|
||||
* \param title new window title, copied
|
||||
*/
|
||||
|
||||
void gui_window_set_title(struct gui_window *g, const char *title)
|
||||
static void gui_window_set_title(struct gui_window *g, const char *title)
|
||||
{
|
||||
int scale_disp;
|
||||
|
||||
@ -1061,7 +1061,7 @@ void gui_window_hide_pointer(struct gui_window *g)
|
||||
* \param url new url for address bar
|
||||
*/
|
||||
|
||||
void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
static void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
{
|
||||
if (!g->toolbar)
|
||||
return;
|
||||
@ -1077,7 +1077,7 @@ void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
* \param g window with start of load
|
||||
*/
|
||||
|
||||
void gui_window_start_throbber(struct gui_window *g)
|
||||
static void gui_window_start_throbber(struct gui_window *g)
|
||||
{
|
||||
ro_gui_window_update_toolbar_buttons(g);
|
||||
ro_gui_menu_refresh(ro_gui_browser_window_menu);
|
||||
@ -1093,7 +1093,7 @@ void gui_window_start_throbber(struct gui_window *g)
|
||||
* \param g window with start of load
|
||||
*/
|
||||
|
||||
void gui_window_stop_throbber(struct gui_window *g)
|
||||
static void gui_window_stop_throbber(struct gui_window *g)
|
||||
{
|
||||
ro_gui_window_update_toolbar_buttons(g);
|
||||
ro_gui_menu_refresh(ro_gui_browser_window_menu);
|
||||
@ -1105,7 +1105,7 @@ void gui_window_stop_throbber(struct gui_window *g)
|
||||
* set favicon
|
||||
*/
|
||||
|
||||
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
if (g == NULL || g->toolbar == NULL)
|
||||
return;
|
||||
@ -1113,15 +1113,6 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
ro_toolbar_set_site_favicon(g->toolbar, icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* set gui display of a retrieved favicon representing the search provider
|
||||
* \param ico may be NULL for local calls; then access current cache from
|
||||
* search_web_ico()
|
||||
*/
|
||||
void gui_window_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Place the caret in a browser window.
|
||||
*
|
||||
@ -1260,7 +1251,7 @@ bool gui_window_scroll_start(struct gui_window *g)
|
||||
* \return true iff succesful
|
||||
*/
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
wimp_pointer pointer;
|
||||
@ -1319,7 +1310,7 @@ bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
* \param g gui_window containing the content
|
||||
* \param c the content to save
|
||||
*/
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
static void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
{
|
||||
ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL, url, title);
|
||||
@ -5264,3 +5255,19 @@ bool ro_gui_alt_pressed(void)
|
||||
xosbyte1(osbyte_SCAN_KEYBOARD, 2 ^ 0x80, 0, &alt);
|
||||
return (alt == 0xff);
|
||||
}
|
||||
|
||||
static struct gui_window_table gui_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_icon = gui_window_set_icon,
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
|
||||
.save_link = gui_window_save_link,
|
||||
.drag_start = gui_window_drag_start,
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_window_table *riscos_gui_window_table = &gui_window_table;
|
||||
|
@ -25,19 +25,11 @@
|
||||
#ifndef _NETSURF_RISCOS_WINDOW_H_
|
||||
#define _NETSURF_RISCOS_WINDOW_H_
|
||||
|
||||
extern struct gui_window_table *riscos_gui_window_table;
|
||||
|
||||
void ro_gui_window_initialise(void);
|
||||
|
||||
bool ro_gui_window_check_menu(wimp_menu *menu);
|
||||
|
||||
/* core acessors */
|
||||
struct gui_window *gui_window_create(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
void gui_window_destroy(struct gui_window *g);
|
||||
|
||||
void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1737,15 +1737,6 @@ gui_window_remove_caret(struct gui_window *w)
|
||||
HideCaret(w->drawingarea);
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_set_search_ico(hlcache_handle *ico)
|
||||
{
|
||||
}
|
||||
|
||||
void gui_window_new_content(struct gui_window *w)
|
||||
{
|
||||
@ -1756,16 +1747,6 @@ bool gui_window_scroll_start(struct gui_window *w)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
|
||||
struct gui_window *w)
|
||||
@ -1884,16 +1865,21 @@ nsws_create_main_class(HINSTANCE hinstance) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct gui_window_table win32_window_table = {
|
||||
.create = gui_window_create,
|
||||
.destroy = gui_window_destroy,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
.stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
static struct gui_table gui_table = {
|
||||
.poll = gui_poll,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
.window = &win32_window_table,
|
||||
};
|
||||
|
||||
struct gui_table *win32_gui_table = &gui_table;
|
||||
|
Loading…
Reference in New Issue
Block a user