From f5375b6ab64edbe5e5b017b053fb1385613ceef9 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Tue, 12 Dec 2000 08:57:30 +0000 Subject: Fl_Gl_Window does not set drawbuffer(BACKBUFFER) for single-buffered windows. Fl_Input::replace(...) correctly updates the display if the replaced region does not include the mark, point, or selected region. Added Fl::add_check(...), Fl::remove_check, and Fl::has_check. These are similar to idle callbacks but are only called just before it waits for new events. They can be used to watch for changes in global state and respond to them. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1347 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/functions.html | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'documentation/functions.html') diff --git a/documentation/functions.html b/documentation/functions.html index d2a06357a..591f4edba 100644 --- a/documentation/functions.html +++ b/documentation/functions.html @@ -326,9 +326,39 @@ fair degree of accuracy: main() { Fl::add_timeout(1.0,callback); - for (;;) Fl::wait(); + return Fl::run(); } +

static void Fl::add_check(void (*cb)(void*),void*v=0)

+ +Fltk will call this callback just before it flushes the display and +waits for events. This is different than an idle callback because it +is only called once, then fltk calls the system and tells it not to +return until an event happens. + +

This can be used by code that wants to monitor the +application's state, such as to keep a display up to date. The +advantage of using a check callback is that it is called only when no +events are pending. If events are coming in quickly, whole blocks of +them will be processed before this is called once. This can save +significant time and avoid the application falling behind the events. + +

Sample code: + +

+

static int Fl::arg(int argc, char **argv, int &i)

Consume a single switch from argv, starting at word i. @@ -867,6 +897,15 @@ Returns true if the timeout exists and has not been called yet. Removes a timeout callback. It is harmless to remove a timeout callback that no longer exists. +

static int Fl::has_check(void (*cb)(void*), void* = 0)

+ +Returns true if the check exists and has not been called yet. + +

static void Fl::remove_check(void (*cb)(void*), void* = 0)

+ +Removes a check callback. It is harmless to remove a check +callback that no longer exists. +

static Fl::run()

As long as any windows are displayed this calls Fl::wait() -- cgit v1.2.3