Skip to content

Commit

Permalink
Fl_Gl_Window does not set drawbuffer(BACKBUFFER) for single-buffered
Browse files Browse the repository at this point in the history
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
  • Loading branch information
spitzak committed Dec 12, 2000
1 parent 0d0b066 commit f5375b6
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 104 deletions.
7 changes: 5 additions & 2 deletions FL/Fl.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl.H,v 1.8.2.9 2000/06/21 17:36:33 bill Exp $"
// "$Id: Fl.H,v 1.8.2.10 2000/12/12 08:57:29 spitzak Exp $"
//
// Main header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -94,6 +94,9 @@ public:
static FL_EXPORT void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);
static FL_EXPORT int has_timeout(Fl_Timeout_Handler, void* = 0);
static FL_EXPORT void remove_timeout(Fl_Timeout_Handler, void* = 0);
static FL_EXPORT void add_check(Fl_Timeout_Handler, void* = 0);
static FL_EXPORT int has_check(Fl_Timeout_Handler, void* = 0);
static FL_EXPORT void remove_check(Fl_Timeout_Handler, void* = 0);
static FL_EXPORT void add_fd(int fd, int when, void (*cb)(int,void*),void* =0);
static FL_EXPORT void add_fd(int fd, void (*cb)(int, void*), void* = 0);
static FL_EXPORT void remove_fd(int, int when);
Expand Down Expand Up @@ -214,5 +217,5 @@ public:
#endif

//
// End of "$Id: Fl.H,v 1.8.2.9 2000/06/21 17:36:33 bill Exp $".
// End of "$Id: Fl.H,v 1.8.2.10 2000/12/12 08:57:29 spitzak Exp $".
//
10 changes: 4 additions & 6 deletions FL/glut.H
@@ -1,5 +1,5 @@
//
// "$Id: glut.H,v 1.6.2.7 2000/12/06 15:45:12 easysw Exp $"
// "$Id: glut.H,v 1.6.2.8 2000/12/12 08:57:30 spitzak Exp $"
//
// GLUT emulation header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -430,16 +430,14 @@ extern "C" {

extern int APIENTRY glutExtensionSupported(char *name);

/* Stroke font opaque addresses (use constants instead in source code). */
extern void *glutStrokeRoman;
extern void *glutStrokeMonoRoman;

/* Stroke font constants (use these in GLUT program). */
#if defined(_WIN32) || defined(WIN32)
# define GLUT_STROKE_ROMAN ((void*)0)
# define GLUT_STROKE_MONO_ROMAN ((void*)1)
#else
extern void *glutStrokeRoman;
# define GLUT_STROKE_ROMAN (&glutStrokeRoman)
extern void *glutStrokeMonoRoman;
# define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
#endif

Expand Down Expand Up @@ -472,5 +470,5 @@ extern void APIENTRY glutSolidIcosahedron();
#endif /* __glut_h__ */

//
// End of "$Id: glut.H,v 1.6.2.7 2000/12/06 15:45:12 easysw Exp $".
// End of "$Id: glut.H,v 1.6.2.8 2000/12/12 08:57:30 spitzak Exp $".
//
41 changes: 40 additions & 1 deletion documentation/functions.html
Expand Up @@ -326,9 +326,39 @@ <h3><A name=repeat_timeout>static void Fl::repeat_timeout(float t, void (*cb)(vo

main() {
Fl::add_timeout(1.0,callback);
for (;;) Fl::wait();
return Fl::run();
}</PRE></UL>

<h3><A name=add_timeout>static void Fl::add_check(void (*cb)(void*),void*v=0)</A></h3>

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.

<p>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.

<p>Sample code:

<ul><pre>bool state_changed; // anything that changes the display turns this on

void callback(void*) {
if (!state_changed) return;
state_changed = false;
do_expensive_calculation();
widget->redraw();
}

main() {
Fl::add_check(1.0,callback);
return Fl::run();
}</pre></ul>

<h3><A name=arg>static int Fl::arg(int argc, char **argv, int &amp;i)</A></h3>

Consume a single switch from <tt>argv</tt>, starting at word i.
Expand Down Expand Up @@ -867,6 +897,15 @@ <h3><A name=remove_timeout>static void Fl::remove_timeout(void (*cb)(void*), voi
Removes a timeout callback. It is harmless to remove a timeout
callback that no longer exists.

<h3><A name=has_check>static int Fl::has_check(void (*cb)(void*), void* = 0)</A></h3>

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

<h3><A name=remove_check>static void Fl::remove_check(void (*cb)(void*), void* = 0)</A></h3>

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

<h3><A name=run>static Fl::run()</A></h3>

As long as any windows are displayed this calls <tt>Fl::wait()</tt>
Expand Down

0 comments on commit f5375b6

Please sign in to comment.