projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pure code janitoring: Shuffled the order of some of the case statements
[freeglut]
/
src
/
freeglut_structure.c
diff --git
a/src/freeglut_structure.c
b/src/freeglut_structure.c
index
4a2fa06
..
e11cdf7
100644
(file)
--- a/
src/freeglut_structure.c
+++ b/
src/freeglut_structure.c
@@
-52,6
+52,13
@@
SFG_Structure fgStructure = { { NULL, NULL }, /* The list of windows */
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
+void fgClearCallBacks( 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;
+ fgClearCallBacks( 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...
@@
-109,7
+118,7
@@
SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
/*
* This private function creates a menu and adds it to the menus list
*/
/*
* This private function creates a menu and adds it to the menus list
*/
-SFG_Menu* fgCreateMenu( FGCBmenu menuCallback )
+SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
{
int x = 100, y = 100, w = 100, h = 100 ;
SFG_Window *current_window = fgStructure.Window ;
{
int x = 100, y = 100, w = 100, h = 100 ;
SFG_Window *current_window = fgStructure.Window ;
@@
-266,11
+275,15
@@
void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
while ( (subWindow = (SFG_Window *)window->Children.First) != NULL )
fgDestroyWindow( subWindow, needToClose );
while ( (subWindow = (SFG_Window *)window->Children.First) != NULL )
fgDestroyWindow( subWindow, needToClose );
- if ( window->Callbacks.Destroy != NULL )
+ /*
+ * XXX Since INVOKE_WCB() tests the function pointer, why not make
+ * XXX this unconditional? Overhead is close to nil, and it would
+ * XXX clarify the code by omitting a conditional test.
+ */
+ if ( FETCH_WCB( *window, Destroy ) )
{
SFG_Window *activeWindow = fgStructure.Window ;
{
SFG_Window *activeWindow = fgStructure.Window ;
- fgSetWindow ( window ) ;
- window->Callbacks.Destroy () ;
+ INVOKE_WCB( *window, Destroy, ( ) );
fgSetWindow ( activeWindow ) ;
}
fgSetWindow ( activeWindow ) ;
}
@@
-293,6
+306,7
@@
void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
free( window );
if ( fgStructure.Window == window )
fgStructure.Window = NULL ;
free( window );
if ( fgStructure.Window == window )
fgStructure.Window = NULL ;
+ fgClearCallBacks( window );
}
/*
}
/*