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 ++++++---------- src/Fl_Pack.cxx | 11 +++++++++-- src/Fl_win32.cxx | 8 +++----- 3 files changed, 18 insertions(+), 17 deletions(-) (limited to 'src') 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 $". // diff --git a/src/Fl_Pack.cxx b/src/Fl_Pack.cxx index d3818c10c..dac8e4501 100644 --- a/src/Fl_Pack.cxx +++ b/src/Fl_Pack.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Pack.cxx,v 1.6.2.2 2000/06/05 21:20:55 mike Exp $" +// "$Id: Fl_Pack.cxx,v 1.6.2.3 2000/06/20 05:47:37 bill Exp $" // // Packing widget for the Fast Light Tool Kit (FLTK). // @@ -63,6 +63,13 @@ void Fl_Pack::draw() { Y = current_position; H = o->h(); } + // Last child, if resizable, takes all remaining room + if(i == 0 && o == this->resizable()) { + if(horizontal()) + W = this->w() - Fl::box_dw(box()) - maximum_position; + else + H = this->h() - Fl::box_dh(box()) - maximum_position; + } if (spacing_ && current_position>maximum_position && (X != o->x() || Y != o->y() || d&FL_DAMAGE_ALL)) { fl_color(color()); @@ -105,5 +112,5 @@ void Fl_Pack::draw() { } // -// End of "$Id: Fl_Pack.cxx,v 1.6.2.2 2000/06/05 21:20:55 mike Exp $". +// End of "$Id: Fl_Pack.cxx,v 1.6.2.3 2000/06/20 05:47:37 bill Exp $". // diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 982044ab3..1f5eeb90b 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_win32.cxx,v 1.33.2.27 2000/06/18 00:38:40 bill Exp $" +// "$Id: Fl_win32.cxx,v 1.33.2.28 2000/06/20 05:47:38 bill Exp $" // // WIN32-specific code for the Fast Light Tool Kit (FLTK). // @@ -151,8 +151,6 @@ void Fl::remove_fd(int n) { MSG fl_msg; -#define FOREVER 1e20 - // This is never called with time_to_wait < 0.0. // It *should* return negative on error, 0 if nothing happens before // timeout, and >0 if any callbacks were done. This version only @@ -233,7 +231,7 @@ int fl_wait(double time_to_wait) { int fl_ready() { if (PeekMessage(&fl_msg, NULL, 0, 0, PM_NOREMOVE)) return 1; #ifdef USE_ASYNC_SELECT - return (0); + return 0; #else timeval t; t.tv_sec = 0; @@ -953,5 +951,5 @@ void Fl_Window::make_current() { } // -// End of "$Id: Fl_win32.cxx,v 1.33.2.27 2000/06/18 00:38:40 bill Exp $". +// End of "$Id: Fl_win32.cxx,v 1.33.2.28 2000/06/20 05:47:38 bill Exp $". // -- cgit v1.2.3