From 5031b80b331ddc58fd24f3fe7a85503320cf9689 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Thu, 17 Jul 2003 23:01:02 +0000 Subject: [project @ 2003-07-17 23:01:02 by bursa] Fix 670947, tidy gui code, move some headers. svn path=/import/netsurf/; revision=231 --- content/content.h | 4 +- content/fetch.c | 4 ++ debug/fontd.c | 11 +++- debug/fontd.h | 48 ----------------- desktop/browser.c | 26 ++++----- desktop/browser.h | 4 -- desktop/gui.h | 6 ++- desktop/netsurf.c | 1 - desktop/netsurf.h | 3 -- render/box.c | 12 ++--- render/box.h | 4 +- render/font.h | 30 +++++++++++ render/layout.c | 12 ++--- riscos/font.c | 15 ++++-- riscos/font.h | 51 ------------------ riscos/gui.c | 156 +++++++++++++++++++++++++++++++++--------------------- riscos/gui.h | 59 --------------------- riscos/plugin.c | 9 ++-- 18 files changed, 188 insertions(+), 267 deletions(-) delete mode 100644 debug/fontd.h create mode 100644 render/font.h delete mode 100644 riscos/font.h delete mode 100644 riscos/gui.h diff --git a/content/content.h b/content/content.h index 5ef9f4eea..db98ffa95 100644 --- a/content/content.h +++ b/content/content.h @@ -19,9 +19,7 @@ #include "netsurf/content/fetch.h" #include "netsurf/css/css.h" #include "netsurf/render/box.h" -#ifdef riscos -#include "netsurf/riscos/font.h" -#endif +#include "netsurf/render/font.h" /** diff --git a/content/fetch.c b/content/fetch.c index 330f68d3b..a57231bf8 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -60,6 +60,10 @@ static struct fetch *fetch_list = 0; static size_t fetch_curl_data(void * data, size_t size, size_t nmemb, struct fetch *f); static size_t fetch_curl_header(char * data, size_t size, size_t nmemb, struct fetch *f); +#ifdef riscos +extern const char * const NETSURF_DIR; +#endif + /** * fetch_init -- initialise the fetcher diff --git a/debug/fontd.c b/debug/fontd.c index 89ae8ed75..f4537c238 100644 --- a/debug/fontd.c +++ b/debug/fontd.c @@ -8,10 +8,19 @@ #include #include #include "netsurf/css/css.h" -#include "netsurf/debug/fontd.h" +#include "netsurf/render/font.h" #include "netsurf/utils/utils.h" #include "netsurf/utils/log.h" +#define FONT_FAMILIES 1 +#define FONT_BOLD 2 +#define FONT_SLANTED 1 + +/* a font_set is just a linked list of font_data for each face for now */ +struct font_set { + struct font_data *font[FONT_FAMILIES * 4]; +}; + /** * font id = font family * 4 + bold * 2 + slanted * font family: 0 = sans-serif, 1 = serif, ... diff --git a/debug/fontd.h b/debug/fontd.h deleted file mode 100644 index 562e2d69f..000000000 --- a/debug/fontd.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of NetSurf, http://netsurf.sourceforge.net/ - * Licensed under the GNU General Public License, - * http://www.opensource.org/licenses/gpl-license - * Copyright 2003 James Bursa - */ - -#ifndef _NETSURF_RISCOS_FONT_H_ -#define _NETSURF_RISCOS_FONT_H_ - -/** - * structures and typedefs - */ - -#include "netsurf/css/css.h" - -typedef unsigned int font_id; - -#define FONT_FAMILIES 1 -#define FONT_BOLD 2 -#define FONT_SLANTED 1 - -/* a font_set is just a linked list of font_data for each face for now */ -struct font_set { - struct font_data *font[FONT_FAMILIES * 4]; -}; - -struct font_data { - unsigned int size; - unsigned int space_width; - struct font_data *next; -}; - -/** - * interface - */ - -unsigned long font_width(struct font_data *font, const char * text, unsigned int length); -void font_position_in_string(const char* text, struct font_data *font, - unsigned int length, unsigned long x, int* char_offset, int* pixel_offset); - -struct font_set *font_new_set(void); -struct font_data *font_open(struct font_set *set, struct css_style *style); -void font_free_set(struct font_set *set); -char * font_split(struct font_data *data, const char * text, unsigned int length, - unsigned int width, unsigned int *used_width); - -#endif diff --git a/desktop/browser.c b/desktop/browser.c index ad29e6f38..0782bd6fb 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -6,22 +6,21 @@ * Copyright 2003 James Bursa */ +#include +#include +#include +#include +#include +#include +#include "curl/curl.h" +#include "libxml/debugXML.h" #include "netsurf/content/cache.h" #include "netsurf/content/fetchcache.h" #include "netsurf/desktop/browser.h" -#include "netsurf/riscos/font.h" #include "netsurf/render/box.h" +#include "netsurf/render/font.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" -#include "libxml/uri.h" -#include "libxml/debugXML.h" -#include "curl/curl.h" -#include -#include -#include -#include -#include -#include static void browser_window_start_throbber(struct browser_window* bw); static void browser_window_text_selection(struct browser_window* bw, @@ -187,7 +186,10 @@ void browser_window_destroy(struct browser_window* bw) content_remove_instance(bw->current_content, bw, 0, 0, 0, &bw->current_content_state); content_remove_user(bw->current_content, browser_window_callback, bw, 0); } - + if (bw->loading_content != NULL) { + content_remove_user(bw->loading_content, browser_window_callback, bw, 0); + } +/* if (bw->history != NULL) { struct history* current = bw->history; @@ -209,7 +211,7 @@ void browser_window_destroy(struct browser_window* bw) xfree(hh); } } - +*/ xfree(bw->url); gui_window_destroy(bw->window); diff --git a/desktop/browser.h b/desktop/browser.h index 016f2e636..fe664adec 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -13,7 +13,6 @@ #include "netsurf/content/content.h" #include "netsurf/desktop/gui.h" #include "netsurf/render/box.h" -#include "netsurf/riscos/font.h" typedef int browser_window_flags; #define browser_TOOLBAR ((browser_window_flags) 1) @@ -30,9 +29,6 @@ typedef int action_buttons; #define act_BUTTON_ALTERNATIVE ((action_buttons) 1) #define act_BUTTON_CONTEXT_MENU ((action_buttons) 2) - - - struct history { struct history* earlier; diff --git a/desktop/gui.h b/desktop/gui.h index 1a44cf980..6d1ef5045 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -12,7 +12,9 @@ typedef enum { GUI_BROWSER_WINDOW } gui_window_type; typedef enum { SAFE, UNSAFE } gui_safety; -#include "netsurf/riscos/gui.h" +struct ro_gui_window; +typedef struct ro_gui_window gui_window; + #include "netsurf/desktop/browser.h" struct gui_message @@ -56,6 +58,6 @@ void gui_gadget_combo(struct browser_window* bw, struct gui_gadget* g, unsigned void gui_edit_textarea(struct browser_window* bw, struct gui_gadget* g); void gui_edit_textbox(struct browser_window* bw, struct gui_gadget* g); -void gui_show_choices(); +void gui_show_choices(void); #endif diff --git a/desktop/netsurf.c b/desktop/netsurf.c index aacb657d9..0392d986a 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -16,7 +16,6 @@ #include int netsurf_quit = 0; -gui_window* netsurf_gui_windows = NULL; static void netsurf_init(int argc, char** argv); static void netsurf_exit(void); diff --git a/desktop/netsurf.h b/desktop/netsurf.h index dba94927a..67329e164 100644 --- a/desktop/netsurf.h +++ b/desktop/netsurf.h @@ -8,9 +8,6 @@ #ifndef _NETSURF_DESKTOP_NETSURF_H_ #define _NETSURF_DESKTOP_NETSURF_H_ -#include "netsurf/desktop/browser.h" - -extern gui_window* netsurf_gui_windows; extern int netsurf_quit; void netsurf_poll(void); diff --git a/render/box.c b/render/box.c index aee750bc1..27b4fceae 100644 --- a/render/box.c +++ b/render/box.c @@ -17,10 +17,10 @@ #include "netsurf/content/fetchcache.h" #include "netsurf/css/css.h" #include "netsurf/render/box.h" +#include "netsurf/render/font.h" #include "netsurf/render/html.h" #ifdef riscos #include "netsurf/desktop/gui.h" -#include "netsurf/riscos/font.h" #include "netsurf/riscos/plugin.h" #endif #define NDEBUG @@ -1691,12 +1691,12 @@ bool plugin_decode(struct content* content, char* url, struct box* box, * we can't handle this object. */ if(po->data == 0 && po->classid == 0) { - return FALSE; + return false; } if(po->data == 0 && po->classid != 0) { if(strncasecmp(po->classid, "clsid:", 6) == 0) { LOG(("ActiveX object - n0")); - return FALSE; + return false; } else { url = url_join(po->classid, po->codebase); @@ -1718,11 +1718,11 @@ bool plugin_decode(struct content* content, char* url, struct box* box, */ if(po->type != 0) { if (content_lookup(po->type) == CONTENT_OTHER) - return FALSE; + return false; } if(po->codetype != 0) { if (content_lookup(po->codetype) == CONTENT_OTHER) - return FALSE; + return false; } /* If we've got to here, the object declaration has provided us with @@ -1734,6 +1734,6 @@ bool plugin_decode(struct content* content, char* url, struct box* box, */ html_fetch_object(content, url, box); - return TRUE; + return true; } diff --git a/render/box.h b/render/box.h index dfb0a2603..4ec60d791 100644 --- a/render/box.h +++ b/render/box.h @@ -12,9 +12,7 @@ #include #include "libxml/HTMLparser.h" #include "netsurf/css/css.h" -#ifdef riscos -#include "netsurf/riscos/font.h" -#endif +#include "netsurf/render/font.h" /** * structures diff --git a/render/font.h b/render/font.h new file mode 100644 index 000000000..80d8a2f2f --- /dev/null +++ b/render/font.h @@ -0,0 +1,30 @@ +/* + * This file is part of NetSurf, http://netsurf.sourceforge.net/ + * Licensed under the GNU General Public License, + * http://www.opensource.org/licenses/gpl-license + * Copyright 2003 Phil Mellor + * Copyright 2003 James Bursa + */ + +#ifndef _NETSURF_RISCOS_FONT_H_ +#define _NETSURF_RISCOS_FONT_H_ + +#include "netsurf/css/css.h" + +struct font_data { + int handle; + unsigned int size; + unsigned int space_width; + struct font_data *next; +}; + +struct font_set *font_new_set(void); +struct font_data *font_open(struct font_set *set, struct css_style *style); +void font_free_set(struct font_set *set); +unsigned long font_width(struct font_data *font, const char * text, unsigned int length); +void font_position_in_string(const char* text, struct font_data *font, + unsigned int length, unsigned long x, int* char_offset, int* pixel_offset); +char * font_split(struct font_data *data, const char * text, unsigned int length, + unsigned int width, unsigned int *used_width); + +#endif diff --git a/render/layout.c b/render/layout.c index 7949d1d3a..369f77491 100644 --- a/render/layout.c +++ b/render/layout.c @@ -12,21 +12,17 @@ #include #include #include "libxml/HTMLparser.h" +#include "netsurf/content/content.h" +#include "netsurf/css/css.h" #ifdef riscos #include "netsurf/desktop/gui.h" #endif -#include "netsurf/content/content.h" #include "netsurf/render/box.h" -#include "netsurf/css/css.h" +#include "netsurf/render/font.h" #include "netsurf/render/layout.h" -#ifdef riscos -#include "netsurf/riscos/font.h" -#else -#include "netsurf/debug/fontd.h" -#endif -#include "netsurf/utils/utils.h" #define NDEBUG #include "netsurf/utils/log.h" +#include "netsurf/utils/utils.h" /** * internal functions diff --git a/riscos/font.c b/riscos/font.c index 25db522fc..493a7e507 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -8,12 +8,21 @@ #include #include +#include "oslib/font.h" #include "netsurf/css/css.h" -#include "netsurf/riscos/font.h" -#include "netsurf/utils/utils.h" #include "netsurf/desktop/gui.h" +#include "netsurf/render/font.h" #include "netsurf/utils/log.h" -#include "oslib/font.h" +#include "netsurf/utils/utils.h" + +#define FONT_FAMILIES 1 +#define FONT_BOLD 2 +#define FONT_SLANTED 1 + +/* a font_set is just a linked list of font_data for each face for now */ +struct font_set { + struct font_data *font[FONT_FAMILIES * 4]; +}; /** * font id = font family * 4 + bold * 2 + slanted diff --git a/riscos/font.h b/riscos/font.h deleted file mode 100644 index 1576311c7..000000000 --- a/riscos/font.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of NetSurf, http://netsurf.sourceforge.net/ - * Licensed under the GNU General Public License, - * http://www.opensource.org/licenses/gpl-license - * Copyright 2003 Phil Mellor - * Copyright 2003 James Bursa - */ - -#ifndef _NETSURF_RISCOS_FONT_H_ -#define _NETSURF_RISCOS_FONT_H_ - -/** - * structures and typedefs - */ - -#include "netsurf/css/css.h" -#include "oslib/font.h" - -typedef unsigned int font_id; - -#define FONT_FAMILIES 1 -#define FONT_BOLD 2 -#define FONT_SLANTED 1 - -/* a font_set is just a linked list of font_data for each face for now */ -struct font_set { - struct font_data *font[FONT_FAMILIES * 4]; -}; - -struct font_data { - font_f handle; - unsigned int size; - unsigned int space_width; - struct font_data *next; -}; - -/** - * interface - */ - -unsigned long font_width(struct font_data *font, const char * text, unsigned int length); -void font_position_in_string(const char* text, struct font_data *font, - unsigned int length, unsigned long x, int* char_offset, int* pixel_offset); - -struct font_set *font_new_set(void); -struct font_data *font_open(struct font_set *set, struct css_style *style); -void font_free_set(struct font_set *set); -char * font_split(struct font_data *data, const char * text, unsigned int length, - unsigned int width, unsigned int *used_width); - -#endif diff --git a/riscos/gui.c b/riscos/gui.c index 83f3e3be9..4c46efdff 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -22,8 +22,8 @@ #include "netsurf/desktop/gui.h" #include "netsurf/desktop/netsurf.h" #include "netsurf/desktop/options.h" +#include "netsurf/render/font.h" #include "netsurf/render/html.h" -#include "netsurf/riscos/font.h" #include "netsurf/riscos/theme.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" @@ -31,6 +31,7 @@ const char *__dynamic_da_name = "NetSurf"; char *NETSURF_DIR; +static gui_window *window_list = 0; int gadget_subtract_x; int gadget_subtract_y; @@ -122,23 +123,6 @@ int config_br_open = 0; int config_prox_open = 0; int config_th_open = 0; -void wimp_close_window_CHECK(wimp_w close); -void wimp_close_window_CHECK(wimp_w close) -{ - if (close == config) - config_open = 0; - else if (close == config_br) - config_br_open = 0; - else if (close == config_prox) - config_prox_open = 0; - else if (close == config_th) - { - config_th_open = 0; - ro_gui_destroy_theme_menu(); - } - wimp_close_window(close); -} - struct ro_gui_drag_info; typedef enum { mouseaction_NONE, @@ -148,6 +132,47 @@ typedef enum { mouseaction_TOGGLESIZE, mouseaction_ICONISE, mouseaction_CLOSE } mouseaction; + +int ro_x_units(unsigned long browser_units); +int ro_y_units(unsigned long browser_units); +unsigned long browser_x_units(int ro_units); +unsigned long browser_y_units(int ro_units); + +struct ro_gui_window +{ + gui_window_type type; + + union { + struct { + wimp_w window; + wimp_w toolbar; + int toolbar_width; + struct browser_window* bw; + } browser; + } data; + + char status[256]; + char title[256]; + char url[256]; + gui_window* next; + + int throbber; + float throbtime; + + gui_safety redraw_safety; + enum { drag_NONE, drag_UNKNOWN, drag_BROWSER_TEXT_SELECTION } drag_status; + int old_width; +}; + +void ro_gui_window_click(gui_window* g, wimp_pointer* mouse); +//void ro_gui_window_mouse_at(gui_window* g, wimp_pointer* mouse); +void ro_gui_window_open(gui_window* g, wimp_open* open); +void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw); +//void ro_gui_window_keypress(gui_window* g, wimp_key* key); +void gui_remove_gadget(struct gui_gadget* g); + + + static void ro_gui_load_messages(void); static wimp_w ro_gui_load_template(const char* template_name); static void ro_gui_load_templates(void); @@ -184,7 +209,24 @@ static void ro_gui_menu_selection(wimp_selection* selection); static void ro_msg_datasave(wimp_message* block); static void ro_msg_dataload(wimp_message* block); static void gui_set_gadget_extent(struct box* box, int x, int y, os_box* extent, struct gui_gadget* g); +static void ro_gui_close_dialog(wimp_w close); + +void ro_gui_close_dialog(wimp_w close) +{ + if (close == config) + config_open = 0; + else if (close == config_br) + config_br_open = 0; + else if (close == config_prox) + config_prox_open = 0; + else if (close == config_th) + { + config_th_open = 0; + ro_gui_destroy_theme_menu(); + } + wimp_close_window(close); +} void ro_gui_load_messages(void) { @@ -415,6 +457,7 @@ gui_window* create_gui_browser_window(struct browser_window* bw) strcpy(g->title, "NetSurf"); + g->data.browser.toolbar = 0; if ((bw->flags & browser_TOOLBAR) != 0) { ro_theme_window create_toolbar; @@ -502,8 +545,8 @@ gui_window* create_gui_browser_window(struct browser_window* bw) g->redraw_safety = SAFE; - g->next = netsurf_gui_windows; - netsurf_gui_windows = g; + g->next = window_list; + window_list = g; return g; } @@ -518,20 +561,25 @@ void gui_window_set_title(gui_window* g, char* title) void gui_window_destroy(gui_window* g) { - if (g == NULL) - return; + assert(g != 0); - if (g == netsurf_gui_windows) - netsurf_gui_windows = g->next; + if (g == window_list) + window_list = g->next; else { gui_window* gg; - gg = netsurf_gui_windows; + assert(window_list != NULL); + gg = window_list; while (gg->next != g && gg->next != NULL) gg = gg->next; - if (gg->next == g) - gg->next = g->next; + assert(gg->next != NULL); + gg->next = g->next; } + + xwimp_delete_window(g->data.browser.window); + if (g->data.browser.toolbar) + xwimp_delete_window(g->data.browser.toolbar); + xfree(g); } @@ -546,13 +594,6 @@ void gui_window_show(gui_window* g) ro_gui_window_open(g, (wimp_open*)&state); } -void gui_window_hide(gui_window* g) -{ - if (g == NULL) - return; - wimp_close_window(g->data.browser.window); -} - void gui_window_redraw(gui_window* g, unsigned long x0, unsigned long y0, unsigned long x1, unsigned long y1) { @@ -1183,11 +1224,11 @@ void gui_init(int argc, char** argv) void ro_gui_throb(void) { - gui_window* g = netsurf_gui_windows; + gui_window* g; //float nowtime = (float) (clock() + 0) / CLOCKS_PER_SEC; /* workaround compiler warning */ float nowtime = (float) clock() / CLOCKS_PER_SEC; - while (g != NULL) + for (g = window_list; g != NULL; g = g->next) { if (g->type == GUI_BROWSER_WINDOW) { @@ -1230,14 +1271,13 @@ void ro_gui_throb(void) } } } - g = g->next; } } gui_window* ro_lookup_gui_from_w(wimp_w window) { - gui_window* g = netsurf_gui_windows; - while (g != NULL) + gui_window* g; + for (g = window_list; g != NULL; g = g->next) { if (g->type == GUI_BROWSER_WINDOW) { @@ -1246,16 +1286,15 @@ gui_window* ro_lookup_gui_from_w(wimp_w window) return g; } } - g = g->next; } return NULL; } gui_window* ro_lookup_gui_toolbar_from_w(wimp_w window) { - gui_window* g = netsurf_gui_windows; + gui_window* g; - while (g != NULL) + for (g = window_list; g != NULL; g = g->next) { if (g->type == GUI_BROWSER_WINDOW) { @@ -1264,7 +1303,6 @@ gui_window* ro_lookup_gui_toolbar_from_w(wimp_w window) return g; } } - g = g->next; } return NULL; } @@ -1420,19 +1458,19 @@ void ro_gui_w_click(wimp_pointer* pointer) LOG(("closing windows")); if (pointer->buttons != 1) { - wimp_close_window_CHECK(config_br); - wimp_close_window_CHECK(config_prox); - wimp_close_window_CHECK(config_th); - wimp_close_window_CHECK(config); + ro_gui_close_dialog(config_br); + ro_gui_close_dialog(config_prox); + ro_gui_close_dialog(config_th); + ro_gui_close_dialog(config); } } else if (pointer->i == ro_gui_icon("CONFIG_CANCEL")) { - wimp_close_window_CHECK(config_br); - wimp_close_window_CHECK(config_prox); - wimp_close_window_CHECK(config_th); + ro_gui_close_dialog(config_br); + ro_gui_close_dialog(config_prox); + ro_gui_close_dialog(config_th); if (pointer->buttons != 1) - wimp_close_window_CHECK(config); + ro_gui_close_dialog(config); else options_to_ro(&OPTIONS, &choices); } @@ -1444,12 +1482,12 @@ void ro_gui_w_click(wimp_pointer* pointer) get_browser_choices(&choices.browser); get_browser_choices(&browser_choices); if (pointer->buttons != 1) - wimp_close_window_CHECK(config_br); + ro_gui_close_dialog(config_br); } else if (pointer->i == ro_gui_icon("CONFIG_BR_CANCEL")) { if (pointer->buttons != 1) - wimp_close_window_CHECK(config_br); + ro_gui_close_dialog(config_br); else set_browser_choices(&choices.browser); } @@ -1471,12 +1509,12 @@ void ro_gui_w_click(wimp_pointer* pointer) get_proxy_choices(&choices.proxy); get_proxy_choices(&proxy_choices); if (pointer->buttons != 1) - wimp_close_window_CHECK(config_prox); + ro_gui_close_dialog(config_prox); } else if (pointer->i == ro_gui_icon("CONFIG_PROX_CANCEL")) { if (pointer->buttons != 1) - wimp_close_window_CHECK(config_prox); + ro_gui_close_dialog(config_prox); else set_proxy_choices(&choices.proxy); } @@ -1491,12 +1529,12 @@ void ro_gui_w_click(wimp_pointer* pointer) get_theme_choices(&choices.theme); get_theme_choices(&theme_choices); if (pointer->buttons != 1) - wimp_close_window_CHECK(config_th); + ro_gui_close_dialog(config_th); } else if (pointer->i == ro_gui_icon("CONFIG_TH_CANCEL")) { if (pointer->buttons != 1) - wimp_close_window_CHECK(config_th); + ro_gui_close_dialog(config_th); else set_theme_choices(&choices.theme); } @@ -2207,9 +2245,9 @@ void gui_poll(void) case wimp_CLOSE_WINDOW_REQUEST : g = ro_lookup_gui_from_w(block.close.w); if (g != NULL) - gui_window_hide(g); + browser_window_destroy(g->data.browser.bw); else - wimp_close_window_CHECK(block.close.w); + ro_gui_close_dialog(block.close.w); break; case wimp_POINTER_LEAVING_WINDOW : diff --git a/riscos/gui.h b/riscos/gui.h deleted file mode 100644 index 841d8c7c2..000000000 --- a/riscos/gui.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of NetSurf, http://netsurf.sourceforge.net/ - * Licensed under the GNU General Public License, - * http://www.opensource.org/licenses/gpl-license - * Copyright 2003 Phil Mellor - */ - -#ifndef _NETSURF_RISCOS_GUI_H_ -#define _NETSURF_RISCOS_GUI_H_ - -#include "netsurf/render/box.h" -#include "oslib/wimp.h" - -extern char *NETSURF_DIR; - -struct ro_gui_window; -typedef struct ro_gui_window gui_window; - -int ro_x_units(unsigned long browser_units); -int ro_y_units(unsigned long browser_units); -unsigned long browser_x_units(int ro_units); -unsigned long browser_y_units(int ro_units); - -struct ro_gui_window -{ - gui_window_type type; - - union { - struct { - wimp_w window; - wimp_w toolbar; - int toolbar_width; - struct browser_window* bw; - } browser; - } data; - - char status[256]; - char title[256]; - char url[256]; - gui_window* next; - - int throbber; - float throbtime; - - gui_safety redraw_safety; - enum { drag_NONE, drag_UNKNOWN, drag_BROWSER_TEXT_SELECTION } drag_status; - int old_width; -}; - -#include "netsurf/desktop/browser.h" - -void ro_gui_window_click(gui_window* g, wimp_pointer* mouse); -//void ro_gui_window_mouse_at(gui_window* g, wimp_pointer* mouse); -void ro_gui_window_open(gui_window* g, wimp_open* open); -void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw); -//void ro_gui_window_keypress(gui_window* g, wimp_key* key); -void gui_remove_gadget(struct gui_gadget* g); - -#endif diff --git a/riscos/plugin.c b/riscos/plugin.c index 074b9ec97..051de207f 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -131,7 +132,7 @@ void plugin_create_sysvar(const char *mime_type, char* sysvar) /** * plugin_handleable * Tests whether we can handle an object using a browser plugin - * returns TRUE if we can handle it, FALSE if we can't. + * returns true if we can handle it, false if we can't. */ bool plugin_handleable(const char *mime_type) { @@ -142,13 +143,13 @@ bool plugin_handleable(const char *mime_type) e = xmimemaptranslate_mime_type_to_filetype(mime_type, (bits *) &fv); if (e) { LOG(("xmimemaptranslate_mime_type_to_filetype failed: %s", e->errmess)); - return FALSE; + return false; } sprintf(sysvar, "%s%x", ALIAS_PREFIX, fv); if (getenv(sysvar) == 0) - return FALSE; - return TRUE; + return false; + return true; } /** -- cgit v1.2.3