summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-04-26 22:48:00 +0100
committerVincent Sanders <vince@kyllikki.org>2017-04-26 22:48:00 +0100
commit66602e63277ad0063e7267ea8e32d75da590bceb (patch)
tree8c3f956d43f4831225177c43b3dbd25524ea05ed
parent87ed0904e0dd1fec1b204f64db760aa65fad2cd6 (diff)
downloadnetsurf-66602e63277ad0063e7267ea8e32d75da590bceb.tar.gz
netsurf-66602e63277ad0063e7267ea8e32d75da590bceb.tar.bz2
fixup errors introduced in set_scroll API change
-rw-r--r--frontends/amiga/gui.c48
-rw-r--r--frontends/beos/window.cpp16
2 files changed, 43 insertions, 21 deletions
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 18816c496..7eacda784 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -242,7 +242,7 @@ static void ami_do_redraw(struct gui_window_2 *g);
static void ami_schedule_redraw_remove(struct gui_window_2 *gwin);
static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *restrict sy);
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy);
+static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *rect);
static void gui_window_remove_caret(struct gui_window *g);
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip);
//static void amiga_window_invalidate_area(struct gui_window *g, const struct rect *restrict rect);
@@ -1494,6 +1494,7 @@ static void ami_gui_scroll_internal(struct gui_window_2 *gwin, int xs, int ys)
{
struct IBox *bbox;
int x, y;
+ struct rect rect;
if(ami_mouse_to_ns_coords(gwin, &x, &y, -1, -1) == true)
{
@@ -1560,8 +1561,9 @@ static void ami_gui_scroll_internal(struct gui_window_2 *gwin, int xs, int ys)
}
ami_gui_free_space_box(bbox);
-
- gui_window_set_scroll(gwin->gw, xs, ys);
+ rect.x0 = rect.x1 = xs;
+ rect.y0 = rect.y1 = ys;
+ gui_window_set_scroll(gwin->gw, &rect);
}
}
}
@@ -2561,12 +2563,15 @@ static BOOL ami_gui_event(void *w)
if(drag_x_move || drag_y_move)
{
+ struct rect rect;
+
gui_window_get_scroll(gwin->gw,
&gwin->gw->scrollx, &gwin->gw->scrolly);
- gui_window_set_scroll(gwin->gw,
- gwin->gw->scrollx + drag_x_move,
- gwin->gw->scrolly + drag_y_move);
+ rect.x0 = rect.x1 = gwin->gw->scrollx + drag_x_move;
+ rect.y0 = rect.y1 = gwin->gw->scrolly + drag_y_move;
+
+ gui_window_set_scroll(gwin->gw, &rect);
}
// ReplyMsg((struct Message *)message);
@@ -2921,11 +2926,15 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
if(redraw)
{
+ struct rect rect;
+
ami_plot_clear_bbox(gwin->win->RPort, bbox);
browser_window_update(gwin->gw->bw, false);
- gui_window_set_scroll(gwin->gw,
- gwin->gw->scrollx, gwin->gw->scrolly);
+ rect.x0 = rect.x1 = gwin->gw->scrollx;
+ rect.y0 = rect.y1 = gwin->gw->scrolly;
+
+ gui_window_set_scroll(gwin->gw, &rect);
gwin->redraw_scroll = false;
browser_window_refresh_url_bar(gwin->gw->bw);
@@ -4981,25 +4990,33 @@ static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *r
* \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 *g, const struct rect *rect)
+static nserror
+gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
{
struct IBox *bbox;
int width, height;
nserror res;
+ int sx = 0, sy = 0;
if(!g) {
return NSERROR_BAD_PARAMETER;
}
- if(!g->bw ||
- browser_window_has_content(g->bw) == false) return;
+ if(!g->bw || browser_window_has_content(g->bw) == false) {
+ return NSERROR_BAD_PARAMETER;
+ }
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
+ res = ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox);
+ if(res != NSERROR_OK) {
amiga_warn_user("NoMemory", "");
- return;
+ return res;
}
- if(sx < 0) sx=0;
- if(sy < 0) sy=0;
+ if (rect->x0 > 0) {
+ sx = rect->x0;
+ }
+ if (rect->y0 > 0) {
+ sy = rect->y0;
+ }
browser_window_get_extents(g->bw, false, &width, &height);
@@ -5037,6 +5054,7 @@ static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *re
g->scrollx = sx;
g->scrolly = sy;
}
+ return NSERROR_OK;
}
static void gui_window_update_extent(struct gui_window *g)
diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp
index 2121d9456..8acb20a37 100644
--- a/frontends/beos/window.cpp
+++ b/frontends/beos/window.cpp
@@ -1049,16 +1049,20 @@ static nserror
gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
{
//CALLED();
- if (g->view == NULL)
- return;
- if (!g->view->LockLooper())
- return;
+ if (g->view == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (!g->view->LockLooper()) {
+ return NSERROR_BAD_PARAMETER;
+ }
#warning XXX: report to view frame ?
- if (g->view->ScrollBar(B_HORIZONTAL))
+ if (g->view->ScrollBar(B_HORIZONTAL)) {
g->view->ScrollBar(B_HORIZONTAL)->SetValue(rect->x0);
- if (g->view->ScrollBar(B_VERTICAL))
+ }
+ if (g->view->ScrollBar(B_VERTICAL)) {
g->view->ScrollBar(B_VERTICAL)->SetValue(rect->y0);
+ }
g->view->UnlockLooper();