X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_state.c;h=9e3a627de48be3f4e755d95d1f4a928af1aac606;hb=67e12a9904a16f2765c33dcd75b31926691416f1;hp=cafdfb9faab101f8d34169dd499aa1a6c605b213;hpb=027fcf9e66356b06563140740f8d1c7bc05c9987;p=freeglut diff --git a/src/freeglut_state.c b/src/freeglut_state.c index cafdfb9..9e3a627 100644 --- a/src/freeglut_state.c +++ b/src/freeglut_state.c @@ -64,30 +64,6 @@ static int fghGetConfig( int attribute ) } #endif -/* Check if the window is in full screen state. */ -static int fghCheckFullScreen(void) -{ -#if TARGET_HOST_POSIX_X11 - - int result; - - result = 0; - if (fgDisplay.StateFullScreen != None) - { - result = fgHintPresent(fgStructure.CurrentWindow->Window.Handle, - fgDisplay.State, - fgDisplay.StateFullScreen); - } - - return result; - -#else - - return 0; - -#endif -} - /* -- INTERFACE FUNCTIONS -------------------------------------------------- */ /* @@ -203,6 +179,10 @@ int FGAPIENTRY glutGet( GLenum eWhat ) case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Use ? fgState.Size.Y : -1 ; case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ; + case GLUT_INIT_MAJOR_VERSION: return fgState.MajorVersion ; + case GLUT_INIT_MINOR_VERSION: return fgState.MinorVersion ; + case GLUT_INIT_FLAGS: return fgState.ContextFlags ; + case GLUT_INIT_PROFILE: return fgState.ContextProfile ; #if TARGET_HOST_POSIX_X11 /* @@ -330,7 +310,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) GLXFBConfig * fbconfig; int isPossible; - fbconfig = fgChooseFBConfig(); + fbconfig = fgChooseFBConfig(NULL); if (fbconfig == NULL) { @@ -360,16 +340,28 @@ int FGAPIENTRY glutGet( GLenum eWhat ) /* Handle the OpenGL inquiries */ case GLUT_WINDOW_RGBA: +#if defined(_WIN32_WCE) + boolValue = (GLboolean)0; /* WinCE doesn't support this feature */ +#else glGetBooleanv ( GL_RGBA_MODE, &boolValue ); returnValue = boolValue ? 1 : 0; +#endif return returnValue; case GLUT_WINDOW_DOUBLEBUFFER: +#if defined(_WIN32_WCE) + boolValue = (GLboolean)0; /* WinCE doesn't support this feature */ +#else glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue ); returnValue = boolValue ? 1 : 0; +#endif return returnValue; case GLUT_WINDOW_STEREO: +#if defined(_WIN32_WCE) + boolValue = (GLboolean)0; /* WinCE doesn't support this feature */ +#else glGetBooleanv ( GL_STEREO, &boolValue ); returnValue = boolValue ? 1 : 0; +#endif return returnValue; case GLUT_WINDOW_RED_SIZE: @@ -385,16 +377,32 @@ int FGAPIENTRY glutGet( GLenum eWhat ) glGetIntegerv ( GL_ALPHA_BITS, &returnValue ); return returnValue; case GLUT_WINDOW_ACCUM_RED_SIZE: +#if defined(_WIN32_WCE) + returnValue = 0; /* WinCE doesn't support this feature */ +#else glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue ); +#endif return returnValue; case GLUT_WINDOW_ACCUM_GREEN_SIZE: +#if defined(_WIN32_WCE) + returnValue = 0; /* WinCE doesn't support this feature */ +#else glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue ); +#endif return returnValue; case GLUT_WINDOW_ACCUM_BLUE_SIZE: +#if defined(_WIN32_WCE) + returnValue = 0; /* WinCE doesn't support this feature */ +#else glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue ); +#endif return returnValue; case GLUT_WINDOW_ACCUM_ALPHA_SIZE: +#if defined(_WIN32_WCE) + returnValue = 0; /* WinCE doesn't support this feature */ +#else glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue ); +#endif return returnValue; case GLUT_WINDOW_DEPTH_SIZE: glGetIntegerv ( GL_DEPTH_BITS, &returnValue ); @@ -440,24 +448,11 @@ int FGAPIENTRY glutGet( GLenum eWhat ) freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 ); - /* - * We need to call GetWindowRect() first... - * (this returns the pixel coordinates of the outside of the window) - */ +#if defined(_WIN32_WCE) GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect ); - - /* ...then we've got to correct the results we've just received... */ - -#if !defined(_WIN32_WCE) - if ( ( fgStructure.GameModeWindow != fgStructure.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) && - ( ! fgStructure.CurrentWindow->IsMenu ) ) - { - winRect.left += GetSystemMetrics( SM_CXSIZEFRAME ); - winRect.right -= GetSystemMetrics( SM_CXSIZEFRAME ); - winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ); - winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME ); - } -#endif /* !defined(_WIN32_WCE) */ +#else + winRect = fghGetClientArea(fgStructure.CurrentWindow, FALSE); +#endif /* defined(_WIN32_WCE) */ switch( eWhat ) { @@ -470,17 +465,32 @@ int FGAPIENTRY glutGet( GLenum eWhat ) break; case GLUT_WINDOW_BORDER_WIDTH : -#if defined(_WIN32_WCE) - return 0; -#else - return GetSystemMetrics( SM_CXSIZEFRAME ); -#endif /* !defined(_WIN32_WCE) */ - case GLUT_WINDOW_HEADER_HEIGHT : #if defined(_WIN32_WCE) return 0; #else - return GetSystemMetrics( SM_CYCAPTION ); + { + DWORD windowStyle; + + if (fgStructure.CurrentWindow && fgStructure.CurrentWindow->Window.Handle) + windowStyle = GetWindowLong(fgStructure.CurrentWindow->Window.Handle, GWL_STYLE); + else + /* If no window, return sizes for a default window with title bar and border */ + windowStyle = WS_OVERLAPPEDWINDOW; + + switch( eWhat ) + { + case GLUT_WINDOW_BORDER_WIDTH: + { + int xBorderWidth, yBorderWidth; + fghGetBorderWidth(windowStyle, &xBorderWidth, &yBorderWidth); + return xBorderWidth; + } + case GLUT_WINDOW_HEADER_HEIGHT: + /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */ + return (windowStyle & WS_MAXIMIZEBOX)? GetSystemMetrics( SM_CYCAPTION ) : 0; + } + } #endif /* defined(_WIN32_WCE) */ case GLUT_DISPLAY_MODE_POSSIBLE: @@ -534,11 +544,15 @@ int FGAPIENTRY glutGet( GLenum eWhat ) case GLUT_DIRECT_RENDERING: return fgState.DirectContext; - break; case GLUT_FULL_SCREEN: - return fghCheckFullScreen(); - break; + return fgStructure.CurrentWindow->State.IsFullscreen; + + case GLUT_AUX: + return fgState.AuxiliaryBufferNumber; + + case GLUT_MULTISAMPLE: + return fgState.SampleNumber; default: fgWarning( "glutGet(): missing enum handle %d", eWhat ); @@ -639,10 +653,14 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat ) return 0; case GLUT_HAS_SPACEBALL: + return fgHasSpaceball(); + case GLUT_HAS_TABLET: return 0; case GLUT_NUM_SPACEBALL_BUTTONS: + return fgSpaceballNumButtons(); + case GLUT_NUM_TABLET_BUTTONS: return 0;