DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1948
Version: 1.3-current


This bug also exists in 1.1.9 (and possibly the 2.x tree).

The emulation of glutIdleFunc() by the Fltk glut compatability code works
in such a way that *only* the glut idle finction can exist. Any other idle
functions in use, manipulated by the regular fltk add_idle / remove_idle
functions will become broken if glutIdleFunc() is used in the same
application as them.

The attached patch files fix up glut_compatability.cxx and FL/glut.H to
make things work better.


One thing that occurs to me (from some further tests) is that if we take
this patch (or even if we don't!) then it might be a Good Idea to put
something in the docs to warn the end users not to mix'n'match using
glutIdleFunc() with the Fl::[add|remove]_idle() methods, for the glut
windows...

With the patch in, the idea is that you can use FL::[add|remove]_idle()
for your non-glut code and *either* glutIdleFunc() *or*
Fl::[add|remove]_idle() for the glut windows - and the glutIdleFunc()
*will not* break the other fltk idle functions (whereas the current
implementation of glutIdleFunc() *does* break the fltk idle functions.
As I discovered the hard way...)


Link: http://www.fltk.org/str.php?L1948
Version: 1.3-current
--- ../fltk-1.1/FL/glut.H       2008-04-26 23:13:06.000000000 +0100
+++ ./fltk-1.1/FL/glut.H        2008-04-29 20:19:24.000000000 +0100
@@ -68,6 +68,7 @@
   void (*motion)(int x, int y);
   void (*passivemotion)(int x, int y);
   void (*entry)(int);
+  void (*idle)(); // glut idle function for this window
   void (*visibility)(int);
   void (*special)(int, int x, int y);
   Fl_Glut_Window(int w, int h, const char *);
@@ -79,7 +80,7 @@
 extern FL_EXPORT int glut_menu;                        // the current menu

 // function pointers that are not per-window:
-extern FL_EXPORT void (*glut_idle_function)();
+extern FL_EXPORT void (*glut_idle_function)(); // I don't understand what 
these are for - IMM
 extern FL_EXPORT void (*glut_menustate_function)(int);
 extern FL_EXPORT void (*glut_menustatus_function)(int,int,int);

@@ -237,7 +238,8 @@
 inline void glutVisibilityFunc(void (*f)(int s)) {glut_window->visibility=f;}
 enum {GLUT_NOT_VISIBLE, GLUT_VISIBLE};

-inline void glutIdleFunc(void (*f)()) {Fl::set_idle(f);}
+//inline void glutIdleFunc(void (*f)()) {Fl::set_idle(f);}
+FL_EXPORT void glutIdleFunc(void (*f)()) ; // {Fl::set_idle(f);}

 // Warning: this cast may not work on all machines:
 inline void glutTimerFunc(unsigned int msec, void (*f)(int), int value) {
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to