diff --git a/CHANGES b/CHANGES index 099423078..106b18352 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,6 @@ CHANGES IN FLTK 1.1.6 - - Documentation updates (STR #608) + - Documentation updates (STR #552, STR #608) - Fl_Sys_Menu_Bar didn't compile on case-sensitive file-systems (STR #622) - FLUID didn't handle default function parameters diff --git a/documentation/Fl.html b/documentation/Fl.html index 5f9ad95d3..5e34d8394 100644 --- a/documentation/Fl.html +++ b/documentation/Fl.html @@ -233,6 +233,29 @@ FLTK will not recursively call the idle callback. Fl::wait() at t seconds after this function is called. The optional void* argument is passed to the callback. +

You can have multiple timeout callbacks. To remove an timeout +callback use Fl::remove_timeout(). + +

If you need more accurate, repeated timeouts, use Fl::repeat_timeout() to +reschedule the subsequent timeouts.

+ +

The following code will print "TICK" each second on +stdout with a fair degree of accuracy:

+ +
+    void callback(void*) {
+      puts("TICK");
+      Fl::repeat_timeout(1.0, callback);
+    }
+
+    int main() {
+      Fl::add_timeout(1.0, callback);
+      return Fl::run();
+    }
+
+

int arg(int, char**, int&);

Consume a single switch from argv, starting at word i. @@ -988,31 +1011,24 @@ callback that no longer exists.

void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);

-

Inside a timeout callback you can call this to add another timeout. -Rather than the time being measured from "now", it is measured from -when the system call elapsed that caused this timeout to be called. This -will result in far more accurate spacing of the timeout callbacks, it -also has slightly less system call overhead. (It will also use all -your machine time if your timeout code and FLTK's overhead take more -than t seconds, as the real timeout will be reduced to zero). +

This method repeats a timeout callback from the expiration of the +previous timeout, allowing for more accurate timing. You may only call +this method inside a timeout callback. -

It is undefined what this does if called from outside a timeout -callback. +

The following code will print "TICK" each second on +stdout with a fair degree of accuracy:

-

This code will print "TICK" each second on stdout, with a -fair degree of accuracy: +

+    void callback(void*) {
+      puts("TICK");
+      Fl::repeat_timeout(1.0, callback);
+    }
 
-
+    int main() {
+      Fl::add_timeout(1.0, callback);
+      return Fl::run();
+    }
+

int run();