X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffreeglut_window_mswin.c;h=93c2dce99c0e4263806d29c9ec2eef732b6a83e9;hb=ef90e5c72102f31823452430eb0b704dd3a44113;hp=bf4ef0405dcf85ea4d0b0f94bac14aaf45861b0d;hpb=83a7f1444d1388983a7b756dde26b0cc74101b13;p=freeglut diff --git a/src/mswin/freeglut_window_mswin.c b/src/mswin/freeglut_window_mswin.c index bf4ef04..93c2dce 100644 --- a/src/mswin/freeglut_window_mswin.c +++ b/src/mswin/freeglut_window_mswin.c @@ -25,6 +25,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#define FREEGLUT_BUILDING_LIB #include #include "../Common/freeglut_internal.h" @@ -79,17 +80,6 @@ typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShar #endif /* End of copying the necessary parts out of it. */ -/* pushing attribute/value pairs into an array */ -#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 ); - #ifdef WM_TOUCH typedef BOOL (WINAPI *pRegisterTouchWindow)(HWND,ULONG); static pRegisterTouchWindow fghRegisterTouchWindow = (pRegisterTouchWindow)0xDEADBEEF; @@ -169,9 +159,9 @@ void fgNewWGLCreateContext( SFG_Window* window ) return; } - wglMakeCurrent( window->Window.Device, window->Window.Context ); + wglMakeCurrent( window->Window.pContext.Device, window->Window.Context ); - if ( !fghIsExtensionSupported( window->Window.Device, "WGL_ARB_create_context" ) ) + if ( !fghIsExtensionSupported( window->Window.pContext.Device, "WGL_ARB_create_context" ) ) { return; } @@ -185,7 +175,7 @@ void fgNewWGLCreateContext( SFG_Window* window ) fgError( "wglCreateContextAttribsARB not found" ); } - context = wglCreateContextAttribsARB( window->Window.Device, 0, attributes ); + context = wglCreateContextAttribsARB( window->Window.pContext.Device, 0, attributes ); if ( context == NULL ) { fghContextCreationError(); @@ -296,7 +286,7 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, if (checkOnly) current_hDC = CreateDC(TEXT("DISPLAY"), NULL ,NULL ,NULL); else - current_hDC = window->Window.Device; + current_hDC = window->Window.pContext.Device; fghFillPFD( ppfd, current_hDC, layer_type ); pixelformat = ChoosePixelFormat( current_hDC, ppfd ); @@ -370,13 +360,13 @@ void fgPlatformSetWindow ( SFG_Window *window ) { if( fgStructure.CurrentWindow ) ReleaseDC( fgStructure.CurrentWindow->Window.Handle, - fgStructure.CurrentWindow->Window.Device ); + fgStructure.CurrentWindow->Window.pContext.Device ); if ( window ) { - window->Window.Device = GetDC( window->Window.Handle ); + window->Window.pContext.Device = GetDC( window->Window.Handle ); wglMakeCurrent( - window->Window.Device, + window->Window.pContext.Device, window->Window.Context ); } @@ -978,10 +968,10 @@ void fgPlatformGlutFullScreen( SFG_Window *win ) /* store current window rect */ - GetWindowRect( win->Window.Handle, &win->State.OldRect ); + GetWindowRect( win->Window.Handle, &win->State.pWState.OldRect ); /* store current window style */ - win->State.OldStyle = s = GetWindowLong(win->Window.Handle, GWL_STYLE); + win->State.pWState.OldStyle = s = GetWindowLong(win->Window.Handle, GWL_STYLE); /* remove decorations from style and add popup style*/ s &= ~WS_OVERLAPPEDWINDOW; @@ -992,7 +982,7 @@ void fgPlatformGlutFullScreen( SFG_Window *win ) /* For fullscreen mode, find the monitor that is covered the most * by the window and get its rect as the resize target. */ - hMonitor= MonitorFromRect(&win->State.OldRect, MONITOR_DEFAULTTONEAREST); + hMonitor= MonitorFromRect(&win->State.pWState.OldRect, MONITOR_DEFAULTTONEAREST); mi.cbSize = sizeof(mi); GetMonitorInfo(hMonitor, &mi); rect = mi.rcMonitor; @@ -1048,16 +1038,16 @@ void fgPlatformGlutLeaveFullScreen( SFG_Window *win ) } /* restore style of window before making it fullscreen */ - SetWindowLong(win->Window.Handle, GWL_STYLE, win->State.OldStyle); + SetWindowLong(win->Window.Handle, GWL_STYLE, win->State.pWState.OldStyle); SetWindowPos(win->Window.Handle, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); /* Then resize */ SetWindowPos(win->Window.Handle, HWND_TOP, - win->State.OldRect.left, - win->State.OldRect.top, - win->State.OldRect.right - win->State.OldRect.left, - win->State.OldRect.bottom - win->State.OldRect.top, + win->State.pWState.OldRect.left, + win->State.pWState.OldRect.top, + win->State.pWState.OldRect.right - win->State.pWState.OldRect.left, + win->State.pWState.OldRect.bottom - win->State.pWState.OldRect.top, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOZORDER ); @@ -1078,3 +1068,11 @@ void fgPlatformGlutFullScreenToggle( SFG_Window *win ) } +/* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */ + +int FGAPIENTRY __glutCreateWindowWithExit( const char *title, void (__cdecl *exit_function)(int) ) +{ + __glutExitFunc = exit_function; + return glutCreateWindow( title ); +} +