fix pending redraw discovery

svn path=/trunk/netsurf/; revision=10515
This commit is contained in:
Vincent Sanders 2010-04-28 23:29:12 +00:00
parent 2fd1476f8c
commit 0d3601a7ce
4 changed files with 21 additions and 10 deletions

View File

@ -154,20 +154,20 @@ get_root_widget(fbtk_widget_t *widget)
void
fbtk_request_redraw(fbtk_widget_t *widget)
{
widget->redraw_required = 1;
widget->redraw_required = true;
if (widget->type == FB_WIDGET_TYPE_WINDOW) {
fbtk_widget_list_t *lent = widget->u.window.widgets;
while (lent != NULL) {
lent->widget->redraw_required = 1;
lent->widget->redraw_required = true;
lent = lent->next;
}
}
while (widget->parent != NULL) {
widget = widget->parent;
widget->redraw_required = 1;
widget->redraw_required = true;
}
}
@ -760,6 +760,17 @@ fbtk_move_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
}
bool
fbtk_redraw_pending(fbtk_widget_t *widget)
{
fbtk_widget_t *root;
/* ensure we have the root widget */
root = get_root_widget(widget);
return root->redraw_required;
}
int
fbtk_redraw(fbtk_widget_t *widget)
{

View File

@ -241,6 +241,8 @@ void fbtk_request_redraw(fbtk_widget_t *widget);
*/
int fbtk_redraw(fbtk_widget_t *widget);
bool fbtk_redraw_pending(fbtk_widget_t *widget);
int fbtk_count_children(fbtk_widget_t *widget);
bool fbtk_get_bbox(fbtk_widget_t *widget, struct nsfb_bbox_s *bbox);

View File

@ -69,8 +69,6 @@ struct gui_window *input_window = NULL;
struct gui_window *search_current_window;
struct gui_window *window_list = NULL;
bool redraws_pending = false;
/* private data for browser user widget */
struct browser_widget_s {
struct browser_window *bw; /**< The browser window connected to this gui window */
@ -472,7 +470,7 @@ void gui_multitask(void)
void gui_poll(bool active)
{
nsfb_event_t event;
int timeout;
int timeout; /* timeout in miliseconds */
/* run the scheduler and discover how long to wait for the next event */
timeout = schedule_run();
@ -482,7 +480,7 @@ void gui_poll(bool active)
timeout = 0;
/* if redraws are pending do not wait for event, return immediately */
if (redraws_pending)
if (fbtk_redraw_pending(fbtk))
timeout = 0;
if (fbtk_event(fbtk, &event, timeout)) {

View File

@ -191,9 +191,9 @@ schedule_run(void)
/* make rettime relative to now */
timersub(&nexttime, &tv, &rettime);
LOG(("returning time to next event as %ldcs",(rettime.tv_sec * 100) + (rettime.tv_usec / 10000)));
/* return next event time in cs */
return (rettime.tv_sec * 100) + (rettime.tv_usec / 10000);
/*LOG(("returning time to next event as %ldms",(rettime.tv_sec * 1000) + (rettime.tv_usec / 1000))); */
/* return next event time in milliseconds (24days max wait) */
return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
}
void list_schedule(void)