X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffreeglut_main_mswin.c;h=be48b23dec7769879c2a59156ff258cd25d50b59;hb=1359ef1242ec8e5310430da3373a0b013ac71af6;hp=7037e3d176b0a94c4aeb42f94c81df7f33f6c74e;hpb=3e5e3f51c272a95dc877b781281880061690b935;p=freeglut diff --git a/src/mswin/freeglut_main_mswin.c b/src/mswin/freeglut_main_mswin.c index 7037e3d..be48b23 100644 --- a/src/mswin/freeglut_main_mswin.c +++ b/src/mswin/freeglut_main_mswin.c @@ -26,11 +26,30 @@ */ #include -#include "freeglut_internal_mswin.h" +#include "../Common/freeglut_internal.h" extern void fghRedrawWindow ( SFG_Window *window ); +extern void fgNewWGLCreateContext( SFG_Window* window ); +extern GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, + unsigned char layer_type ); + +#ifdef WM_TOUCH +typedef BOOL (WINAPI *pGetTouchInputInfo)(HTOUCHINPUT,UINT,PTOUCHINPUT,int); +typedef BOOL (WINAPI *pCloseTouchInputHandle)(HTOUCHINPUT); +static pGetTouchInputInfo fghGetTouchInputInfo = (pGetTouchInputInfo)0xDEADBEEF; +static pCloseTouchInputHandle fghCloseTouchInputHandle = (pCloseTouchInputHandle)0xDEADBEEF; +#endif + +/* + * Helper functions for getting client area from the window rect + * 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 fghComputeWindowRectFromClientArea_QueryWindow( const SFG_Window *window, RECT *clientRect, BOOL posIsOutside ); +extern RECT fghGetClientArea ( const SFG_Window *window, BOOL wantPosOutside ); + void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height ) { @@ -89,6 +108,16 @@ void fgPlatformDisplayWindow ( SFG_Window *window ) } +unsigned long fgPlatformSystemTime ( void ) +{ +#if defined(_WIN32_WCE) + return GetTickCount(); +#else + return timeGetTime(); +#endif +} + + void fgPlatformSleepForEvents( long msec ) { MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT ); @@ -310,7 +339,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, "fgPlatformWindowProc" ); window->Window.Handle = hWnd; - window->Window.Device = GetDC( hWnd ); + window->Window.pContext.Device = GetDC( hWnd ); if( window->IsMenu ) { unsigned int current_DisplayMode = fgState.DisplayMode; @@ -321,7 +350,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, fgState.DisplayMode = current_DisplayMode; if( fgStructure.MenuContext ) - wglMakeCurrent( window->Window.Device, + wglMakeCurrent( window->Window.pContext.Device, fgStructure.MenuContext->MContext ); else @@ -329,11 +358,11 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, fgStructure.MenuContext = (SFG_MenuContext *)malloc( sizeof(SFG_MenuContext) ); fgStructure.MenuContext->MContext = - wglCreateContext( window->Window.Device ); + wglCreateContext( window->Window.pContext.Device ); } /* window->Window.Context = wglGetCurrentContext (); */ - window->Window.Context = wglCreateContext( window->Window.Device ); + window->Window.Context = wglCreateContext( window->Window.pContext.Device ); } else { @@ -343,13 +372,13 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if( ! fgState.UseCurrentContext ) window->Window.Context = - wglCreateContext( window->Window.Device ); + wglCreateContext( window->Window.pContext.Device ); else { window->Window.Context = wglGetCurrentContext( ); if( ! window->Window.Context ) window->Window.Context = - wglCreateContext( window->Window.Device ); + wglCreateContext( window->Window.pContext.Device ); } #if !defined(_WIN32_WCE) @@ -372,7 +401,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, fgSetWindow( current_window ); } - ReleaseDC( window->Window.Handle, window->Window.Device ); + ReleaseDC( window->Window.Handle, window->Window.pContext.Device ); #if defined(_WIN32_WCE) /* Take over button handling */