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