diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-11-02 15:46:42 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-11-02 15:46:42 +0000 |
commit | c31c4babe172ab581a3196536d47fc2558a01acd (patch) | |
tree | 62d8630490f7969d0e690ba881d7b956e53d7561 /riscos | |
parent | 1794ac0d333acc61eda3424141d4722b7eab9a2b (diff) | |
download | netsurf-c31c4babe172ab581a3196536d47fc2558a01acd.tar.gz netsurf-c31c4babe172ab581a3196536d47fc2558a01acd.tar.bz2 |
Change contextual content retrieval to browser features.
Update the API which allows frontends to acquire the page features
(images, link urls or form elements) present at the given coordinates
within a browser window.
By making this an explicit browser_window API and using the browser.h
header for the associated data structure with a more appropriate API
naming the usage is much more obvious and contained.
Additionally the link url is now passed around as a nsurl stopping it
being converted from nsurl to text and back again several times.
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/window.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/riscos/window.c b/riscos/window.c index 5c47e115c..74d514693 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -1868,7 +1868,7 @@ bool ro_gui_window_toolbar_keypress(void *data, wimp_key *key) bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key, bool is_toolbar) { - struct contextual_content cont; + struct browser_window_features cont; os_error *ro_error; wimp_pointer pointer; os_coord pos; @@ -1892,7 +1892,7 @@ bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key, if (!ro_gui_window_to_window_pos(g, pointer.pos.x, pointer.pos.y, &pos)) return false; - browser_window_get_contextual_content(g->bw, pos.x, pos.y, &cont); + browser_window_get_features(g->bw, pos.x, pos.y, &cont); switch (c) { case IS_WIMP_KEY + wimp_KEY_F1: /* Help. */ @@ -2144,7 +2144,7 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu, struct gui_window *g; struct browser_window *bw; struct toolbar *toolbar; - struct contextual_content cont; + struct browser_window_features cont; bool export_sprite, export_draw, have_content; os_coord pos; browser_editor_flags editor_flags; @@ -2176,21 +2176,15 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu, current_menu_main = NULL; current_menu_object = NULL; - if (current_menu_url != NULL) { - nsurl_unref(current_menu_url); - current_menu_url = NULL; - } + current_menu_url = NULL; if (ro_gui_window_to_window_pos(g, pointer->pos.x, pointer->pos.y, &pos)) { - browser_window_get_contextual_content(bw, - pos.x, pos.y, &cont); + browser_window_get_features(bw, pos.x, pos.y, &cont); current_menu_main = cont.main; current_menu_object = cont.object; - if (cont.link_url != NULL) { - nsurl_create(cont.link_url, ¤t_menu_url); - } + current_menu_url = cont.link; } } @@ -3049,10 +3043,7 @@ void ro_gui_window_menu_close(wimp_w w, wimp_i i, wimp_menu *menu) { if (menu == ro_gui_browser_window_menu) { current_menu_object = NULL; - if (current_menu_url != NULL) { - nsurl_unref(current_menu_url); - current_menu_url = NULL; - } + current_menu_url = NULL; } else if (menu == gui_form_select_menu) { gui_form_select_control = NULL; } |