Trying again to change \"fgStructure.Window\" to \"fgStructure.CurrentWindow\" and \"fgStructure.Menu\" to \"fgStructure.CurrentMenu\" for easier maintenance.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@574 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2005-04-22 14:17:31 +00:00
parent a72757e31d
commit 43f57a35bb
11 changed files with 174 additions and 174 deletions

View File

@ -33,12 +33,12 @@
/*
* All of the callbacks setting methods can be generalized to this:
*/
#define SET_CALLBACK(a) \
do \
{ \
if( fgStructure.Window == NULL ) \
return; \
SET_WCB( ( *( fgStructure.Window ) ), a, callback ); \
#define SET_CALLBACK(a) \
do \
{ \
if( fgStructure.CurrentWindow == NULL ) \
return; \
SET_WCB( ( *( fgStructure.CurrentWindow ) ), a, callback ); \
} while( 0 )
/*
@ -132,11 +132,11 @@ static void fghVisibility( int status )
int glut_status = GLUT_VISIBLE;
FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED ( "Visibility Callback" );
freeglut_return_if_fail( fgStructure.Window );
freeglut_return_if_fail( fgStructure.CurrentWindow );
if( ( GLUT_HIDDEN == status ) || ( GLUT_FULLY_COVERED == status ) )
glut_status = GLUT_NOT_VISIBLE;
INVOKE_WCB( *( fgStructure.Window ), Visibility, ( glut_status ) );
INVOKE_WCB( *( fgStructure.CurrentWindow ), Visibility, ( glut_status ) );
}
void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) )
@ -180,13 +180,13 @@ void FGAPIENTRY glutJoystickFunc( void (* callback)
fgInitialiseJoysticks ();
SET_CALLBACK( Joystick );
fgStructure.Window->State.JoystickPollRate = pollInterval;
fgStructure.CurrentWindow->State.JoystickPollRate = pollInterval;
fgStructure.Window->State.JoystickLastPoll =
fgElapsedTime() - fgStructure.Window->State.JoystickPollRate;
fgStructure.CurrentWindow->State.JoystickLastPoll =
fgElapsedTime() - fgStructure.CurrentWindow->State.JoystickPollRate;
if( fgStructure.Window->State.JoystickLastPoll < 0 )
fgStructure.Window->State.JoystickLastPoll = 0;
if( fgStructure.CurrentWindow->State.JoystickLastPoll < 0 )
fgStructure.CurrentWindow->State.JoystickLastPoll = 0;
}
/*
@ -255,8 +255,8 @@ void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) )
void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMenuDestroyFunc" );
if( fgStructure.Menu )
fgStructure.Menu->Destroy = callback;
if( fgStructure.CurrentMenu )
fgStructure.CurrentMenu->Destroy = callback;
}
/*

View File

@ -154,7 +154,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
fgError( "Failed to create cursor" );
}
XDefineCursor( fgDisplay.Display,
fgStructure.Window->Window.Handle, cursor );
fgStructure.CurrentWindow->Window.Handle, cursor );
}
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
@ -163,20 +163,20 @@ void FGAPIENTRY glutSetCursor( int cursorID )
* This is a temporary solution only...
*/
/* Set the cursor AND change it for this window class. */
# define MAP_CURSOR(a,b) \
case a: \
SetCursor( LoadCursor( NULL, b ) ); \
SetClassLong( fgStructure.Window->Window.Handle, \
GCL_HCURSOR, \
( LONG )LoadCursor( NULL, b ) ); \
# define MAP_CURSOR(a,b) \
case a: \
SetCursor( LoadCursor( NULL, b ) ); \
SetClassLong( fgStructure.CurrentWindow->Window.Handle, \
GCL_HCURSOR, \
( LONG )LoadCursor( NULL, b ) ); \
break;
/* Nuke the cursor AND change it for this window class. */
# define ZAP_CURSOR(a,b) \
case a: \
SetCursor( NULL ); \
SetClassLong( fgStructure.Window->Window.Handle, \
GCL_HCURSOR, ( LONG )NULL ); \
# define ZAP_CURSOR(a,b) \
case a: \
SetCursor( NULL ); \
SetClassLong( fgStructure.CurrentWindow->Window.Handle, \
GCL_HCURSOR, ( LONG )NULL ); \
break;
switch( cursorID )
@ -211,7 +211,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
}
#endif
fgStructure.Window->State.Cursor = cursorID;
fgStructure.CurrentWindow->State.Cursor = cursorID;
}
/*
@ -227,7 +227,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
XWarpPointer(
fgDisplay.Display,
None,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
0, 0, 0, 0,
x, y
);
@ -242,7 +242,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
coords.y = y;
/* ClientToScreen() translates {coords} for us. */
ClientToScreen( fgStructure.Window->Window.Handle, &coords );
ClientToScreen( fgStructure.CurrentWindow->Window.Handle, &coords );
SetCursorPos( coords.x, coords.y );
}

