From 53f5a9ab4d9c54b8b73a973a4c4931685e936517 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 11 Feb 2009 22:36:07 +0000 Subject: stop SDL frontend consuming all available CPU when idel svn path=/trunk/netsurf/; revision=6448 --- framebuffer/fb_frontend.h | 2 +- framebuffer/fb_frontend_linuxfb.c | 2 +- framebuffer/fb_frontend_sdl.c | 9 ++++++--- framebuffer/fb_gui.c | 6 +++--- 4 files changed, 11 insertions(+), 8 deletions(-) (limited to 'framebuffer') diff --git a/framebuffer/fb_frontend.h b/framebuffer/fb_frontend.h index 624e3e016..773c40382 100644 --- a/framebuffer/fb_frontend.h +++ b/framebuffer/fb_frontend.h @@ -21,7 +21,7 @@ extern framebuffer_t *fb_os_init(int argc, char** argv); extern void fb_os_quit(framebuffer_t *fb); -extern void fb_os_input(struct gui_window *g); +extern void fb_os_input(struct gui_window *g, bool active); extern void fb_os_option_override(void); extern void fb_os_redraw(struct bbox_s *box); diff --git a/framebuffer/fb_frontend_linuxfb.c b/framebuffer/fb_frontend_linuxfb.c index 9d43ce237..08be46de6 100644 --- a/framebuffer/fb_frontend_linuxfb.c +++ b/framebuffer/fb_frontend_linuxfb.c @@ -591,7 +591,7 @@ void fb_os_quit(framebuffer_t *fb) fb_cleanup(); } -void fb_os_input(struct gui_window *g) +void fb_os_input(struct gui_window *g, bool active) { ssize_t amt; struct input_event event; diff --git a/framebuffer/fb_frontend_sdl.c b/framebuffer/fb_frontend_sdl.c index a953912ad..b45f371d9 100644 --- a/framebuffer/fb_frontend_sdl.c +++ b/framebuffer/fb_frontend_sdl.c @@ -58,7 +58,7 @@ framebuffer_t *fb_os_init(int argc, char** argv) newfb->width = 800; newfb->height = 600; - newfb->bpp = 16; + newfb->bpp = 32; sdl_screen = SDL_SetVideoMode(newfb->width, newfb->height, @@ -84,11 +84,14 @@ void fb_os_quit(framebuffer_t *fb) { } -void fb_os_input(struct gui_window *g) +void fb_os_input(struct gui_window *g, bool active) { SDL_Event event; - SDL_PollEvent(&event);//SDL_WaitEvent(&event); + if (active) + SDL_PollEvent(&event); + else + SDL_WaitEvent(&event); switch (event.type) { case SDL_KEYDOWN: diff --git a/framebuffer/fb_gui.c b/framebuffer/fb_gui.c index b769ece06..07a615251 100644 --- a/framebuffer/fb_gui.c +++ b/framebuffer/fb_gui.c @@ -208,11 +208,11 @@ void gui_poll(bool active) // LOG(("enter fetch_poll")); if (active) fetch_poll(); + //LOG(("enter schedule run")); - schedule_run(); + active = schedule_run() | active; - - fb_os_input(input_window); + fb_os_input(input_window, active); if (redraws_pending == true) { struct gui_window *g; -- cgit v1.2.3