diff options
author | Vincent Sanders <vince@kyllikki.org> | 2017-04-26 22:28:41 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2017-04-26 22:28:41 +0100 |
commit | 87ed0904e0dd1fec1b204f64db760aa65fad2cd6 (patch) | |
tree | 1bd62daa3a4c4ca40d9af3057765b567e6e32745 /frontends/atari/gui.c | |
parent | 7bbf2a9ca0cd418f64b001b87f77c779433119fe (diff) | |
parent | 5fba1fb94d875a849d3c9092943406b7cab4d27a (diff) | |
download | netsurf-87ed0904e0dd1fec1b204f64db760aa65fad2cd6.tar.gz netsurf-87ed0904e0dd1fec1b204f64db760aa65fad2cd6.tar.bz2 |
Merge branch 'vince/scroll-api'
Diffstat (limited to 'frontends/atari/gui.c')
-rw-r--r-- | frontends/atari/gui.c | 29 |
1 files 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; } /** |