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

View File

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

View File

@ -37,7 +37,7 @@ void FGAPIENTRY glutPostRedisplay( void )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "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" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSwapBuffers" );
glFlush( ); glFlush( );
if( ! fgStructure.Window->Window.DoubleBuffered ) if( ! fgStructure.CurrentWindow->Window.DoubleBuffered )
return; return;
#if TARGET_HOST_UNIX_X11 #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 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SwapBuffers( fgStructure.Window->Window.Device ); SwapBuffers( fgStructure.CurrentWindow->Window.Device );
#endif #endif
/* GLUT_FPS env var support */ /* GLUT_FPS env var support */

View File

@ -436,7 +436,7 @@ int FGAPIENTRY glutEnterGameMode( void )
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
/* Move the window up to the topleft corner */ /* 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 * 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 */ /* Get the current postion of the drawable area on screen */
XTranslateCoordinates( XTranslateCoordinates(
fgDisplay.Display, fgDisplay.Display,
fgStructure.Window->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
fgDisplay.RootWindow, fgDisplay.RootWindow,
0, 0, &x, &y, 0, 0, &x, &y,
&child &child
); );
/* Move the decorataions out of the topleft corner of the display */ /* 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); -x, -y);
} }

View File

@ -569,8 +569,8 @@ struct tagSFG_Structure
SFG_List Menus; /* The global menus list */ SFG_List Menus; /* The global menus list */
SFG_List WindowsToDestroy; SFG_List WindowsToDestroy;
SFG_Window* Window; /* The currently active win. */ SFG_Window* CurrentWindow; /* The currently set window */
SFG_Menu* Menu; /* Same, but menu... */ SFG_Menu* CurrentMenu; /* Same, but menu... */
SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */ SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */
@ -693,7 +693,7 @@ extern SFG_State fgState;
* window set, respectively: * window set, respectively:
*/ */
#define FREEGLUT_EXIT_IF_NO_WINDOW( string ) \ #define FREEGLUT_EXIT_IF_NO_WINDOW( string ) \
if ( ! fgStructure.Window ) \ if ( ! fgStructure.CurrentWindow ) \
{ \ { \
fgError ( " ERROR: Function <%s> called" \ fgError ( " ERROR: Function <%s> called" \
" with no current window defined.", (string) ) ; \ " 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 ) 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 ); 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 ) 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( window );
freeglut_return_if_fail( FETCH_WCB ( *window, Display ) ); freeglut_return_if_fail( FETCH_WCB ( *window, Display ) );
@ -1025,7 +1025,7 @@ void FGAPIENTRY glutMainLoop( void )
{ {
if ( FETCH_WCB( *window, Visibility ) ) if ( FETCH_WCB( *window, Visibility ) )
{ {
SFG_Window *current_window = fgStructure.Window ; SFG_Window *current_window = fgStructure.CurrentWindow ;
INVOKE_WCB( *window, Visibility, ( window->State.Visible ) ); INVOKE_WCB( *window, Visibility, ( window->State.Visible ) );
fgSetWindow( current_window ); fgSetWindow( current_window );

View File

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

View File

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

View File

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

View File

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