stop SDL frontend consuming all available CPU when idel

svn path=/trunk/netsurf/; revision=6448
This commit is contained in:
Vincent Sanders 2009-02-11 22:36:07 +00:00
parent cbf07e1bc3
commit 53f5a9ab4d
4 changed files with 11 additions and 8 deletions

View File

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

View File

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

View File

@ -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:

View File

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