projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixes for menus being attached to multiple buttons/windows (John Fay)
[freeglut]
/
src
/
freeglut_structure.c
diff --git
a/src/freeglut_structure.c
b/src/freeglut_structure.c
index
2b70de2
..
482740e
100644
(file)
--- a/
src/freeglut_structure.c
+++ b/
src/freeglut_structure.c
@@
-25,14
+25,9
@@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <GL/freeglut.h>
#include "freeglut_internal.h"
#include <GL/freeglut.h>
#include "freeglut_internal.h"
-
/* -- GLOBAL EXPORTS ------------------------------------------------------- */
/*
/* -- GLOBAL EXPORTS ------------------------------------------------------- */
/*
@@
-104,7
+99,7
@@
SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
* dependant, and resides in freeglut_window.c. Uses fgState.
*/
fgOpenWindow( window, title, x, y, w, h, gameMode,
* dependant, and resides in freeglut_window.c. Uses fgState.
*/
fgOpenWindow( window, title, x, y, w, h, gameMode,
- parent ? GL_TRUE : GL_FALSE );
+ (GLboolean)(parent ? GL_TRUE : GL_FALSE) );
return window;
}
return window;
}
@@
-120,7
+115,7
@@
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
/* Have the menu object created */
SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );
/* Have the menu object created */
SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );
- menu->ParentWindow = fgStructure.Window;
+ menu->ParentWindow = NULL;
/* Create a window for the menu to reside in. */
/* Create a window for the menu to reside in. */
@@
-197,8
+192,6
@@
void fgCloseWindows( )
*/
void fgDestroyWindow( SFG_Window* window )
{
*/
void fgDestroyWindow( SFG_Window* window )
{
- int menu_index;
-
FREEGLUT_INTERNAL_ERROR_EXIT ( window, "Window destroy function called with null window",
"fgDestroyWindow" );
FREEGLUT_INTERNAL_ERROR_EXIT ( window, "Window destroy function called with null window",
"fgDestroyWindow" );
@@
-219,10
+212,6
@@
void fgDestroyWindow( SFG_Window* window )
if( window->ActiveMenu )
fgDeactivateMenu( window );
if( window->ActiveMenu )
fgDeactivateMenu( window );
- for( menu_index = 0; menu_index < 3; menu_index ++ )
- if( window->Menu[ menu_index ] )
- window->Menu[ menu_index ]->ParentWindow = NULL;
-
fghClearCallBacks( window );
fgCloseWindow( window );
free( window );
fghClearCallBacks( window );
fgCloseWindow( window );
free( window );
@@
-239,6
+228,10
@@
static void fghRemoveMenuFromWindow( SFG_Window* window, SFG_Menu* menu )
SFG_Window *subWindow;
int i;
SFG_Window *subWindow;
int i;
+ /* Check whether this is the active menu in the window */
+ if ( menu == window->ActiveMenu )
+ window->ActiveMenu = NULL ;
+
/*
* Check if the menu is attached to the current window,
* if so, have it detached (by overwriting with a NULL):
/*
* Check if the menu is attached to the current window,
* if so, have it detached (by overwriting with a NULL):
@@
-323,7
+316,7
@@
void fgDestroyMenu( SFG_Menu* menu )
}
if( fgStructure.Window == menu->Window )
}
if( fgStructure.Window == menu->Window )
- fgSetWindow( menu->ParentWindow );
+ fgSetWindow( NULL );
fgDestroyWindow( menu->Window );
fgListRemove( &fgStructure.Menus, &menu->Node );
if( fgStructure.Menu == menu )
fgDestroyWindow( menu->Window );
fgListRemove( &fgStructure.Menus, &menu->Node );
if( fgStructure.Menu == menu )