diff --git a/CHANGES b/CHANGES index c60dbf50b..1cd9028a9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.1.0 + - Minor changes to the MacOS X event handling code. - Added syntax highlighting example code to the editor test program. - Fl_Text_Display didn't range check style buffer diff --git a/src/Fl.cxx b/src/Fl.cxx index ae199f122..5b126c4b5 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl.cxx,v 1.24.2.41.2.37 2002/06/07 16:57:21 easysw Exp $" +// "$Id: Fl.cxx,v 1.24.2.41.2.38 2002/06/11 16:17:41 easysw Exp $" // // Main event handling code for the Fast Light Tool Kit (FLTK). // @@ -221,7 +221,7 @@ void Fl::remove_check(Fl_Timeout_Handler cb, void *arg) { void (*Fl::idle)(); // see Fl_add_idle.cxx for the add/remove functions -extern int fl_wait(double time); // in Fl_x.cxx or Fl_win32.cxx +extern int fl_wait(double time); // in Fl_.cxx static char in_idle; @@ -931,5 +931,5 @@ void Fl_Window::flush() { } // -// End of "$Id: Fl.cxx,v 1.24.2.41.2.37 2002/06/07 16:57:21 easysw Exp $". +// End of "$Id: Fl.cxx,v 1.24.2.41.2.38 2002/06/11 16:17:41 easysw Exp $". // diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 1115ff3a8..c5fea48fa 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_mac.cxx,v 1.1.2.24 2002/06/03 16:09:27 easysw Exp $" +// "$Id: Fl_mac.cxx,v 1.1.2.25 2002/06/11 16:17:41 easysw Exp $" // // MacOS specific code for the Fast Light Tool Kit (FLTK). // @@ -77,6 +77,7 @@ Fl_Window *Fl_Window::current_; EventRef fl_os_event; // last (mouse) event // forward declarations of variables in this file +static int got_events = 0; static Fl_Window* resize_from_system; static CursPtr default_cursor_ptr; static Cursor default_cursor; @@ -190,6 +191,8 @@ static pascal OSStatus carbonDispatchHandler( EventHandlerCallRef nextHandler, E fl_lock_function(); + got_event = 1; + switch ( GetEventClass( event ) ) { case kEventClassMouse: @@ -300,14 +303,14 @@ static double do_queued_events( double time = 0.0 ) ret = InstallEventLoopTimer( GetMainEventLoop(), 0, 0, NewEventLoopTimerUPP( timerProcCB ), 0, &timer ); } + got_event = 0; + + fl_unlock_function(); + if ( time > 0.0 ) { - fl_unlock_function(); - SetEventLoopTimerNextFireTime( timer, time ); RunApplicationEventLoop(); // will return after the previously set time - - fl_lock_function(); } else { @@ -318,6 +321,8 @@ static double do_queued_events( double time = 0.0 ) ReleaseEvent( breakEvent ); } + fl_lock_function(); + #if CONSOLIDATE_MOTION if (send_motion && send_motion == fl_xmousewin) { send_motion = 0; @@ -331,14 +336,15 @@ static double do_queued_events( double time = 0.0 ) /** * This public function handles all events. It wait a maximum of - * 'time' secods for an event. It returns the same time that was given - * in the argument! + * 'time' secods for an event. This version returns 1 if events + * other than the timeout timer were processed. * * \todo there is no socket handling in this code whatsoever */ -double fl_wait( double time ) +int fl_wait( double time ) { - return do_queued_events( time ); + do_queued_events( time ); + return (got_events); } @@ -1426,6 +1432,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { // -// End of "$Id: Fl_mac.cxx,v 1.1.2.24 2002/06/03 16:09:27 easysw Exp $". +// End of "$Id: Fl_mac.cxx,v 1.1.2.25 2002/06/11 16:17:41 easysw Exp $". //