From db549331f7523fbbfe0460b8adb540838f582cec Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 26 Apr 2017 22:23:27 +0100 Subject: [PATCH] Update atari frontend for set_scroll API change --- frontends/atari/gui.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c index cdea953b2..4876d3106 100644 --- a/frontends/atari/gui.c +++ b/frontends/atari/gui.c @@ -424,17 +424,30 @@ bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy) return( true ); } -static void gui_window_set_scroll(struct gui_window *w, int sx, int sy) +/** + * Set the scroll position of a atari browser window. + * + * Scrolls the viewport to ensure the specified rectangle of the + * content is shown. The atari 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) { - if ( (w == NULL) - || (w->browser->bw == NULL) - || (!browser_window_has_content(w->browser->bw))) - return; + if ((gw == NULL) || + (gw->browser->bw == NULL) || + (!browser_window_has_content(gw->browser->bw))) { + return NSERROR_BAD_PARAMETER; + } - LOG("scroll (gui_window: %p) %d, %d\n", w, sx, sy); - window_scroll_by(w->root, sx, sy); - return; + LOG("scroll (gui_window: %p) %d, %d\n", gw, rect->x0, rect->y0); + window_scroll_by(gw->root, rect->x0, rect->y0); + return NSERROR_OK; } /**