From b212e59a20f304132e8c6636771d250ac7998ad3 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Thu, 6 Nov 2003 19:41:41 +0000 Subject: [project @ 2003-11-06 19:41:41 by bursa] Mask null polls and use PollIdle when appropriate. svn path=/import/netsurf/; revision=406 --- desktop/netsurf.c | 55 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'desktop/netsurf.c') diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 0392d986a..ebc364612 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -6,6 +6,8 @@ * Copyright 2003 James Bursa */ +#include +#include #include "netsurf/desktop/options.h" #include "netsurf/desktop/netsurf.h" #include "netsurf/desktop/browser.h" @@ -13,21 +15,35 @@ #include "netsurf/content/cache.h" #include "netsurf/content/fetch.h" #include "netsurf/utils/log.h" -#include -int netsurf_quit = 0; +bool netsurf_quit = false; static void netsurf_init(int argc, char** argv); +static void netsurf_poll(void); static void netsurf_exit(void); -void netsurf_poll(void) +/** + * Gui NetSurf main(). + */ + +int main(int argc, char** argv) { - gui_poll(); - fetch_poll(); + netsurf_init(argc, argv); + + while (!netsurf_quit) + netsurf_poll(); + + netsurf_exit(); + + return EXIT_SUCCESS; } +/** + * Initialise components used by gui NetSurf. + */ + void netsurf_init(int argc, char** argv) { stdout = stderr; @@ -41,24 +57,23 @@ void netsurf_init(int argc, char** argv) } -void netsurf_exit(void) -{ - cache_quit(); - fetch_quit(); -} - +/** + * Poll components which require it. + */ -int main(int argc, char** argv) +void netsurf_poll(void) { - netsurf_init(argc, argv); + gui_poll(fetch_active); + fetch_poll(); +} - while (netsurf_quit == 0) - netsurf_poll(); - LOG(("Netsurf quit!")); - netsurf_exit(); +/** + * Clean up components used by gui NetSurf. + */ - return 0; +void netsurf_exit(void) +{ + cache_quit(); + fetch_quit(); } - - -- cgit v1.2.3