View File

@ -37,7 +37,7 @@ void FGAPIENTRY glutPostRedisplay( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPostRedisplay" );
fgStructure.Window->State.Redisplay = GL_TRUE;
fgStructure.CurrentWindow->State.Redisplay = GL_TRUE;
}
/*
@ -49,13 +49,13 @@ void FGAPIENTRY glutSwapBuffers( void )
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSwapBuffers" );
glFlush( );
if( ! fgStructure.Window->Window.DoubleBuffered )
if( ! fgStructure.CurrentWindow->Window.DoubleBuffered )
return;
#if TARGET_HOST_UNIX_X11
glXSwapBuffers( fgDisplay.Display, fgStructure.Window->Window.Handle );
glXSwapBuffers( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SwapBuffers( fgStructure.Window->Window.Device );
SwapBuffers( fgStructure.CurrentWindow->Window.Device );
#endif
/* GLUT_FPS env var support */

View File

@ -436,7 +436,7 @@ int FGAPIENTRY glutEnterGameMode( void )
#if TARGET_HOST_UNIX_X11
/* Move the window up to the topleft corner */
XMoveWindow( fgDisplay.Display, fgStructure.Window->Window.Handle, 0, 0 );
XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle, 0, 0 );
/*
* Sync needed to avoid a real race, the Xserver must have really created
@ -502,14 +502,14 @@ int FGAPIENTRY glutEnterGameMode( void )
/* Get the current postion of the drawable area on screen */
XTranslateCoordinates(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
fgDisplay.RootWindow,
0, 0, &x, &y,
&child
);
/* Move the decorataions out of the topleft corner of the display */
XMoveWindow( fgDisplay.Display, fgStructure.Window->Window.Handle,
XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
-x, -y);
}

View File

