From 153c4444543411b00fc8682bd38d6e1758a63082 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 22 Aug 2012 12:22:58 +0100 Subject: Move browser_window struct to private header. Places that shouldn't include it do, such as front end code. Frontends that have been updated to build: framebuffer gtk monkey riscos TODO: amiga atari beos cocoa windows --- desktop/browser.c | 2 +- desktop/browser.h | 146 +------------------------------------ desktop/browser_private.h | 177 +++++++++++++++++++++++++++++++++++++++++++++ desktop/frames.c | 2 +- desktop/search.c | 2 +- desktop/selection.c | 1 + desktop/selection.h | 3 +- desktop/textinput.c | 2 +- desktop/tree_url_node.h | 2 + framebuffer/clipboard.c | 2 + framebuffer/gui.c | 1 + framebuffer/localhistory.c | 1 + gtk/dialogs/options.c | 1 + gtk/dialogs/source.c | 1 + gtk/gui.c | 2 +- gtk/scaffolding.c | 2 +- gtk/search.c | 2 +- gtk/toolbar.c | 1 + gtk/window.c | 2 +- monkey/browser.c | 2 +- render/box_normalise.c | 1 + render/html_script.c | 1 + riscos/dialog.c | 5 +- riscos/history.c | 1 + riscos/print.c | 1 + riscos/search.c | 1 + riscos/textselection.c | 5 -- riscos/window.c | 2 +- 28 files changed, 207 insertions(+), 164 deletions(-) create mode 100644 desktop/browser_private.h diff --git a/desktop/browser.c b/desktop/browser.c index 42acc3452..5175fc469 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -42,7 +42,7 @@ #include "content/hlcache.h" #include "content/urldb.h" #include "desktop/401login.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/download.h" #include "desktop/frames.h" #include "desktop/history_core.h" diff --git a/desktop/browser.h b/desktop/browser.h index dda2d3eed..d5ad064cc 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -33,17 +33,11 @@ #include "utils/types.h" -struct box; +struct browser_window; struct hlcache_handle; -struct form; -struct form_control; struct gui_window; struct history; struct selection; -struct browser_window; -struct url_data; -struct bitmap; -struct scroll_msg_data; struct fetch_multipart_data; typedef bool (*browser_caret_callback)(struct browser_window *bw, uint32_t key, @@ -66,144 +60,6 @@ typedef enum { DRAGGING_OTHER } browser_drag_type; -/** Browser window data. */ -struct browser_window { - /** Page currently displayed, or 0. Must have status READY or DONE. */ - struct hlcache_handle *current_content; - /** Page being loaded, or 0. */ - struct hlcache_handle *loading_content; - - /** Page Favicon */ - struct hlcache_handle *current_favicon; - /** handle for favicon which we started loading early */ - struct hlcache_handle *loading_favicon; - /** favicon fetch already failed - prevents infinite error looping */ - bool failed_favicon; - - /** Window history structure. */ - struct history *history; - - /** Handler for keyboard input, or 0. */ - browser_caret_callback caret_callback; - /** Handler for pasting text, or 0. */ - browser_paste_callback paste_callback; - /** Handler for repositioning caret, or 0. */ - browser_move_callback move_callback; - - /** User parameters for caret_callback, paste_callback, and - * move_callback */ - void *caret_p1; - void *caret_p2; - - /** Platform specific window data. */ - struct gui_window *window; - - /** Busy indicator is active. */ - bool throbbing; - /** Add loading_content to the window history when it loads. */ - bool history_add; - - /** Fragment identifier for current_content. */ - lwc_string *frag_id; - - /** Current drag status. */ - browser_drag_type drag_type; - - /** Current drag's browser window, when not in root bw. */ - struct browser_window *drag_window; - - /** Mouse position at start of current scroll drag. */ - int drag_start_x; - int drag_start_y; - /** Scroll offsets at start of current scroll draw. */ - int drag_start_scroll_x; - int drag_start_scroll_y; - /** Frame resize directions for current frame resize drag. */ - unsigned int drag_resize_left : 1; - unsigned int drag_resize_right : 1; - unsigned int drag_resize_up : 1; - unsigned int drag_resize_down : 1; - - /** Current fetch is download */ - bool download; - - /** Refresh interval (-1 if undefined) */ - int refresh_interval; - - /** Window has been resized, and content needs reformatting. */ - bool reformat_pending; - - /** Window dimensions */ - int x; - int y; - int width; - int height; - - struct scrollbar *scroll_x; /**< Horizontal scroll. */ - struct scrollbar *scroll_y; /**< Vertical scroll. */ - - /** scale of window contents */ - float scale; - - /** Window characteristics */ - enum { - BROWSER_WINDOW_NORMAL, - BROWSER_WINDOW_IFRAME, - BROWSER_WINDOW_FRAME, - BROWSER_WINDOW_FRAMESET, - } browser_window_type; - - /** frameset characteristics */ - int rows; - int cols; - - /** frame dimensions */ - struct frame_dimension frame_width; - struct frame_dimension frame_height; - int margin_width; - int margin_height; - - /** frame name for targetting */ - char *name; - - /** frame characteristics */ - bool no_resize; - frame_scrolling scrolling; - bool border; - colour border_colour; - - /** iframe parent box */ - struct box *box; - - /** [cols * rows] children */ - struct browser_window *children; - struct browser_window *parent; - - /** [iframe_count] iframes */ - int iframe_count; - struct browser_window *iframes; - - /** browser window child of root browser window which has input focus */ - struct browser_window *focus; - - /** Last time a link was followed in this window */ - unsigned int last_action; - - /** Current selection, or NULL if none */ - struct selection *cur_sel; - - /** Current context for free text search, or NULL if none */ - struct search_context *cur_search; - - /** current javascript context */ - struct jscontext *jsctx; - - /** cache of the currently displayed status text. */ - char *status_text; /**< Current status bar text. */ - int status_text_len; /**< Length of the browser_window::status_text buffer. */ - int status_match; /**< Number of times an idempotent status-set operation was performed. */ - int status_miss; /**< Number of times status was really updated. */ -}; extern bool browser_reformat_pending; diff --git a/desktop/browser_private.h b/desktop/browser_private.h new file mode 100644 index 000000000..91372acc3 --- /dev/null +++ b/desktop/browser_private.h @@ -0,0 +1,177 @@ +/* + * Copyright 2003 Phil Mellor + * Copyright 2006 James Bursa + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** \file + * Browser window private structure. + */ + +#ifndef _NETSURF_DESKTOP_BROWSER_PRIVATE_H_ +#define _NETSURF_DESKTOP_BROWSER_PRIVATE_H_ + +#include + +#include "desktop/browser.h" + + +struct box; +struct hlcache_handle; +struct gui_window; +struct history; +struct selection; + +/** Browser window data. */ +struct browser_window { + /** Page currently displayed, or 0. Must have status READY or DONE. */ + struct hlcache_handle *current_content; + /** Page being loaded, or 0. */ + struct hlcache_handle *loading_content; + + /** Page Favicon */ + struct hlcache_handle *current_favicon; + /** handle for favicon which we started loading early */ + struct hlcache_handle *loading_favicon; + /** favicon fetch already failed - prevents infinite error looping */ + bool failed_favicon; + + /** Window history structure. */ + struct history *history; + + /** Handler for keyboard input, or 0. */ + browser_caret_callback caret_callback; + /** Handler for pasting text, or 0. */ + browser_paste_callback paste_callback; + /** Handler for repositioning caret, or 0. */ + browser_move_callback move_callback; + + /** User parameters for caret_callback, paste_callback, and + * move_callback */ + void *caret_p1; + void *caret_p2; + + /** Platform specific window data. */ + struct gui_window *window; + + /** Busy indicator is active. */ + bool throbbing; + /** Add loading_content to the window history when it loads. */ + bool history_add; + + /** Fragment identifier for current_content. */ + lwc_string *frag_id; + + /** Current drag status. */ + browser_drag_type drag_type; + + /** Current drag's browser window, when not in root bw. */ + struct browser_window *drag_window; + + /** Mouse position at start of current scroll drag. */ + int drag_start_x; + int drag_start_y; + /** Scroll offsets at start of current scroll draw. */ + int drag_start_scroll_x; + int drag_start_scroll_y; + /** Frame resize directions for current frame resize drag. */ + unsigned int drag_resize_left : 1; + unsigned int drag_resize_right : 1; + unsigned int drag_resize_up : 1; + unsigned int drag_resize_down : 1; + + /** Current fetch is download */ + bool download; + + /** Refresh interval (-1 if undefined) */ + int refresh_interval; + + /** Window has been resized, and content needs reformatting. */ + bool reformat_pending; + + /** Window dimensions */ + int x; + int y; + int width; + int height; + + struct scrollbar *scroll_x; /**< Horizontal scroll. */ + struct scrollbar *scroll_y; /**< Vertical scroll. */ + + /** scale of window contents */ + float scale; + + /** Window characteristics */ + enum { + BROWSER_WINDOW_NORMAL, + BROWSER_WINDOW_IFRAME, + BROWSER_WINDOW_FRAME, + BROWSER_WINDOW_FRAMESET, + } browser_window_type; + + /** frameset characteristics */ + int rows; + int cols; + + /** frame dimensions */ + struct frame_dimension frame_width; + struct frame_dimension frame_height; + int margin_width; + int margin_height; + + /** frame name for targetting */ + char *name; + + /** frame characteristics */ + bool no_resize; + frame_scrolling scrolling; + bool border; + colour border_colour; + + /** iframe parent box */ + struct box *box; + + /** [cols * rows] children */ + struct browser_window *children; + struct browser_window *parent; + + /** [iframe_count] iframes */ + int iframe_count; + struct browser_window *iframes; + + /** browser window child of root browser window which has input focus */ + struct browser_window *focus; + + /** Last time a link was followed in this window */ + unsigned int last_action; + + /** Current selection, or NULL if none */ + struct selection *cur_sel; + + /** Current context for free text search, or NULL if none */ + struct search_context *cur_search; + + /** current javascript context */ + struct jscontext *jsctx; + + /** cache of the currently displayed status text. */ + char *status_text; /**< Current status bar text. */ + int status_text_len; /**< Length of the browser_window::status_text buffer. */ + int status_match; /**< Number of times an idempotent status-set operation was performed. */ + int status_miss; /**< Number of times status was really updated. */ +}; + +#endif diff --git a/desktop/frames.c b/desktop/frames.c index 0d67ad8c5..cc2cabfd2 100644 --- a/desktop/frames.c +++ b/desktop/frames.c @@ -30,7 +30,7 @@ #include #include "utils/config.h" #include "content/hlcache.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/frames.h" #include "desktop/history_core.h" #include "desktop/gui.h" diff --git a/desktop/search.c b/desktop/search.c index 2fe762941..29d28bdaa 100644 --- a/desktop/search.c +++ b/desktop/search.c @@ -28,7 +28,7 @@ #include #include "content/content.h" #include "content/hlcache.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/options.h" #include "desktop/search.h" diff --git a/desktop/selection.c b/desktop/selection.c index 15f82bfd6..5633b1823 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -28,6 +28,7 @@ #include #include +#include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/mouse.h" #include "desktop/plotters.h" diff --git a/desktop/selection.h b/desktop/selection.h index 7ece4bd85..aebb1698f 100644 --- a/desktop/selection.h +++ b/desktop/selection.h @@ -23,7 +23,8 @@ #ifndef _NETSURF_DESKTOP_SELECTION_H_ #define _NETSURF_DESKTOP_SELECTION_H_ -#include "desktop/browser.h" +#include +#include "desktop/mouse.h" struct box; diff --git a/desktop/textinput.c b/desktop/textinput.c index 36011bed9..8efc71963 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -29,7 +29,7 @@ #include #include -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/mouse.h" #include "desktop/scrollbar.h" diff --git a/desktop/tree_url_node.h b/desktop/tree_url_node.h index 15243e93d..1fa89cdba 100644 --- a/desktop/tree_url_node.h +++ b/desktop/tree_url_node.h @@ -27,6 +27,8 @@ #include "desktop/tree.h" +struct url_data; + void tree_url_node_init(const char *folder_icon_name); void tree_url_node_cleanup(void); struct node *tree_create_URL_node(struct tree *tree, diff --git a/framebuffer/clipboard.c b/framebuffer/clipboard.c index 85e6a1da2..7503303bd 100644 --- a/framebuffer/clipboard.c +++ b/framebuffer/clipboard.c @@ -23,6 +23,8 @@ #include #include #include +#include "desktop/browser.h" +#include "desktop/gui.h" #include "desktop/selection.h" #include "framebuffer/gui.h" #include "utils/log.h" diff --git a/framebuffer/gui.c b/framebuffer/gui.c index dfbaa263d..db0a9ef02 100644 --- a/framebuffer/gui.c +++ b/framebuffer/gui.c @@ -31,6 +31,7 @@ #include #include +#include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/mouse.h" #include "desktop/plotters.h" diff --git a/framebuffer/localhistory.c b/framebuffer/localhistory.c index 4b329a832..f6c24a1a4 100644 --- a/framebuffer/localhistory.c +++ b/framebuffer/localhistory.c @@ -31,6 +31,7 @@ #include #include +#include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/plotters.h" #include "desktop/netsurf.h" diff --git a/gtk/dialogs/options.c b/gtk/dialogs/options.c index 1d095af97..a449e6fb9 100644 --- a/gtk/dialogs/options.c +++ b/gtk/dialogs/options.c @@ -26,6 +26,7 @@ #include #include +#include "desktop/browser_private.h" #include "desktop/options.h" #include "desktop/print.h" #include "desktop/searchweb.h" diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c index ad2ee2c63..0804dfffb 100644 --- a/gtk/dialogs/source.c +++ b/gtk/dialogs/source.c @@ -30,6 +30,7 @@ #include "gtk/gui.h" #include "gtk/print.h" #include "gtk/selection.h" +#include "desktop/browser_private.h" #include "desktop/netsurf.h" #include "desktop/print.h" #include "desktop/options.h" diff --git a/gtk/gui.c b/gtk/gui.c index 4956677a1..222c98202 100644 --- a/gtk/gui.c +++ b/gtk/gui.c @@ -45,7 +45,7 @@ #include "content/fetchers/resource.h" #include "content/hlcache.h" #include "content/urldb.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/cookies.h" #include "desktop/gui.h" #include "desktop/history_global_core.h" diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index 2b0036762..f6f6d9857 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -33,7 +33,7 @@ #include "content/content.h" #include "content/hlcache.h" #include "css/utils.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/history_core.h" #include "desktop/hotlist.h" #include "desktop/gui.h" diff --git a/gtk/search.c b/gtk/search.c index 52bf1c147..37b7397c4 100644 --- a/gtk/search.c +++ b/gtk/search.c @@ -32,7 +32,7 @@ #include "utils/config.h" #include "content/content.h" #include "content/hlcache.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/search.h" #include "desktop/searchweb.h" diff --git a/gtk/toolbar.c b/gtk/toolbar.c index 0e5ef4e1d..9c89ee0c9 100644 --- a/gtk/toolbar.c +++ b/gtk/toolbar.c @@ -18,6 +18,7 @@ #include +#include "desktop/browser_private.h" #include "desktop/searchweb.h" #include "utils/log.h" #include "utils/messages.h" diff --git a/gtk/window.c b/gtk/window.c index 89248e485..8a3a085f3 100644 --- a/gtk/window.c +++ b/gtk/window.c @@ -28,7 +28,7 @@ #include "content/hlcache.h" #include "gtk/window.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/mouse.h" #include "desktop/options.h" #include "desktop/searchweb.h" diff --git a/monkey/browser.c b/monkey/browser.c index a9cfd046d..ddea08675 100644 --- a/monkey/browser.c +++ b/monkey/browser.c @@ -21,7 +21,7 @@ #include -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/gui.h" #include "utils/ring.h" #include "utils/log.h" diff --git a/render/box_normalise.c b/render/box_normalise.c index 19a1cbc25..8428b8455 100644 --- a/render/box_normalise.c +++ b/render/box_normalise.c @@ -25,6 +25,7 @@ #include #include +#include #include "css/css.h" #include "css/select.h" #include "render/box.h" diff --git a/render/html_script.c b/render/html_script.c index 446868b86..9edd08cf2 100644 --- a/render/html_script.c +++ b/render/html_script.c @@ -35,6 +35,7 @@ #include "javascript/js.h" #include "content/content_protected.h" #include "content/fetch.h" +#include "content/hlcache.h" #include "render/html_internal.h" typedef bool (script_handler_t)(struct jscontext *jscontext, const char *data, size_t size) ; diff --git a/riscos/dialog.c b/riscos/dialog.c index ab53603dc..1fabbcb5e 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -685,11 +685,10 @@ bool ro_gui_dialog_zoom_apply(wimp_w w) { void ro_gui_dialog_prepare_zoom(struct gui_window *g) { char scale_buffer[8]; - sprintf(scale_buffer, "%.0f", g->bw->scale * 100); + sprintf(scale_buffer, "%.0f", browser_window_get_scale(g->bw) * 100); ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer, true); ro_gui_set_icon_selected_state(dialog_zoom, ICON_ZOOM_FRAMES, true); - ro_gui_set_icon_shaded_state(dialog_zoom, ICON_ZOOM_FRAMES, - !(g->bw->parent)); + ro_gui_set_icon_shaded_state(dialog_zoom, ICON_ZOOM_FRAMES, true); ro_gui_current_zoom_gui = g; ro_gui_wimp_event_memorise(dialog_zoom); } diff --git a/riscos/history.c b/riscos/history.c index 00ff5d6ff..8a3b562cb 100644 --- a/riscos/history.c +++ b/riscos/history.c @@ -30,6 +30,7 @@ #include "desktop/history_core.h" #include "desktop/plotters.h" #include "riscos/dialog.h" +#include "desktop/browser_private.h" #include "desktop/options.h" #include "riscos/gui.h" #include "riscos/wimp.h" diff --git a/riscos/print.c b/riscos/print.c index 46ceb851a..05eb8fdba 100644 --- a/riscos/print.c +++ b/riscos/print.c @@ -32,6 +32,7 @@ #include "utils/config.h" #include "content/content.h" #include "content/hlcache.h" +#include "desktop/browser_private.h" #include "desktop/options.h" #include "desktop/plotters.h" #include "riscos/dialog.h" diff --git a/riscos/search.c b/riscos/search.c index 76d333fea..db87cad8d 100644 --- a/riscos/search.c +++ b/riscos/search.c @@ -32,6 +32,7 @@ #include "content/hlcache.h" #include "desktop/browser.h" #include "desktop/gui.h" +#include "desktop/browser_private.h" #include "desktop/search.h" #include "desktop/selection.h" #include "riscos/dialog.h" diff --git a/riscos/textselection.c b/riscos/textselection.c index c5a42b548..96c3e2c90 100644 --- a/riscos/textselection.c +++ b/riscos/textselection.c @@ -498,8 +498,6 @@ bool ro_gui_save_clipboard(const char *path) void ro_gui_selection_dragging(wimp_message *message) { wimp_full_message_dragging *drag = (wimp_full_message_dragging*)message; - struct browser_window *bw; - hlcache_handle *h; struct gui_window *g; os_coord pos; @@ -517,9 +515,6 @@ void ro_gui_selection_dragging(wimp_message *message) if (!ro_gui_window_to_window_pos(g, drag->pos.x, drag->pos.y, &pos)) return; - bw = g->bw; - h = bw->current_content; - drag_claimed = false; } diff --git a/riscos/window.c b/riscos/window.c index 085e02a0e..b7fffd66b 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -45,7 +45,7 @@ #include "content/hlcache.h" #include "content/urldb.h" #include "css/css.h" -#include "desktop/browser.h" +#include "desktop/browser_private.h" #include "desktop/cookies.h" #include "desktop/scrollbar.h" #include "desktop/frames.h" -- cgit v1.2.3