mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 05:27:00 +03:00
stop SDL frontend consuming all available CPU when idel
svn path=/trunk/netsurf/; revision=6448
This commit is contained in:
parent
cbf07e1bc3
commit
53f5a9ab4d
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user