diff options
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/dialog.c | 1 | ||||
-rw-r--r-- | riscos/gui.c | 23 | ||||
-rw-r--r-- | riscos/gui.h | 1 | ||||
-rw-r--r-- | riscos/history.c | 5 | ||||
-rw-r--r-- | riscos/iconbar.c | 1 | ||||
-rw-r--r-- | riscos/window.c | 91 | ||||
-rw-r--r-- | riscos/window.h | 6 |
7 files changed, 52 insertions, 76 deletions
diff --git a/riscos/dialog.c b/riscos/dialog.c index 1c95a7099..fd854b857 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -37,6 +37,7 @@ #include "utils/nsoption.h" #include "utils/log.h" #include "utils/messages.h" +#include "utils/nsurl.h" #include "utils/url.h" #include "utils/utils.h" #include "desktop/netsurf.h" diff --git a/riscos/gui.c b/riscos/gui.c index 09f254bb4..3253f796f 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -1852,34 +1852,30 @@ static void ro_gui_handle_event(wimp_event_no event, wimp_block *block) /** - * Poll the OS for events (RISC OS). - * - * \param active return as soon as possible + * Poll the RISC OS wimp for events. */ static void riscos_poll(bool active) { wimp_event_no event; wimp_block block; - const wimp_poll_flags mask = wimp_MASK_LOSE | wimp_MASK_GAIN | - wimp_SAVE_FP; + const wimp_poll_flags mask = wimp_MASK_LOSE | wimp_MASK_GAIN | wimp_SAVE_FP; os_t track_poll_offset; /* Poll wimp. */ xhourglass_off(); track_poll_offset = ro_mouse_poll_interval(); - if (active) { - event = wimp_poll(mask, &block, 0); - } else if (sched_active || (track_poll_offset > 0) || - browser_reformat_pending) { + if (sched_active || (track_poll_offset > 0)) { os_t t = os_read_monotonic_time(); - if (track_poll_offset > 0) + if (track_poll_offset > 0) { t += track_poll_offset; - else + } else { t += 10; + } - if (sched_active && (sched_time - t) < 0) + if (sched_active && (sched_time - t) < 0) { t = sched_time; + } event = wimp_poll_idle(mask, &block, t, 0); } else { @@ -1900,9 +1896,6 @@ static void riscos_poll(bool active) } ro_gui_window_update_boxes(); - - if (browser_reformat_pending && event == wimp_NULL_REASON_CODE) - ro_gui_window_process_reformats(); } diff --git a/riscos/gui.h b/riscos/gui.h index bc59b5db9..3403f551e 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -134,7 +134,6 @@ void ro_gui_window_iconise(struct gui_window *g, bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message); void ro_gui_window_redraw_all(void); void ro_gui_window_update_boxes(void); -void ro_gui_window_process_reformats(void); void ro_gui_window_quit(void); /* void ro_gui_window_close_all(void); */ #define ro_gui_window_close_all ro_gui_window_quit /* no need for a separate fn */ diff --git a/riscos/history.c b/riscos/history.c index 8c096b88c..3b8b63ae1 100644 --- a/riscos/history.c +++ b/riscos/history.c @@ -74,9 +74,8 @@ void ro_gui_history_init(void) /** * Open history window. * - * \param bw browser window to open history for - * \param history history to open - * \param at_pointer open the window at the pointer + * \param g The riscos window to open history for. + * \param at_pointer open the window at the pointer. */ void ro_gui_history_open(struct gui_window *g, bool at_pointer) diff --git a/riscos/iconbar.c b/riscos/iconbar.c index 11640fe7c..f29b019a2 100644 --- a/riscos/iconbar.c +++ b/riscos/iconbar.c @@ -36,6 +36,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/utils.h" +#include "utils/nsurl.h" #include "desktop/netsurf.h" #include "desktop/browser.h" diff --git a/riscos/window.c b/riscos/window.c index e1eaf871d..ab4cb0c50 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -602,8 +602,6 @@ static struct gui_window *gui_window_create(struct browser_window *bw, ro_gui_window_menu_close); /* Set the window options */ - bw->window = g; - bw->scale = ((float)nsoption_int(scale)) / 100; ro_gui_window_clone_options(g, existing); ro_gui_window_update_toolbar_buttons(g); @@ -975,7 +973,6 @@ static void gui_window_update_extent(struct gui_window *g) os_error *error; wimp_window_info info; wimp_window_state state; - bool update; unsigned int flags; assert(g); @@ -995,9 +992,8 @@ static void gui_window_update_extent(struct gui_window *g) info.yscroll += scroll; } - /* only allow a further reformat if we've gained/lost scrollbars */ + /* only schedule a reformat if we've gained/lost scrollbars */ flags = info.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL); - update = g->bw->reformat_pending; g->update_extent = true; ro_gui_window_open(PTR_WIMP_OPEN(&info)); @@ -1009,8 +1005,9 @@ static void gui_window_update_extent(struct gui_window *g) warn_user("WimpError", error->errmess); return; } - if (flags == (state.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL))) - g->bw->reformat_pending = update; + if (flags == (state.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL))) { + browser_window_schedule_reformat(g->bw); + } } @@ -1072,13 +1069,7 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) } -/** - * Set the contents of a window's address bar. - * - * \param g gui_window to update - * \param url new url for address bar - */ - +/* exported function documented in riscos/window.h */ void gui_window_set_url(struct gui_window *g, const char *url) { if (!g->toolbar) @@ -1563,8 +1554,7 @@ void ro_gui_window_open(wimp_open *open) height -= size; state.visible.y0 += size; if (h) { - g->bw->reformat_pending = true; - browser_reformat_pending = true; + browser_window_schedule_reformat(g->bw); } } state.flags |= wimp_WINDOW_HSCROLL; @@ -1573,8 +1563,7 @@ void ro_gui_window_open(wimp_open *open) height += size; state.visible.y0 -= size; if (h) { - g->bw->reformat_pending = true; - browser_reformat_pending = true; + browser_window_schedule_reformat(g->bw); } } state.flags &= ~wimp_WINDOW_HSCROLL; @@ -1589,8 +1578,7 @@ void ro_gui_window_open(wimp_open *open) width -= size; state.visible.x1 -= size; if (h) { - g->bw->reformat_pending = true; - browser_reformat_pending = true; + browser_window_schedule_reformat(g->bw); } } state.flags |= wimp_WINDOW_VSCROLL; @@ -1599,8 +1587,7 @@ void ro_gui_window_open(wimp_open *open) width += size; state.visible.x1 += size; if (h) { - g->bw->reformat_pending = true; - browser_reformat_pending = true; + browser_window_schedule_reformat(g->bw); } } state.flags &= ~wimp_WINDOW_VSCROLL; @@ -1613,8 +1600,7 @@ void ro_gui_window_open(wimp_open *open) if ((g->old_width > 0) && (g->old_width != width) && (ro_gui_ctrl_pressed())) new_scale = (g->bw->scale * width) / g->old_width; - g->bw->reformat_pending = true; - browser_reformat_pending = true; + browser_window_schedule_reformat(g->bw); } if (g->update_extent || g->old_width != width || g->old_height != height) { @@ -2436,7 +2422,6 @@ void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action) { struct gui_window *g; - struct browser_window *bw; hlcache_handle *h; struct toolbar *toolbar; bool export; @@ -2446,8 +2431,7 @@ void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu, g = (struct gui_window *) ro_gui_wimp_event_get_user_data(w); toolbar = g->toolbar; - bw = g->bw; - h = bw->current_content; + h = g->bw->current_content; switch (action) { case BROWSER_PAGE_INFO: @@ -2484,9 +2468,9 @@ void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu, break; case BROWSER_SELECTION_SAVE: - if (browser_window_get_editor_flags(bw) & BW_EDITOR_CAN_COPY) + if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_COPY) ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL, - browser_window_get_selection(bw), + browser_window_get_selection(g->bw), NULL, NULL); break; @@ -3810,13 +3794,13 @@ bool ro_gui_window_check_menu(wimp_menu *menu) * Return boolean flags to show what RISC OS types we can sensibly convert * the given object into. * - * \TODO -- This should probably be somewhere else but in window.c, and - * should probably even be done in content_(). + * \todo This should probably be somewhere else but in window.c, and + * should probably even be done in content_(). * - * \param *h The object to test. - * \param *export_draw true on exit if a drawfile would be possible. - * \param *export_sprite true on exit if a sprite would be possible. - * \return true if valid data is returned; else false. + * \param h The object to test. + * \param export_draw true on exit if a drawfile would be possible. + * \param export_sprite true on exit if a sprite would be possible. + * \return true if valid data is returned; else false. */ bool ro_gui_window_content_export_types(hlcache_handle *h, @@ -3855,10 +3839,10 @@ bool ro_gui_window_content_export_types(hlcache_handle *h, /** * Return true if a browser window can navigate upwards. * - * \TODO -- This should probably be somewhere else but in window.c. + * \todo This should probably be somewhere else but in window.c. * - * \param *bw the browser window to test. - * \return true if navigation up is possible; else false. + * \param bw the browser window to test. + * \return true if navigation up is possible otherwise false. */ bool ro_gui_window_up_available(struct browser_window *bw) @@ -3986,8 +3970,8 @@ void ro_gui_window_prepare_objectinfo(hlcache_handle *object, const char *href) /** * Launch a new url in the given window. * - * \param g gui_window to update - * \param url url to be launched + * \param g gui_window to update + * \param url1 url to be launched */ void ro_gui_window_launch_url(struct gui_window *g, const char *url1) @@ -4385,25 +4369,17 @@ void ro_gui_window_update_boxes(void) /** - * Process pending reformats + * callback from core to reformat a window. */ - -void ro_gui_window_process_reformats(void) +static void riscos_window_reformat(struct gui_window *gw) { - struct gui_window *g; - - browser_reformat_pending = false; - for (g = window_list; g; g = g->next) { - if (!g->bw->reformat_pending) - continue; - g->bw->reformat_pending = false; - browser_window_reformat(g->bw, false, - g->old_width / 2, - g->old_height / 2); + if (gw != NULL) { + browser_window_reformat(gw->bw, false, + gw->old_width / 2, + gw->old_height / 2); } } - /** * Destroy all browser windows. */ @@ -4860,8 +4836,8 @@ void ro_gui_window_process_form_select_menu(struct gui_window *g, /** * Convert a RISC OS window handle to a gui_window. * - * \param w RISC OS window handle - * \return pointer to a structure if found, 0 otherwise + * \param window RISC OS window handle. + * \return A pointer to a riscos gui window if found or NULL. */ struct gui_window *ro_gui_window_lookup(wimp_w window) @@ -4870,7 +4846,7 @@ struct gui_window *ro_gui_window_lookup(wimp_w window) for (g = window_list; g; g = g->next) if (g->window == window) return g; - return 0; + return NULL; } @@ -5180,6 +5156,7 @@ static struct gui_window_table window_table = { .set_scroll = gui_window_set_scroll, .get_dimensions = gui_window_get_dimensions, .update_extent = gui_window_update_extent, + .reformat = riscos_window_reformat, .set_title = gui_window_set_title, .set_url = gui_window_set_url, diff --git a/riscos/window.h b/riscos/window.h index a55ce1b9f..c4daf8bb8 100644 --- a/riscos/window.h +++ b/riscos/window.h @@ -33,6 +33,12 @@ void ro_gui_window_initialise(void); bool ro_gui_window_check_menu(wimp_menu *menu); +/** + * Set the contents of a window's address bar. + * + * \param g gui_window to update + * \param url new url for address bar + */ void gui_window_set_url(struct gui_window *g, const char *url); #endif |