@ -569,8 +569,8 @@ struct tagSFG_Structure
SFG_List Menus; /* The global menus list */
SFG_List WindowsToDestroy;
SFG_Window* Window; /* The currently active win. */
SFG_Menu* Menu; /* Same, but menu... */
SFG_Window* CurrentWindow; /* The currently set window */
SFG_Menu* CurrentMenu; /* Same, but menu... */
SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */
@ -693,7 +693,7 @@ extern SFG_State fgState;
* window set, respectively:
*/
#define FREEGLUT_EXIT_IF_NO_WINDOW( string ) \
if ( ! fgStructure.Window ) \
if ( ! fgStructure.CurrentWindow ) \
{ \
fgError ( " ERROR: Function <%s> called" \
" with no current window defined.", (string) ) ; \

View File

@ -89,7 +89,7 @@ struct GXKeyList gxKeyList;
*/
static void fghReshapeWindow ( SFG_Window *window, int width, int height )
{
SFG_Window *current_window = fgStructure.Window;
SFG_Window *current_window = fgStructure.CurrentWindow;
freeglut_return_if_fail( window != NULL );
@ -187,7 +187,7 @@ static void fghReshapeWindow ( SFG_Window *window, int width, int height )
*/
static void fghRedrawWindow ( SFG_Window *window )
{
SFG_Window *current_window = fgStructure.Window;
SFG_Window *current_window = fgStructure.CurrentWindow;
freeglut_return_if_fail( window );
freeglut_return_if_fail( FETCH_WCB ( *window, Display ) );
@ -1025,7 +1025,7 @@ void FGAPIENTRY glutMainLoop( void )
{
if ( FETCH_WCB( *window, Visibility ) )
{
SFG_Window *current_window = fgStructure.Window ;
SFG_Window *current_window = fgStructure.CurrentWindow ;
INVOKE_WCB( *window, Visibility, ( window->State.Visible ) );
fgSetWindow( current_window );

View File

@ -110,7 +110,7 @@ static SFG_MenuEntry *fghFindMenuEntry( SFG_Menu* menu, int index )
*/
static void fghDeactivateSubMenu( SFG_MenuEntry *menuEntry )
{
SFG_Window *current_window = fgStructure.Window;
SFG_Window *current_window = fgStructure.CurrentWindow;
SFG_MenuEntry *subMenuIter;
/* Hide the present menu's window */
fgSetWindow( menuEntry->SubMenu->Window );
@ -215,7 +215,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
{
if ( ! menuEntry->SubMenu->IsActive )
{
SFG_Window *current_window = fgStructure.Window;
SFG_Window *current_window = fgStructure.CurrentWindow;
/* Set up the initial menu position now... */
menuEntry->SubMenu->IsActive = GL_TRUE;
@ -440,10 +440,10 @@ static void fghExecuteMenuCallback( SFG_Menu* menu )
*/
void fgDisplayMenu( void )
{
SFG_Window* window = fgStructure.Window;
SFG_Window* window = fgStructure.CurrentWindow;
SFG_Menu* menu = NULL;
FREEGLUT_INTERNAL_ERROR_EXIT ( fgStructure.Window, "Displaying menu in nonexistent window",
FREEGLUT_INTERNAL_ERROR_EXIT ( fgStructure.CurrentWindow, "Displaying menu in nonexistent window",
"fgDisplayMenu" );
/* Check if there is an active menu attached to this window... */
@ -564,11 +564,11 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed,
* Save the current window and menu and set the current
* window to the window whose menu this is
*/
SFG_Window *save_window = fgStructure.Window;
SFG_Menu *save_menu = fgStructure.Menu;
SFG_Window *save_window = fgStructure.CurrentWindow;
SFG_Menu *save_menu = fgStructure.CurrentMenu;
SFG_Window *parent_window = window->ActiveMenu->ParentWindow;
fgSetWindow( parent_window );
fgStructure.Menu = window->ActiveMenu;
fgStructure.CurrentMenu = window->ActiveMenu;
/* Execute the menu callback */
fghExecuteMenuCallback( window->ActiveMenu );
@ -576,7 +576,7 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed,
/* Restore the current window and menu */
fgSetWindow( save_window );
fgStructure.Menu = save_menu;
fgStructure.CurrentMenu = save_menu;
}
else if( pressed )
/*
@ -621,7 +621,7 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed,
*/
void fgDeactivateMenu( SFG_Window *window )
{
SFG_Window *current_window = fgStructure.Window;
SFG_Window *current_window = fgStructure.CurrentWindow;
/* Check if there is an active menu attached to this window... */
SFG_Menu* menu = window->ActiveMenu;
@ -664,10 +664,10 @@ void fghCalculateMenuBoxSize( void )
int width = 0, height = 0;
/* Make sure there is a current menu set */
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentMenu );
/* The menu's box size depends on the menu entries: */
for( menuEntry = ( SFG_MenuEntry * )fgStructure.Menu->Entries.First;
for( menuEntry = ( SFG_MenuEntry * )fgStructure.CurrentMenu->Entries.First;
menuEntry;
menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
{
@ -695,8 +695,8 @@ void fghCalculateMenuBoxSize( void )
}
/* Store the menu's box size now: */
fgStructure.Menu->Height = height + 2 * FREEGLUT_MENU_BORDER;
fgStructure.Menu->Width = width + 4 * FREEGLUT_MENU_BORDER;
fgStructure.CurrentMenu->Height = height + 2 * FREEGLUT_MENU_BORDER;
fgStructure.CurrentMenu->Width = width + 4 * FREEGLUT_MENU_BORDER;
}
@ -735,8 +735,8 @@ int FGAPIENTRY glutGetMenu( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetMenu" );
if( fgStructure.Menu )
return fgStructure.Menu->ID;
if( fgStructure.CurrentMenu )
return fgStructure.CurrentMenu->ID;
return 0;
}
@ -753,7 +753,7 @@ void FGAPIENTRY glutSetMenu( int menuID )
freeglut_return_if_fail( menu );
fgStructure.Menu = menu;
fgStructure.CurrentMenu = menu;
}
/*
@ -764,13 +764,13 @@ void FGAPIENTRY glutAddMenuEntry( const char* label, int value )
SFG_MenuEntry* menuEntry;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutAddMenuEntry" );
menuEntry = (SFG_MenuEntry *)calloc( sizeof(SFG_MenuEntry), 1 );
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentMenu );
menuEntry->Text = strdup( label );
menuEntry->ID = value;
/* Have the new menu entry attached to the current menu */
fgListAppend( &fgStructure.Menu->Entries, &menuEntry->Node );
fgListAppend( &fgStructure.CurrentMenu->Entries, &menuEntry->Node );
fghCalculateMenuBoxSize( );
}
@ -787,14 +787,14 @@ void FGAPIENTRY glutAddSubMenu( const char *label, int subMenuID )
menuEntry = ( SFG_MenuEntry * )calloc( sizeof( SFG_MenuEntry ), 1 );
subMenu = fgMenuByID( subMenuID );
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentMenu );
freeglut_return_if_fail( subMenu );
menuEntry->Text = strdup( label );
menuEntry->SubMenu = subMenu;
menuEntry->ID = -1;
fgListAppend( &fgStructure.Menu->Entries, &menuEntry->Node );
fgListAppend( &fgStructure.CurrentMenu->Entries, &menuEntry->Node );
fghCalculateMenuBoxSize( );
}
@ -806,10 +806,10 @@ void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value )
SFG_MenuEntry* menuEntry = NULL;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutChangeToMenuEntry" );
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentMenu );
/* Get n-th menu entry in the current menu, starting from one: */
menuEntry = fghFindMenuEntry( fgStructure.Menu, item );
menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );
freeglut_return_if_fail( menuEntry );
@ -836,11 +836,11 @@ void FGAPIENTRY glutChangeToSubMenu( int item, const char* label,
subMenu = fgMenuByID( subMenuID );
menuEntry = NULL;
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentMenu );
freeglut_return_if_fail( subMenu );
/* Get n-th menu entry in the current menu, starting from one: */
menuEntry = fghFindMenuEntry( fgStructure.Menu, item );
menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );
freeglut_return_if_fail( menuEntry );
@ -862,14 +862,14 @@ void FGAPIENTRY glutRemoveMenuItem( int item )
SFG_MenuEntry* menuEntry;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutRemoveMenuItem" );
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentMenu );
/* Get n-th menu entry in the current menu, starting from one: */
menuEntry = fghFindMenuEntry( fgStructure.Menu, item );
menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );
freeglut_return_if_fail( menuEntry );
fgListRemove( &fgStructure.Menu->Entries, &menuEntry->Node );
fgListRemove( &fgStructure.CurrentMenu->Entries, &menuEntry->Node );
if ( menuEntry->Text )
free( menuEntry->Text );
@ -884,13 +884,13 @@ void FGAPIENTRY glutAttachMenu( int button )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutAttachMenu" );
freeglut_return_if_fail( fgStructure.Window );
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentWindow );
freeglut_return_if_fail( fgStructure.CurrentMenu );
freeglut_return_if_fail( button >= 0 );
freeglut_return_if_fail( button < FREEGLUT_MAX_MENUS );
fgStructure.Window->Menu[ button ] = fgStructure.Menu;
fgStructure.CurrentWindow->Menu[ button ] = fgStructure.CurrentMenu;
}
/*
@ -900,13 +900,13 @@ void FGAPIENTRY glutDetachMenu( int button )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDetachMenu" );
freeglut_return_if_fail( fgStructure.Window );
freeglut_return_if_fail( fgStructure.Menu );
freeglut_return_if_fail( fgStructure.CurrentWindow );
freeglut_return_if_fail( fgStructure.CurrentMenu );
freeglut_return_if_fail( button >= 0 );
freeglut_return_if_fail( button < FREEGLUT_MAX_MENUS );
fgStructure.Window->Menu[ button ] = NULL;
fgStructure.CurrentWindow->Menu[ button ] = NULL;
}
/*
@ -915,13 +915,13 @@ void FGAPIENTRY glutDetachMenu( int button )
void* FGAPIENTRY glutGetMenuData( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetMenuData" );
return fgStructure.Menu->UserData;
return fgStructure.CurrentMenu->UserData;
}
void FGAPIENTRY glutSetMenuData(void* data)
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetMenuData" );
fgStructure.Menu->UserData=data;
fgStructure.CurrentMenu->UserData=data;
}
/*** END OF FILE ***/

