projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding temporary fix to "glutInitDisplayString" to ignore numerical assignments
[freeglut]
/
src
/
freeglut_state.c
diff --git
a/src/freeglut_state.c
b/src/freeglut_state.c
index
4968b47
..
4da1b5e
100644
(file)
--- a/
src/freeglut_state.c
+++ b/
src/freeglut_state.c
@@
-45,7
+45,7
@@
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
/*
* Queries the GL context about some attributes
*/
/*
* Queries the GL context about some attributes
*/
@@
-124,7
+124,7
@@
void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
*/
int FGAPIENTRY glutGet( GLenum eWhat )
{
*/
int FGAPIENTRY glutGet( GLenum eWhat )
{
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
int returnValue ;
GLboolean boolValue ;
#endif
int returnValue ;
GLboolean boolValue ;
#endif
@@
-162,7
+162,7
@@
int FGAPIENTRY glutGet( GLenum eWhat )
/* XXX Multisampling. Return what I know about multisampling. */
return 0;
/* XXX Multisampling. Return what I know about multisampling. */
return 0;
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
/*
* The rest of GLX queries under X are general enough to use a macro to
* check them
/*
* The rest of GLX queries under X are general enough to use a macro to
* check them
@@
-260,7
+260,15
@@
int FGAPIENTRY glutGet( GLenum eWhat )
/* I do not know yet if there will be a fgChooseVisual() function for Win32 */
case GLUT_DISPLAY_MODE_POSSIBLE:
/* I do not know yet if there will be a fgChooseVisual() function for Win32 */
case GLUT_DISPLAY_MODE_POSSIBLE:
- return( fgChooseVisual() == NULL ? 0 : 1 );
+ {
+ XVisualInfo* visualInfo = fgChooseVisual();
+ if ( visualInfo == NULL ) {
+ return 0;
+ } else {
+ XFree( visualInfo );
+ return 1;
+ }
+ }
/* This is system-dependant */
case GLUT_WINDOW_FORMAT_ID:
/* This is system-dependant */
case GLUT_WINDOW_FORMAT_ID:
@@
-269,7
+277,7
@@
int FGAPIENTRY glutGet( GLenum eWhat )
return fgStructure.CurrentWindow->Window.VisualInfo->visualid;
return fgStructure.CurrentWindow->Window.VisualInfo->visualid;
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
/* Handle the OpenGL inquiries */
case GLUT_WINDOW_RGBA:
/* Handle the OpenGL inquiries */
case GLUT_WINDOW_RGBA:
@@
-361,8
+369,8
@@
int FGAPIENTRY glutGet( GLenum eWhat )
/* ...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.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) &&
+#if !defined(_WIN32_WCE)
+ if ( ( fgStructure.GameModeWindow != fgStructure.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) &&
( ! fgStructure.CurrentWindow->IsMenu ) )
{
winRect.left += GetSystemMetrics( SM_CXSIZEFRAME );
( ! fgStructure.CurrentWindow->IsMenu ) )
{
winRect.left += GetSystemMetrics( SM_CXSIZEFRAME );
@@
-370,7
+378,7
@@
int FGAPIENTRY glutGet( GLenum eWhat )
winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
}
winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
}
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
switch( eWhat )
{
switch( eWhat )
{
@@
-383,33
+391,33
@@
int FGAPIENTRY glutGet( GLenum eWhat )
break;
case GLUT_WINDOW_BORDER_WIDTH :
break;
case GLUT_WINDOW_BORDER_WIDTH :
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
return 0;
#else
return GetSystemMetrics( SM_CXSIZEFRAME );
return 0;
#else
return GetSystemMetrics( SM_CXSIZEFRAME );
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
case GLUT_WINDOW_HEADER_HEIGHT :
case GLUT_WINDOW_HEADER_HEIGHT :
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
return 0;
#else
return GetSystemMetrics( SM_CYCAPTION );
return 0;
#else
return GetSystemMetrics( SM_CYCAPTION );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
case GLUT_DISPLAY_MODE_POSSIBLE:
case GLUT_DISPLAY_MODE_POSSIBLE:
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
return GL_FALSE;
#else
return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
PFD_MAIN_PLANE );
return GL_FALSE;
#else
return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
PFD_MAIN_PLANE );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
case GLUT_WINDOW_FORMAT_ID:
case GLUT_WINDOW_FORMAT_ID:
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
if( fgStructure.CurrentWindow != NULL )
return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );
if( fgStructure.CurrentWindow != NULL )
return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
return 0;
#endif
return 0;
#endif
@@
-478,7
+486,7
@@
int FGAPIENTRY glutDeviceGet( GLenum eWhat )
*/
return TRUE ;
*/
return TRUE ;
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
case GLUT_HAS_MOUSE:
return TRUE ;
case GLUT_HAS_MOUSE:
return TRUE ;
@@
-505,7
+513,7
@@
int FGAPIENTRY glutDeviceGet( GLenum eWhat )
*/
return 3 ;
*/
return 3 ;
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
case GLUT_HAS_MOUSE:
/*
case GLUT_HAS_MOUSE:
/*
@@
-516,11
+524,11
@@
int FGAPIENTRY glutDeviceGet( GLenum eWhat )
case GLUT_NUM_MOUSE_BUTTONS:
/* We are much more fortunate under Win32 about this... */
case GLUT_NUM_MOUSE_BUTTONS:
/* We are much more fortunate under Win32 about this... */
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
return 1;
#else
return GetSystemMetrics( SM_CMOUSEBUTTONS );
return 1;
#else
return GetSystemMetrics( SM_CMOUSEBUTTONS );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
#endif
#endif
@@
-540,14
+548,21
@@
int FGAPIENTRY glutDeviceGet( GLenum eWhat )
case GLUT_JOYSTICK_AXES:
return glutJoystickGetNumAxes ( 0 );
case GLUT_JOYSTICK_AXES:
return glutJoystickGetNumAxes ( 0 );
- case GLUT_HAS_SPACEBALL:
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
+ return fgInputDeviceDetect ();
+
+ case GLUT_NUM_DIALS:
+ if ( fgState.InputDevsInitialised ) return 8;
+ return 0;
+
+ case GLUT_NUM_BUTTON_BOX_BUTTONS:
+ return 0;
+
+ case GLUT_HAS_SPACEBALL:
case GLUT_HAS_TABLET:
return FALSE;
case GLUT_NUM_SPACEBALL_BUTTONS:
case GLUT_HAS_TABLET:
return FALSE;
case GLUT_NUM_SPACEBALL_BUTTONS:
- case GLUT_NUM_BUTTON_BOX_BUTTONS:
- case GLUT_NUM_DIALS:
case GLUT_NUM_TABLET_BUTTONS:
return 0;
case GLUT_NUM_TABLET_BUTTONS:
return 0;
@@
-572,7
+587,7
@@
int FGAPIENTRY glutDeviceGet( GLenum eWhat )
int FGAPIENTRY glutGetModifiers( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetModifiers" );
int FGAPIENTRY glutGetModifiers( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetModifiers" );
- if( fgState.Modifiers == 0xffffffff )
+ if( fgState.Modifiers == INVALID_MODIFIERS )
{
fgWarning( "glutGetModifiers() called outside an input callback" );
return 0;
{
fgWarning( "glutGetModifiers() called outside an input callback" );
return 0;
@@
-597,7
+612,7
@@
int FGAPIENTRY glutLayerGet( GLenum eWhat )
switch( eWhat )
{
switch( eWhat )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
case GLUT_OVERLAY_POSSIBLE:
return FALSE;
case GLUT_OVERLAY_POSSIBLE:
return FALSE;
@@
-623,7
+638,7
@@
int FGAPIENTRY glutLayerGet( GLenum eWhat )
case GLUT_OVERLAY_DAMAGED:
return -1;
case GLUT_OVERLAY_DAMAGED:
return -1;
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
case GLUT_OVERLAY_POSSIBLE:
/* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
case GLUT_OVERLAY_POSSIBLE:
/* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,