diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-08-20 00:16:52 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-08-20 00:16:52 +0100 |
commit | 4dc4d8b318c9bee25ca9b2982495b2906cc76287 (patch) | |
tree | ce55d6902a33a0e00c388a65a450e05d19dd4d2c /frontends/monkey | |
parent | c0e27bd0da9c6804c788473b891bff6c0c98af66 (diff) | |
download | netsurf-4dc4d8b318c9bee25ca9b2982495b2906cc76287.tar.gz netsurf-4dc4d8b318c9bee25ca9b2982495b2906cc76287.tar.bz2 |
add miscellaneous event to browser window callback table
extend the browser window callback table with a miscallaneous event
entry. This is used to replace all browser window callbacks which
take no parameters.
This reduces the API surface from seven separate calls to a single
call with an enumeration which may be readily extended.
The initial implementation in the frontends simply calls the original
implementations to reduce scope for errors.
Diffstat (limited to 'frontends/monkey')
-rw-r--r-- | frontends/monkey/browser.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c index b6919940b..26ae09028 100644 --- a/frontends/monkey/browser.c +++ b/frontends/monkey/browser.c @@ -683,6 +683,47 @@ monkey_window_handle_command(int argc, char **argv) } +/** + * process miscellaneous window events + * + * \param gw The window receiving the event. + * \param event The event code. + * \return NSERROR_OK when processed ok + */ +static nserror +gui_window_event(struct gui_window *gw, enum gui_window_event event) +{ + switch (event) { + case GW_EVENT_UPDATE_EXTENT: + gui_window_update_extent(gw); + break; + + case GW_EVENT_REMOVE_CARET: + gui_window_remove_caret(gw); + break; + + case GW_EVENT_SCROLL_START: + gui_window_scroll_start(gw); + break; + + case GW_EVENT_NEW_CONTENT: + gui_window_new_content(gw); + break; + + case GW_EVENT_START_THROBBER: + gui_window_start_throbber(gw); + break; + + case GW_EVENT_STOP_THROBBER: + gui_window_stop_throbber(gw); + break; + + default: + break; + } + return NSERROR_OK; +} + static struct gui_window_table window_table = { .create = gui_window_create, .destroy = gui_window_destroy, @@ -690,7 +731,7 @@ static struct gui_window_table window_table = { .get_scroll = gui_window_get_scroll, .set_scroll = gui_window_set_scroll, .get_dimensions = gui_window_get_dimensions, - .update_extent = gui_window_update_extent, + .event = gui_window_event, .set_title = gui_window_set_title, .set_url = gui_window_set_url, @@ -698,13 +739,8 @@ static struct gui_window_table window_table = { .set_status = gui_window_set_status, .set_pointer = gui_window_set_pointer, .place_caret = gui_window_place_caret, - .remove_caret = gui_window_remove_caret, .drag_start = gui_window_drag_start, .save_link = gui_window_save_link, - .scroll_start = gui_window_scroll_start, - .new_content = gui_window_new_content, - .start_throbber = gui_window_start_throbber, - .stop_throbber = gui_window_stop_throbber, .console_log = gui_window_console_log, }; |