View File

@ -51,7 +51,7 @@ int FGAPIENTRY glutExtensionSupported( const char* extension )
/* Make sure there is a current window, and thus a current context available */
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutExtensionSupported" );
freeglut_return_val_if_fail( fgStructure.Window != NULL, 0 );
freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 );
if (strchr(extension, ' '))
return 0;
@ -95,7 +95,7 @@ void FGAPIENTRY glutIgnoreKeyRepeat( int ignore )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutIgnoreKeyRepeat" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutIgnoreKeyRepeat" );
fgStructure.Window->State.IgnoreKeyRepeat = ignore ? GL_TRUE : GL_FALSE;
fgStructure.CurrentWindow->State.IgnoreKeyRepeat = ignore ? GL_TRUE : GL_FALSE;
}
/*
@ -134,9 +134,9 @@ void FGAPIENTRY glutForceJoystickFunc( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutForceJoystickFunc" );
#if !TARGET_HOST_WINCE
freeglut_return_if_fail( fgStructure.Window != NULL );
freeglut_return_if_fail( FETCH_WCB( *( fgStructure.Window ), Joystick ) );
fgJoystickPollWindow( fgStructure.Window );
freeglut_return_if_fail( fgStructure.CurrentWindow != NULL );
freeglut_return_if_fail( FETCH_WCB( *( fgStructure.CurrentWindow ), Joystick ) );
fgJoystickPollWindow( fgStructure.CurrentWindow );
#endif /* !TARGET_HOST_WINCE */
}

