replace redraw and update methods with invalidate in window table API

This commit is contained in:
Vincent Sanders 2017-04-19 16:23:08 +01:00
parent 7e0ed132f7
commit 14bff8d023
3 changed files with 26 additions and 21 deletions

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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);
};