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/windows/window.c | |
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/windows/window.c')
-rw-r--r-- | frontends/windows/window.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/frontends/windows/window.c b/frontends/windows/window.c index e1254d8f2..05d7a54d9 100644 --- a/frontends/windows/window.c +++ b/frontends/windows/window.c @@ -1694,6 +1694,39 @@ static void win32_window_stop_throbber(struct gui_window *w) /** + * process miscellaneous window events + * + * \param gw The window receiving the event. + * \param event The event code. + * \return NSERROR_OK when processed ok + */ +static nserror +win32_window_event(struct gui_window *gw, enum gui_window_event event) +{ + switch (event) { + case GW_EVENT_UPDATE_EXTENT: + win32_window_update_extent(gw); + break; + + case GW_EVENT_REMOVE_CARET: + win32_window_remove_caret(gw); + break; + + case GW_EVENT_START_THROBBER: + win32_window_start_throbber(gw); + break; + + case GW_EVENT_STOP_THROBBER: + win32_window_stop_throbber(gw); + break; + + default: + break; + } + return NSERROR_OK; +} + +/** * win32 frontend browser window handling operation table */ static struct gui_window_table window_table = { @@ -1703,16 +1736,13 @@ static struct gui_window_table window_table = { .get_scroll = win32_window_get_scroll, .set_scroll = win32_window_set_scroll, .get_dimensions = win32_window_get_dimensions, - .update_extent = win32_window_update_extent, + .event = win32_window_event, .set_title = win32_window_set_title, .set_url = win32_window_set_url, .set_status = win32_window_set_status, .set_pointer = win32_window_set_pointer, .place_caret = win32_window_place_caret, - .remove_caret = win32_window_remove_caret, - .start_throbber = win32_window_start_throbber, - .stop_throbber = win32_window_stop_throbber, }; struct gui_window_table *win32_window_table = &window_table; |