/*
* 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 )
/*
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 ) )
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;
}
/*
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;
}
/*
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
* 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 )
}
#endif
- fgStructure.Window->State.Cursor = cursorID;
+ fgStructure.CurrentWindow->State.Cursor = cursorID;
}
/*
XWarpPointer(
fgDisplay.Display,
None,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
0, 0, 0, 0,
x, 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 );
}
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPostRedisplay" );
- fgStructure.Window->State.Redisplay = GL_TRUE;
+ fgStructure.CurrentWindow->State.Redisplay = GL_TRUE;
}
/*
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 */
#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
/* 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);
}
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 */
* 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) ) ; \
*/
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 );
*/
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 ) );
{
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 );
*/
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 );
{
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;
*/
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... */
* 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 );
/* Restore the current window and menu */
fgSetWindow( save_window );
- fgStructure.Menu = save_menu;
+ fgStructure.CurrentMenu = save_menu;
}
else if( 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;
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 )
{
}
/* 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;
}
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetMenu" );
- if( fgStructure.Menu )
- return fgStructure.Menu->ID;
+ if( fgStructure.CurrentMenu )
+ return fgStructure.CurrentMenu->ID;
return 0;
}
freeglut_return_if_fail( menu );
- fgStructure.Menu = menu;
+ fgStructure.CurrentMenu = menu;
}
/*
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( );
}
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( );
}
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 );
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 );
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 );
{
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;
}
/*
{
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;
}
/*
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 ***/
/* 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;
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;
}
/*
{
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 */
}
{
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;
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:
/* 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.
*/
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()
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);
return 0;
XTranslateCoordinates(
fgDisplay.Display,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
w, 0, 0, &x, &y, &w);
switch ( 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 )
/* 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
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 );
#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;
/* 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;
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:
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;
#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 ;
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 );
/* 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 */
fgListAppend( &fgStructure.Menus, &menu->Node );
/* Newly created menus implicitly become current ones */
- fgStructure.Menu = menu;
+ fgStructure.CurrentMenu = menu;
return menu;
}
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
fgDestroyWindow( ( SFG_Window * )window->Children.First );
{
- SFG_Window *activeWindow = fgStructure.Window;
+ SFG_Window *activeWindow = fgStructure.CurrentWindow;
INVOKE_WCB( *window, Destroy, ( ) );
fgSetWindow( activeWindow );
}
fghClearCallBacks( window );
fgCloseWindow( window );
free( window );
- if( fgStructure.Window == window )
- fgStructure.Window = NULL;
+ if( fgStructure.CurrentWindow == window )
+ fgStructure.CurrentWindow = NULL;
}
/*
*/
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;
}
/*
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 );
}
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 )
{
);
}
#endif
- fgStructure.Window = window;
+ fgStructure.CurrentWindow = 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 );
/*
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 );
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;
}
/*
#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;
}
/*
#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;
}
/*
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;
}
/*
{
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
XSetWMName(
fgDisplay.Display,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
&text
);
#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);
}
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
XSetWMIconName(
fgDisplay.Display,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
&text
);
#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);
}
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;
}
/*
#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 */
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,
#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
#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
XMoveResizeWindow(
fgDisplay.Display,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
0, 0,
fgDisplay.ScreenWidth,
fgDisplay.ScreenHeight
XTranslateCoordinates(
fgDisplay.Display,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
fgDisplay.RootWindow,
0, 0, &x, &y, &w
);
{
XMoveWindow(
fgDisplay.Display,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
-x, -y
);
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
* 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,
{
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 ***/