X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_state_mswin.c;h=a217747ebd242385eeda7c06cdf64c917854f517;hb=af4474129987c478bad43ff0b4f44c2470298a8d;hp=c4598d4ce01e673b96bd6557549309bc15d82dec;hpb=8281152cfb738a2740d16dfb3f7f816467a6b2ae;p=freeglut diff --git a/src/mswin/fg_state_mswin.c b/src/mswin/fg_state_mswin.c index c4598d4..a217747 100644 --- a/src/mswin/fg_state_mswin.c +++ b/src/mswin/fg_state_mswin.c @@ -37,7 +37,7 @@ extern GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, * and the window rect from the client area given the style of the window * (or a valid window pointer from which the style can be queried). */ -extern void fghGetClientArea( RECT *clientRect, const SFG_Window *window, BOOL wantPosOutside ); +extern void fghGetClientArea( RECT *clientRect, const SFG_Window *window ); extern void fghGetStyleFromWindow( const SFG_Window *window, DWORD *windowStyle, DWORD *windowExStyle ); extern void fghComputeWindowRectFromClientArea_UseStyle( RECT *clientRect, const DWORD windowStyle, const DWORD windowExStyle, BOOL posIsOutside ); @@ -141,10 +141,20 @@ int fgPlatformGlutGet ( GLenum eWhat ) return returnValue; case GLUT_WINDOW_BUFFER_SIZE: - returnValue = 1 ; /* TODO????? */ - return returnValue; + { + PIXELFORMATDESCRIPTOR pfd; + HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device; + int iPixelFormat = GetPixelFormat( hdc ); + DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); + + returnValue = pfd.cColorBits; + if (pfd.iPixelType==PFD_TYPE_RGBA) + returnValue += pfd.cAlphaBits; + + return returnValue; + } case GLUT_WINDOW_STENCIL_SIZE: - returnValue = 0 ; /* TODO????? */ + glGetIntegerv ( GL_STENCIL_BITS, &returnValue ); return returnValue; case GLUT_WINDOW_X: @@ -226,15 +236,19 @@ int fgPlatformGlutGet ( GLenum eWhat ) /* Get style of window, or default style */ fghGetStyleFromWindow( fgStructure.CurrentWindow, &windowStyle, &windowExStyle ); - /* Get client area if any window */ + /* Get client area if we have a current window, else use dummy rect */ + /* Also get window rect (including non-client area) */ if (fgStructure.CurrentWindow && fgStructure.CurrentWindow->Window.Handle) - fghGetClientArea(&clientRect,fgStructure.CurrentWindow,FALSE); + { + fghGetClientArea(&clientRect,fgStructure.CurrentWindow); + GetWindowRect(fgStructure.CurrentWindow->Window.Handle,&winRect); + } else + { SetRect(&clientRect,0,0,200,200); - - /* Compute window rect (including non-client area) */ - CopyRect(&winRect,&clientRect); - fghComputeWindowRectFromClientArea_UseStyle(&winRect,windowStyle,windowExStyle,FALSE); + CopyRect(&winRect,&clientRect); + fghComputeWindowRectFromClientArea_UseStyle(&winRect,windowStyle,windowExStyle,FALSE); + } /* Calculate border width by taking width of whole window minus width of client area and divide by two * NB: we assume horizontal and vertical borders have the same size, which should always be the case