View File

@ -53,8 +53,8 @@ static int fghGetConfig( int attribute )
{
int returnValue = 0;
if( fgStructure.Window )
glXGetConfig( fgDisplay.Display, fgStructure.Window->Window.VisualInfo,
if( fgStructure.CurrentWindow )
glXGetConfig( fgDisplay.Display, fgStructure.CurrentWindow->Window.VisualInfo,
attribute, &returnValue );
return returnValue;
@ -109,8 +109,8 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
break;
case GLUT_WINDOW_CURSOR:
if( fgStructure.Window != NULL )
fgStructure.Window->State.Cursor = value;
if( fgStructure.CurrentWindow != NULL )
fgStructure.CurrentWindow->State.Cursor = value;
break;
default:
@ -188,7 +188,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* Colormap size is handled in a bit different way than all the rest */
case GLUT_WINDOW_COLORMAP_SIZE:
if( (fghGetConfig( GLX_RGBA )) || (fgStructure.Window == NULL) )
if( (fghGetConfig( GLX_RGBA )) || (fgStructure.CurrentWindow == NULL) )
{
/*
* We've got a RGBA visual, so there is no colormap at all.
@ -196,7 +196,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
*/
return 0;
}
return fgStructure.Window->Window.VisualInfo->visual->map_entries;
return fgStructure.CurrentWindow->Window.VisualInfo->visual->map_entries;
/*
* Those calls are somewhat similiar, as they use XGetWindowAttributes()
@ -210,12 +210,12 @@ int FGAPIENTRY glutGet( GLenum eWhat )
int x, y;
Window w;
if( fgStructure.Window == NULL )
if( fgStructure.CurrentWindow == NULL )
return 0;
XTranslateCoordinates(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
fgDisplay.RootWindow,
0, 0, &x, &y, &w);
@ -229,7 +229,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
return 0;
XTranslateCoordinates(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
w, 0, 0, &x, &y, &w);
switch ( eWhat )
@ -244,11 +244,11 @@ int FGAPIENTRY glutGet( GLenum eWhat )
{
XWindowAttributes winAttributes;
if( fgStructure.Window == NULL )
if( fgStructure.CurrentWindow == NULL )
return 0;
XGetWindowAttributes(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
&winAttributes
);
switch ( eWhat )
@ -264,10 +264,10 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* This is system-dependant */
case GLUT_WINDOW_FORMAT_ID:
if( fgStructure.Window == NULL )
if( fgStructure.CurrentWindow == NULL )
return 0;
return fgStructure.Window->Window.VisualInfo->visualid;
return fgStructure.CurrentWindow->Window.VisualInfo->visualid;
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
@ -351,19 +351,19 @@ int FGAPIENTRY glutGet( GLenum eWhat )
RECT winRect;
freeglut_return_val_if_fail( fgStructure.Window != NULL, 0 );
freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 );
/*
* We need to call GetWindowRect() first...
* (this returns the pixel coordinates of the outside of the window)
*/
GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect );
/* ...then we've got to correct the results we've just received... */
#if !TARGET_HOST_WINCE
if ( ( fgStructure.GameMode != fgStructure.Window ) && ( fgStructure.Window->Parent == NULL ) &&
( ! fgStructure.Window->IsMenu ) )
if ( ( fgStructure.GameMode != fgStructure.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) &&
( ! fgStructure.CurrentWindow->IsMenu ) )
{
winRect.left += GetSystemMetrics( SM_CXSIZEFRAME );
winRect.right -= GetSystemMetrics( SM_CXSIZEFRAME );
@ -400,15 +400,15 @@ int FGAPIENTRY glutGet( GLenum eWhat )
#if TARGET_HOST_WINCE
return GL_FALSE;
#else
return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
PFD_MAIN_PLANE );
#endif /* TARGET_HOST_WINCE */
case GLUT_WINDOW_FORMAT_ID:
#if !TARGET_HOST_WINCE
if( fgStructure.Window != NULL )
return GetPixelFormat( fgStructure.Window->Window.Device );
if( fgStructure.CurrentWindow != NULL )
return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );
#endif /* TARGET_HOST_WINCE */
return 0;
@ -416,24 +416,24 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* The window structure queries */
case GLUT_WINDOW_PARENT:
if( fgStructure.Window == NULL ) return 0;
if( fgStructure.Window->Parent == NULL ) return 0;
return fgStructure.Window->Parent->ID;
if( fgStructure.CurrentWindow == NULL ) return 0;
if( fgStructure.CurrentWindow->Parent == NULL ) return 0;
return fgStructure.CurrentWindow->Parent->ID;
case GLUT_WINDOW_NUM_CHILDREN:
if( fgStructure.Window == NULL )
if( fgStructure.CurrentWindow == NULL )
return 0;
return fgListLength( &fgStructure.Window->Children );
return fgListLength( &fgStructure.CurrentWindow->Children );
case GLUT_WINDOW_CURSOR:
if( fgStructure.Window == NULL )
if( fgStructure.CurrentWindow == NULL )
return 0;
return fgStructure.Window->State.Cursor;
return fgStructure.CurrentWindow->State.Cursor;
case GLUT_MENU_NUM_ITEMS:
if( fgStructure.Menu == NULL )
if( fgStructure.CurrentMenu == NULL )
return 0;
return fgListLength( &fgStructure.Menu->Entries );
return fgListLength( &fgStructure.CurrentMenu->Entries );
case GLUT_ACTION_ON_WINDOW_CLOSE:
return fgState.ActionOnWindowClose;
@ -531,7 +531,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
return fgState.JoysticksInitialised;
case GLUT_JOYSTICK_POLL_RATE:
return fgStructure.Window ? fgStructure.Window->State.JoystickPollRate : 0;
return fgStructure.CurrentWindow ? fgStructure.CurrentWindow->State.JoystickPollRate : 0;
/* XXX The following two are only for Joystick 0 but this is an improvement */
case GLUT_JOYSTICK_BUTTONS:
@ -552,7 +552,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
return 0;
case GLUT_DEVICE_IGNORE_KEY_REPEAT:
return fgStructure.Window ? fgStructure.Window->State.IgnoreKeyRepeat : 0;
return fgStructure.CurrentWindow ? fgStructure.CurrentWindow->State.IgnoreKeyRepeat : 0;
case GLUT_DEVICE_KEY_REPEAT:
return fgState.KeyRepeat;
@ -626,7 +626,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
case GLUT_OVERLAY_POSSIBLE:
/* return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
/* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
PFD_OVERLAY_PLANE ); */
return FALSE ;

