diff options
author | James Bursa <james@netsurf-browser.org> | 2003-11-06 19:41:41 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2003-11-06 19:41:41 +0000 |
commit | b212e59a20f304132e8c6636771d250ac7998ad3 (patch) | |
tree | 41ae6f084229ac7a517b81dbe6a3f2e3f3ea6137 /desktop | |
parent | 33759f1e7b56b9ec682f3b82c878818018e652c8 (diff) | |
download | netsurf-b212e59a20f304132e8c6636771d250ac7998ad3.tar.gz netsurf-b212e59a20f304132e8c6636771d250ac7998ad3.tar.bz2 |
[project @ 2003-11-06 19:41:41 by bursa]
Mask null polls and use PollIdle when appropriate.
svn path=/import/netsurf/; revision=406
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/gui.h | 3 | ||||
-rw-r--r-- | desktop/netsurf.c | 55 | ||||
-rw-r--r-- | desktop/netsurf.h | 4 |
3 files changed, 39 insertions, 23 deletions
diff --git a/desktop/gui.h b/desktop/gui.h index bb52979c2..aa87b6681 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -15,6 +15,7 @@ typedef enum { SAFE, UNSAFE } gui_safety; struct gui_window; typedef struct gui_window gui_window; +#include <stdbool.h> #include "netsurf/desktop/browser.h" struct gui_message @@ -51,7 +52,7 @@ void gui_download_window_error(gui_window *g, const char *error); void gui_init(int argc, char** argv); void gui_multitask(void); -void gui_poll(void); +void gui_poll(bool active); gui_safety gui_window_set_redraw_safety(gui_window* g, gui_safety s); 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 <bursa@users.sourceforge.net> */ +#include <stdbool.h> +#include <stdlib.h> #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 <stdlib.h> -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(); } - - diff --git a/desktop/netsurf.h b/desktop/netsurf.h index 67329e164..aa3bf8b54 100644 --- a/desktop/netsurf.h +++ b/desktop/netsurf.h @@ -8,9 +8,9 @@ #ifndef _NETSURF_DESKTOP_NETSURF_H_ #define _NETSURF_DESKTOP_NETSURF_H_ -extern int netsurf_quit; +#include <stdbool.h> -void netsurf_poll(void); +extern bool netsurf_quit; #endif |