From 14bff8d023891ad6cd02e5986dae4368dfdef80b Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 19 Apr 2017 16:23:08 +0100 Subject: replace redraw and update methods with invalidate in window table API --- desktop/browser.c | 6 +++--- desktop/gui_factory.c | 5 +---- include/netsurf/window.h | 36 ++++++++++++++++++++++-------------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/desktop/browser.c b/desktop/browser.c index 0a4afc19b..45f300697 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -2332,7 +2332,7 @@ void browser_window_update(struct browser_window *bw, bool scroll_to_top) } } - guit->window->redraw(bw->window); + guit->window->invalidate(bw->window, NULL); break; @@ -2398,7 +2398,7 @@ void browser_window_update_box(struct browser_window *bw, struct rect *rect) if (bw->window != NULL) { /* Front end window */ - guit->window->update(bw->window, rect); + guit->window->invalidate(bw->window, rect); } else { /* Core managed browser window */ browser_window_get_position(bw, true, &pos_x, &pos_y); @@ -2410,7 +2410,7 @@ void browser_window_update_box(struct browser_window *bw, struct rect *rect) rect->x1 += pos_x / bw->scale; rect->y1 += pos_y / bw->scale; - guit->window->update(top->window, rect); + guit->window->invalidate(top->window, rect); } } diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c index 88bb9baf5..e1de21ea1 100644 --- a/desktop/gui_factory.c +++ b/desktop/gui_factory.c @@ -161,10 +161,7 @@ static nserror verify_window_register(struct gui_window_table *gwt) if (gwt->destroy == NULL) { return NSERROR_BAD_PARAMETER; } - if (gwt->redraw == NULL) { - return NSERROR_BAD_PARAMETER; - } - if (gwt->update == NULL) { + if (gwt->invalidate == NULL) { return NSERROR_BAD_PARAMETER; } if (gwt->get_scroll == NULL) { diff --git a/include/netsurf/window.h b/include/netsurf/window.h index b88736807..434a79584 100644 --- a/include/netsurf/window.h +++ b/include/netsurf/window.h @@ -98,21 +98,23 @@ struct gui_window_table { void (*destroy)(struct gui_window *gw); /** - * Force a redraw of the entire contents of a window. + * Invalidate an area of a window. * - * @todo this API should be merged with update. + * The specified area of the window should now be considered + * out of date. If the area is NULL the entire window must be + * invalidated. It is expected that the windowing system will + * then subsequently cause redraw/expose operations as + * necessary. * - * \param g gui_window to redraw - */ - void (*redraw)(struct gui_window *g); - - /** - * Redraw an area of a window. + * \note the frontend should not attempt to actually start the + * redraw operations as a result of this callback because the + * core redraw functions may already be threaded. * * \param g gui_window - * \param rect area to redraw + * \param rect area to redraw or NULL for the entire window area + * \return NSERROR_OK on success or appropriate error code */ - void (*update)(struct gui_window *g, const struct rect *rect); + nserror (*invalidate)(struct gui_window *g, const struct rect *rect); /** * Get the scroll position of a browser window. @@ -289,7 +291,7 @@ struct gui_window_table { /** * Called when the gui_window has new content. * - * \param g the gui_window that has new content + * \param g the gui_window that has new content */ void (*new_content)(struct gui_window *g); @@ -303,13 +305,19 @@ struct gui_window_table { */ void (*file_gadget_open)(struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget); - /** object dragged to window*/ + /** + * object dragged to window + */ void (*drag_save_object)(struct gui_window *g, struct hlcache_handle *c, gui_save_type type); - /** drag selection save */ + /** + * drag selection save + */ void (*drag_save_selection)(struct gui_window *g, const char *selection); - /** selection started */ + /** + * selection started + */ void (*start_selection)(struct gui_window *g); }; -- cgit v1.2.3