View File

@ -110,7 +110,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
{
int x = 100, y = 100, w = 100, h = 100;
SFG_Window *current_window = fgStructure.Window;
SFG_Window *current_window = fgStructure.CurrentWindow;
/* Have the menu object created */
SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );
@ -120,7 +120,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
/* Create a window for the menu to reside in. */
fgCreateWindow( NULL, "freeglut menu", x, y, w, h, GL_FALSE, GL_TRUE );
menu->Window = fgStructure.Window;
menu->Window = fgStructure.CurrentWindow;
glutDisplayFunc( fgDisplayMenu );
glutHideWindow( ); /* Hide the window for now */
@ -135,7 +135,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
fgListAppend( &fgStructure.Menus, &menu->Node );
/* Newly created menus implicitly become current ones */
fgStructure.Menu = menu;
fgStructure.CurrentMenu = menu;
return menu;
}
@ -153,8 +153,8 @@ void fgAddToWindowDestroyList( SFG_Window* window )
fgListAppend( &fgStructure.WindowsToDestroy, &new_list_entry->node );
/* Check if the window is the current one... */
if( fgStructure.Window == window )
fgStructure.Window = NULL;
if( fgStructure.CurrentWindow == window )
fgStructure.CurrentWindow = NULL;
/*
* Clear all window callbacks except Destroy, which will
@ -199,7 +199,7 @@ void fgDestroyWindow( SFG_Window* window )
fgDestroyWindow( ( SFG_Window * )window->Children.First );
{
SFG_Window *activeWindow = fgStructure.Window;
SFG_Window *activeWindow = fgStructure.CurrentWindow;
INVOKE_WCB( *window, Destroy, ( ) );
fgSetWindow( activeWindow );
}
@ -215,8 +215,8 @@ void fgDestroyWindow( SFG_Window* window )
fghClearCallBacks( window );
fgCloseWindow( window );
free( window );
if( fgStructure.Window == window )
fgStructure.Window = NULL;
if( fgStructure.CurrentWindow == window )
fgStructure.CurrentWindow = NULL;
}
/*
@ -292,10 +292,10 @@ void fgDestroyMenu( SFG_Menu* menu )
*/
if( menu->Destroy )
{
SFG_Menu *activeMenu=fgStructure.Menu;
fgStructure.Menu = menu;
SFG_Menu *activeMenu=fgStructure.CurrentMenu;
fgStructure.CurrentMenu = menu;
menu->Destroy( );
fgStructure.Menu = activeMenu;
fgStructure.CurrentMenu = activeMenu;
}
/*
@ -315,12 +315,12 @@ void fgDestroyMenu( SFG_Menu* menu )
free( entry );
}
if( fgStructure.Window == menu->Window )
if( fgStructure.CurrentWindow == menu->Window )
fgSetWindow( NULL );
fgDestroyWindow( menu->Window );
fgListRemove( &fgStructure.Menus, &menu->Node );
if( fgStructure.Menu == menu )
fgStructure.Menu = NULL;
if( fgStructure.CurrentMenu == menu )
fgStructure.CurrentMenu = NULL;
free( menu );
}

View File

@ -259,9 +259,9 @@ void fgSetWindow ( SFG_Window *window )
window->Window.Context
);
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
if( fgStructure.Window )
ReleaseDC( fgStructure.Window->Window.Handle,
fgStructure.Window->Window.Device );
if( fgStructure.CurrentWindow )
ReleaseDC( fgStructure.CurrentWindow->Window.Handle,
fgStructure.CurrentWindow->Window.Device );
if ( window )
{
@ -272,7 +272,7 @@ void fgSetWindow ( SFG_Window *window )
);
}
#endif
fgStructure.Window = window;
fgStructure.CurrentWindow = window;
}
@ -623,7 +623,7 @@ void fgCloseWindow( SFG_Window* window )
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
/* Make sure we don't close a window with current context active */
if( fgStructure.Window == window )
if( fgStructure.CurrentWindow == window )
wglMakeCurrent( NULL, NULL );
/*
@ -708,8 +708,8 @@ void FGAPIENTRY glutSetWindow( int ID )
SFG_Window* window = NULL;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetWindow" );
if( fgStructure.Window != NULL )
if( fgStructure.Window->ID == ID )
if( fgStructure.CurrentWindow != NULL )
if( fgStructure.CurrentWindow->ID == ID )
return;
window = fgWindowByID( ID );
@ -728,9 +728,9 @@ void FGAPIENTRY glutSetWindow( int ID )
int FGAPIENTRY glutGetWindow( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetWindow" );
if( fgStructure.Window == NULL )
if( fgStructure.CurrentWindow == NULL )
return 0;
return fgStructure.Window->ID;
return fgStructure.CurrentWindow->ID;
}
/*
@ -743,16 +743,16 @@ void FGAPIENTRY glutShowWindow( void )
#if TARGET_HOST_UNIX_X11
XMapWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
XMapWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
ShowWindow( fgStructure.Window->Window.Handle, SW_SHOW );
ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_SHOW );
#endif
fgStructure.Window->State.Redisplay = GL_TRUE;
fgStructure.CurrentWindow->State.Redisplay = GL_TRUE;
}
/*
@ -765,22 +765,22 @@ void FGAPIENTRY glutHideWindow( void )
#if TARGET_HOST_UNIX_X11
if( fgStructure.Window->Parent == NULL )
if( fgStructure.CurrentWindow->Parent == NULL )
XWithdrawWindow( fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
fgDisplay.Screen );
else
XUnmapWindow( fgDisplay.Display,
fgStructure.Window->Window.Handle );
fgStructure.CurrentWindow->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
ShowWindow( fgStructure.Window->Window.Handle, SW_HIDE );
ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_HIDE );
#endif
fgStructure.Window->State.Redisplay = GL_FALSE;
fgStructure.CurrentWindow->State.Redisplay = GL_FALSE;
}
/*
@ -791,20 +791,20 @@ void FGAPIENTRY glutIconifyWindow( void )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutIconifyWindow" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutIconifyWindow" );
fgStructure.Window->State.Visible = GL_FALSE;
fgStructure.CurrentWindow->State.Visible = GL_FALSE;
#if TARGET_HOST_UNIX_X11
XIconifyWindow( fgDisplay.Display, fgStructure.Window->Window.Handle,
XIconifyWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
fgDisplay.Screen );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
ShowWindow( fgStructure.Window->Window.Handle, SW_MINIMIZE );
ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_MINIMIZE );
#endif
fgStructure.Window->State.Redisplay = GL_FALSE;
fgStructure.CurrentWindow->State.Redisplay = GL_FALSE;
}
/*
@ -814,7 +814,7 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetWindowTitle" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetWindowTitle" );
if( ! fgStructure.Window->Parent )
if( ! fgStructure.CurrentWindow->Parent )
{
#if TARGET_HOST_UNIX_X11
@ -827,7 +827,7 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
XSetWMName(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
&text
);
@ -835,13 +835,13 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
#elif TARGET_HOST_WIN32
SetWindowText( fgStructure.Window->Window.Handle, title );
SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
#elif TARGET_HOST_WINCE
{
wchar_t* wstr = fghWstrFromStr(title);
SetWindowText( fgStructure.Window->Window.Handle, wstr );
SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr );
free(wstr);
}
@ -857,7 +857,7 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetIconTitle" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetIconTitle" );
if( ! fgStructure.Window->Parent )
if( ! fgStructure.CurrentWindow->Parent )
{
#if TARGET_HOST_UNIX_X11
@ -870,7 +870,7 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
XSetWMIconName(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
&text
);
@ -878,13 +878,13 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
#elif TARGET_HOST_WIN32
SetWindowText( fgStructure.Window->Window.Handle, title );
SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
#elif TARGET_HOST_WINCE
{
wchar_t* wstr = fghWstrFromStr(title);
SetWindowText( fgStructure.Window->Window.Handle, wstr );
SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr );
free(wstr);
}
@ -900,9 +900,9 @@ void FGAPIENTRY glutReshapeWindow( int width, int height )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutReshapeWindow" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutReshapeWindow" );
fgStructure.Window->State.NeedToResize = GL_TRUE;
fgStructure.Window->State.Width = width ;
fgStructure.Window->State.Height = height;
fgStructure.CurrentWindow->State.NeedToResize = GL_TRUE;
fgStructure.CurrentWindow->State.Width = width ;
fgStructure.CurrentWindow->State.Height = height;
}
/*
@ -915,7 +915,7 @@ void FGAPIENTRY glutPositionWindow( int x, int y )
#if TARGET_HOST_UNIX_X11
XMoveWindow( fgDisplay.Display, fgStructure.Window->Window.Handle,
XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
x, y );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
@ -925,9 +925,9 @@ void FGAPIENTRY glutPositionWindow( int x, int y )
RECT winRect;
/* "GetWindowRect" returns the pixel coordinates of the outside of the window */
GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect );
MoveWindow(
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
x,
y,
winRect.right - winRect.left,
@ -949,12 +949,12 @@ void FGAPIENTRY glutPushWindow( void )
#if TARGET_HOST_UNIX_X11
XLowerWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
XLowerWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SetWindowPos(
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
HWND_BOTTOM,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE
@ -973,12 +973,12 @@ void FGAPIENTRY glutPopWindow( void )
#if TARGET_HOST_UNIX_X11
XRaiseWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
XRaiseWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SetWindowPos(
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
HWND_TOP,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE
@ -1002,7 +1002,7 @@ void FGAPIENTRY glutFullScreen( void )
XMoveResizeWindow(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
0, 0,
fgDisplay.ScreenWidth,
fgDisplay.ScreenHeight
@ -1012,7 +1012,7 @@ void FGAPIENTRY glutFullScreen( void )
XTranslateCoordinates(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
fgDisplay.RootWindow,
0, 0, &x, &y, &w
);
@ -1021,7 +1021,7 @@ void FGAPIENTRY glutFullScreen( void )
{
XMoveWindow(
fgDisplay.Display,
fgStructure.Window->Window.Handle,
fgStructure.CurrentWindow->Window.Handle,
-x, -y
);
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
@ -1049,7 +1049,7 @@ void FGAPIENTRY glutFullScreen( void )
* SWP_NOZORDER Retains the current Z order (ignore 2nd param)
*/
SetWindowPos( fgStructure.Window->Window.Handle,
SetWindowPos( fgStructure.CurrentWindow->Window.Handle,
HWND_TOP,
rect.left,
rect.top,
@ -1069,14 +1069,14 @@ void* FGAPIENTRY glutGetWindowData( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetWindowData" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutGetWindowData" );
return fgStructure.Window->UserData;
return fgStructure.CurrentWindow->UserData;
}
void FGAPIENTRY glutSetWindowData(void* data)
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetWindowData" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetWindowData" );
fgStructure.Window->UserData = data;
fgStructure.CurrentWindow->UserData = data;
}
/*** END OF FILE ***/