From 6177e2930bb3c74908daa52a16a2b7c830108d0c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 23 Apr 2017 20:29:22 +0100 Subject: Update monkey frontend to use invalidate window area API --- frontends/monkey/browser.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c index 3bf0dd036..7cd3d077b 100644 --- a/frontends/monkey/browser.c +++ b/frontends/monkey/browser.c @@ -118,12 +118,6 @@ gui_window_set_title(struct gui_window *g, const char *title) fprintf(stdout, "WINDOW TITLE WIN %u STR %s\n", g->win_num, title); } -static void -gui_window_redraw_window(struct gui_window *g) -{ - fprintf(stdout, "WINDOW REDRAW WIN %u\n", g->win_num); -} - static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, bool scaled) @@ -166,13 +160,28 @@ gui_window_set_scroll(struct gui_window *g, int sx, int sy) fprintf(stdout, "WINDOW SET_SCROLL WIN %u X %d Y %d\n", g->win_num, sx, sy); } -static void -gui_window_update_box(struct gui_window *g, const struct rect *rect) +/** + * Invalidates an area of a monkey browser window + * + * \param gw gui_window + * \param rect area to redraw or NULL for the entire window area + * \return NSERROR_OK on success or appropriate error code + */ +static nserror +monkey_window_invalidate_area(struct gui_window *gw, const struct rect *rect) { - fprintf(stdout, "WINDOW UPDATE_BOX WIN %u X %d Y %d WIDTH %d HEIGHT %d\n", - g->win_num, rect->x0, rect->y0, - (rect->x1 - rect->x0), (rect->y1 - rect->y0)); - + fprintf(stdout, "WINDOW INVALIDATE_AREA WIN %u", gw->win_num); + + if (rect != NULL) { + fprintf(stdout, + " X %d Y %d WIDTH %d HEIGHT %d\n", + rect->x0, rect->y0, + (rect->x1 - rect->x0), (rect->y1 - rect->y0)); + } else { + fprintf(stdout," ALL\n"); + } + + return NSERROR_OK; } static void @@ -501,8 +510,7 @@ monkey_window_handle_command(int argc, char **argv) static struct gui_window_table window_table = { .create = gui_window_create, .destroy = gui_window_destroy, - .redraw = gui_window_redraw_window, - .update = gui_window_update_box, + .invalidate = monkey_window_invalidate_area, .get_scroll = gui_window_get_scroll, .set_scroll = gui_window_set_scroll, .get_dimensions = gui_window_get_dimensions, -- cgit v1.2.3