git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@514
7f0cb862-5218-0410-a997-
914c9d46530a
-int fgGetCursorError( Cursor cursor )
+static int fghGetCursorError( Cursor cursor )
{
int ret = 0;
char buf[ 256 ];
{
int ret = 0;
char buf[ 256 ];
/*
* Open issues:
* (a) Partial error checking. Is that a problem?
/*
* Open issues:
* (a) Partial error checking. Is that a problem?
- * Is fgGetCursorError() correct? Should we abort on errors?
+ * Is fghGetCursorError() correct? Should we abort on errors?
* Should there be a freeglut-wide X error handler? Should
* we use the X error-handler mechanism?
* (b) FULL_CROSSHAIR demotes to plain CROSSHAIR. Old GLUT allows
* Should there be a freeglut-wide X error handler? Should
* we use the X error-handler mechanism?
* (b) FULL_CROSSHAIR demotes to plain CROSSHAIR. Old GLUT allows
- error = fgGetCursorError( cursor );
+ error = fghGetCursorError( cursor );
if( GLUT_CURSOR_INHERIT == cursorID )
XUndefineCursor( fgDisplay.Display,
if( GLUT_CURSOR_INHERIT == cursorID )
XUndefineCursor( fgDisplay.Display,
* Remembers the current visual settings, so that
* we can change them and restore later...
*/
* Remembers the current visual settings, so that
* we can change them and restore later...
*/
-void fghRememberState( void )
+static void fghRememberState( void )
{
#if TARGET_HOST_UNIX_X11
{
#if TARGET_HOST_UNIX_X11
/*
* Restores the previously remembered visual settings
*/
/*
* Restores the previously remembered visual settings
*/
-void fghRestoreState( void )
+static void fghRestoreState( void )
{
#if TARGET_HOST_UNIX_X11
{
#if TARGET_HOST_UNIX_X11
/*
* Checks the display mode settings against user's preferences
*/
/*
* Checks the display mode settings against user's preferences
*/
-GLboolean fghCheckDisplayMode( int width, int height, int depth, int refresh )
+static GLboolean fghCheckDisplayMode( int width, int height, int depth, int refresh )
{
/* The desired values should be stored in fgState structure... */
return ( width == fgState.GameModeSize.X ) &&
{
/* The desired values should be stored in fgState structure... */
return ( width == fgState.GameModeSize.X ) &&
/*
* Changes the current display mode to match user's settings
*/
/*
* Changes the current display mode to match user's settings
*/
-GLboolean fghChangeDisplayMode( GLboolean haveToTest )
+static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
{
#if TARGET_HOST_UNIX_X11
{
#if TARGET_HOST_UNIX_X11
* The sign of n can be flipped to get the reverse loop
*/
* The sign of n can be flipped to get the reverse loop
*/
-static void circleTable(double **sint,double **cost,const int n)
+static void fghCircleTable(double **sint,double **cost,const int n)
{
free(*sint);
free(*cost);
{
free(*sint);
free(*cost);
- fgError("Failed to allocate memory in circleTable");
+ fgError("Failed to allocate memory in fghCircleTable");
}
/* Compute cos and sin around the circle */
}
/* Compute cos and sin around the circle */
double *sint1,*cost1;
double *sint2,*cost2;
double *sint1,*cost1;
double *sint2,*cost2;
- circleTable(&sint1,&cost1,-slices);
- circleTable(&sint2,&cost2,stacks*2);
+ fghCircleTable(&sint1,&cost1,-slices);
+ fghCircleTable(&sint2,&cost2,stacks*2);
/* The top stack is covered with a triangle fan */
/* The top stack is covered with a triangle fan */
double *sint1,*cost1;
double *sint2,*cost2;
double *sint1,*cost1;
double *sint2,*cost2;
- circleTable(&sint1,&cost1,-slices );
- circleTable(&sint2,&cost2, stacks*2);
+ fghCircleTable(&sint1,&cost1,-slices );
+ fghCircleTable(&sint2,&cost2, stacks*2);
/* Draw a line loop for each stack */
/* Draw a line loop for each stack */
/* Pre-computed circle */
double *sint,*cost;
/* Pre-computed circle */
double *sint,*cost;
- circleTable(&sint,&cost,-slices);
+ fghCircleTable(&sint,&cost,-slices);
/* Cover the circular base with a triangle fan... */
/* Cover the circular base with a triangle fan... */
/* Pre-computed circle */
double *sint,*cost;
/* Pre-computed circle */
double *sint,*cost;
- circleTable(&sint,&cost,-slices);
+ fghCircleTable(&sint,&cost,-slices);
/* Pre-computed circle */
double *sint,*cost;
/* Pre-computed circle */
double *sint,*cost;
- circleTable(&sint,&cost,-slices);
+ fghCircleTable(&sint,&cost,-slices);
/* Cover the base and top */
/* Cover the base and top */
/* Pre-computed circle */
double *sint,*cost;
/* Pre-computed circle */
double *sint,*cost;
- circleTable(&sint,&cost,-slices);
+ fghCircleTable(&sint,&cost,-slices);
/*
* A call to this function should initialize all the display stuff...
*/
/*
* A call to this function should initialize all the display stuff...
*/
-void fgInitialize( const char* displayName )
+static void fghInitialize( const char* displayName )
{
#if TARGET_HOST_UNIX_X11
fgDisplay.Display = XOpenDisplay( displayName );
{
#if TARGET_HOST_UNIX_X11
fgDisplay.Display = XOpenDisplay( displayName );
* in the program arguments, we will use the DISPLAY environment
* variable for opening the X display (see code above):
*/
* in the program arguments, we will use the DISPLAY environment
* variable for opening the X display (see code above):
*/
- fgInitialize( displayName );
+ fghInitialize( displayName );
/*
* Geometry parsing deffered until here because we may need the screen
/*
* Geometry parsing deffered until here because we may need the screen
#define freeglut_assert_menu assert( fgStructure.Menu != NULL );
/*
#define freeglut_assert_menu assert( fgStructure.Menu != NULL );
/*
- * The initialize and deinitialize functions get called on glutInit()
- * and glutMainLoop() end respectively. They should create/clean up
+ * The deinitialize function gets called on glutMainLoop() end. It should clean up
* everything inside of the freeglut
*/
* everything inside of the freeglut
*/
-void fgInitialize( const char* displayName );
void fgDeinitialize( void );
/*
void fgDeinitialize( void );
/*
static void fghJoystickFindDevices ( SFG_Joystick* joy, mach_port_t );
static CFDictionaryRef fghJoystickGetCFProperties ( SFG_Joystick* joy, io_object_t );
static void fghJoystickFindDevices ( SFG_Joystick* joy, mach_port_t );
static CFDictionaryRef fghJoystickGetCFProperties ( SFG_Joystick* joy, io_object_t );
-void fghJoystickEnumerateElements ( SFG_Joystick* joy, CFTypeRef element );
+static void fghJoystickEnumerateElements ( SFG_Joystick* joy, CFTypeRef element );
/* callback for CFArrayApply */
static void fghJoystickElementEnumerator ( SFG_Joystick* joy, void *element, void* vjs );
/* callback for CFArrayApply */
static void fghJoystickElementEnumerator ( SFG_Joystick* joy, void *element, void* vjs );
-void fghJoystickParseElement ( SFG_Joystick* joy, CFDictionaryRef element );
+static void fghJoystickParseElement ( SFG_Joystick* joy, CFDictionaryRef element );
-void fghJoystickAddAxisElement ( SFG_Joystick* joy, CFDictionaryRef axis );
-void fghJoystickAddButtonElement ( SFG_Joystick* joy, CFDictionaryRef button );
-void fghJoystickAddHatElement ( SFG_Joystick* joy, CFDictionaryRef hat );
+static void fghJoystickAddAxisElement ( SFG_Joystick* joy, CFDictionaryRef axis );
+static void fghJoystickAddButtonElement ( SFG_Joystick* joy, CFDictionaryRef button );
+static void fghJoystickAddHatElement ( SFG_Joystick* joy, CFDictionaryRef hat );
* and all other "joystick timer" code can be yanked.
*
*/
* and all other "joystick timer" code can be yanked.
*
*/
-static void fgCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e)
+static void fghCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e)
{
if( FETCH_WCB( *w, Joystick ) )
{
e->found = GL_TRUE;
e->data = w;
}
{
if( FETCH_WCB( *w, Joystick ) )
{
e->found = GL_TRUE;
e->data = w;
}
- fgEnumSubWindows( w, fgCheckJoystickCallback, e );
+ fgEnumSubWindows( w, fghCheckJoystickCallback, e );
-static int fgHaveJoystick( void )
+static int fghHaveJoystick( void )
{
SFG_Enumerator enumerator;
enumerator.found = GL_FALSE;
enumerator.data = NULL;
{
SFG_Enumerator enumerator;
enumerator.found = GL_FALSE;
enumerator.data = NULL;
- fgEnumWindows( fgCheckJoystickCallback, &enumerator );
+ fgEnumWindows( fghCheckJoystickCallback, &enumerator );
return !!enumerator.data;
}
return !!enumerator.data;
}
-static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
+static void fghHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
{
if( w->State.Redisplay )
{
e->found = GL_TRUE;
e->data = w;
}
{
if( w->State.Redisplay )
{
e->found = GL_TRUE;
e->data = w;
}
- fgEnumSubWindows( w, fgHavePendingRedisplaysCallback, e );
+ fgEnumSubWindows( w, fghHavePendingRedisplaysCallback, e );
-static int fgHavePendingRedisplays (void)
+static int fghHavePendingRedisplays (void)
{
SFG_Enumerator enumerator;
enumerator.found = GL_FALSE;
enumerator.data = NULL;
{
SFG_Enumerator enumerator;
enumerator.found = GL_FALSE;
enumerator.data = NULL;
- fgEnumWindows( fgHavePendingRedisplaysCallback, &enumerator );
+ fgEnumWindows( fghHavePendingRedisplaysCallback, &enumerator );
return !!enumerator.data;
}
/*
* Returns the number of GLUT ticks (milliseconds) till the next timer event.
*/
return !!enumerator.data;
}
/*
* Returns the number of GLUT ticks (milliseconds) till the next timer event.
*/
-static long fgNextTimer( void )
+static long fghNextTimer( void )
{
long ret = INT_MAX;
SFG_Timer *timer = fgState.Timers.First;
{
long ret = INT_MAX;
SFG_Timer *timer = fgState.Timers.First;
* Does the magic required to relinquish the CPU until something interesting
* happens.
*/
* Does the magic required to relinquish the CPU until something interesting
* happens.
*/
-static void fgSleepForEvents( void )
+static void fghSleepForEvents( void )
- if( fgState.IdleCallback || fgHavePendingRedisplays( ) )
+ if( fgState.IdleCallback || fghHavePendingRedisplays( ) )
- msec = fgNextTimer( );
- if( fgHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */
- msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
+ msec = fghNextTimer( );
+ if( fghHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */
+ msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
#if TARGET_HOST_UNIX_X11
/*
#if TARGET_HOST_UNIX_X11
/*
/*
* Returns GLUT modifier mask for an XEvent.
*/
/*
* Returns GLUT modifier mask for an XEvent.
*/
-int fgGetXModifiers( XEvent *event )
+static int fghGetXModifiers( XEvent *event )
! FETCH_WCB( *window, MouseWheel ) )
break;
! FETCH_WCB( *window, MouseWheel ) )
break;
- fgState.Modifiers = fgGetXModifiers( &event );
+ fgState.Modifiers = fghGetXModifiers( &event );
/*
* Finally execute the mouse or mouse wheel callback
/*
* Finally execute the mouse or mouse wheel callback
if( keyboard_cb )
{
fgSetWindow( window );
if( keyboard_cb )
{
fgSetWindow( window );
- fgState.Modifiers = fgGetXModifiers( &event );
+ fgState.Modifiers = fghGetXModifiers( &event );
keyboard_cb( asciiCode[ 0 ],
event.xkey.x, event.xkey.y
);
keyboard_cb( asciiCode[ 0 ],
event.xkey.x, event.xkey.y
);
if( special_cb && (special != -1) )
{
fgSetWindow( window );
if( special_cb && (special != -1) )
{
fgSetWindow( window );
- fgState.Modifiers = fgGetXModifiers( &event );
+ fgState.Modifiers = fghGetXModifiers( &event );
special_cb( special, event.xkey.x, event.xkey.y );
fgState.Modifiers = 0xffffffff;
}
special_cb( special, event.xkey.x, event.xkey.y );
fgState.Modifiers = 0xffffffff;
}
if( fgState.IdleCallback )
fgState.IdleCallback( );
if( fgState.IdleCallback )
fgState.IdleCallback( );
/*
* Determine a GLUT modifer mask based on MS-WINDOWS system info.
*/
/*
* Determine a GLUT modifer mask based on MS-WINDOWS system info.
*/
-int fgGetWin32Modifiers (void)
+static int fghGetWin32Modifiers (void)
{
return
( ( ( GetKeyState( VK_LSHIFT ) < 0 ) ||
{
return
( ( ( GetKeyState( VK_LSHIFT ) < 0 ) ||
- fgState.Modifiers = fgGetWin32Modifiers( );
+ fgState.Modifiers = fghGetWin32Modifiers( );
if( ( wParam & MK_LBUTTON ) ||
( wParam & MK_MBUTTON ) ||
if( ( wParam & MK_LBUTTON ) ||
( wParam & MK_MBUTTON ) ||
break;
fgSetWindow( window );
break;
fgSetWindow( window );
- fgState.Modifiers = fgGetWin32Modifiers( );
+ fgState.Modifiers = fghGetWin32Modifiers( );
INVOKE_WCB(
*window, Mouse,
INVOKE_WCB(
*window, Mouse,
break;
fgSetWindow( window );
break;
fgSetWindow( window );
- fgState.Modifiers = fgGetWin32Modifiers( );
+ fgState.Modifiers = fghGetWin32Modifiers( );
while( ticks-- )
if( FETCH_WCB( *window, MouseWheel ) )
while( ticks-- )
if( FETCH_WCB( *window, MouseWheel ) )
* Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly.
*/
* Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly.
*/
- fgState.Modifiers = fgGetWin32Modifiers( );
+ fgState.Modifiers = fghGetWin32Modifiers( );
GetCursorPos( &mouse_pos );
ScreenToClient( window->Window.Handle, &mouse_pos );
GetCursorPos( &mouse_pos );
ScreenToClient( window->Window.Handle, &mouse_pos );
* Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly.
*/
* Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly.
*/
- fgState.Modifiers = fgGetWin32Modifiers( );
+ fgState.Modifiers = fghGetWin32Modifiers( );
GetCursorPos( &mouse_pos );
ScreenToClient( window->Window.Handle, &mouse_pos );
GetCursorPos( &mouse_pos );
ScreenToClient( window->Window.Handle, &mouse_pos );
if( (fgState.KeyRepeat==GLUT_KEY_REPEAT_OFF || window->State.IgnoreKeyRepeat==GL_TRUE) && (HIWORD(lParam) & KF_REPEAT) )
break;
if( (fgState.KeyRepeat==GLUT_KEY_REPEAT_OFF || window->State.IgnoreKeyRepeat==GL_TRUE) && (HIWORD(lParam) & KF_REPEAT) )
break;
- fgState.Modifiers = fgGetWin32Modifiers( );
+ fgState.Modifiers = fghGetWin32Modifiers( );
INVOKE_WCB( *window, Keyboard,
( (char)wParam,
window->State.MouseX, window->State.MouseY )
INVOKE_WCB( *window, Keyboard,
( (char)wParam,
window->State.MouseX, window->State.MouseY )
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
-void fgClearCallBacks( SFG_Window *window )
+static void fghClearCallBacks( SFG_Window *window )
SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
int fakeArgc = 0;
SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
int fakeArgc = 0;
- fgClearCallBacks( window );
+ fghClearCallBacks( window );
/*
* If the freeglut internals haven't been initialized yet,
/*
* If the freeglut internals haven't been initialized yet,
*/
{
FGCBDestroy destroy = FETCH_WCB( *window, Destroy );
*/
{
FGCBDestroy destroy = FETCH_WCB( *window, Destroy );
- fgClearCallBacks( window );
+ fghClearCallBacks( window );
SET_WCB( *window, Destroy, destroy );
}
}
SET_WCB( *window, Destroy, destroy );
}
}
if( window->Menu[ menu_index ] )
window->Menu[ menu_index ]->ParentWindow = NULL;
if( window->Menu[ menu_index ] )
window->Menu[ menu_index ]->ParentWindow = NULL;
- fgClearCallBacks( window );
+ fghClearCallBacks( window );
fgCloseWindow( window );
free( window );
if( fgStructure.Window == window )
fgCloseWindow( window );
free( window );
if( fgStructure.Window == window )
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
-static void teapot( GLint grid, GLdouble scale, GLenum type )
+static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
{
#if TARGET_HOST_WINCE
int i, numV=sizeof(strip_vertices)/4, numI=sizeof(strip_normals)/4;
{
#if TARGET_HOST_WINCE
int i, numV=sizeof(strip_vertices)/4, numI=sizeof(strip_normals)/4;
void FGAPIENTRY glutWireTeapot( GLdouble size )
{
/* We will use the general teapot rendering code */
void FGAPIENTRY glutWireTeapot( GLdouble size )
{
/* We will use the general teapot rendering code */
- teapot( 10, size, GL_LINE );
+ fghTeapot( 10, size, GL_LINE );
void FGAPIENTRY glutSolidTeapot( GLdouble size )
{
/* We will use the general teapot rendering code */
void FGAPIENTRY glutSolidTeapot( GLdouble size )
{
/* We will use the general teapot rendering code */
- teapot( 7, size, GL_FILL );
+ fghTeapot( 7, size, GL_FILL );
#include <aygshell.h>
#pragma comment( lib, "Aygshell.lib" )
#include <aygshell.h>
#pragma comment( lib, "Aygshell.lib" )
-wchar_t* wstr_from_str(const char* str)
+static wchar_t* fghWstrFromStr(const char* str)
{
int i,len=strlen(str);
wchar_t* wstr = (wchar_t*)malloc(2*len+2);
{
int i,len=strlen(str);
wchar_t* wstr = (wchar_t*)malloc(2*len+2);
- wchar_t* wstr = wstr_from_str(title);
+ wchar_t* wstr = fghWstrFromStr(title);
window->Window.Handle = CreateWindow(
_T("FREEGLUT"),
window->Window.Handle = CreateWindow(
_T("FREEGLUT"),
#elif TARGET_HOST_WINCE
{
#elif TARGET_HOST_WINCE
{
- wchar_t* wstr = wstr_from_str(title);
+ wchar_t* wstr = fghWstrFromStr(title);
SetWindowText( fgStructure.Window->Window.Handle, wstr );
SetWindowText( fgStructure.Window->Window.Handle, wstr );
#elif TARGET_HOST_WINCE
{
#elif TARGET_HOST_WINCE
{
- wchar_t* wstr = wstr_from_str(title);
+ wchar_t* wstr = fghWstrFromStr(title);
SetWindowText( fgStructure.Window->Window.Handle, wstr );
SetWindowText( fgStructure.Window->Window.Handle, wstr );