summaryrefslogtreecommitdiff
path: root/frontends/framebuffer
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-04-26 22:24:29 +0100
committerVincent Sanders <vince@kyllikki.org>2017-04-26 22:24:29 +0100
commita696720cd605439be5473de209531c5113f47a97 (patch)
treebe1c77e44923c93531e914b40d656783b2776b7b /frontends/framebuffer
parentdb9b829df2a7c1676da131f5fe66f106af2ba14a (diff)
downloadnetsurf-a696720cd605439be5473de209531c5113f47a97.tar.gz
netsurf-a696720cd605439be5473de209531c5113f47a97.tar.bz2
Update framebuffer frontend for set_scroll API change
Diffstat (limited to 'frontends/framebuffer')
-rw-r--r--frontends/framebuffer/gui.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c
index 0221a8ec3..062cb5659 100644
--- a/frontends/framebuffer/gui.c
+++ b/frontends/framebuffer/gui.c
@@ -1807,7 +1807,7 @@ gui_window_destroy(struct gui_window *gw)
/**
* Invalidates an area of a framebuffer browser window
*
- * \param gw The netsurf window being invalidated.
+ * \param g The netsurf window being invalidated.
* \param rect area to redraw or NULL for the entire window area
* \return NSERROR_OK on success or appropriate error code
*/
@@ -1844,16 +1844,29 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
return true;
}
-static void
-gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
+/**
+ * Set the scroll position of a framebuffer browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The framebuffer implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param gw gui_window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
{
struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser);
float scale = browser_window_get_scale(gw->bw);
assert(bwidget);
- widget_scroll_x(gw, sx * scale, true);
- widget_scroll_y(gw, sy * scale, true);
+ widget_scroll_x(gw, rect->x0 * scale, true);
+ widget_scroll_y(gw, rect->y0 * scale, true);
+
+ return NSERROR_OK;
}
@@ -1867,16 +1880,16 @@ gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
* \return NSERROR_OK on sucess and width and height updated.
*/
static nserror
-gui_window_get_dimensions(struct gui_window *g,
+gui_window_get_dimensions(struct gui_window *gw,
int *width,
int *height,
bool scaled)
{
- *width = fbtk_get_width(g->browser);
- *height = fbtk_get_height(g->browser);
+ *width = fbtk_get_width(gw->browser);
+ *height = fbtk_get_height(gw->browser);
if (scaled) {
- float scale = browser_window_get_scale(g->bw);
+ float scale = browser_window_get_scale(gw->bw);
*width /= scale;
*height /= scale;
}