Rationalizing the names of the platform-specific functions so that they begin with "fgPlatform"

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1000 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2012-01-23 05:01:37 +00:00
parent 2b9a6f6732
commit d36338f9f1
16 changed files with 95 additions and 89 deletions

View File

@ -39,8 +39,8 @@
/* -- PRIVATE FUNCTIONS --------------------------------------------------- */ /* -- PRIVATE FUNCTIONS --------------------------------------------------- */
extern void fghSetCursor ( SFG_Window *window, int cursorID ); extern void fgPlatformSetCursor ( SFG_Window *window, int cursorID );
extern void fghWarpPointer ( int x, int y ); extern void fgPlatformWarpPointer ( int x, int y );
#if TARGET_HOST_POSIX_X11 || TARGET_HOST_MAC_OSX || TARGET_HOST_SOLARIS #if TARGET_HOST_POSIX_X11 || TARGET_HOST_MAC_OSX || TARGET_HOST_SOLARIS
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
@ -104,7 +104,7 @@ static cursorCacheEntry cursorCache[] = {
{ XC_bottom_left_corner, None } /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */ { XC_bottom_left_corner, None } /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */
}; };
static void fghSetCursor ( SFG_Window *window, int cursorID ) static void fgPlatformSetCursor ( SFG_Window *window, int cursorID )
{ {
Cursor cursor; Cursor cursor;
/* /*
@ -150,7 +150,7 @@ static void fghSetCursor ( SFG_Window *window, int cursorID )
} }
static void fghWarpPointer ( int x, int y ) static void fgPlatformWarpPointer ( int x, int y )
{ {
XWarpPointer( XWarpPointer(
fgDisplay.Display, fgDisplay.Display,
@ -168,7 +168,7 @@ static void fghWarpPointer ( int x, int y )
/* -- INTERNAL FUNCTIONS ---------------------------------------------------- */ /* -- INTERNAL FUNCTIONS ---------------------------------------------------- */
void fgSetCursor ( SFG_Window *window, int cursorID ) void fgSetCursor ( SFG_Window *window, int cursorID )
{ {
fghSetCursor ( window, cursorID ); fgPlatformSetCursor ( window, cursorID );
} }
@ -182,7 +182,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetCursor" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetCursor" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetCursor" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetCursor" );
fghSetCursor ( fgStructure.CurrentWindow, cursorID ); fgPlatformSetCursor ( fgStructure.CurrentWindow, cursorID );
fgStructure.CurrentWindow->State.Cursor = cursorID; fgStructure.CurrentWindow->State.Cursor = cursorID;
} }
@ -194,7 +194,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWarpPointer" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWarpPointer" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutWarpPointer" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutWarpPointer" );
fghWarpPointer ( x, y ); fgPlatformWarpPointer ( x, y );
} }
/*** END OF FILE ***/ /*** END OF FILE ***/

View File

@ -30,7 +30,7 @@
#include "freeglut_internal.h" #include "freeglut_internal.h"
extern SFG_Proc fghGetProcAddress( const char *procName ); extern SFG_Proc fghGetProcAddress( const char *procName );
extern GLUTproc fghGetPlatformSpecificGLUTProcAddress( const char *procName ); extern GLUTproc fgPlatformGlutGetProcAddress( const char *procName );
static GLUTproc fghGetGLUTProcAddress( const char* procName ) static GLUTproc fghGetGLUTProcAddress( const char* procName )
{ {
@ -223,6 +223,12 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName )
} }
static GLUTproc fgPlatformGlutGetProcAddress( const char* procName )
{
return NULL;
}
SFG_Proc fghGetProcAddress( const char *procName ) SFG_Proc fghGetProcAddress( const char *procName )
{ {
#if defined( GLX_ARB_get_proc_address ) #if defined( GLX_ARB_get_proc_address )
@ -245,7 +251,7 @@ glutGetProcAddress( const char *procName )
/* Some GLUT functions are platform-specific: */ /* Some GLUT functions are platform-specific: */
if ( !p ) if ( !p )
p = fghGetPlatformSpecificGLUTProcAddress( procName ); p = fgPlatformGlutGetProcAddress( procName );
return ( p != NULL ) ? p : fghGetProcAddress( procName ); return ( p != NULL ) ? p : fghGetProcAddress( procName );
} }

View File

