>
> IIRC, there is a "current" window in GLUT that we can use.


Here's two little patch files; can somebody who knows glut et al better than me 
figure out of they are valid? I've done a little test and it seems ok but...

FL/glut.H
------------------------------------
--- ../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) {
------------------------------------


src/glut_compatability.cxx
------------------------------------
--- ../fltk-1.1/src/glut_compatability.cxx      2008-04-26 23:13:02.000000000 
+0100
+++ ./fltk-1.1/src/glut_compatability.cxx       2008-04-29 20:11:18.000000000 
+0100
@@ -179,6 +179,7 @@
   motion = 0;
   passivemotion = 0;
   entry = 0;
+  idle = 0;
   visibility = 0;
   special = 0;
   mouse_down = 0;
@@ -375,6 +376,19 @@
   m->size--;
 }

+
+void glutIdleFunc(void (*f)())
+{
+       // no change
+       if(glut_window->idle == f) return;
+       // remove current idle
+       if(glut_window->idle) Fl::remove_idle((void (*)(void 
*))glut_window->idle);
+       // install new idle func - if one was passed
+       if(f) Fl::add_idle((void (*)(void *))f);
+       // record new idle func - even if it is NULL
+       glut_window->idle = f;
+} // glutIdleFunc
+
 ////////////////////////////////////////////////////////////////

 int glutGet(GLenum type) {
@@ -390,7 +404,7 @@
     else
       return 0;
 //case GLUT_WINDOW_NUM_CHILDREN:
-//case GLUT_WINDOW_CURSOR: return
+//case GLUT_WINDOW_CURSOR: return
   case GLUT_SCREEN_WIDTH: return Fl::w();
   case GLUT_SCREEN_HEIGHT: return Fl::h();
 //case GLUT_SCREEN_WIDTH_MM:
@@ -481,7 +495,7 @@

   const char *extensions, *start;
   const int len = strlen( extension );
-
+
   start = extensions = (const char *) glGetString(GL_EXTENSIONS);

   if (!extensions) return 0;
------------------------------------

--
Ian




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

Reply via email to