From fae8eb0b74e98838021c31ff5478d43e06b82132 Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Sat, 10 Mar 2012 03:07:13 +0000 Subject: [PATCH] moved some windows only code from common to windows specific got rid of fgPlatformGlutLayerGet as we'll never implement layer support (added some notes too) added note about implementability of glutGetModeValues Moved joystick function from misc to Joystick code file git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1096 7f0cb862-5218-0410-a997-914c9d46530a --- src/Common/freeglut_joystick.c | 15 ++++++++- src/Common/freeglut_main.c | 16 ---------- src/Common/freeglut_misc.c | 13 -------- src/Common/freeglut_state.c | 36 +++++++++++++++++---- src/Common/freeglut_window.c | 8 ----- src/mswin/freeglut_main_mswin.c | 14 ++++++++ src/mswin/freeglut_state_mswin.c | 65 ++++++++++---------------------------- src/x11/freeglut_state_x11.c | 43 ------------------------- 8 files changed, 74 insertions(+), 136 deletions(-) diff --git a/src/Common/freeglut_joystick.c b/src/Common/freeglut_joystick.c index f6edc26..d4e7446 100644 --- a/src/Common/freeglut_joystick.c +++ b/src/Common/freeglut_joystick.c @@ -976,8 +976,21 @@ int fgJoystickDetect( void ) } /* - * Joystick information functions + * Joystick information, setup and execution functions */ + +/* + * Forces the joystick callback to be executed + */ +void FGAPIENTRY glutForceJoystickFunc( void ) +{ + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutForceJoystickFunc" ); +#if !defined(_WIN32_WCE) + freeglut_return_if_fail( fgStructure.CurrentWindow != NULL ); + freeglut_return_if_fail( FETCH_WCB( *( fgStructure.CurrentWindow ), Joystick ) ); + fgJoystickPollWindow( fgStructure.CurrentWindow ); +#endif /* !defined(_WIN32_WCE) */ +} int glutJoystickGetNumAxes( int ident ) { FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetNumAxes" ); diff --git a/src/Common/freeglut_main.c b/src/Common/freeglut_main.c index 73f53c9..ee40496 100644 --- a/src/Common/freeglut_main.c +++ b/src/Common/freeglut_main.c @@ -39,22 +39,6 @@ # define VFPRINTF(s,f,a) #endif -#ifdef _WIN32_WCE - -typedef struct GXDisplayProperties GXDisplayProperties; -typedef struct GXKeyList GXKeyList; -#include - -typedef struct GXKeyList (*GXGETDEFAULTKEYS)(int); -typedef int (*GXOPENINPUT)(); - -GXGETDEFAULTKEYS GXGetDefaultKeys_ = NULL; -GXOPENINPUT GXOpenInput_ = NULL; - -struct GXKeyList gxKeyList; - -#endif /* _WIN32_WCE */ - /* * Try to get the maximum value allowed for ints, falling back to the minimum * guaranteed by ISO C99 if there is no suitable header. diff --git a/src/Common/freeglut_misc.c b/src/Common/freeglut_misc.c index 4aa809a..18dab12 100644 --- a/src/Common/freeglut_misc.c +++ b/src/Common/freeglut_misc.c @@ -171,19 +171,6 @@ void FGAPIENTRY glutSetKeyRepeat( int repeatMode ) } /* - * Forces the joystick callback to be executed - */ -void FGAPIENTRY glutForceJoystickFunc( void ) -{ - FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutForceJoystickFunc" ); -#if !defined(_WIN32_WCE) - freeglut_return_if_fail( fgStructure.CurrentWindow != NULL ); - freeglut_return_if_fail( FETCH_WCB( *( fgStructure.CurrentWindow ), Joystick ) ); - fgJoystickPollWindow( fgStructure.CurrentWindow ); -#endif /* !defined(_WIN32_WCE) */ -} - -/* * */ void FGAPIENTRY glutSetColor( int nColor, GLfloat red, GLfloat green, GLfloat blue ) diff --git a/src/Common/freeglut_state.c b/src/Common/freeglut_state.c index b134660..84e2ccd 100644 --- a/src/Common/freeglut_state.c +++ b/src/Common/freeglut_state.c @@ -43,7 +43,6 @@ extern int fgPlatformGlutGet ( GLenum eWhat ); extern int fgPlatformGlutDeviceGet ( GLenum eWhat ); -extern int fgPlatformGlutLayerGet ( GLenum eWhat ); extern int *fgPlatformGlutGetModeValues(GLenum eWhat, int *size); @@ -291,16 +290,41 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat ) FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutLayerGet" ); /* - * This is easy as layers are not implemented ;-) - * - * XXX Can we merge the UNIX/X11 and WIN32 sections? Or - * XXX is overlay support planned? + * This is easy as layers are not implemented and + * overlay support is not planned. E.g. on Windows, + * overlay requests in PFDs are ignored + * (see iLayerType at http://msdn.microsoft.com/en-us/library/dd368826(v=vs.85).aspx) */ switch( eWhat ) { + case GLUT_OVERLAY_POSSIBLE: + return 0 ; + + case GLUT_LAYER_IN_USE: + return GLUT_NORMAL; + + case GLUT_HAS_OVERLAY: + return 0; + + case GLUT_TRANSPARENT_INDEX: + /* + * Return just anything, which is always defined as zero + * + * XXX HUH? + */ + return 0; + + case GLUT_NORMAL_DAMAGED: + /* XXX Actually I do not know. Maybe. */ + return 0; + + case GLUT_OVERLAY_DAMAGED: + return -1; + default: - return fgPlatformGlutLayerGet( eWhat ); + fgWarning( "glutLayerGet(): missing enum handle %d", eWhat ); + break; } /* And fail. That's good. Programs do love failing. */ diff --git a/src/Common/freeglut_window.c b/src/Common/freeglut_window.c index 9e04081..5a29a27 100644 --- a/src/Common/freeglut_window.c +++ b/src/Common/freeglut_window.c @@ -29,14 +29,6 @@ #include #include "freeglut_internal.h" -#if defined(_WIN32_WCE) -# include -# ifdef FREEGLUT_LIB_PRAGMAS -# pragma comment( lib, "Aygshell.lib" ) -# endif -#endif /* defined(_WIN32_WCE) */ - - /* * TODO BEFORE THE STABLE RELEASE: * diff --git a/src/mswin/freeglut_main_mswin.c b/src/mswin/freeglut_main_mswin.c index 290f161..127a090 100644 --- a/src/mswin/freeglut_main_mswin.c +++ b/src/mswin/freeglut_main_mswin.c @@ -42,6 +42,20 @@ static pGetTouchInputInfo fghGetTouchInputInfo = (pGetTouchInputInfo)0xDEADBEEF; static pCloseTouchInputHandle fghCloseTouchInputHandle = (pCloseTouchInputHandle)0xDEADBEEF; #endif +#ifdef _WIN32_WCE +typedef struct GXDisplayProperties GXDisplayProperties; +typedef struct GXKeyList GXKeyList; +#include + +typedef struct GXKeyList (*GXGETDEFAULTKEYS)(int); +typedef int (*GXOPENINPUT)(); + +GXGETDEFAULTKEYS GXGetDefaultKeys_ = NULL; +GXOPENINPUT GXOpenInput_ = NULL; + +struct GXKeyList gxKeyList; +#endif /* _WIN32_WCE */ + /* * Helper functions for getting client area from the window rect * and the window rect from the client area given the style of the window diff --git a/src/mswin/freeglut_state_mswin.c b/src/mswin/freeglut_state_mswin.c index 8c33a07..4daec41 100644 --- a/src/mswin/freeglut_state_mswin.c +++ b/src/mswin/freeglut_state_mswin.c @@ -47,6 +47,13 @@ extern void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* y */ #define WGL_SAMPLES_ARB 0x2042 +#if defined(_WIN32_WCE) +# include +# ifdef FREEGLUT_LIB_PRAGMAS +# pragma comment( lib, "Aygshell.lib" ) +# endif +#endif /* defined(_WIN32_WCE) */ + int fgPlatformGlutGet ( GLenum eWhat ) @@ -283,55 +290,15 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat ) return -1; } - -int fgPlatformGlutLayerGet( GLenum eWhat ) -{ - /* - * This is easy as layers are not implemented ;-) - * - * XXX Can we merge the UNIX/X11 and WIN32 sections? Or - * XXX is overlay support planned? - */ - switch( eWhat ) - { - - case GLUT_OVERLAY_POSSIBLE: -/* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE, - PFD_OVERLAY_PLANE ); */ - return 0 ; - - case GLUT_LAYER_IN_USE: - return GLUT_NORMAL; - - case GLUT_HAS_OVERLAY: - return 0; - - case GLUT_TRANSPARENT_INDEX: - /* - * Return just anything, which is always defined as zero - * - * XXX HUH? - */ - return 0; - - case GLUT_NORMAL_DAMAGED: - /* XXX Actually I do not know. Maybe. */ - return 0; - - case GLUT_OVERLAY_DAMAGED: - return -1; - - default: - fgWarning( "glutLayerGet(): missing enum handle %d", eWhat ); - break; - } - - /* And fail. That's good. Programs do love failing. */ - return -1; -} - - -/* MSwin does not currently have any Mode values? */ +/* + * This is for querying the number of supported auxiliary or multisample + * buffers for a (the current?) display mode. + * see http://old.nabble.com/-GLX--glutGetModeValues-to13514723.html#a13514723 + * Not currently implemented, but we should be able to query the relevant + * info using + * http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt + * (if supported on the executing machine!) + */ int *fgPlatformGlutGetModeValues(GLenum eWhat, int *size) { *size = 0; diff --git a/src/x11/freeglut_state_x11.c b/src/x11/freeglut_state_x11.c index 40267e4..9a5fd71 100644 --- a/src/x11/freeglut_state_x11.c +++ b/src/x11/freeglut_state_x11.c @@ -255,49 +255,6 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat ) return -1; } -int fgPlatformGlutLayerGet( GLenum eWhat ) -{ - /* - * This is easy as layers are not implemented ;-) - * - * XXX Can we merge the UNIX/X11 and WIN32 sections? Or - * XXX is overlay support planned? - */ - switch( eWhat ) - { - case GLUT_OVERLAY_POSSIBLE: - return 0; - - case GLUT_LAYER_IN_USE: - return GLUT_NORMAL; - - case GLUT_HAS_OVERLAY: - return 0; - - case GLUT_TRANSPARENT_INDEX: - /* - * Return just anything, which is always defined as zero - * - * XXX HUH? - */ - return 0; - - case GLUT_NORMAL_DAMAGED: - /* XXX Actually I do not know. Maybe. */ - return 0; - - case GLUT_OVERLAY_DAMAGED: - return -1; - - default: - fgWarning( "glutLayerGet(): missing enum handle %d", eWhat ); - break; - } - - /* And fail. That's good. Programs do love failing. */ - return -1; -} - int *fgPlatformGlutGetModeValues(GLenum eWhat, int *size) { -- 1.7.10.4