From f7e4caec2575619b6578b866bb59630bb513049c Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Tue, 20 Jun 2000 05:47:38 +0000 Subject: Whoops, I screwed up the timeout callbacks a bit. add_timeout will now do the callback at time t after the call to add_timeout, like before. add_interval_timeout is a new call that measures time from when the last timeout was called. This has slightly less overhead and allows accurate spacing of timeouts. Patch from Stuart Levy so the *last* widget in an Fl_Pack may be resizable. This should be compatable because resizable didn't do anything before so there was no reason to set it. Makefiles for no-cygwin from Paul Baxter (see README.win32 for info). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1222 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/Fl.cxx') diff --git a/src/Fl.cxx b/src/Fl.cxx index d67235e9f..c8584707e 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl.cxx,v 1.24.2.27 2000/06/18 00:38:39 bill Exp $" +// "$Id: Fl.cxx,v 1.24.2.28 2000/06/20 05:47:36 bill Exp $" // // Main event handling code for the Fast Light Tool Kit (FLTK). // @@ -132,7 +132,6 @@ static void elapse_timeouts() { } static char in_idle; -static char in_timeout; double Fl::wait(double time_to_wait) { if (numtimeouts) { @@ -148,9 +147,7 @@ double Fl::wait(double time_to_wait) { if (numtimeouts) memmove(timeout, timeout+1, numtimeouts*sizeof(Timeout)); // Now it is safe for the callback to do add_timeout: - in_timeout = 1; cb(arg); - in_timeout = 0; } } else { reset_clock = 1; // we are not going to check the clock @@ -200,12 +197,11 @@ int Fl::ready() { } void Fl::add_timeout(double t, Fl_Timeout_Handler cb, void *v) { + elapse_timeouts(); + add_interval_timeout(t, cb, v); +} - // This little test gets rid of about half the calls to get the time - // and has the added advantage of making timeouts that think they - // are happening at regular intervals actually happen at regular - // intervals: - if (!in_timeout) elapse_timeouts(); +void Fl::add_interval_timeout(double t, Fl_Timeout_Handler cb, void *v) { if (numtimeouts >= timeout_array_size) { timeout_array_size = 2*timeout_array_size+1; @@ -733,5 +729,5 @@ void Fl_Window::flush() { } // -// End of "$Id: Fl.cxx,v 1.24.2.27 2000/06/18 00:38:39 bill Exp $". +// End of "$Id: Fl.cxx,v 1.24.2.28 2000/06/20 05:47:36 bill Exp $". // -- cgit v1.2.3