projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix a game mode crashing bug, conditional compilation for Windows, and comment out...
[freeglut]
/
src
/
freeglut_structure.c
diff --git
a/src/freeglut_structure.c
b/src/freeglut_structure.c
index
b4834a7
..
3b3032d
100644
(file)
--- a/
src/freeglut_structure.c
+++ b/
src/freeglut_structure.c
@@
-29,7
+29,7
@@
#include "config.h"
#endif
#include "config.h"
#endif
-#include "../include/GL/freeglut.h"
+#include <GL/freeglut.h>
#include "freeglut_internal.h"
#include "freeglut_internal.h"
@@
-110,6
+110,9
@@
SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
window->IsMenu = isMenu;
window->IsMenu = isMenu;
+ window->State.IgnoreKeyRepeat = GL_FALSE;
+ window->State.KeyRepeating = GL_FALSE;
+
/*
* Open the window now. The fgOpenWindow() function is system
* dependant, and resides in freeglut_window.c. Uses fgState.
/*
* Open the window now. The fgOpenWindow() function is system
* dependant, and resides in freeglut_window.c. Uses fgState.
@@
-147,7
+150,7
@@
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
* Create a window for the menu to reside in.
*/
* Create a window for the menu to reside in.
*/
- fgCreateWindow( NULL, NULL, x, y, w, h, GL_FALSE, GL_TRUE );
+ fgCreateWindow( NULL, "freeglut menu", x, y, w, h, GL_FALSE, GL_TRUE );
menu->Window = fgStructure.Window;
glutDisplayFunc( fgDisplayMenu );
menu->Window = fgStructure.Window;
glutDisplayFunc( fgDisplayMenu );
@@
-199,7
+202,7
@@
void fgAddToWindowDestroyList( SFG_Window* window )
* to ensure that they are no longer called after this point.
*/
{
* to ensure that they are no longer called after this point.
*/
{
- void *destroy = FETCH_WCB( *window, Destroy );
+ FGCBDestroy destroy = FETCH_WCB( *window, Destroy );
fgClearCallBacks( window );
SET_WCB( *window, Destroy, destroy );
}
fgClearCallBacks( window );
SET_WCB( *window, Destroy, destroy );
}
@@
-210,10
+213,9
@@
void fgAddToWindowDestroyList( SFG_Window* window )
*/
void fgCloseWindows( )
{
*/
void fgCloseWindows( )
{
- SFG_WindowList *window_ptr;
-
- while( window_ptr = fgStructure.WindowsToDestroy.First )
+ while( fgStructure.WindowsToDestroy.First )
{
{
+ SFG_WindowList *window_ptr = fgStructure.WindowsToDestroy.First;
fgDestroyWindow( window_ptr->window );
fgListRemove( &fgStructure.WindowsToDestroy, &window_ptr->node );
free( window_ptr );
fgDestroyWindow( window_ptr->window );
fgListRemove( &fgStructure.WindowsToDestroy, &window_ptr->node );
free( window_ptr );
@@
-227,19
+229,18
@@
void fgCloseWindows( )
*/
void fgDestroyWindow( SFG_Window* window )
{
*/
void fgDestroyWindow( SFG_Window* window )
{
- SFG_Window* subWindow;
- int menu_index ;
+ int menu_index;
assert( window );
freeglut_assert_ready;
assert( window );
freeglut_assert_ready;
- while( subWindow = ( SFG_Window * )window->Children.First )
- fgDestroyWindow( subWindow );
+ while( window->Children.First )
+ fgDestroyWindow( ( SFG_Window * )window->Children.First );
{
{
- SFG_Window *activeWindow = fgStructure.Window ;
+ SFG_Window *activeWindow = fgStructure.Window;
INVOKE_WCB( *window, Destroy, ( ) );
INVOKE_WCB( *window, Destroy, ( ) );
- fgSetWindow ( activeWindow );
+ fgSetWindow( activeWindow );
}
if( window->Parent )
}
if( window->Parent )
@@
-250,11
+251,9
@@
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 ;
- }
+ for( menu_index = 0; menu_index < 3; menu_index ++ )
+ if( window->Menu[ menu_index ] )
+ window->Menu[ menu_index ]->ParentWindow = NULL;
fgClearCallBacks( window );
fgCloseWindow( window );
fgClearCallBacks( window );
fgCloseWindow( window );
@@
-312,7
+311,6
@@
void fgDestroyMenu( SFG_Menu* menu )
{
SFG_Window *window;
SFG_Menu *from;
{
SFG_Window *window;
SFG_Menu *from;
- SFG_MenuEntry *entry;
assert( menu );
freeglut_assert_ready;
assert( menu );
freeglut_assert_ready;
@@
-349,8
+347,10
@@
void fgDestroyMenu( SFG_Menu* menu )
* Now we are pretty sure the menu is not used anywhere
* and that we can remove all of its entries
*/
* Now we are pretty sure the menu is not used anywhere
* and that we can remove all of its entries
*/
- while( entry = ( SFG_MenuEntry * )menu->Entries.First )
+ while( menu->Entries.First )
{
{
+ SFG_MenuEntry *entry = ( SFG_MenuEntry * ) menu->Entries.First;
+
fgListRemove( &menu->Entries, &entry->Node );
if( entry->Text )
fgListRemove( &menu->Entries, &entry->Node );
if( entry->Text )
@@
-358,7
+358,6
@@
void fgDestroyMenu( SFG_Menu* menu )
entry->Text = NULL;
free( entry );
entry->Text = NULL;
free( entry );
- entry = NULL;
}
if( fgStructure.Window == menu->Window )
}
if( fgStructure.Window == menu->Window )
@@
-397,24
+396,21
@@
void fgCreateStructure( void )
*/
void fgDestroyStructure( void )
{
*/
void fgDestroyStructure( void )
{
- SFG_Window *window;
- SFG_Menu *menu;
-
freeglut_assert_ready;
/*
* Clean up the WindowsToDestroy list.
*/
freeglut_assert_ready;
/*
* Clean up the WindowsToDestroy list.
*/
- fgCloseWindows();
+ fgCloseWindows( );
/*
* Make sure all windows and menus have been deallocated
*/
/*
* Make sure all windows and menus have been deallocated
*/
- while( menu = ( SFG_Menu * )fgStructure.Menus.First )
- fgDestroyMenu( menu );
+ while( fgStructure.Menus.First )
+ fgDestroyMenu( ( SFG_Menu * )fgStructure.Menus.First );
- while( window = ( SFG_Window * )fgStructure.Windows.First )
- fgDestroyWindow( window );
+ while( fgStructure.Windows.First )
+ fgDestroyWindow( ( SFG_Window * )fgStructure.Windows.First );
}
/*
}
/*
@@
-517,13
+513,13
@@
static void fghcbWindowByID( SFG_Window *window, SFG_Enumerator *enumerator )
/*
* Make sure we do not overwrite our precious results...
*/
/*
* Make sure we do not overwrite our precious results...
*/
- if ( enumerator->found )
+ if( enumerator->found )
return;
/*
* Check the window's handle. Hope this works. Looks ugly. That's for sure.
*/
return;
/*
* Check the window's handle. Hope this works. Looks ugly. That's for sure.
*/
- if( window->ID == (int) (enumerator->data) ) /* XXX int/ptr conversion! */
+ if( window->ID == *( int *)(enumerator->data) )
{
enumerator->found = GL_TRUE;
enumerator->data = window;
{
enumerator->found = GL_TRUE;
enumerator->data = window;
@@
-550,10
+546,10
@@
SFG_Window* fgWindowByID( int windowID )
* Uses a method very similiar for fgWindowByHandle...
*/
enumerator.found = GL_FALSE;
* Uses a method very similiar for fgWindowByHandle...
*/
enumerator.found = GL_FALSE;
- enumerator.data = (void *) windowID; /* XXX int/pointer conversion! */
+ enumerator.data = ( void * )&windowID;
fgEnumWindows( fghcbWindowByID, &enumerator );
if( enumerator.found )
fgEnumWindows( fghcbWindowByID, &enumerator );
if( enumerator.found )
- return( SFG_Window *) enumerator.data;
+ return ( SFG_Window * )enumerator.data;
return NULL;
}
return NULL;
}
@@
-589,10
+585,9
@@
void fgListInit(SFG_List *list)
void fgListAppend(SFG_List *list, SFG_Node *node)
{
void fgListAppend(SFG_List *list, SFG_Node *node)
{
- SFG_Node *ln;
-
- if ( ln = (SFG_Node *)list->Last )
+ if ( list->Last )
{
{
+ SFG_Node *ln = (SFG_Node *) list->Last;
ln->Next = node;
node->Prev = ln;
}
ln->Next = node;
node->Prev = ln;
}
@@
-608,15
+603,13
@@
void fgListAppend(SFG_List *list, SFG_Node *node)
void fgListRemove(SFG_List *list, SFG_Node *node)
{
void fgListRemove(SFG_List *list, SFG_Node *node)
{
- SFG_Node *ln;
-
- if( ln = (SFG_Node *)node->Next )
- ln->Prev = node->Prev;
- if( ln = (SFG_Node *)node->Prev )
- ln->Next = node->Next;
- if( (ln = (SFG_Node *)list->First) == node )
+ if( node->Next )
+ ( ( SFG_Node * )node->Next )->Prev = node->Prev;
+ if( node->Prev )
+ ( ( SFG_Node * )node->Prev )->Next = node->Next;
+ if( ( ( SFG_Node * )list->First ) == node )
list->First = node->Next;
list->First = node->Next;
- if( (ln = (SFG_Node *)list->Last) == node )
+ if( ( ( SFG_Node * )list->Last ) == node )
list->Last = node->Prev;
}
list->Last = node->Prev;
}