[project @ 2004-03-21 13:55:51 by bursa]

Implement gui_window_update_box() and use in response to CONTENT_MSG_REDRAW.

svn path=/import/netsurf/; revision=644
This commit is contained in:
James Bursa 2004-03-21 13:55:51 +00:00
parent 187ee0f98e
commit 423f0f1e70
4 changed files with 62 additions and 3 deletions

View File

@ -199,6 +199,7 @@ void browser_window_callback(content_msg msg, struct content *c,
void *p1, void *p2, const char *error)
{
struct browser_window *bw = p1;
struct box *box;
char status[40];
if (c->type == CONTENT_OTHER) {
@ -277,7 +278,16 @@ void browser_window_callback(content_msg msg, struct content *c,
break;
case CONTENT_MSG_REDRAW:
gui_window_redraw_window(bw->window);
/* error actually holds the box */
box = (struct box *) error;
if (box) {
int x, y;
box_coords(box, &x, &y);
gui_window_update_box(bw->window, x, y,
x + box->width,
y + box->height);
} else
gui_window_redraw_window(bw->window);
break;
#ifdef WITH_AUTH

View File

@ -28,6 +28,7 @@ void gui_window_hide(gui_window* g);
void gui_window_redraw(gui_window* g, unsigned long x0, unsigned long y0,
unsigned long x1, unsigned long y1);
void gui_window_redraw_window(gui_window* g);
void gui_window_update_box(gui_window *g, int x0, int y0, int x1, int y1);
void gui_window_set_scroll(gui_window* g, unsigned long sx, unsigned long sy);
unsigned long gui_window_get_width(gui_window* g);
void gui_window_set_extent(gui_window* g, unsigned long width, unsigned long height);

View File

@ -642,8 +642,7 @@ void html_object_callback(content_msg msg, struct content *object,
break;
case CONTENT_MSG_REDRAW:
/** \todo send up box coordinates */
content_broadcast(c, CONTENT_MSG_REDRAW, 0);
content_broadcast(c, CONTENT_MSG_REDRAW, box);
break;
#ifdef WITH_AUTH

View File

@ -254,6 +254,55 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
}
}
/**
* Redraw an area of a window.
*
* \param g gui_window
* \param x0 minimum x
* \param y0 minimum y
* \param x1 maximum x
* \param y1 maximum y
*/
void gui_window_update_box(gui_window *g, int x0, int y0, int x1, int y1)
{
struct content *c = g->data.browser.bw->current_content;
osbool more;
os_error *error;
wimp_draw update;
update.w = g->window;
update.box.x0 = x0 * 2;
update.box.y0 = -y1 * 2;
update.box.x1 = x1 * 2;
update.box.y1 = -y0 * 2;
error = xwimp_update_window(&update, &more);
if (error) {
LOG(("xwimp_update_window: 0x%x: %s",
error->errnum, error->errmess));
return;
}
while (more) {
content_redraw(c,
update.box.x0 - update.xscroll,
update.box.y1 - update.yscroll,
c->width * 2, c->height * 2,
update.clip.x0, update.clip.y0,
update.clip.x1 - 1, update.clip.y1 - 1,
g->scale);
error = xwimp_get_rectangle(&update, &more);
if (error) {
LOG(("xwimp_get_rectangle: 0x%x: %s",
error->errnum, error->errmess));
return;
}
}
}
void gui_window_set_scroll(gui_window* g, unsigned long sx, unsigned long sy)
{
wimp_window_state state;