From 34fdedba787550a0ae12b573ad5acc1ecb3702e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 13 Oct 2014 01:15:44 +0200 Subject: [PATCH] remove use of deprecated netsurf_quit variable in beos The core no longer needs to run the event polling loop as fetches are now scheduler driven. This is part of a series which will ultimately remove netsurf_poll callback altogether. --- beos/gui.cpp | 10 +++++++--- beos/gui.h | 3 +++ beos/scaffolding.cpp | 9 ++++++--- beos/window.cpp | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/beos/gui.cpp b/beos/gui.cpp index cb7effead..695ab8d21 100644 --- a/beos/gui.cpp +++ b/beos/gui.cpp @@ -84,6 +84,8 @@ static void *myrealloc(void *ptr, size_t len, void *pw); // enable using resources instead of files #define USE_RESOURCES 1 +bool nsbeos_done = false; + bool replicated = false; /**< if we are running as a replicant */ char *options_file_location; @@ -713,7 +715,7 @@ void nsbeos_pipe_message_top(BMessage *message, BWindow *_this, struct beos_scaf } -static void gui_poll(bool active) +void nsbeos_gui_poll(void) { fd_set read_fd_set, write_fd_set, exc_fd_set; int max_fd; @@ -978,7 +980,7 @@ static struct gui_fetch_table beos_fetch_table = { }; static struct gui_browser_table beos_browser_table = { - gui_poll, + NULL, //nsbeos_gui_poll, beos_schedule, gui_quit, gui_launch_url, @@ -1038,7 +1040,9 @@ int main(int argc, char** argv) gui_init(argc, argv); - netsurf_main_loop(); + while (!nsbeos_done) { + nsbeos_gui_poll(); + } netsurf_exit(); diff --git a/beos/gui.h b/beos/gui.h index 642441fdd..6689bd81a 100644 --- a/beos/gui.h +++ b/beos/gui.h @@ -29,12 +29,15 @@ #define CALLED() fprintf(stderr, "%s()\n", __FUNCTION__); +extern bool nsbeos_done; + extern bool replicated; int gui_init_replicant(int argc, char** argv); extern "C" void gui_401login_open(nsurl *url, const char *realm, nserror (*cb)(bool proceed, void *pw), void *cbpw); +extern "C" void nsbeos_gui_poll(void); extern char *options_file_location; diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp index 45815fa1a..7a00c02a9 100644 --- a/beos/scaffolding.cpp +++ b/beos/scaffolding.cpp @@ -754,7 +754,10 @@ int32 nsbeos_replicant_main_thread(void *_arg) struct replicant_thread_info *info = (struct replicant_thread_info *)_arg; int32 ret = 0; - netsurf_main_loop(); + while (!nsbeos_done) { + nsbeos_gui_poll(); + } + netsurf_exit(); delete info; delete_sem(replicant_done_sem); @@ -769,7 +772,7 @@ static void nsbeos_window_destroy_event(NSBrowserWindow *window, nsbeos_scaffold LOG(("Being Destroyed = %d", g->being_destroyed)); if (--open_windows == 0) - netsurf_quit = true; + nsbeos_done = true; if (window) { window->Lock(); @@ -1275,7 +1278,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m } break; case APPLICATION_QUIT: - netsurf_quit = true; + nsbeos_done = true; break; default: break; diff --git a/beos/window.cpp b/beos/window.cpp index c00a45f4c..3fa88ad33 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -456,7 +456,7 @@ void nsbeos_dispatch_event(BMessage *message) switch (message->what) { case B_QUIT_REQUESTED: // from the BApplication - netsurf_quit = true; + nsbeos_done = true; break; case B_ABOUT_REQUESTED: {