mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 15:32:12 +08:00
Fix MacOS X 10.2 idle handling.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2630 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
CHANGES IN FLTK 1.1.0rc7
|
CHANGES IN FLTK 1.1.0rc7
|
||||||
|
|
||||||
|
- Fixed a problem with Fl::wait(0.0) on MacOS X 10.2;
|
||||||
|
this affected the fractals demo and other OpenGL
|
||||||
|
applications.
|
||||||
- Fl_Glut_Window now takes keyboard focus and handles
|
- Fl_Glut_Window now takes keyboard focus and handles
|
||||||
shortcut events.
|
shortcut events.
|
||||||
- The MacOS X implementation of fl_ready() now checks
|
- The MacOS X implementation of fl_ready() now checks
|
||||||
|
|||||||
+9
-3
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl.cxx,v 1.24.2.41.2.52 2002/08/23 15:09:49 easysw Exp $"
|
// "$Id: Fl.cxx,v 1.24.2.41.2.53 2002/09/20 17:56:56 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@@ -221,6 +221,7 @@ void Fl::remove_check(Fl_Timeout_Handler cb, void *argp) {
|
|||||||
|
|
||||||
void (*Fl::idle)(); // see Fl_add_idle.cxx for the add/remove functions
|
void (*Fl::idle)(); // see Fl_add_idle.cxx for the add/remove functions
|
||||||
|
|
||||||
|
extern int fl_ready(); // in Fl_<platform>.cxx
|
||||||
extern int fl_wait(double time); // in Fl_<platform>.cxx
|
extern int fl_wait(double time); // in Fl_<platform>.cxx
|
||||||
|
|
||||||
static char in_idle;
|
static char in_idle;
|
||||||
@@ -255,8 +256,13 @@ double Fl::wait(double time_to_wait) {
|
|||||||
}
|
}
|
||||||
next_check = first_check;
|
next_check = first_check;
|
||||||
}
|
}
|
||||||
|
// if (idle && !fl_ready()) {
|
||||||
if (idle) {
|
if (idle) {
|
||||||
if (!in_idle) {in_idle = 1; idle(); in_idle = 0;}
|
if (!in_idle) {
|
||||||
|
in_idle = 1;
|
||||||
|
idle();
|
||||||
|
in_idle = 0;
|
||||||
|
}
|
||||||
// the idle function may turn off idle, we can then wait:
|
// the idle function may turn off idle, we can then wait:
|
||||||
if (idle) time_to_wait = 0.0;
|
if (idle) time_to_wait = 0.0;
|
||||||
}
|
}
|
||||||
@@ -954,5 +960,5 @@ void Fl_Window::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl.cxx,v 1.24.2.41.2.52 2002/08/23 15:09:49 easysw Exp $".
|
// End of "$Id: Fl.cxx,v 1.24.2.41.2.53 2002/09/20 17:56:56 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
+13
-35
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_mac.cxx,v 1.1.2.33 2002/09/19 02:32:44 easysw Exp $"
|
// "$Id: Fl_mac.cxx,v 1.1.2.34 2002/09/20 17:56:56 easysw Exp $"
|
||||||
//
|
//
|
||||||
// MacOS specific code for the Fast Light Tool Kit (FLTK).
|
// MacOS specific code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@@ -580,40 +580,18 @@ static double do_queued_events( double time = 0.0 )
|
|||||||
|
|
||||||
fl_unlock_function();
|
fl_unlock_function();
|
||||||
|
|
||||||
if ( time > 0.0 )
|
SetEventLoopTimerNextFireTime( timer, time );
|
||||||
|
RunApplicationEventLoop(); // will return after the previously set time
|
||||||
|
if ( dataready_tid != 0 )
|
||||||
{
|
{
|
||||||
SetEventLoopTimerNextFireTime( timer, time );
|
DEBUGMSG("*** CANCEL THREAD: ");
|
||||||
RunApplicationEventLoop(); // will return after the previously set time
|
pthread_cancel(dataready_tid); // cancel first
|
||||||
if ( dataready_tid != 0 )
|
write(G_pipe[1], "x", 1); // then wakeup thread from select
|
||||||
{
|
pthread_join(dataready_tid, NULL); // wait for thread to finish
|
||||||
DEBUGMSG("*** CANCEL THREAD: ");
|
if ( G_pipe[0] ) { close(G_pipe[0]); G_pipe[0] = 0; }
|
||||||
pthread_cancel(dataready_tid); // cancel first
|
if ( G_pipe[1] ) { close(G_pipe[1]); G_pipe[1] = 0; }
|
||||||
write(G_pipe[1], "x", 1); // then wakeup thread from select
|
dataready_tid = 0;
|
||||||
pthread_join(dataready_tid, NULL); // wait for thread to finish
|
DEBUGMSG("OK\n");
|
||||||
if ( G_pipe[0] ) { close(G_pipe[0]); G_pipe[0] = 0; }
|
|
||||||
if ( G_pipe[1] ) { close(G_pipe[1]); G_pipe[1] = 0; }
|
|
||||||
dataready_tid = 0;
|
|
||||||
DEBUGMSG("OK\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EventRef breakEvent;
|
|
||||||
CreateEvent( 0, kEventClassFLTK, kEventFLTKBreakLoop, 0, kEventAttributeUserEvent, &breakEvent );
|
|
||||||
PostEventToQueue( GetCurrentEventQueue(), breakEvent, kEventPriorityLow );
|
|
||||||
RunApplicationEventLoop();
|
|
||||||
ReleaseEvent( breakEvent );
|
|
||||||
if ( dataready_tid != 0 )
|
|
||||||
{
|
|
||||||
DEBUGMSG("*** CANCEL THREAD: ");
|
|
||||||
pthread_cancel(dataready_tid); // cancel first
|
|
||||||
write(G_pipe[1], "x", 1); // then wakeup thread from select
|
|
||||||
pthread_join(dataready_tid, NULL); // wait for thread to finish
|
|
||||||
if ( G_pipe[0] ) { close(G_pipe[0]); G_pipe[0] = 0; }
|
|
||||||
if ( G_pipe[1] ) { close(G_pipe[1]); G_pipe[1] = 0; }
|
|
||||||
dataready_tid = 0;
|
|
||||||
DEBUGMSG("OK\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_lock_function();
|
fl_lock_function();
|
||||||
@@ -1745,6 +1723,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_mac.cxx,v 1.1.2.33 2002/09/19 02:32:44 easysw Exp $".
|
// End of "$Id: Fl_mac.cxx,v 1.1.2.34 2002/09/20 17:56:56 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user