From c41e61d8b1543d571577005109f15ac25b5f3f17 Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Sat, 10 Mar 2012 02:03:32 +0000 Subject: [PATCH] XParseGeometry include now compiles with windows (VS2010, didn't touch cmake) Various typos in comments Some other cleanup and formatting glutInitDisplayString now understands "borderless" git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1095 7f0cb862-5218-0410-a997-914c9d46530a --- VisualStudio/2010/freeglut.vcxproj | 2 ++ VisualStudio/2010/freeglut.vcxproj.filters | 6 ++++++ src/Common/freeglut_init.c | 12 +++++------- src/Common/freeglut_internal.h | 10 +++++----- src/Common/freeglut_window.c | 5 +---- src/Common/xparsegeometry_repl.c | 4 ++-- src/Common/xparsegeometry_repl.h | 10 ++++------ src/mswin/freeglut_init_mswin.c | 7 ++++--- src/mswin/freeglut_internal_mswin.h | 27 ++++----------------------- src/mswin/freeglut_state_mswin.c | 4 ---- 10 files changed, 33 insertions(+), 54 deletions(-) diff --git a/VisualStudio/2010/freeglut.vcxproj b/VisualStudio/2010/freeglut.vcxproj index 3e47e96..f639596 100644 --- a/VisualStudio/2010/freeglut.vcxproj +++ b/VisualStudio/2010/freeglut.vcxproj @@ -344,6 +344,7 @@ + @@ -368,6 +369,7 @@ + diff --git a/VisualStudio/2010/freeglut.vcxproj.filters b/VisualStudio/2010/freeglut.vcxproj.filters index ad286b3..2661175 100644 --- a/VisualStudio/2010/freeglut.vcxproj.filters +++ b/VisualStudio/2010/freeglut.vcxproj.filters @@ -126,6 +126,9 @@ Source Files\mswin + + Source Files + @@ -154,6 +157,9 @@ Header Files + + Header Files + diff --git a/src/Common/freeglut_init.c b/src/Common/freeglut_init.c index 0c3e697..20073bb 100644 --- a/src/Common/freeglut_init.c +++ b/src/Common/freeglut_init.c @@ -315,9 +315,8 @@ void fgDeinitialize( void ) /* -- INTERFACE FUNCTIONS -------------------------------------------------- */ - #if !TARGET_HOST_POSIX_X11 -#include "Common/xparsegeometry_repl.h" +# include "../Common/xparsegeometry_repl.h" #endif /* @@ -499,7 +498,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) configuration is conformant or not */ break ; - case 6 : /* "depth": Number of bits of precsion in the depth buffer */ + case 6 : /* "depth": Number of bits of precision in the depth buffer */ glut_state_flag |= GLUT_DEPTH ; /* Somebody fix this for me! */ break ; @@ -619,8 +618,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) break ; case 35 : /* "borderless": windows should not have borders */ -#if TARGET_HOST_POSIX_X11 -#endif + glut_state_flag |= GLUT_BORDERLESS; break ; case 36 : /* "aux": some number of aux buffers */ @@ -646,7 +644,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion ) { - /* We will make use of these valuse when creating a new OpenGL context... */ + /* We will make use of these value when creating a new OpenGL context... */ fgState.MajorVersion = majorVersion; fgState.MinorVersion = minorVersion; } @@ -684,4 +682,4 @@ void FGAPIENTRY glutInitWarningFunc( void (* vfgWarning) ( const char *fmt, va_l fgState.WarningFunc = vfgWarning; } -/*** END OF FILE ***/ +/*** END OF FILE ***/ \ No newline at end of file diff --git a/src/Common/freeglut_internal.h b/src/Common/freeglut_internal.h index 45db259..415b9a4 100644 --- a/src/Common/freeglut_internal.h +++ b/src/Common/freeglut_internal.h @@ -941,11 +941,11 @@ SFG_Proc fgPlatformGetProcAddress( const char *procName ); #define ATTRIB(a) attributes[where++]=(a) #define ATTRIB_VAL(a,v) {ATTRIB(a); ATTRIB(v);} -extern int fghIsLegacyContextVersionRequested( void ); -extern int fghMapBit( int mask, int from, int to ); -extern int fghIsLegacyContextRequested( void ); -extern void fghContextCreationError( void ); -extern int fghNumberOfAuxBuffersRequested( void ); +int fghIsLegacyContextVersionRequested( void ); +int fghMapBit( int mask, int from, int to ); +int fghIsLegacyContextRequested( void ); +void fghContextCreationError( void ); +int fghNumberOfAuxBuffersRequested( void ); #endif /* FREEGLUT_INTERNAL_H */ diff --git a/src/Common/freeglut_window.c b/src/Common/freeglut_window.c index 9610a38..9e04081 100644 --- a/src/Common/freeglut_window.c +++ b/src/Common/freeglut_window.c @@ -47,14 +47,11 @@ * glutCreateSubWindow() -- Check when default position and size is {-1,-1} * glutDestroyWindow() -- check the Win32 version * glutSetWindow() -- check the Win32 version - * glutGetWindow() -- OK * glutSetWindowTitle() -- check the Win32 version * glutSetIconTitle() -- check the Win32 version * glutShowWindow() -- check the Win32 version * glutHideWindow() -- check the Win32 version * glutIconifyWindow() -- check the Win32 version - * glutReshapeWindow() -- check the Win32 version - * glutPositionWindow() -- check the Win32 version * glutPushWindow() -- check the Win32 version * glutPopWindow() -- check the Win32 version */ @@ -261,7 +258,7 @@ void FGAPIENTRY glutDestroyWindow( int windowID ) } /* - * This function selects the current window + * This function selects the specified window as the current window */ void FGAPIENTRY glutSetWindow( int ID ) { diff --git a/src/Common/xparsegeometry_repl.c b/src/Common/xparsegeometry_repl.c index 5151715..daacf44 100644 --- a/src/Common/xparsegeometry_repl.c +++ b/src/Common/xparsegeometry_repl.c @@ -32,10 +32,10 @@ from The Open Group. */ -#include "Common/xparsegeometry_repl.h" +#include "../Common/xparsegeometry_repl.h" /* - * XParseGeometry parses strings of the form + * XParseGeometry parses strings of the form * "=x{+-}{+-}", where * width, height, xoffset, and yoffset are unsigned integers. * Example: "=80x24+300-49" diff --git a/src/Common/xparsegeometry_repl.h b/src/Common/xparsegeometry_repl.h index 52c392f..75ebad1 100644 --- a/src/Common/xparsegeometry_repl.h +++ b/src/Common/xparsegeometry_repl.h @@ -42,11 +42,9 @@ from The Open Group. #define XNegative 0x0010 #define YNegative 0x0020 -extern int XParseGeometry ( - const char *string, - int *x, - int *y, - unsigned int *width, /* RETURN */ - unsigned int *height); /* RETURN */ +extern int XParseGeometry (const char *string, /* INPUT */ + int *x, int *y, /* RETURN */ + unsigned int *width, unsigned int *height); /* RETURN */ + #endif diff --git a/src/mswin/freeglut_init_mswin.c b/src/mswin/freeglut_init_mswin.c index ea78641..4e1451d 100644 --- a/src/mswin/freeglut_init_mswin.c +++ b/src/mswin/freeglut_init_mswin.c @@ -121,9 +121,10 @@ void fgPlatformInitialize( const char* displayName ) fgState.Initialised = GL_TRUE; - /* Avoid registering atexit callback on Win32 as it results in an access - * violation due to calling into a module which has been unloaded. - * Any cleanup isn't needed on Windows anyway, the OS takes care of it.c + /* Avoid registering atexit callback on Win32 as it can result in an + * access violation due to calling into a module which has been + * unloaded. + * Any cleanup isn't needed on Windows anyway, the OS takes care of it. * see: http://blogs.msdn.com/b/oldnewthing/archive/2012/01/05/10253268.aspx */ /* atexit(fgDeinitialize); */ diff --git a/src/mswin/freeglut_internal_mswin.h b/src/mswin/freeglut_internal_mswin.h index 8cb3769..571db40 100644 --- a/src/mswin/freeglut_internal_mswin.h +++ b/src/mswin/freeglut_internal_mswin.h @@ -69,8 +69,8 @@ LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); typedef struct tagSFG_PlatformDisplay SFG_PlatformDisplay; struct tagSFG_PlatformDisplay { - HINSTANCE Instance; /* The application's instance */ - DEVMODE DisplayMode; /* Desktop's display settings */ + HINSTANCE Instance; /* The application's instance */ + DEVMODE DisplayMode; /* Desktop's display settings */ char *DisplayName; /* Display name for multi display support*/ }; @@ -83,7 +83,7 @@ typedef HGLRC SFG_WindowContextType; typedef struct tagSFG_PlatformContext SFG_PlatformContext; struct tagSFG_PlatformContext { - HDC Device; /* The window's device context */ + HDC Device; /* The window's device context */ }; @@ -91,31 +91,12 @@ struct tagSFG_PlatformContext typedef struct tagSFG_PlatformWindowState SFG_PlatformWindowState; struct tagSFG_PlatformWindowState { - RECT OldRect; /* window rect - stored before the window is made fullscreen */ + RECT OldRect; /* window rect - stored before the window is made fullscreen */ DWORD OldStyle; /* window style - stored before the window is made fullscreen */ }; -/* For "freeglut_init.c", some definitions of symbols and a prototype to emulate the X11 functionality */ -#define NoValue 0x0000 -#define XValue 0x0001 -#define YValue 0x0002 -#define WidthValue 0x0004 -#define HeightValue 0x0008 -#define AllValues 0x000F -#define XNegative 0x0010 -#define YNegative 0x0020 - -extern int XParseGeometry ( - const char *string, - int *x, - int *y, - unsigned int *width, /* RETURN */ - unsigned int *height); /* RETURN */ - - - /* Joystick-Specific Definitions */ #if !defined(_WIN32_WCE) # define _JS_MAX_AXES 8 diff --git a/src/mswin/freeglut_state_mswin.c b/src/mswin/freeglut_state_mswin.c index aa6e30f..8c33a07 100644 --- a/src/mswin/freeglut_state_mswin.c +++ b/src/mswin/freeglut_state_mswin.c @@ -250,10 +250,6 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat ) /* * Win32 is assumed a keyboard, and this cannot be queried, * except for WindowsCE. - * - * X11 has a core keyboard by definition, although it can - * be present as a virtual/dummy keyboard. For now, there - * is no reliable way to tell if a real keyboard is present. */ #if defined(_WIN32_CE) return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0; -- 1.7.10.4