updated comments from John Fay

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@512 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
brianp 2004-09-10 14:14:30 +00:00
parent 7e23a609ff
commit 5bd18d1bcd
16 changed files with 247 additions and 546 deletions

View File

@ -257,9 +257,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
coords.x = x;
coords.y = y;
/*
* ClientToScreen() translates {coords} for us.
*/
/* ClientToScreen() translates {coords} for us. */
ClientToScreen( fgStructure.Window->Window.Handle, &coords );
SetCursorPos( coords.x, coords.y );
}

View File

@ -13,7 +13,7 @@
* The original freeglut fonts were extracted by a utility written
* by Pawel W. Olszta (see below) and the generated fonts contained
* his copyright exclusively. Steve Baker asserts that Pawel
* assigned intellectual property writes to Steve Baker. Steve
* assigned intellectual property rights to Steve Baker. Steve
* Baker also asserts that fonts cannot be copyrighted. He has
* neither stripped the copyright from the freeglut fonts nor
* formally retitled anything in his name. Since that time, the

View File

@ -86,9 +86,7 @@ void fghRememberState( void )
);
}
/*
* Query the current display settings:
*/
/* Query the current display settings: */
fgDisplay.DisplayModeValid =
XF86VidModeGetModeLine(
fgDisplay.Display,
@ -111,9 +109,7 @@ void fghRememberState( void )
/* DEVMODE devMode; */
/*
* Grab the current desktop settings...
*/
/* Grab the current desktop settings... */
/* hack to get around my stupid cross-gcc headers */
#define FREEGLUT_ENUM_CURRENT_SETTINGS -1
@ -121,9 +117,7 @@ void fghRememberState( void )
EnumDisplaySettings( NULL, FREEGLUT_ENUM_CURRENT_SETTINGS,
&fgDisplay.DisplayMode );
/*
* Make sure we will be restoring all settings needed
*/
/* Make sure we will be restoring all settings needed */
fgDisplay.DisplayMode.dmFields |=
DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
@ -138,9 +132,7 @@ void fghRestoreState( void )
#if TARGET_HOST_UNIX_X11
# ifdef X_XF86VidModeGetAllModeLines
/*
* Restore the remembered pointer position:
*/
/* Restore the remembered pointer position: */
XWarpPointer(
fgDisplay.Display, None, fgDisplay.RootWindow, 0, 0, 0, 0,
fgDisplay.DisplayPointerX, fgDisplay.DisplayPointerY
@ -206,9 +198,7 @@ void fghRestoreState( void )
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
/*
* Restore the previously rememebered desktop display settings
*/
/* Restore the previously rememebered desktop display settings */
ChangeDisplaySettings( &fgDisplay.DisplayMode, 0 );
#endif
@ -219,9 +209,7 @@ void fghRestoreState( void )
*/
GLboolean fghCheckDisplayMode( int width, int height, int depth, int refresh )
{
/*
* The desired values should be stored in fgState structure...
*/
/* The desired values should be stored in fgState structure... */
return ( width == fgState.GameModeSize.X ) &&
( height == fgState.GameModeSize.Y ) &&
( depth == fgState.GameModeDepth ) &&
@ -257,9 +245,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
&displayModes
);
/*
* Check every of the modes looking for one that matches our demands
*/
/* Check every of the modes looking for one that matches our demands */
for( i = 0; i < displayModesCount; i++ )
{
if( fghCheckDisplayMode( displayModes[ i ]->hdisplay,
@ -269,9 +255,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
{
if( haveToTest )
return GL_TRUE;
/*
* OKi, this is the display mode we have been looking for...
*/
/* OKi, this is the display mode we have been looking for... */
XF86VidModeSwitchToMode(
fgDisplay.Display,
fgDisplay.Screen,
@ -282,9 +266,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
}
}
/*
* Something must have went wrong
*/
/* Something must have gone wrong */
return GL_FALSE;
# else
@ -307,9 +289,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
*/
while( EnumDisplaySettings( NULL, displayModes, &devMode ) )
{
/*
* Does the enumerated display mode match the user's preferences?
*/
/* Does the enumerated display mode match the user's preferences? */
if( fghCheckDisplayMode( devMode.dmPelsWidth, devMode.dmPelsHeight,
devMode.dmBitsPerPel,
devMode.dmDisplayFrequency ) )
@ -325,9 +305,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
/* then try without Display Frequency */
displayModes = 0;
/*
* Enumerate the available display modes
*/
/* Enumerate the available display modes */
while( EnumDisplaySettings( NULL, displayModes, &devMode ) )
{
/* then try without Display Frequency */
@ -343,24 +321,18 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
}
}
/*
* Did we find a matching display mode?
*/
/* Did we find a matching display mode? */
if( mode != 0xffffffff )
{
int retVal = DISP_CHANGE_SUCCESSFUL;
/*
* Mark the values we want to modify in the display change call
*/
/* Mark the values we want to modify in the display change call */
devMode.dmFields |=
DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
retVal = ChangeDisplaySettings( &devMode, haveToTest ? CDS_TEST : 0 );
/*
* I don't know if it's really needed, but looks nice:
*/
/* I don't know if it's really needed, but looks nice: */
success = (retVal == DISP_CHANGE_SUCCESSFUL) ||
(retVal == DISP_CHANGE_NOTUPDATED);
@ -407,9 +379,7 @@ void FGAPIENTRY glutGameModeString( const char* string )
string
);
/*
* Hopefully it worked, and if not, we still have the default values
*/
/* Hopefully it worked, and if not, we still have the default values */
fgState.GameModeSize.X = width;
fgState.GameModeSize.Y = height;
fgState.GameModeDepth = depth;
@ -495,9 +465,7 @@ int FGAPIENTRY glutEnterGameMode( void )
int x, y;
Window child;
/*
* Change to viewport to the window topleft edge:
*/
/* Change to viewport to the window topleft edge: */
XF86VidModeSetViewPort( fgDisplay.Display, fgDisplay.Screen, 0, 0 );
/*
@ -522,9 +490,7 @@ int FGAPIENTRY glutEnterGameMode( void )
#endif
/*
* Grab the keyboard, too
*/
/* Grab the keyboard, too */
XGrabKeyboard(
fgDisplay.Display,
fgStructure.GameMode->Window.Handle,
@ -549,7 +515,7 @@ void FGAPIENTRY glutLeaveGameMode( void )
fgAddToWindowDestroyList( fgStructure.GameMode );
fgStructure.GameMode = NULL ;
fgStructure.GameMode = NULL;
#if TARGET_HOST_UNIX_X11

View File

@ -75,9 +75,7 @@ void FGAPIENTRY glutWireCube( GLdouble dSize )
# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );
/*
* PWO: I dared to convert the code to use macros...
*/
/* PWO: I dared to convert the code to use macros... */
glBegin( GL_LINE_LOOP ); N( 1.0, 0.0, 0.0); V(+,-,+); V(+,-,-); V(+,+,-); V(+,+,+); glEnd();
glBegin( GL_LINE_LOOP ); N( 0.0, 1.0, 0.0); V(+,+,+); V(+,+,-); V(-,+,-); V(-,+,+); glEnd();
glBegin( GL_LINE_LOOP ); N( 0.0, 0.0, 1.0); V(+,+,+); V(-,+,+); V(-,-,+); V(+,-,+); glEnd();
@ -99,9 +97,7 @@ void FGAPIENTRY glutSolidCube( GLdouble dSize )
# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );
/*
* PWO: Again, I dared to convert the code to use macros...
*/
/* PWO: Again, I dared to convert the code to use macros... */
glBegin( GL_QUADS );
N( 1.0, 0.0, 0.0); V(+,-,+); V(+,-,-); V(+,+,-); V(+,+,+);
N( 0.0, 1.0, 0.0); V(+,+,+); V(+,+,-); V(-,+,-); V(-,+,+);
@ -593,9 +589,7 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
int i, j;
double spsi, cpsi, sphi, cphi ;
/*
* Allocate the vertices array
*/
/* Allocate the vertices array */
vertex = (double *)calloc( sizeof(double), 3 * nSides * nRings );
normal = (double *)calloc( sizeof(double), 3 * nSides * nRings );
@ -671,15 +665,11 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
int i, j;
double spsi, cpsi, sphi, cphi ;
/*
* Increment the number of sides and rings to allow for one more point than surface
*/
/* Increment the number of sides and rings to allow for one more point than surface */
nSides ++ ;
nRings ++ ;
/*
* Allocate the vertices array
*/
/* Allocate the vertices array */
vertex = (double *)calloc( sizeof(double), 3 * nSides * nRings );
normal = (double *)calloc( sizeof(double), 3 * nSides * nRings );
@ -744,7 +734,8 @@ void FGAPIENTRY glutWireDodecahedron( void )
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875.
* where x = (-1 + sqrt(5))/2, z = (1 + sqrt(5))/2 or
* x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_LINE_LOOP ) ;
glNormal3d ( 0.0, 0.525731112119, 0.850650808354 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ;
@ -794,7 +785,8 @@ void FGAPIENTRY glutSolidDodecahedron( void )
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875.
* where x = (-1 + sqrt(5))/2, z = (1 + sqrt(5))/2 or
* x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_POLYGON ) ;
glNormal3d ( 0.0, 0.525731112119, 0.850650808354 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ;

View File

@ -132,9 +132,7 @@ void fgInitialize( const char* displayName )
fgDisplay.Connection = ConnectionNumber( fgDisplay.Display );
/*
* Create the window deletion atom
*/
/* Create the window deletion atom */
fgDisplay.DeleteWindow = XInternAtom(
fgDisplay.Display,
"WM_DELETE_WINDOW",
@ -146,9 +144,7 @@ void fgInitialize( const char* displayName )
WNDCLASS wc;
ATOM atom;
/*
* What we need to do is to initialize the fgDisplay global structure here.
*/
/* What we need to do is to initialize the fgDisplay global structure here. */
fgDisplay.Instance = GetModuleHandle( NULL );
atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc );
@ -184,16 +180,12 @@ void fgInitialize( const char* displayName )
wc.lpszMenuName = NULL;
wc.lpszClassName = _T("FREEGLUT");
/*
* Register the window class
*/
/* Register the window class */
atom = RegisterClass( &wc );
assert( atom );
}
/*
* The screen dimensions can be obtained via GetSystemMetrics() calls
*/
/* The screen dimensions can be obtained via GetSystemMetrics() calls */
fgDisplay.ScreenWidth = GetSystemMetrics( SM_CXSCREEN );
fgDisplay.ScreenHeight = GetSystemMetrics( SM_CYSCREEN );
@ -233,9 +225,7 @@ void fgDeinitialize( void )
/* fgState.Initialised = GL_FALSE; */
/*
* If there was a menu created, destroy the rendering context
*/
/* If there was a menu created, destroy the rendering context */
if( fgStructure.MenuContext )
{
free( fgStructure.MenuContext );
@ -688,9 +678,7 @@ void FGAPIENTRY glutInitWindowSize( int width, int height )
*/
void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode )
{
/*
* We will make use of this value when creating a new OpenGL context...
*/
/* We will make use of this value when creating a new OpenGL context... */
fgState.DisplayMode = displayMode;
}
@ -732,9 +720,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
token = strtok ( buffer, " \t" );
while ( token )
{
/*
* Process this token
*/
/* Process this token */
int i ;
for ( i = 0; i < NUM_TOKENS; i++ )
{
@ -890,9 +876,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
free ( buffer );
/*
* We will make use of this value when creating a new OpenGL context...
*/
/* We will make use of this value when creating a new OpenGL context... */
fgState.DisplayMode = glut_state_flag;
}

View File

@ -33,9 +33,7 @@
#define VERSION_MINOR 2
#define VERSION_PATCH 0
/*
* Freeglut is meant to be available under all Unix/X11 and Win32 platforms.
*/
/* Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */
#if defined(_WIN32_WCE)
# define TARGET_HOST_UNIX_X11 0
# define TARGET_HOST_WIN32 0
@ -52,9 +50,7 @@
#define FREEGLUT_MAX_MENUS 3
/*
* Somehow all Win32 include headers depend on this one:
*/
/* Somehow all Win32 include headers depend on this one: */
#if TARGET_HOST_WIN32
#include <windows.h>
#include <windowsx.h>
@ -66,9 +62,7 @@
#define strdup _strdup
#endif
/*
* Those files should be available on every platform.
*/
/* Those files should be available on every platform. */
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
@ -82,9 +76,7 @@
#include <sys/time.h>
#endif
/*
* The system-dependant include files should go here:
*/
/* The system-dependant include files should go here: */
#if TARGET_HOST_UNIX_X11
#include <GL/glx.h>
#include <X11/Xlib.h>
@ -96,9 +88,7 @@
#endif
#endif
/*
* Microsoft VisualC++ 5.0's <math.h> does not define the PI
*/
/* Microsoft VisualC++ 5.0's <math.h> does not define the PI */
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
@ -113,9 +103,7 @@
/* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
/*
* Freeglut callbacks type definitions
*/
/* Freeglut callbacks type definitions */
typedef void (* FGCBDisplay )( void );
typedef void (* FGCBReshape )( int, int );
typedef void (* FGCBVisibility )( int );
@ -141,23 +129,17 @@ typedef void (* FGCBTabletMotion )( int, int );
typedef void (* FGCBTabletButton )( int, int, int, int );
typedef void (* FGCBDestroy )( void );
/*
* The global callbacks type definitions
*/
/* The global callbacks type definitions */
typedef void (* FGCBIdle )( void );
typedef void (* FGCBTimer )( int );
typedef void (* FGCBMenuState )( int );
typedef void (* FGCBMenuStatus )( int, int, int );
/*
* The callback used when creating/using menus
*/
/* The callback used when creating/using menus */
typedef void (* FGCBMenu )( int );
/*
* A list structure
*/
/* A list structure */
typedef struct tagSFG_List SFG_List;
struct tagSFG_List
{
@ -165,9 +147,7 @@ struct tagSFG_List
void *Last;
};
/*
* A list node structure
*/
/* A list node structure */
typedef struct tagSFG_Node SFG_Node;
struct tagSFG_Node
{
@ -175,9 +155,7 @@ struct tagSFG_Node
void *Prev;
};
/*
* A helper structure holding two ints and a boolean
*/
/* A helper structure holding two ints and a boolean */
typedef struct tagSFG_XYUse SFG_XYUse;
struct tagSFG_XYUse
{
@ -185,13 +163,11 @@ struct tagSFG_XYUse
GLboolean Use; /* ...and a single boolean. */
};
/*
* A helper structure holding a timeval and a boolean
*/
/* A helper structure holding a timeval and a boolean */
typedef struct tagSFG_Time SFG_Time;
struct tagSFG_Time
{
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
#ifdef WIN32
DWORD Value;
#else
struct timeval Value;
@ -210,9 +186,7 @@ typedef enum
GLUT_EXEC_STATE_STOP
} fgExecutionState ;
/*
* This structure holds different freeglut settings
*/
/* This structure holds different freeglut settings */
typedef struct tagSFG_State SFG_State;
struct tagSFG_State
{
@ -257,9 +231,7 @@ struct tagSFG_State
char *ProgramName; /* Name of the invoking program */
};
/*
* The structure used by display initialization in freeglut_init.c
*/
/* The structure used by display initialization in freeglut_init.c */
typedef struct tagSFG_Display SFG_Display;
struct tagSFG_Display
{
@ -298,9 +270,7 @@ struct tagSFG_Display
};
/*
* The user can create any number of timer hooks
*/
/* The user can create any number of timer hooks */
typedef struct tagSFG_Timer SFG_Timer;
struct tagSFG_Timer
{
@ -347,9 +317,7 @@ struct tagSFG_Context
int DoubleBuffered; /* Treat the window as double-buffered */
};
/*
* Window's state description. This structure should be kept portable.
*/
/* Window's state description. This structure should be kept portable. */
typedef struct tagSFG_WindowState SFG_WindowState;
struct tagSFG_WindowState
{
@ -493,9 +461,7 @@ enum
};
/*
* This structure holds the OpenGL rendering context for all the menu windows
*/
/* This structure holds the OpenGL rendering context for all the menu windows */
typedef struct tagSFG_MenuContext SFG_MenuContext;
struct tagSFG_MenuContext
{
@ -506,9 +472,7 @@ struct tagSFG_MenuContext
SFG_WindowContextType Context; /* The menu window's WGL context */
};
/*
* This structure describes a menu
*/
/* This structure describes a menu */
typedef struct tagSFG_Window SFG_Window;
typedef struct tagSFG_MenuEntry SFG_MenuEntry;
typedef struct tagSFG_Menu SFG_Menu;
@ -530,9 +494,7 @@ struct tagSFG_Menu
SFG_Window *ParentWindow; /* Window in which the menu is defined */
};
/*
* This is a menu entry
*/
/* This is a menu entry */
struct tagSFG_MenuEntry
{
SFG_Node Node;
@ -568,9 +530,7 @@ struct tagSFG_Window
};
/*
* A linked list structure of windows
*/
/* A linked list structure of windows */
typedef struct tagSFG_WindowList SFG_WindowList ;
struct tagSFG_WindowList
{
@ -578,9 +538,7 @@ struct tagSFG_WindowList
SFG_Window *window ;
};
/*
* This holds information about all the windows, menus etc.
*/
/* This holds information about all the windows, menus etc. */
typedef struct tagSFG_Structure SFG_Structure;
struct tagSFG_Structure
{
@ -613,9 +571,7 @@ struct tagSFG_Enumerator
};
typedef void (* FGCBenumerator )( SFG_Window *, SFG_Enumerator * );
/*
* The bitmap font structure
*/
/* The bitmap font structure */
typedef struct tagSFG_Font SFG_Font;
struct tagSFG_Font
{
@ -627,9 +583,7 @@ struct tagSFG_Font
float xorig, yorig; /* Relative origin of the character */
};
/*
* The stroke font structures
*/
/* The stroke font structures */
typedef struct tagSFG_StrokeVertex SFG_StrokeVertex;
struct tagSFG_StrokeVertex
@ -663,19 +617,13 @@ struct tagSFG_StrokeFont
/* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
/*
* Freeglut display related stuff (initialized once per session)
*/
/* Freeglut display related stuff (initialized once per session) */
extern SFG_Display fgDisplay;
/*
* Freeglut internal structure
*/
/* Freeglut internal structure */
extern SFG_Structure fgStructure;
/*
* The current freeglut settings
*/
/* The current freeglut settings */
extern SFG_State fgState;
@ -722,16 +670,12 @@ void fgDeinitialize( void );
void fgCreateStructure( void );
void fgDestroyStructure( void );
/*
* A helper function to check if a display mode is possible to use
*/
/* A helper function to check if a display mode is possible to use */
#if TARGET_HOST_UNIX_X11
XVisualInfo* fgChooseVisual( void );
#endif
/*
* The window procedure for Win32 events handling
*/
/* The window procedure for Win32 events handling */
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam );
@ -757,15 +701,11 @@ void fgCloseWindows ();
void fgDestroyWindow( SFG_Window* window );
void fgClearCallBacks( SFG_Window *window );
/*
* Menu creation and destruction. Defined in freeglut_structure.c
*/
/* Menu creation and destruction. Defined in freeglut_structure.c */
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback );
void fgDestroyMenu( SFG_Menu* menu );
/*
* Joystick device management functions, defined in freeglut_joystick.c
*/
/* Joystick device management functions, defined in freeglut_joystick.c */
void fgJoystickInit( int ident );
void fgJoystickClose( void );
void fgJoystickPollWindow( SFG_Window* window );
@ -829,23 +769,17 @@ void fgDisplayMenu( void );
*/
void fgDisplayCursor( void );
/*
* Elapsed time as per glutGet(GLUT_ELAPSED_TIME).
*/
/* Elapsed time as per glutGet(GLUT_ELAPSED_TIME). */
long fgElapsedTime( void );
/*
* List functions
*/
/* List functions */
void fgListInit(SFG_List *list);
void fgListAppend(SFG_List *list, SFG_Node *node);
void fgListRemove(SFG_List *list, SFG_Node *node);
int fgListLength(SFG_List *list);
void fgListInsert(SFG_List *list, SFG_Node *next, SFG_Node *node);
/*
* Error Messages functions
*/
/* Error Message functions */
void fgError( const char *fmt, ... );
void fgWarning( const char *fmt, ... );

View File

@ -73,9 +73,7 @@
#if TARGET_HOST_UNIX_X11
# define _JS_MAX_AXES 16
# if defined(__FreeBSD__) || defined(__NetBSD__)
/*
* XXX The below hack is done until freeglut's autoconf is updated.
*/
/* XXX The below hack is done until freeglut's autoconf is updated. */
# define HAVE_USB_JS 1
# include <sys/ioctl.h>
@ -133,17 +131,13 @@
#define JS_TRUE 1
#define JS_FALSE 0
/*
* BSD defines from "jsBSD.cxx" around lines 42-270
*/
/* BSD defines from "jsBSD.cxx" around lines 42-270 */
#if defined(__NetBSD__) || defined(__FreeBSD__)
# ifdef HAVE_USB_JS
# if defined(__NetBSD__)
/*
* XXX The below hack is done until freeglut's autoconf is updated.
*/
/* XXX The below hack is done until freeglut's autoconf is updated. */
# define HAVE_USBHID_H 1
# ifdef HAVE_USBHID_H
# include <usbhid.h>
@ -154,9 +148,7 @@
# if __FreeBSD_version < 500000
# include <libusbhid.h>
# else
/*
* XXX The below hack is done until freeglut's autoconf is updated.
*/
/* XXX The below hack is done until freeglut's autoconf is updated. */
# define HAVE_USBHID_H 1
# include <usbhid.h>
# endif
@ -1145,9 +1137,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
joy->name[ 0 ] = '\0';
#if TARGET_HOST_MACINTOSH
/*
* XXX FIXME: get joystick name in Mac
*/
/* XXX FIXME: get joystick name in Mac */
err = ISpStartup( );
@ -1349,9 +1339,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
joy->max[ 0 ] = ( float )joy->jsCaps.wXmax;
}
/*
* Guess all the rest judging on the axes extremals
*/
/* Guess all the rest judging on the axes extremals */
for( i = 0; i < joy->num_axes; i++ )
{
joy->center [ i ] = ( joy->max[ i ] + joy->min[ i ] ) * 0.5f;
@ -1466,9 +1454,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
#endif
#if defined( __linux__ )
/*
* Default for older Linux systems.
*/
/* Default for older Linux systems. */
joy->num_axes = 2;
joy->num_buttons = 32;
@ -1486,9 +1472,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
if( joy->error )
return;
/*
* Set the correct number of axes for the linux driver
*/
/* Set the correct number of axes for the linux driver */
# ifdef JS_NEW
/* Melchior Franz's fixes for big-endian Linuxes since writing
* to the upper byte of an uninitialized word doesn't work.
@ -1741,7 +1725,6 @@ void fgJoystickPollWindow( SFG_Window* window )
/*
* PWO: These jsJoystick class methods have not been implemented.
* We might consider adding such functions to freeglut-2.0.
*/
int glutJoystickGetNumAxes( int ident )
{

View File

@ -480,7 +480,7 @@ static void fgSleepForEvents( void )
* it is possible to have our socket drained but still have
* unprocessed events. (Or, this may just be normal with
* X, anyway?) We do non-trivial processing of X events
* after tham in event-reading loop, in any case, so we
* after the event-reading loop, in any case, so we
* need to allow that we may have an empty socket but non-
* empty event queue.
*/
@ -537,9 +537,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
SFG_Window* window;
XEvent event;
/*
* This code was repeated constantly, so here it goes into a definition:
*/
/* This code was repeated constantly, so here it goes into a definition: */
#define GETWINDOW(a) \
window = fgWindowByHandle( event.a.window ); \
if( window == NULL ) \
@ -558,9 +556,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
switch( event.type )
{
case ClientMessage:
/*
* Destroy the window when the WM_DELETE_WINDOW message arrives
*/
/* Destroy the window when the WM_DELETE_WINDOW message arrives */
if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.DeleteWindow )
{
GETWINDOW( xclient );
@ -851,17 +847,13 @@ void FGAPIENTRY glutMainLoopEvent( void )
break;
}
/*
* No active menu, let's check whether we need to activate one.
*/
/* No active menu, let's check whether we need to activate one. */
if( ( 0 <= button ) &&
( FREEGLUT_MAX_MENUS > button ) &&
( window->Menu[ button ] ) &&
pressed )
{
/*
* XXX Posting a requisite Redisplay seems bogus.
*/
/* XXX Posting a requisite Redisplay seems bogus. */
window->State.Redisplay = GL_TRUE;
fgSetWindow( window );
fgActivateMenu( window, button );
@ -916,9 +908,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
);
}
/*
* Trash the modifiers state
*/
/* Trash the modifiers state */
fgState.Modifiers = 0xffffffff;
}
break;
@ -1225,9 +1215,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
switch( uMsg )
{
case WM_CREATE:
/*
* The window structure is passed as the creation structure paramter...
*/
/* The window structure is passed as the creation structure paramter... */
window = (SFG_Window *) (((LPCREATESTRUCT) lParam)->lpCreateParams);
assert( window != NULL );
@ -1321,7 +1309,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
break;
#if 0
case WM_SETFOCUS:
/* printf("WM_SETFOCUS: %p\n", window ); */
/* printf("WM_SETFOCUS: %p\n", window ); */
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
break;
@ -1329,7 +1317,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if (LOWORD(wParam) != WA_INACTIVE)
{
/* glutSetCursor( fgStructure.Window->State.Cursor ); */
/* printf("WM_ACTIVATE: glutSetCursor( %p, %d)\n", window,
/* printf("WM_ACTIVATE: glutSetCursor( %p, %d)\n", window,
window->State.Cursor ); */
glutSetCursor( window->State.Cursor );
}

View File

@ -117,9 +117,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
SFG_MenuEntry* menuEntry;
int x, y;
/*
* First of all check any of the active sub menus...
*/
/* First of all check any of the active sub menus... */
for( menuEntry = (SFG_MenuEntry *)menu->Entries.First;
menuEntry;
menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
@ -144,9 +142,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
}
}
/*
* That much about our sub menus, let's get to checking the current menu:
*/
/* That much about our sub menus, let's get to checking the current menu: */
x = window->State.MouseX;
y = window->State.MouseY;
@ -157,9 +153,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
menu->IsActive = GL_FALSE;
/*
* Check if the mouse cursor is contained within the current menu box
*/
/* Check if the mouse cursor is contained within the current menu box */
if( ( x >= FREEGLUT_MENU_BORDER ) &&
( x < menu->Width - FREEGLUT_MENU_BORDER ) &&
( y >= FREEGLUT_MENU_BORDER ) &&
@ -168,9 +162,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
{
int menuID = ( y - FREEGLUT_MENU_BORDER ) / FREEGLUT_MENU_HEIGHT;
/*
* The mouse cursor is somewhere over our box, check it out.
*/
/* The mouse cursor is somewhere over our box, check it out. */
menuEntry = fghFindMenuEntry( menu, menuID + 1 );
assert( menuEntry );
@ -200,14 +192,10 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
{
SFG_Window *current_window = fgStructure.Window;
/*
* Set up the initial menu position now...
*/
/* Set up the initial menu position now... */
menuEntry->SubMenu->IsActive = GL_TRUE;
/*
* Set up the initial submenu position now:
*/
/* Set up the initial submenu position now: */
menuEntry->SubMenu->X = menu->X + menu->Width;
menuEntry->SubMenu->Y = menu->Y +
menuEntry->Ordinal * FREEGLUT_MENU_HEIGHT;
@ -236,21 +224,15 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
fghCheckMenuStatus( window, menuEntry->SubMenu );
/*
* Activate it because its parent entry is active
*/
/* Activate it because its parent entry is active */
menuEntry->SubMenu->IsActive = GL_TRUE;
}
/*
* Report back that we have caught the menu cursor
*/
/* Report back that we have caught the menu cursor */
return GL_TRUE;
}
/*
* Looks like the menu cursor is somewhere else...
*/
/* Looks like the menu cursor is somewhere else... */
return GL_FALSE;
}
@ -297,16 +279,12 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
glVertex2i( border, menu->Height - border);
glEnd( );
/*
* Check if any of the submenus is currently active...
*/
/* Check if any of the submenus is currently active... */
for( menuEntry = (SFG_MenuEntry *)menu->Entries.First;
menuEntry;
menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{
/*
* Has the menu been marked as active, maybe?
*/
/* Has the menu been marked as active, maybe? */
if( menuEntry->IsActive )
{
/*
@ -316,9 +294,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
*/
int menuID = menuEntry->Ordinal;
/*
* So have the highlight drawn...
*/
/* So have the highlight drawn... */
glColor4fv( menu_pen_hback );
glBegin( GL_QUADS );
glVertex2i( border,
@ -333,9 +309,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
}
}
/*
* Print the menu entries now...
*/
/* Print the menu entries now... */
glColor4fv( menu_pen_fore );
@ -343,15 +317,11 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
menuEntry;
menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next, ++i )
{
/*
* If the menu entry is active, set the color to white
*/
/* If the menu entry is active, set the color to white */
if( menuEntry->IsActive )
glColor4fv( menu_pen_hfore );
/*
* Move the raster into position...
*/
/* Move the raster into position... */
/* Try to center the text - JCJ 31 July 2003*/
glRasterPos2i(
2 * border,
@ -359,15 +329,11 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
( int )( FREEGLUT_MENU_HEIGHT*0.3 - border )
);
/*
* Have the label drawn, character after character:
*/
/* Have the label drawn, character after character: */
glutBitmapString( FREEGLUT_MENU_FONT,
(unsigned char *)menuEntry->Text);
/*
* If it's a submenu, draw a right arrow
*/
/* If it's a submenu, draw a right arrow */
if( menuEntry->SubMenu )
{
int width = glutBitmapWidth( FREEGLUT_MENU_FONT, '_' );
@ -381,28 +347,20 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
glEnd( );
}
/*
* If the menu entry is active, reset the color
*/
/* If the menu entry is active, reset the color */
if( menuEntry->IsActive )
glColor4fv( menu_pen_fore );
}
/*
* Now we are ready to check if any of our children needs to be redrawn:
*/
/* Now we are ready to check if any of our children needs to be redrawn: */
for( menuEntry = ( SFG_MenuEntry * )menu->Entries.First;
menuEntry;
menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
{
/*
* Is that an active sub menu by any case?
*/
/* Is that an active sub menu by any case? */
if( menuEntry->SubMenu && menuEntry->IsActive )
{
/*
* Yeah, indeed. Have it redrawn now:
*/
/* Yeah, indeed. Have it redrawn now: */
fgSetWindow( menuEntry->SubMenu->Window );
fghDisplayMenuBox( menuEntry->SubMenu );
fgSetWindow( menu->Window );
@ -438,9 +396,7 @@ void fgDisplayMenu( void )
freeglut_assert_window;
/*
* Check if there is an active menu attached to this window...
*/
/* Check if there is an active menu attached to this window... */
menu = window->ActiveMenu;
freeglut_return_if_fail( menu );
@ -487,21 +443,15 @@ void fgDisplayMenu( void )
*/
void fgActivateMenu( SFG_Window* window, int button )
{
/*
* We'll be referencing this menu a lot, so remember its address:
*/
/* We'll be referencing this menu a lot, so remember its address: */
SFG_Menu* menu = window->Menu[ button ];
/*
* Mark the menu as active, so that it gets displayed:
*/
/* Mark the menu as active, so that it gets displayed: */
window->ActiveMenu = menu;
menu->IsActive = GL_TRUE;
fgState.ActiveMenus++;
/*
* Set up the initial menu position now:
*/
/* Set up the initial menu position now: */
menu->X = window->State.MouseX + glutGet( GLUT_WINDOW_X );
menu->Y = window->State.MouseY + glutGet( GLUT_WINDOW_Y );
@ -546,9 +496,7 @@ void fgExecuteMenuCallback( SFG_Menu* menu )
{
SFG_MenuEntry *menuEntry;
/*
* First of all check any of the active sub menus...
*/
/* First of all check any of the active sub menus... */
for( menuEntry = (SFG_MenuEntry *)menu->Entries.First;
menuEntry;
menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next)
@ -572,42 +520,30 @@ void fgDeactivateMenu( SFG_Window *window )
{
SFG_Window *current_window = fgStructure.Window;
/*
* 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_MenuEntry *menuEntry;
/*
* Did we find an active window?
*/
/* Did we find an active window? */
freeglut_return_if_fail( menu );
/*
* Hide the present menu's window
*/
/* Hide the present menu's window */
fgSetWindow( menu->Window );
glutHideWindow( );
/*
* Forget about having that menu active anymore, now:
*/
/* Forget about having that menu active anymore, now: */
menu->Window->ActiveMenu = NULL;
menu->ParentWindow->ActiveMenu = NULL;
menu->IsActive = GL_FALSE;
fgState.ActiveMenus--;
/*
* Hide all submenu windows, and the root menu's window.
*/
/* Hide all submenu windows, and the root menu's window. */
for ( menuEntry = ( SFG_MenuEntry * )menu->Entries.First;
menuEntry;
menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
{
/*
* Is that an active submenu by any case?
*/
/* Is that an active submenu by any case? */
if( menuEntry->SubMenu )
fgDeactivateSubMenu( menuEntry );
}
@ -622,28 +558,20 @@ void fgDeactivateSubMenu( SFG_MenuEntry *menuEntry )
{
SFG_Window *current_window = fgStructure.Window;
SFG_MenuEntry *subMenuIter;
/*
* Hide the present menu's window
*/
/* Hide the present menu's window */
fgSetWindow( menuEntry->SubMenu->Window );
glutHideWindow( );
/*
* Forget about having that menu active anymore, now:
*/
/* Forget about having that menu active anymore, now: */
menuEntry->SubMenu->Window->ActiveMenu = NULL;
menuEntry->SubMenu->IsActive = GL_FALSE;
/*
* Hide all submenu windows, and the root menu's window.
*/
/* Hide all submenu windows, and the root menu's window. */
for ( subMenuIter = (SFG_MenuEntry *)menuEntry->SubMenu->Entries.First;
subMenuIter;
subMenuIter = (SFG_MenuEntry *)subMenuIter->Node.Next )
{
/*
* Is that an active submenu by any case?
*/
/* Is that an active submenu by any case? */
if( subMenuIter->SubMenu )
fgDeactivateSubMenu( subMenuIter );
}
@ -659,22 +587,16 @@ void fghCalculateMenuBoxSize( void )
SFG_MenuEntry* menuEntry;
int width = 0, height = 0;
/*
* Make sure there is a current menu set
*/
/* Make sure there is a current menu set */
freeglut_assert_ready;
freeglut_return_if_fail( fgStructure.Menu );
/*
* 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;
menuEntry;
menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
{
/*
* Update the menu entry's width value
*/
/* Update the menu entry's width value */
menuEntry->Width = glutBitmapLength(
FREEGLUT_MENU_FONT,
(unsigned char *)menuEntry->Text
@ -690,18 +612,14 @@ void fghCalculateMenuBoxSize( void )
(unsigned char *)"_"
);
/*
* Check if it's the biggest we've found
*/
/* Check if it's the biggest we've found */
if( menuEntry->Width > width )
width = menuEntry->Width;
height += FREEGLUT_MENU_HEIGHT;
}
/*
* Store the menu's box size now:
*/
/* Store the menu's box size now: */
fgStructure.Menu->Height = height + 2 * FREEGLUT_MENU_BORDER;
fgStructure.Menu->Width = width + 4 * FREEGLUT_MENU_BORDER;
}
@ -714,9 +632,7 @@ void fghCalculateMenuBoxSize( void )
*/
int FGAPIENTRY glutCreateMenu( void(* callback)( int ) )
{
/*
* The menu object creation code resides in freeglut_structure.c
*/
/* The menu object creation code resides in freeglut_structure.c */
return fgCreateMenu( callback )->ID;
}
@ -730,9 +646,7 @@ void FGAPIENTRY glutDestroyMenu( int menuID )
freeglut_assert_ready;
freeglut_return_if_fail( menu );
/*
* The menu object destruction code resides in freeglut_structure.c
*/
/* The menu object destruction code resides in freeglut_structure.c */
fgDestroyMenu( menu );
}
@ -776,9 +690,7 @@ void FGAPIENTRY glutAddMenuEntry( const char* label, int value )
menuEntry->Text = strdup( label );
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 );
fghCalculateMenuBoxSize( );
@ -801,9 +713,7 @@ void FGAPIENTRY glutAddSubMenu( const char *label, int subMenuID )
menuEntry->SubMenu = subMenu;
menuEntry->ID = -1;
/*
* Make the submenu's parent window be the menu's parent window
*/
/* Make the submenu's parent window be the menu's parent window */
fghSetSubmenuParentWindow( fgStructure.Menu->ParentWindow, subMenu );
fgListAppend( &fgStructure.Menu->Entries, &menuEntry->Node );
@ -820,16 +730,12 @@ void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value )
freeglut_assert_ready;
freeglut_return_if_fail( fgStructure.Menu );
/*
* 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 );
freeglut_return_if_fail( menuEntry );
/*
* We want it to become a normal menu entry, so:
*/
/* We want it to become a normal menu entry, so: */
if( menuEntry->Text )
free( menuEntry->Text );
@ -852,16 +758,12 @@ void FGAPIENTRY glutChangeToSubMenu( int item, const char* label,
freeglut_return_if_fail( fgStructure.Menu );
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 );
freeglut_return_if_fail( menuEntry );
/*
* We want it to become a sub menu entry, so:
*/
/* We want it to become a sub menu entry, so: */
if( menuEntry->Text )
free( menuEntry->Text );
@ -881,9 +783,7 @@ void FGAPIENTRY glutRemoveMenuItem( int item )
freeglut_assert_ready;
freeglut_return_if_fail( fgStructure.Menu );
/*
* 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 );
freeglut_return_if_fail( menuEntry );
@ -911,9 +811,7 @@ void FGAPIENTRY glutAttachMenu( int button )
fgStructure.Window->Menu[ button ] = fgStructure.Menu;
/*
* Make the parent window of the menu (and all submenus) the current window
*/
/* Make the parent window of the menu (and all submenus) the current window */
fghSetSubmenuParentWindow( fgStructure.Window, fgStructure.Menu );
}

View File

@ -53,9 +53,7 @@ int FGAPIENTRY glutExtensionSupported( const char* extension )
const char *extensions, *start;
const int len = strlen( 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_assert_ready;
freeglut_return_val_if_fail( fgStructure.Window != NULL, 0 );
@ -150,9 +148,7 @@ void FGAPIENTRY glutForceJoystickFunc( void )
*/
void FGAPIENTRY glutSetColor( int nColor, GLfloat red, GLfloat green, GLfloat blue )
{
/*
*
*/
/* We really need to do something here. */
}
/*
@ -160,9 +156,7 @@ void FGAPIENTRY glutSetColor( int nColor, GLfloat red, GLfloat green, GLfloat bl
*/
GLfloat FGAPIENTRY glutGetColor( int color, int component )
{
/*
*
*/
/* We really need to do something here. */
return( 0.0f );
}
@ -171,9 +165,7 @@ GLfloat FGAPIENTRY glutGetColor( int color, int component )
*/
void FGAPIENTRY glutCopyColormap( int window )
{
/*
*
*/
/* We really need to do something here. */
}
/*** END OF FILE ***/

View File

@ -144,14 +144,10 @@ int FGAPIENTRY glutGet( GLenum eWhat )
freeglut_assert_ready;
/*
* XXX In chronological code add order. (WHY in that order?)
*/
/* XXX In chronological code add order. (WHY in that order?) */
switch( eWhat )
{
/*
* Following values are stored in fgState and fgDisplay global structures
*/
/* Following values are stored in fgState and fgDisplay global structures */
case GLUT_SCREEN_WIDTH: return fgDisplay.ScreenWidth ;
case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ;
case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ;
@ -167,9 +163,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
* fghGetConfig().
*/
case GLUT_WINDOW_NUM_SAMPLES:
/*
* XXX Multisampling. Return what I know about multisampling.
*/
/* XXX Multisampling. Return what I know about multisampling. */
return 0;
#if TARGET_HOST_UNIX_X11
@ -196,9 +190,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
# undef GLX_QUERY
/*
* 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:
if( (fghGetConfig( GLX_RGBA )) || (fgStructure.Window == NULL) )
{
@ -270,15 +262,11 @@ int FGAPIENTRY glutGet( GLenum eWhat )
}
}
/*
* I do not know yet if there will be a fgChooseVisual() function for Win32
*/
/* I do not know yet if there will be a fgChooseVisual() function for Win32 */
case GLUT_DISPLAY_MODE_POSSIBLE:
return( fgChooseVisual() == NULL ? 0 : 1 );
/*
* This is system-dependant
*/
/* This is system-dependant */
case GLUT_WINDOW_FORMAT_ID:
if( fgStructure.Window == NULL )
return 0;
@ -287,9 +275,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
/*
* Handle the OpenGL inquiries
*/
/* Handle the OpenGL inquiries */
case GLUT_WINDOW_RGBA:
glGetBooleanv ( GL_RGBA_MODE, &boolValue );
returnValue = boolValue ? 1 : 0;
@ -377,9 +363,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
*/
GetWindowRect( fgStructure.Window->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 ( ( fgStructure.GameMode != fgStructure.Window ) && ( fgStructure.Window->Parent == NULL ) &&
@ -434,9 +418,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
#endif
/*
* The window structure queries
*/
/* The window structure queries */
case GLUT_WINDOW_PARENT:
if( fgStructure.Window == NULL ) return 0;
if( fgStructure.Window->Parent == NULL ) return 0;
@ -485,9 +467,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
{
freeglut_assert_ready;
/*
* XXX WARNING: we are mostly lying in this function.
*/
/* XXX WARNING: we are mostly lying in this function. */
switch( eWhat )
{
case GLUT_HAS_KEYBOARD:
@ -539,9 +519,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
return GetSystemMetrics( SM_MOUSEPRESENT );
case GLUT_NUM_MOUSE_BUTTONS:
/*
* We are much more fortunate under Win32 about this...
*/
/* We are much more fortunate under Win32 about this... */
#if TARGET_HOST_WINCE
return 1;
#else
@ -555,9 +533,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
case GLUT_OWNS_JOYSTICK:
case GLUT_JOYSTICK_BUTTONS:
case GLUT_JOYSTICK_AXES:
/*
* XXX WARNING: THIS IS A BIG LIE!
*/
/* XXX WARNING: THIS IS A BIG LIE! */
return 0;
case GLUT_HAS_SPACEBALL:
@ -575,9 +551,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
return fgStructure.Window ? fgStructure.Window->State.IgnoreKeyRepeat : 0;
case GLUT_DEVICE_KEY_REPEAT:
/*
* XXX WARNING: THIS IS A BIG LIE!
*/
/* XXX WARNING: THIS IS A BIG LIE! */
return GLUT_KEY_REPEAT_DEFAULT;
default:
@ -585,9 +559,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
break;
}
/*
* And now -- the failure.
*/
/* And now -- the failure. */
return -1;
}
@ -641,9 +613,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
return 0;
case GLUT_NORMAL_DAMAGED:
/*
* XXX Actually I do not know. Maybe.
*/
/* XXX Actually I do not know. Maybe. */
return FALSE;
case GLUT_OVERLAY_DAMAGED:
@ -671,9 +641,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
return 0;
case GLUT_NORMAL_DAMAGED:
/*
* XXX Actually I do not know. Maybe.
*/
/* XXX Actually I do not know. Maybe. */
return FALSE;
case GLUT_OVERLAY_DAMAGED:
@ -685,9 +653,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
break;
}
/*
* And fail. That's good. Programs do love failing.
*/
/* And fail. That's good. Programs do love failing. */
return -1;
}

View File

@ -1,3 +1,30 @@
/*
* freeglut_stroke_mono_roman.c
*
* freeglut Monospace Roman stroke font definition
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: ?????
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* This file has been automatically generated by the genstroke utility. */

View File

@ -1,3 +1,30 @@
/*
* freeglut_stroke_roman.c
*
* freeglut Roman stroke font definition
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: ?????
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* This file has been automatically generated by the genstroke utility. */

View File

@ -73,9 +73,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
int x, int y, int w, int h,
GLboolean gameMode, GLboolean isMenu )
{
/*
* Have the window object created
*/
/* Have the window object created */
SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
int fakeArgc = 0;
@ -88,9 +86,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
if( !fgState.Initialised )
glutInit( &fakeArgc, NULL );
/*
* Initialize the object properties
*/
/* Initialize the object properties */
window->ID = ++fgStructure.WindowID;
window->State.OldHeight = window->State.OldWidth = -1;
@ -103,9 +99,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
else
fgListAppend( &fgStructure.Windows, &window->Node );
/*
* Set the default mouse cursor and reset the modifiers value
*/
/* Set the default mouse cursor and reset the modifiers value */
window->State.Cursor = GLUT_CURSOR_INHERIT;
window->IsMenu = isMenu;
@ -131,9 +125,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
int x = 100, y = 100, w = 100, h = 100;
SFG_Window *current_window = fgStructure.Window;
/*
* Have the menu object created
*/
/* Have the menu object created */
SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );
int fakeArgc = 0;
@ -146,9 +138,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
menu->ParentWindow = fgStructure.Window;
/*
* 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 );
menu->Window = fgStructure.Window;
@ -157,9 +147,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
glutHideWindow( ); /* Hide the window for now */
fgSetWindow( current_window );
/*
* Initialize the object properties:
*/
/* Initialize the object properties: */
menu->ID = ++fgStructure.MenuID;
menu->Callback = menuCallback;
menu->ActiveEntry = NULL;
@ -167,9 +155,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
fgListInit( &menu->Entries );
fgListAppend( &fgStructure.Menus, &menu->Node );
/*
* Newly created menus implicitly become current ones
*/
/* Newly created menus implicitly become current ones */
fgStructure.Menu = menu;
return menu;
@ -187,9 +173,7 @@ void fgAddToWindowDestroyList( SFG_Window* window )
new_list_entry->window = window;
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 )
fgStructure.Window = NULL;
@ -279,9 +263,7 @@ static void fghRemoveMenuFromWindow( SFG_Window* window, SFG_Menu* menu )
if( window->Menu[ i ] == menu )
window->Menu[ i ] = NULL;
/*
* Call this function for all of the window's children recursively:
*/
/* Call this function for all of the window's children recursively: */
for( subWindow = (SFG_Window *)window->Children.First;
subWindow;
subWindow = (SFG_Window *)subWindow->Node.Next)
@ -315,17 +297,13 @@ void fgDestroyMenu( SFG_Menu* menu )
assert( menu );
freeglut_assert_ready;
/*
* First of all, have all references to this menu removed from all windows:
*/
/* First of all, have all references to this menu removed from all windows: */
for( window = (SFG_Window *)fgStructure.Windows.First;
window;
window = (SFG_Window *)window->Node.Next )
fghRemoveMenuFromWindow( window, menu );
/*
* Now proceed with removing menu entries that lead to this menu
*/
/* Now proceed with removing menu entries that lead to this menu */
for( from = ( SFG_Menu * )fgStructure.Menus.First;
from;
from = ( SFG_Menu * )from->Node.Next )
@ -398,14 +376,10 @@ void fgDestroyStructure( void )
{
freeglut_assert_ready;
/*
* Clean up the WindowsToDestroy list.
*/
/* Clean up the WindowsToDestroy list. */
fgCloseWindows( );
/*
* Make sure all windows and menus have been deallocated
*/
/* Make sure all windows and menus have been deallocated */
while( fgStructure.Menus.First )
fgDestroyMenu( ( SFG_Menu * )fgStructure.Menus.First );
@ -423,9 +397,7 @@ void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator )
assert( enumCallback && enumerator );
freeglut_assert_ready;
/*
* Check every of the top-level windows
*/
/* Check every of the top-level windows */
for( window = ( SFG_Window * )fgStructure.Windows.First;
window;
window = ( SFG_Window * )window->Node.Next )
@ -467,9 +439,7 @@ static void fghcbWindowByHandle( SFG_Window *window,
if ( enumerator->found )
return;
/*
* Check the window's handle. Hope this works. Looks ugly. That's for sure.
*/
/* Check the window's handle. Hope this works. Looks ugly. That's for sure. */
if( window->Window.Handle == (SFG_WindowHandleType) (enumerator->data) )
{
enumerator->found = GL_TRUE;
@ -478,9 +448,7 @@ static void fghcbWindowByHandle( SFG_Window *window,
return;
}
/*
* Otherwise, check this window's children
*/
/* Otherwise, check this window's children */
fgEnumSubWindows( window, fghcbWindowByHandle, enumerator );
}
@ -493,9 +461,7 @@ SFG_Window* fgWindowByHandle ( SFG_WindowHandleType hWindow )
{
SFG_Enumerator enumerator;
/*
* This is easy and makes use of the windows enumeration defined above
*/
/* This is easy and makes use of the windows enumeration defined above */
enumerator.found = GL_FALSE;
enumerator.data = (void *)hWindow;
fgEnumWindows( fghcbWindowByHandle, &enumerator );
@ -510,15 +476,11 @@ SFG_Window* fgWindowByHandle ( SFG_WindowHandleType hWindow )
*/
static void fghcbWindowByID( SFG_Window *window, SFG_Enumerator *enumerator )
{
/*
* Make sure we do not overwrite our precious results...
*/
/* Make sure we do not overwrite our precious results... */
if( enumerator->found )
return;
/*
* Check the window's handle. Hope this works. Looks ugly. That's for sure.
*/
/* Check the window's handle. Hope this works. Looks ugly. That's for sure. */
if( window->ID == *( int *)(enumerator->data) )
{
enumerator->found = GL_TRUE;
@ -527,9 +489,7 @@ static void fghcbWindowByID( SFG_Window *window, SFG_Enumerator *enumerator )
return;
}
/*
* Otherwise, check this window's children
*/
/* Otherwise, check this window's children */
fgEnumSubWindows( window, fghcbWindowByID, enumerator );
}
@ -542,9 +502,7 @@ SFG_Window* fgWindowByID( int windowID )
{
SFG_Enumerator enumerator;
/*
* Uses a method very similiar for fgWindowByHandle...
*/
/* Uses a method very similiar for fgWindowByHandle... */
enumerator.found = GL_FALSE;
enumerator.data = ( void * )&windowID;
fgEnumWindows( fghcbWindowByID, &enumerator );
@ -555,7 +513,7 @@ SFG_Window* fgWindowByID( int windowID )
/*
* Looks up a menu given its ID. This is easier that fgWindowByXXX
* as all menus are placed in a single doubly linked list...
* as all menus are placed in one doubly linked list...
*/
SFG_Menu* fgMenuByID( int menuID )
{
@ -563,9 +521,7 @@ SFG_Menu* fgMenuByID( int menuID )
freeglut_assert_ready;
/*
* It's enough to check all entries in fgStructure.Menus...
*/
/* It's enough to check all entries in fgStructure.Menus... */
for( menu = (SFG_Menu *)fgStructure.Menus.First;
menu;
menu = (SFG_Menu *)menu->Node.Next )

View File

@ -182,9 +182,7 @@ static void teapot( GLint grid, GLdouble scale, GLenum type )
*/
void FGAPIENTRY glutWireTeapot( GLdouble size )
{
/*
* We will use the general teapot rendering code
*/
/* We will use the general teapot rendering code */
teapot( 10, size, GL_LINE );
}
@ -193,9 +191,7 @@ void FGAPIENTRY glutWireTeapot( GLdouble size )
*/
void FGAPIENTRY glutSolidTeapot( GLdouble size )
{
/*
* We will use the general teapot rendering code
*/
/* We will use the general teapot rendering code */
teapot( 7, size, GL_FILL );
}

View File

@ -91,8 +91,8 @@ XVisualInfo* fgChooseVisual( void )
* First we have to process the display mode settings...
*/
/*
* Why is there a semi-colon in this #define? The code
* that uses the macro seems to always add more semicolons...
* XXX Why is there a semi-colon in this #define? The code
* XXX that uses the macro seems to always add more semicolons...
*/
#define ATTRIB(a) attributes[where++]=a;
#define ATTRIB_VAL(a,v) {ATTRIB(a); ATTRIB(v);}
@ -447,13 +447,13 @@ void fgOpenWindow( SFG_Window* window, const char* title,
/*
* Fill in the size hints values now (the x, y, width and height
* settings are obsolote, are there any more WMs that support them?)
* settings are obsolete, are there any more WMs that support them?)
* Unless the X servers actually stop supporting these, we should
* continue to fill them in. It is *not* our place to tell the user
* that they should replace a window manager that they like, and which
* works, just because *we* think that it's not "modern" enough.
*/
#if TARGET_HOST_WINCE
#if TARGET_HOST_WINCE /* Since this is in the X11 branch, it's pretty dumb */
sizeHints.x = 0;
sizeHints.y = 0;
sizeHints.width = 320;
@ -467,9 +467,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
wmHints.flags = StateHint;
wmHints.initial_state = fgState.ForceIconic ? IconicState : NormalState;
/*
* Prepare the window and iconified window names...
*/
/* Prepare the window and iconified window names... */
XStringListToTextProperty( (char **) &title, 1, &textProperty );
XSetWMProperties(
@ -498,9 +496,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
freeglut_assert_ready;
/*
* Grab the window class we have registered on glutInit():
*/
/* Grab the window class we have registered on glutInit(): */
atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc );
assert( atom != 0 );
@ -640,9 +636,7 @@ void fgCloseWindow( SFG_Window* window )
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
/*
* Make sure we don't close a window with current context active
*/
/* Make sure we don't close a window with current context active */
if( fgStructure.Window == window )
wglMakeCurrent( NULL, NULL );
@ -690,7 +684,6 @@ int FGAPIENTRY glutCreateWindow( const char* title )
int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h )
{
int ret = 0;
SFG_Window* window = NULL;
SFG_Window* parent = NULL;
@ -941,6 +934,7 @@ void FGAPIENTRY glutPositionWindow( int x, int y )
{
RECT winRect;
/* "GetWindowRect" returns the pixel coordinates of the outside of the window */
GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
MoveWindow(
fgStructure.Window->Window.Handle,