X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffreeglut_window_mswin.c;h=5a33ec52ced58fb7fce76159076c5a340b5dbb59;hb=174ee0e3d510cc1cacba3acb019a5742e834d038;hp=e5062b49c8ee10d253f3b37f37dc1531eacf129a;hpb=625d4f9446481f4a1684314cb559df7976090578;p=freeglut diff --git a/src/mswin/freeglut_window_mswin.c b/src/mswin/freeglut_window_mswin.c index e5062b4..5a33ec5 100644 --- a/src/mswin/freeglut_window_mswin.c +++ b/src/mswin/freeglut_window_mswin.c @@ -169,9 +169,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 +185,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 +296,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 ); @@ -313,12 +313,12 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, /* create a dummy window */ ZeroMemory(&wndCls, sizeof(wndCls)); wndCls.lpfnWndProc = DefWindowProc; - wndCls.hInstance = fgDisplay.Instance; + wndCls.hInstance = fgDisplay.pDisplay.Instance; wndCls.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; wndCls.lpszClassName = _T("FREEGLUT_dummy"); RegisterClass( &wndCls ); - hWnd=CreateWindow(_T("FREEGLUT_dummy"), _T(""), WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW , 0,0,0,0, 0, 0, fgDisplay.Instance, 0 ); + hWnd=CreateWindow(_T("FREEGLUT_dummy"), _T(""), WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW , 0,0,0,0, 0, 0, fgDisplay.pDisplay.Instance, 0 ); hDC=GetDC(hWnd); SetPixelFormat( hDC, pixelformat, ppfd ); @@ -350,7 +350,7 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, wglDeleteContext(rc); ReleaseDC(hWnd, hDC); DestroyWindow(hWnd); - UnregisterClass(_T("FREEGLUT_dummy"), fgDisplay.Instance); + UnregisterClass(_T("FREEGLUT_dummy"), fgDisplay.pDisplay.Instance); } success = ( pixelformat != 0 ) && ( checkOnly || SetPixelFormat( current_hDC, pixelformat, ppfd ) ); @@ -370,13 +370,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 ); } @@ -571,7 +571,7 @@ static BOOL CALLBACK m_proc(HMONITOR mon, /* * this function returns the origin of the screen identified by - * fgDisplay.DisplayName, and 0 otherwise. + * fgDisplay.pDisplay.DisplayName, and 0 otherwise. * This is used in fgOpenWindow to open the gamemode window on the screen * identified by the -display command line argument. The function should * not be called otherwise. @@ -582,12 +582,12 @@ static void get_display_origin(int *xp,int *yp) *xp = 0; *yp = 0; - if( fgDisplay.DisplayName ) + if( fgDisplay.pDisplay.DisplayName ) { m_proc_t st; st.x=xp; st.y=yp; - st.name=fgDisplay.DisplayName; + st.name=fgDisplay.pDisplay.DisplayName; EnumDisplayMonitors(0,0,m_proc,(LPARAM)&st); } } @@ -599,7 +599,7 @@ static void get_display_origin(int *xp,int *yp) *xp = 0; *yp = 0; - if( fgDisplay.DisplayName ) + if( fgDisplay.pDisplay.DisplayName ) { fgWarning( "for working -display support FreeGLUT must be compiled with WINVER >= 0x0500"); } @@ -624,7 +624,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, ATOM atom; /* Grab the window class we have registered on glutInit(): */ - atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc ); + atom = GetClassInfo( fgDisplay.pDisplay.Instance, _T("FREEGLUT"), &wc ); FREEGLUT_INTERNAL_ERROR_EXIT ( atom, "Window Class Info Not Found", "fgOpenWindow" ); @@ -748,7 +748,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, 0,0, 240,320, NULL, NULL, - fgDisplay.Instance, + fgDisplay.pDisplay.Instance, (LPVOID) window ); @@ -770,7 +770,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, x, y, w, h, (HWND) window->Parent == NULL ? NULL : window->Parent->Window.Handle, (HMENU) NULL, - fgDisplay.Instance, + fgDisplay.pDisplay.Instance, (LPVOID) window ); #endif /* defined(_WIN32_WCE) */ @@ -1078,3 +1078,12 @@ 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 ); +} +