diff options
author | Steve Fryatt <stevef@netsurf-browser.org> | 2013-12-30 12:36:24 +0000 |
---|---|---|
committer | Steve Fryatt <stevef@netsurf-browser.org> | 2013-12-30 12:36:24 +0000 |
commit | b8dd4f282b521f881f33841a9e3bb101f933c349 (patch) | |
tree | 867771af6bafdac145f3dfe77f2e00221bdd5612 /riscos/gui | |
parent | f825521072ed7e459e7fa465cf66efd24f5feb76 (diff) | |
download | netsurf-b8dd4f282b521f881f33841a9e3bb101f933c349.tar.gz netsurf-b8dd4f282b521f881f33841a9e3bb101f933c349.tar.bz2 |
Bring hotlist icon event handling in line with other toolbar actions.
- Make hotlist icon return click events to clients.
- Move URL add and remove code into browser window toolbar event handler.
- Pass hotlist icon URL add/remove via RISC OS hotlist interface.
Diffstat (limited to 'riscos/gui')
-rw-r--r-- | riscos/gui/url_bar.c | 40 | ||||
-rw-r--r-- | riscos/gui/url_bar.h | 2 |
2 files changed, 13 insertions, 29 deletions
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c index 1bc426166..e51795734 100644 --- a/riscos/gui/url_bar.c +++ b/riscos/gui/url_bar.c @@ -760,40 +760,22 @@ bool ro_gui_url_bar_click(struct url_bar *url_bar, pos.y > url_bar->extent.y1) return false; - /* If we have a click over the hotlist icon, hotlist add/remove. */ + /* If we have a Select or Adjust click, check if it originated on the + * hotlist icon; if it did, return an event. + */ - if (pointer->buttons == wimp_SINGLE_SELECT && - url_bar->text_buffer != NULL) { + if (pointer->buttons == wimp_SINGLE_SELECT || + pointer->buttons == wimp_SINGLE_ADJUST) { if (pos.x >= url_bar->hotlist.extent.x0 && pos.x <= url_bar->hotlist.extent.x1 && pos.y >= url_bar->hotlist.extent.y0 && pos.y <= url_bar->hotlist.extent.y1) { - nsurl *n; - bool redraw = false; - if (nsurl_create((const char *)url_bar->text_buffer, - &n) == NSERROR_OK) { - if (url_bar->hotlist.add) { - if (hotlist_add_url(n) == NSERROR_OK) { - redraw = true; - url_bar->hotlist.add = false; - } - } else { - /* TODO: Open "Remove page from - * Hotlist?" query dialogue box, - * rather than silent removal. */ - hotlist_remove_url(n); - redraw = true; - url_bar->hotlist.add = true; - } - nsurl_unref(n); - - if (redraw && !url_bar->hidden) - xwimp_force_redraw(url_bar->window, - url_bar->hotlist.extent.x0, - url_bar->hotlist.extent.y0, - url_bar->hotlist.extent.x1, - url_bar->hotlist.extent.y1); - } + if (pointer->buttons == wimp_SINGLE_SELECT && + action != NULL) + *action = TOOLBAR_URL_SELECT_HOTLIST; + else if (pointer->buttons == wimp_SINGLE_ADJUST && + action != NULL) + *action = TOOLBAR_URL_ADJUST_HOTLIST; return true; } } diff --git a/riscos/gui/url_bar.h b/riscos/gui/url_bar.h index 04a8468ba..c20dbf943 100644 --- a/riscos/gui/url_bar.h +++ b/riscos/gui/url_bar.h @@ -34,6 +34,8 @@ typedef enum { TOOLBAR_URL_NONE = 0, /* Special case: no action */ TOOLBAR_URL_DRAG_URL, TOOLBAR_URL_DRAG_FAVICON, + TOOLBAR_URL_SELECT_HOTLIST, + TOOLBAR_URL_ADJUST_HOTLIST } url_bar_action; struct url_bar; |