@ -39,9 +39,9 @@
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
extern void fghRememberState( void ); extern void fgPlatformRememberState( void );
extern void fghRestoreState( void ); extern void fgPlatformRestoreState( void );
extern GLboolean fghChangeDisplayMode( GLboolean haveToTest ); extern GLboolean fgPlatformChangeDisplayMode( GLboolean haveToTest );
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
@ -163,7 +163,7 @@ static int xrandr_resize(int xsz, int ysz, int rate, int just_checking)
* Remembers the current visual settings, so that * Remembers the current visual settings, so that
* we can change them and restore later... * we can change them and restore later...
*/ */
static void fghRememberState( void ) static void fgPlatformRememberState( void )
{ {
int event_base, error_base; int event_base, error_base;
@ -248,7 +248,7 @@ static void fghRememberState( void )
/* /*
* Restores the previously remembered visual settings * Restores the previously remembered visual settings
*/ */
static void fghRestoreState( void ) static void fgPlatformRestoreState( void )
{ {
/* Restore the remembered pointer position: */ /* Restore the remembered pointer position: */
XWarpPointer( XWarpPointer(
@ -398,7 +398,7 @@ static int fghCheckDisplayModes( GLboolean exactMatch, int displayModesCount, XF
/* /*
* Changes the current display mode to match user's settings * Changes the current display mode to match user's settings
*/ */
static GLboolean fghChangeDisplayMode( GLboolean haveToTest ) static GLboolean fgPlatformChangeDisplayMode( GLboolean haveToTest )
{ {
GLboolean success = GL_FALSE; GLboolean success = GL_FALSE;
/* first try to use XRandR, then fallback to XF86VidMode */ /* first try to use XRandR, then fallback to XF86VidMode */
@ -532,7 +532,7 @@ void FGAPIENTRY glutGameModeString( const char* string )
/* All values not specified are now set to -1, which means those /* All values not specified are now set to -1, which means those
* aspects of the current display mode are not changed in * aspects of the current display mode are not changed in
* fghChangeDisplayMode() above. * fgPlatformChangeDisplayMode() above.
*/ */
fgState.GameModeSize.X = width; fgState.GameModeSize.X = width;
fgState.GameModeSize.Y = height; fgState.GameModeSize.Y = height;
@ -552,9 +552,9 @@ int FGAPIENTRY glutEnterGameMode( void )
if( fgStructure.GameModeWindow ) if( fgStructure.GameModeWindow )
fgAddToWindowDestroyList( fgStructure.GameModeWindow ); fgAddToWindowDestroyList( fgStructure.GameModeWindow );
else else
fghRememberState( ); fgPlatformRememberState( );
if( ! fghChangeDisplayMode( GL_FALSE ) ) if( ! fgPlatformChangeDisplayMode( GL_FALSE ) )
{ {
fgWarning( "failed to change screen settings" ); fgWarning( "failed to change screen settings" );
return 0; return 0;
@ -680,7 +680,7 @@ void FGAPIENTRY glutLeaveGameMode( void )
#endif #endif
fghRestoreState(); fgPlatformRestoreState();
} }
/* /*
@ -696,7 +696,7 @@ int FGAPIENTRY glutGameModeGet( GLenum eWhat )
return !!fgStructure.GameModeWindow; return !!fgStructure.GameModeWindow;
case GLUT_GAME_MODE_POSSIBLE: case GLUT_GAME_MODE_POSSIBLE:
return fghChangeDisplayMode( GL_TRUE ); return fgPlatformChangeDisplayMode( GL_TRUE );
case GLUT_GAME_MODE_WIDTH: case GLUT_GAME_MODE_WIDTH:
return fgState.GameModeSize.X; return fgState.GameModeSize.X;

View File

@ -100,9 +100,9 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
extern void fghInitialize( const char* displayName ); extern void fgPlatformInitialize( const char* displayName );
extern void fghDeinitialiseInputDevices ( void ); extern void fgPlatformDeinitialiseInputDevices ( void );
extern void fghCloseDisplay ( void ); extern void fgPlatformCloseDisplay ( void );
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
@ -246,7 +246,7 @@ int fgHintPresent(Window window, Atom property, Atom hint)
/* /*
* A call to this function should initialize all the display stuff... * A call to this function should initialize all the display stuff...
*/ */
static void fghInitialize( const char* displayName ) static void fgPlatformInitialize( const char* displayName )
{ {
fgDisplay.Display = XOpenDisplay( displayName ); fgDisplay.Display = XOpenDisplay( displayName );
@ -437,7 +437,7 @@ void fghCloseInputDevices ( void )
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
static void fghDeinitialiseInputDevices ( void ) static void fgPlatformDeinitialiseInputDevices ( void )
{ {
fghCloseInputDevices (); fghCloseInputDevices ();
@ -446,7 +446,7 @@ static void fghDeinitialiseInputDevices ( void )
} }
static void fghCloseDisplay ( void ) static void fgPlatformCloseDisplay ( void )
{ {
/* /*
* Make sure all X-client data we have created will be destroyed on * Make sure all X-client data we have created will be destroyed on
@ -506,7 +506,7 @@ void fgDeinitialize( void )
free( timer ); free( timer );
} }
fghDeinitialiseInputDevices (); fgPlatformDeinitialiseInputDevices ();
fgState.MouseWheelTicks = 0; fgState.MouseWheelTicks = 0;
@ -560,7 +560,7 @@ void fgDeinitialize( void )
fgState.ProgramName = NULL; fgState.ProgramName = NULL;
} }
fghCloseDisplay (); fgPlatformCloseDisplay ();
fgState.Initialised = GL_FALSE; fgState.Initialised = GL_FALSE;
} }
@ -617,7 +617,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
* in the program arguments, we will use the DISPLAY environment * in the program arguments, we will use the DISPLAY environment
* variable for opening the X display (see code above): * variable for opening the X display (see code above):
*/ */
fghInitialize( displayName ); fgPlatformInitialize( displayName );
/* /*
* Geometry parsing deffered until here because we may need the screen * Geometry parsing deffered until here because we may need the screen

View File

@ -99,7 +99,7 @@ extern int serial_getchar ( SERIALPORT *port );
extern int serial_putchar ( SERIALPORT *port, unsigned char ch ); extern int serial_putchar ( SERIALPORT *port, unsigned char ch );
extern void serial_flush ( SERIALPORT *port ); extern void serial_flush ( SERIALPORT *port );
extern void fghRegisterDialDevice ( const char *dial_device ); extern void fgPlatformRegisterDialDevice ( const char *dial_device );
static void send_dial_event(int dial, int value); static void send_dial_event(int dial, int value);
static void poll_dials(int id); static void poll_dials(int id);
@ -128,7 +128,7 @@ int fgInputDeviceDetect( void )
* Try initializing the input device(s) * Try initializing the input device(s)
*/ */
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
static void fghRegisterDialDevice ( const char *dial_device ) static void fgPlatformRegisterDialDevice ( const char *dial_device )
{ {
} }
#endif #endif
@ -139,7 +139,7 @@ void fgInitialiseInputDevices ( void )
{ {
const char *dial_device=NULL; const char *dial_device=NULL;
dial_device = getenv ( "GLUT_DIALS_SERIAL" ); dial_device = getenv ( "GLUT_DIALS_SERIAL" );
fghRegisterDialDevice ( dial_device ); fgPlatformRegisterDialDevice ( dial_device );
if ( !dial_device ) return; if ( !dial_device ) return;
if ( !( dialbox_port = serial_open ( dial_device ) ) ) return; if ( !( dialbox_port = serial_open ( dial_device ) ) ) return;

View File

@ -859,7 +859,7 @@ GLXFBConfig* fgChooseFBConfig( int* numcfgs );
/* The window procedure for Win32 events handling */ /* The window procedure for Win32 events handling */
#if TARGET_HOST_MS_WINDOWS #if TARGET_HOST_MS_WINDOWS
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam ); WPARAM wParam, LPARAM lParam );
void fgNewWGLCreateContext( SFG_Window* window ); void fgNewWGLCreateContext( SFG_Window* window );
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,

View File

@ -77,11 +77,11 @@ struct GXKeyList gxKeyList;
static pCloseTouchInputHandle fghCloseTouchInputHandle = (pCloseTouchInputHandle)0xDEADBEEF; static pCloseTouchInputHandle fghCloseTouchInputHandle = (pCloseTouchInputHandle)0xDEADBEEF;
#endif #endif
extern void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height ); extern void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height );
extern void fghcbPlatformDisplayWindow ( SFG_Window *window ); extern void fgPlatformDisplayWindow ( SFG_Window *window );
extern void fghPlatformSleepForEvents( long msec ); extern void fgPlatformSleepForEvents( long msec );
extern void fghProcessSingleEvent ( void ); extern void fgPlatformProcessSingleEvent ( void );
extern void fghMainLoopPreliminaryWork ( void ); extern void fgPlatformMainLoopPreliminaryWork ( void );
/* /*
@ -103,7 +103,7 @@ extern void fghMainLoopPreliminaryWork ( void );
* match the new window size. * match the new window size.
*/ */
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
static void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height ) static void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height )
{ {
XResizeWindow( fgDisplay.Display, window->Window.Handle, XResizeWindow( fgDisplay.Display, window->Window.Handle,
width, height ); width, height );
@ -117,7 +117,7 @@ static void fghReshapeWindow ( SFG_Window *window, int width, int height )
freeglut_return_if_fail( window != NULL ); freeglut_return_if_fail( window != NULL );
fghPlatformReshapeWindow ( window, width, height ); fgPlatformReshapeWindow ( window, width, height );
if( FETCH_WCB( *window, Reshape ) ) if( FETCH_WCB( *window, Reshape ) )
INVOKE_WCB( *window, Reshape, ( width, height ) ); INVOKE_WCB( *window, Reshape, ( width, height ) );
@ -177,7 +177,7 @@ void fghRedrawWindow ( SFG_Window *window )
* A static helper function to execute display callback for a window * A static helper function to execute display callback for a window
*/ */
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
static void fghcbPlatformDisplayWindow ( SFG_Window *window ) static void fgPlatformDisplayWindow ( SFG_Window *window )
{ {
fghRedrawWindow ( window ) ; fghRedrawWindow ( window ) ;
} }
@ -190,7 +190,7 @@ static void fghcbDisplayWindow( SFG_Window *window,
window->State.Visible ) window->State.Visible )
{ {
window->State.Redisplay = GL_FALSE; window->State.Redisplay = GL_FALSE;
fghcbPlatformDisplayWindow ( window ); fgPlatformDisplayWindow ( window );
} }
fgEnumSubWindows( window, fghcbDisplayWindow, enumerator ); fgEnumSubWindows( window, fghcbDisplayWindow, enumerator );
@ -423,7 +423,7 @@ static long fghNextTimer( void )
*/ */
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
static void fghPlatformSleepForEvents( long msec ) static void fgPlatformSleepForEvents( long msec )
{ {
/* /*
* Possibly due to aggressive use of XFlush() and friends, * Possibly due to aggressive use of XFlush() and friends,
@ -469,14 +469,14 @@ static void fghSleepForEvents( void )
if( fghHaveJoystick( ) && ( msec > 10 ) ) if( fghHaveJoystick( ) && ( msec > 10 ) )
msec = 10; msec = 10;
fghPlatformSleepForEvents ( msec ); fgPlatformSleepForEvents ( msec );
} }
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* Returns GLUT modifier mask for the state field of an X11 event. * Returns GLUT modifier mask for the state field of an X11 event.
*/ */
int fghGetModifiers( int state ) int fgPlatformGetModifiers( int state )
{ {
int ret = 0; int ret = 0;
@ -933,7 +933,7 @@ static void fghPrintEvent( XEvent *event )
} }
void fghProcessSingleEvent ( void ) void fgPlatformProcessSingleEvent ( void )
{ {
SFG_Window* window; SFG_Window* window;
XEvent event; XEvent event;
@ -1147,7 +1147,7 @@ void fghProcessSingleEvent ( void )
* XXX track ButtonPress/ButtonRelease events in our own * XXX track ButtonPress/ButtonRelease events in our own
* XXX bit-mask? * XXX bit-mask?
*/ */
fgState.Modifiers = fghGetModifiers( event.xmotion.state ); fgState.Modifiers = fgPlatformGetModifiers( event.xmotion.state );
if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) { if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) {
INVOKE_WCB( *window, Motion, ( event.xmotion.x, INVOKE_WCB( *window, Motion, ( event.xmotion.x,
event.xmotion.y ) ); event.xmotion.y ) );
@ -1201,7 +1201,7 @@ void fghProcessSingleEvent ( void )
! FETCH_WCB( *window, MouseWheel ) ) ! FETCH_WCB( *window, MouseWheel ) )
break; break;
fgState.Modifiers = fghGetModifiers( event.xbutton.state ); fgState.Modifiers = fgPlatformGetModifiers( event.xbutton.state );
/* Finally execute the mouse or mouse wheel callback */ /* Finally execute the mouse or mouse wheel callback */
if( ( button < glutDeviceGet ( GLUT_NUM_MOUSE_BUTTONS ) ) || ( ! FETCH_WCB( *window, MouseWheel ) ) ) if( ( button < glutDeviceGet ( GLUT_NUM_MOUSE_BUTTONS ) ) || ( ! FETCH_WCB( *window, MouseWheel ) ) )
@ -1316,7 +1316,7 @@ void fghProcessSingleEvent ( void )
if( keyboard_cb ) if( keyboard_cb )
{ {
fgSetWindow( window ); fgSetWindow( window );
fgState.Modifiers = fghGetModifiers( event.xkey.state ); fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );
keyboard_cb( asciiCode[ 0 ], keyboard_cb( asciiCode[ 0 ],
event.xkey.x, event.xkey.y event.xkey.x, event.xkey.y
); );
@ -1385,7 +1385,7 @@ void fghProcessSingleEvent ( void )
if( special_cb && (special != -1) ) if( special_cb && (special != -1) )
{ {
fgSetWindow( window ); fgSetWindow( window );
fgState.Modifiers = fghGetModifiers( event.xkey.state ); fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );
special_cb( special, event.xkey.x, event.xkey.y ); special_cb( special, event.xkey.x, event.xkey.y );
fgState.Modifiers = INVALID_MODIFIERS; fgState.Modifiers = INVALID_MODIFIERS;
} }
@ -1412,7 +1412,7 @@ void fghProcessSingleEvent ( void )
} }
static void fghMainLoopPreliminaryWork ( void ) static void fgPlatformMainLoopPreliminaryWork ( void )
{ {
} }
#endif #endif
@ -1424,7 +1424,7 @@ static void fghMainLoopPreliminaryWork ( void )
*/ */
void FGAPIENTRY glutMainLoopEvent( void ) void FGAPIENTRY glutMainLoopEvent( void )
{ {
fghProcessSingleEvent (); fgPlatformProcessSingleEvent ();
if( fgState.Timers.First ) if( fgState.Timers.First )
fghCheckTimers( ); fghCheckTimers( );
@ -1444,7 +1444,7 @@ void FGAPIENTRY glutMainLoop( void )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMainLoop" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMainLoop" );
fghMainLoopPreliminaryWork (); fgPlatformMainLoopPreliminaryWork ();
fgState.ExecState = GLUT_EXEC_STATE_RUNNING ; fgState.ExecState = GLUT_EXEC_STATE_RUNNING ;
while( fgState.ExecState == GLUT_EXEC_STATE_RUNNING ) while( fgState.ExecState == GLUT_EXEC_STATE_RUNNING )

View File

@ -85,7 +85,7 @@ static float menu_pen_hback [4] = {1.0f, 1.0f, 1.0f, 1.0f};
#endif #endif
extern GLvoid fghGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y ); extern GLvoid fgPlatformGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y );
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
@ -143,7 +143,7 @@ static void fghDeactivateSubMenu( SFG_MenuEntry *menuEntry )
* Private function to get the virtual maximum screen extent * Private function to get the virtual maximum screen extent
*/ */
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11
static GLvoid fghGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y ) static GLvoid fgPlatformGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y )
{ {
int wx, wy; int wx, wy;
Window w; Window w;
@ -163,7 +163,7 @@ static GLvoid fghGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y )
static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y ) static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
{ {
if( fgStructure.GameModeWindow ) if( fgStructure.GameModeWindow )
fghGetGameModeVMaxExtent ( window, x, y ); fgPlatformGetGameModeVMaxExtent ( window, x, y );
else else
{ {
*x = fgDisplay.ScreenWidth; *x = fgDisplay.ScreenWidth;

View File

@ -14,7 +14,7 @@
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
/* import function from freeglut_main.c */ /* import function from freeglut_main.c */
int fghGetModifiers( int state ); extern int fgPlatformGetModifiers( int state );
/* extension opcode for XInput */ /* extension opcode for XInput */
int xi_opcode = -1; int xi_opcode = -1;
@ -160,7 +160,7 @@ void fgHandleExtensionEvents( XEvent* base_ev ) {
case XI_Enter: case XI_Enter:
case XI_Leave: case XI_Leave:
fgState.Modifiers = fghGetModifiers( ((XIEnterEvent*)event)->mods.base ); fgState.Modifiers = fgPlatformGetModifiers( ((XIEnterEvent*)event)->mods.base );
INVOKE_WCB( *window, MultiEntry, ( INVOKE_WCB( *window, MultiEntry, (
event->deviceid, event->deviceid,
(event->evtype == XI_Enter ? GLUT_ENTERED : GLUT_LEFT) (event->evtype == XI_Enter ? GLUT_ENTERED : GLUT_LEFT)
@ -172,7 +172,7 @@ void fgHandleExtensionEvents( XEvent* base_ev ) {
case XI_ButtonPress: case XI_ButtonPress:
case XI_ButtonRelease: case XI_ButtonRelease:
fgState.Modifiers = fghGetModifiers( event->mods.base ); fgState.Modifiers = fgPlatformGetModifiers( event->mods.base );
INVOKE_WCB( *window, MultiButton, ( INVOKE_WCB( *window, MultiButton, (
event->deviceid, event->deviceid,
event->event_x, event->event_x,
@ -189,7 +189,7 @@ void fgHandleExtensionEvents( XEvent* base_ev ) {
break; break;
case XI_Motion: case XI_Motion:
fgState.Modifiers = fghGetModifiers( event->mods.base ); fgState.Modifiers = fgPlatformGetModifiers( event->mods.base );
for (i = 0; i < event->buttons.mask_len; i++) if (event->buttons.mask[i]) button = 1; for (i = 0; i < event->buttons.mask_len; i++) if (event->buttons.mask[i]) button = 1;
if (button) { if (button) {
INVOKE_WCB( *window, MultiMotion, ( event->deviceid, event->event_x, event->event_y ) ); INVOKE_WCB( *window, MultiMotion, ( event->deviceid, event->event_x, event->event_y ) );

View File

@ -30,7 +30,7 @@
void fghSetCursor ( SFG_Window *window, int cursorID ) void fgPlatformSetCursor ( SFG_Window *window, int cursorID )
{ {
/* /*
* Joe Krahn is re-writing the following code. * Joe Krahn is re-writing the following code.
@ -101,7 +101,7 @@ void fghSetCursor ( SFG_Window *window, int cursorID )
} }
void fghWarpPointer ( int x, int y ) void fgPlatformWarpPointer ( int x, int y )
{ {
POINT coords; POINT coords;
coords.x = x; coords.x = x;

View File

@ -28,7 +28,7 @@
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "freeglut_internal_mswin.h" #include "freeglut_internal_mswin.h"
GLUTproc fghGetPlatformSpecificGLUTProcAddress( const char* procName ) GLUTproc fgPlatformGlutGetProcAddress( const char* procName )
{ {
#if !defined(_WIN32_WCE) #if !defined(_WIN32_WCE)
/* optimization: quick initial check */ /* optimization: quick initial check */

View File

@ -32,7 +32,7 @@
* Remembers the current visual settings, so that * Remembers the current visual settings, so that
* we can change them and restore later... * we can change them and restore later...
*/ */
void fghRememberState( void ) void fgPlatformRememberState( void )
{ {
/* DEVMODE devMode; */ /* DEVMODE devMode; */
@ -53,7 +53,7 @@ void fghRememberState( void )
/* /*
* Restores the previously remembered visual settings * Restores the previously remembered visual settings
*/ */
void fghRestoreState( void ) void fgPlatformRestoreState( void )
{ {
/* Restore the previously remembered desktop display settings */ /* Restore the previously remembered desktop display settings */
ChangeDisplaySettingsEx( fgDisplay.DisplayName,&fgDisplay.DisplayMode, 0,0,0 ); ChangeDisplaySettingsEx( fgDisplay.DisplayName,&fgDisplay.DisplayMode, 0,0,0 );
@ -66,7 +66,7 @@ void fghRestoreState( void )
/* /*
* Changes the current display mode to match user's settings * Changes the current display mode to match user's settings
*/ */
GLboolean fghChangeDisplayMode( GLboolean haveToTest ) GLboolean fgPlatformChangeDisplayMode( GLboolean haveToTest )
{ {
GLboolean success = GL_FALSE; GLboolean success = GL_FALSE;
DEVMODE devMode; DEVMODE devMode;

View File

@ -32,7 +32,7 @@
/* /*
* A call to this function should initialize all the display stuff... * A call to this function should initialize all the display stuff...
*/ */
void fghInitialize( const char* displayName ) void fgPlatformInitialize( const char* displayName )
{ {
WNDCLASS wc; WNDCLASS wc;
ATOM atom; ATOM atom;
@ -54,7 +54,7 @@ void fghInitialize( const char* displayName )
* XXX Old code had "| CS_DBCLCKS" commented out. Plans for the * XXX Old code had "| CS_DBCLCKS" commented out. Plans for the
* XXX future? Dead-end idea? * XXX future? Dead-end idea?
*/ */
wc.lpfnWndProc = fgWindowProc; wc.lpfnWndProc = fgPlatformWindowProc;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = fgDisplay.Instance; wc.hInstance = fgDisplay.Instance;
@ -75,7 +75,7 @@ void fghInitialize( const char* displayName )
/* Register the window class */ /* Register the window class */
atom = RegisterClass( &wc ); atom = RegisterClass( &wc );
FREEGLUT_INTERNAL_ERROR_EXIT ( atom, "Window Class Not Registered", "fghInitialize" ); FREEGLUT_INTERNAL_ERROR_EXIT ( atom, "Window Class Not Registered", "fgPlatformInitialize" );
} }
/* The screen dimensions can be obtained via GetSystemMetrics() calls */ /* The screen dimensions can be obtained via GetSystemMetrics() calls */
@ -104,7 +104,7 @@ void fghInitialize( const char* displayName )
DeleteDC(context); DeleteDC(context);
} }
else else
fgWarning("fghInitialize: " fgWarning("fgPlatformInitialize: "
"CreateDC failed, Screen size info may be incorrect\n" "CreateDC failed, Screen size info may be incorrect\n"
"This is quite likely caused by a bad '-display' parameter"); "This is quite likely caused by a bad '-display' parameter");
@ -131,7 +131,7 @@ void fghInitialize( const char* displayName )
/* Platform-Specific Deinitialization Functions: */ /* Platform-Specific Deinitialization Functions: */
extern void fghCloseInputDevices ( void ); extern void fghCloseInputDevices ( void );
void fghDeinitialiseInputDevices ( void ) void fgPlatformDeinitialiseInputDevices ( void )
{ {
#if !defined(_WIN32_WCE) #if !defined(_WIN32_WCE)
fghCloseInputDevices (); fghCloseInputDevices ();
@ -140,7 +140,7 @@ void fghDeinitialiseInputDevices ( void )
fgState.InputDevsInitialised = GL_FALSE; fgState.InputDevsInitialised = GL_FALSE;
} }
void fghCloseDisplay ( void ) void fgPlatformCloseDisplay ( void )
{ {
if( fgDisplay.DisplayName ) if( fgDisplay.DisplayName )
{ {

View File

@ -45,7 +45,7 @@ int serial_putchar ( SERIALPORT *port, unsigned char ch );
void serial_flush ( SERIALPORT *port ); void serial_flush ( SERIALPORT *port );
void fghRegisterDialDevice ( const char *dial_device ) void fgPlatformRegisterDialDevice ( const char *dial_device )
{ {
if (!dial_device){ if (!dial_device){
static char devname[256]; static char devname[256];

View File

@ -32,7 +32,7 @@
extern void fghRedrawWindow ( SFG_Window *window ); extern void fghRedrawWindow ( SFG_Window *window );
void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height ) void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height )
{ {
RECT windowRect; RECT windowRect;
@ -80,7 +80,7 @@ void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height )
} }
void fghcbPlatformDisplayWindow ( SFG_Window *window ) void fgPlatformDisplayWindow ( SFG_Window *window )
{ {
RedrawWindow( RedrawWindow(
window->Window.Handle, NULL, NULL, window->Window.Handle, NULL, NULL,
@ -89,13 +89,13 @@ void fghcbPlatformDisplayWindow ( SFG_Window *window )
} }
void fghPlatformSleepForEvents( long msec ) void fgPlatformSleepForEvents( long msec )
{ {
MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT ); MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT );
} }
void fghProcessSingleEvent ( void ) void fgPlatformProcessSingleEvent ( void )
{ {
MSG stMsg; MSG stMsg;
@ -123,7 +123,7 @@ void fghProcessSingleEvent ( void )
void fghMainLoopPreliminaryWork ( void ) void fgPlatformMainLoopPreliminaryWork ( void )
{ {
SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
@ -154,7 +154,7 @@ void fghMainLoopPreliminaryWork ( void )
/* /*
* Determine a GLUT modifer mask based on MS-WINDOWS system info. * Determine a GLUT modifer mask based on MS-WINDOWS system info.
*/ */
static int fghGetModifiers (void) static int fgPlatformGetModifiers (void)
{ {
return return
( ( ( GetKeyState( VK_LSHIFT ) < 0 ) || ( ( ( GetKeyState( VK_LSHIFT ) < 0 ) ||
@ -168,7 +168,7 @@ static int fghGetModifiers (void)
/* /*
* The window procedure for handling Win32 events * The window procedure for handling Win32 events
*/ */
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
LPARAM lParam ) LPARAM lParam )
{ {
static unsigned char lControl = 0, rControl = 0, lShift = 0, static unsigned char lControl = 0, rControl = 0, lShift = 0,
@ -307,7 +307,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
/* The window structure is passed as the creation structure parameter... */ /* The window structure is passed as the creation structure parameter... */
window = (SFG_Window *) (((LPCREATESTRUCT) lParam)->lpCreateParams); window = (SFG_Window *) (((LPCREATESTRUCT) lParam)->lpCreateParams);
FREEGLUT_INTERNAL_ERROR_EXIT ( ( window != NULL ), "Cannot create window", FREEGLUT_INTERNAL_ERROR_EXIT ( ( window != NULL ), "Cannot create window",
"fgWindowProc" ); "fgPlatformWindowProc" );
window->Window.Handle = hWnd; window->Window.Handle = hWnd;
window->Window.Device = GetDC( hWnd ); window->Window.Device = GetDC( hWnd );
@ -497,7 +497,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
} }
SetFocus(window->Window.Handle); SetFocus(window->Window.Handle);
fgState.Modifiers = fghGetModifiers( ); fgState.Modifiers = fgPlatformGetModifiers( );
if( ( wParam & MK_LBUTTON ) || if( ( wParam & MK_LBUTTON ) ||
( wParam & MK_MBUTTON ) || ( wParam & MK_MBUTTON ) ||
@ -607,7 +607,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
break; break;
fgSetWindow( window ); fgSetWindow( window );
fgState.Modifiers = fghGetModifiers( ); fgState.Modifiers = fgPlatformGetModifiers( );
INVOKE_WCB( INVOKE_WCB(
*window, Mouse, *window, Mouse,
@ -641,7 +641,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
break; break;
fgSetWindow( window ); fgSetWindow( window );
fgState.Modifiers = fghGetModifiers( ); fgState.Modifiers = fgPlatformGetModifiers( );
/* /*
* XXX Should use WHEEL_DELTA instead of 120 * XXX Should use WHEEL_DELTA instead of 120
@ -702,7 +702,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
* Remember the current modifiers state. This is done here in order * Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly. * to make sure the VK_DELETE keyboard callback is executed properly.
*/ */
fgState.Modifiers = fghGetModifiers( ); fgState.Modifiers = fgPlatformGetModifiers( );
GetCursorPos( &mouse_pos ); GetCursorPos( &mouse_pos );
ScreenToClient( window->Window.Handle, &mouse_pos ); ScreenToClient( window->Window.Handle, &mouse_pos );
@ -792,7 +792,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
* Remember the current modifiers state. This is done here in order * Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly. * to make sure the VK_DELETE keyboard callback is executed properly.
*/ */
fgState.Modifiers = fghGetModifiers( ); fgState.Modifiers = fgPlatformGetModifiers( );
GetCursorPos( &mouse_pos ); GetCursorPos( &mouse_pos );
ScreenToClient( window->Window.Handle, &mouse_pos ); ScreenToClient( window->Window.Handle, &mouse_pos );
@ -877,7 +877,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if( (fgState.KeyRepeat==GLUT_KEY_REPEAT_OFF || window->State.IgnoreKeyRepeat==GL_TRUE) && (HIWORD(lParam) & KF_REPEAT) ) if( (fgState.KeyRepeat==GLUT_KEY_REPEAT_OFF || window->State.IgnoreKeyRepeat==GL_TRUE) && (HIWORD(lParam) & KF_REPEAT) )
break; break;
fgState.Modifiers = fghGetModifiers( ); fgState.Modifiers = fgPlatformGetModifiers( );
INVOKE_WCB( *window, Keyboard, INVOKE_WCB( *window, Keyboard,
( (char)wParam, ( (char)wParam,
window->State.MouseX, window->State.MouseY ) window->State.MouseX, window->State.MouseY )

View File

@ -29,7 +29,7 @@
#include "freeglut_internal_mswin.h" #include "freeglut_internal_mswin.h"
GLvoid fghGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y ) GLvoid fgPlatformGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y )
{ {
*x = glutGet ( GLUT_SCREEN_WIDTH ); *x = glutGet ( GLUT_SCREEN_WIDTH );
*y = glutGet ( GLUT_SCREEN_HEIGHT ); *y = glutGet ( GLUT_SCREEN_HEIGHT );