From b1029506505320859c57d056011003b71053b600 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 19 Apr 2017 16:33:31 +0100 Subject: update atari frontend for invalidate window API change --- frontends/atari/gui.c | 52 ++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c index 1287b4715..ad568b761 100644 --- a/frontends/atari/gui.c +++ b/frontends/atari/gui.c @@ -385,34 +385,41 @@ static void atari_window_reformat(struct gui_window *gw) } } -static void gui_window_redraw_window(struct gui_window *gw) -{ - //CMP_BROWSER b; - GRECT rect; - if (gw == NULL) - return; - //b = gw->browser; - window_get_grect(gw->root, BROWSER_AREA_CONTENT, &rect); - window_schedule_redraw_grect(gw->root, &rect); -} -static void gui_window_update_box(struct gui_window *gw, const struct rect *rect) +/** + * Invalidates an area of an atari 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 +atari_window_invalidate_area(struct gui_window *gw, + const struct rect *rect) { GRECT area; - struct gemtk_wm_scroll_info_s *slid; - if (gw == NULL) - return; - - slid = gemtk_wm_get_scroll_info(gw->root->win); + if (gw == NULL) { + return NSERROR_BAD_PARAMETER; + } window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area); - area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px); - area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px); - area.g_w = rect->x1 - rect->x0; - area.g_h = rect->y1 - rect->y0; + + if (rect != NULL) { + struct gemtk_wm_scroll_info_s *slid; + + slid = gemtk_wm_get_scroll_info(gw->root->win); + + area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px); + area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px); + area.g_w = rect->x1 - rect->x0; + area.g_h = rect->y1 - rect->y0; + } + //dbg_grect("update box", &area); window_schedule_redraw_grect(gw->root, &area); + + return NSERROR_OK; } bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy) @@ -680,7 +687,7 @@ static void gui_window_new_content(struct gui_window *w) slid->x_pos = 0; slid->y_pos = 0; gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER); - gui_window_redraw_window(w); + atari_window_invalidate_area(w, NULL); } @@ -1051,8 +1058,7 @@ static void gui_init(int argc, char** argv) static struct gui_window_table atari_window_table = { .create = gui_window_create, .destroy = gui_window_destroy, - .redraw = gui_window_redraw_window, - .update = gui_window_update_box, + .invalidate = atari_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