Author: matt
Date: 2008-10-19 13:15:32 -0700 (Sun, 19 Oct 2008)
New Revision: 6473
Log:
Fixed adding an idle handler during a draw() call (STR #1950)

Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/src/Fl.cxx
   branches/branch-1.3/test/mandelbrot.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2008-10-19 16:40:38 UTC (rev 6472)
+++ branches/branch-1.3/CHANGES 2008-10-19 20:15:32 UTC (rev 6473)
@@ -1,5 +1,7 @@
 CHANGES IN FLTK 1.3.0
 
+       - Fixed adding an idle handler during
+         a draw() call (STR #1950)
        - Fl_Group::clip_children() is now public (STR #2017)
        - Added clarification to Fl_GL_Window mode
          function (STR #1945)

Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx      2008-10-19 16:40:38 UTC (rev 6472)
+++ branches/branch-1.3/src/Fl.cxx      2008-10-19 20:15:32 UTC (rev 6473)
@@ -381,6 +381,8 @@
     if (idle) time_to_wait = 0.0;
   }
   flush();
+  if (idle && !in_idle) // 'idle' may have been set within flush()
+    time_to_wait = 0.0;
   return fl_wait(time_to_wait);
 
 #else
@@ -427,6 +429,8 @@
   } else {
     // do flush first so that user sees the display:
     flush();
+    if (idle && !in_idle) // 'idle' may have been set within flush()
+      time_to_wait = 0.0;
     return fl_wait(time_to_wait);
   }
 #endif

Modified: branches/branch-1.3/test/mandelbrot.cxx
===================================================================
--- branches/branch-1.3/test/mandelbrot.cxx     2008-10-19 16:40:38 UTC (rev 
6472)
+++ branches/branch-1.3/test/mandelbrot.cxx     2008-10-19 20:15:32 UTC (rev 
6473)
@@ -33,12 +33,12 @@
 Drawing_Window mbrot;
 Drawing_Window jbrot;
 
-void idle() {
-  if (!mbrot.d->idle() && !(jbrot.d && jbrot.d->idle())) Fl::set_idle(0);
+void idle(void*) {
+  if (!mbrot.d->idle() && !(jbrot.d && jbrot.d->idle())) Fl::remove_idle(idle);
 }
 
 void set_idle() {
-  Fl::set_idle(idle);
+  Fl::add_idle(idle);
 }
 
 static void window_callback(Fl_Widget*, void*) {exit(0);}

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to