diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2019-08-03 15:52:42 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2019-08-03 15:57:23 +0100 |
commit | 3938d5340b4d44dfe9c7839d1dc2bd790607f8ff (patch) | |
tree | 9d534645860dea8134a24d5cebb9338bc24fafb6 /include/netsurf/core_window.h | |
parent | 8cff4b79d602b4437a81f3e008f22caf276d102a (diff) | |
download | netsurf-3938d5340b4d44dfe9c7839d1dc2bd790607f8ff.tar.gz netsurf-3938d5340b4d44dfe9c7839d1dc2bd790607f8ff.tar.bz2 |
Corewindow: Sanitise scrolling API.
Now the core has a helper so that all the front ends don't need
to implement the scroll to show area API.
Now they simply have get and set scroll APIs.
Diffstat (limited to 'include/netsurf/core_window.h')
-rw-r--r-- | include/netsurf/core_window.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/include/netsurf/core_window.h b/include/netsurf/core_window.h index 77d220b9c..7eabda1d1 100644 --- a/include/netsurf/core_window.h +++ b/include/netsurf/core_window.h @@ -74,16 +74,33 @@ struct core_window_callback_table { * \param[in] cw the core window object * \param[in] width the width in px, or negative if don't care * \param[in] height the height in px, or negative if don't care + * \return NSERROR_OK on success or appropriate error code */ - void (*update_size)(struct core_window *cw, int width, int height); + nserror (*update_size)(struct core_window *cw, int width, int height); /** - * Scroll the window to make area visible + * Scroll the window to given scroll offsets + * + * Note: Core callers of this may want to look at calling + * the `cw_helper_scroll_visible()`, rather than calling + * this directly. * * \param[in] cw the core window object - * \param[in] r rectangle to make visible + * \param[in] x x-scroll value to set + * \param[in] y y-scroll value to set + * \return NSERROR_OK on success or appropriate error code */ - void (*scroll_visible)(struct core_window *cw, const struct rect *r); + nserror (*set_scroll)(struct core_window *cw, int x, int y); + + /** + * Get the current scroll offsets + * + * \param[in] cw the core window object + * \param[out] returns horizontal scroll in px + * \param[out] returns vertical scroll in px + * \return NSERROR_OK on success or appropriate error code + */ + nserror (*get_scroll)(struct core_window *cw, int *x, int *y); /** * Get window viewport dimensions @@ -91,8 +108,9 @@ struct core_window_callback_table { * \param[in] cw the core window object * \param[out] width to be set to viewport width in px * \param[out] height to be set to viewport height in px + * \return NSERROR_OK on success or appropriate error code */ - void (*get_window_dimensions)(struct core_window *cw, + nserror (*get_window_dimensions)(struct core_window *cw, int *width, int *height); /** @@ -100,8 +118,9 @@ struct core_window_callback_table { * * \param[in] cw the core window object * \param[in] ds the current drag status + * \return NSERROR_OK on success or appropriate error code */ - void (*drag_status)(struct core_window *cw, + nserror (*drag_status)(struct core_window *cw, core_window_drag_status ds); }; |