Added fgInitCallBacks() to freeglut_structure.c. (The function takes
authorRichard Rauch <rkr@olib.org>
Fri, 7 Nov 2003 09:55:43 +0000 (09:55 +0000)
committerRichard Rauch <rkr@olib.org>
Fri, 7 Nov 2003 09:55:43 +0000 (09:55 +0000)
an {SFG_Window *}.)  Added prototype to freeglut_internal.h.  Added use
of the function to the window initialization.  (Don't count on calloc(),
which sets all bits to 0.)

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@316 7f0cb862-5218-0410-a997-914c9d46530a

src/freeglut_internal.h
src/freeglut_structure.c

index 9cfe936..45dd726 100644 (file)
@@ -697,6 +697,7 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
 
 /*
  * Window creation, opening, closing and destruction.
 
 /*
  * Window creation, opening, closing and destruction.
+ * Also CallBack initialization.
  * Defined in freeglut_structure.c, freeglut_window.c.
  */
 SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
  * Defined in freeglut_structure.c, freeglut_window.c.
  */
 SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
@@ -710,6 +711,7 @@ void        fgAddToWindowDestroyList ( SFG_Window* window,
                                        GLboolean needToClose ) ;
 void        fgCloseWindows ();
 void        fgDestroyWindow( SFG_Window* window, GLboolean needToClose );
                                        GLboolean needToClose ) ;
 void        fgCloseWindows ();
 void        fgDestroyWindow( SFG_Window* window, GLboolean needToClose );
+void        fgInitCallBacks( SFG_Window *window );
 
 /*
  * Menu creation and destruction. Defined in freeglut_structure.c
 
 /*
  * Menu creation and destruction. Defined in freeglut_structure.c
index 8708d2b..30a905b 100644 (file)
@@ -52,6 +52,13 @@ SFG_Structure fgStructure = { { NULL, NULL },  /* The list of windows       */
 
 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
 
 
 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
 
+void fgInitCallBacks( SFG_Window *window )
+{
+    int i;
+    for( i = 0; i < TOTAL_CALLBACKS; ++i )
+        window->CallBacks[ i ] = NULL;
+}
+
 /*
  * This private function creates, opens and adds to the hierarchy
  * a freeglut window complete with OpenGL context and stuff...
 /*
  * This private function creates, opens and adds to the hierarchy
  * a freeglut window complete with OpenGL context and stuff...
@@ -67,6 +74,8 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
     SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
     int fakeArgc = 0;
 
     SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
     int fakeArgc = 0;
 
+    fgInitCallBacks( window );
+
     /*
      * If the freeglut internals haven't been initialized yet,
      * do it now. Hack's idea courtesy of Chris Purnell...
     /*
      * If the freeglut internals haven't been initialized yet,
      * do it now. Hack's idea courtesy of Chris Purnell...