X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffreeglut_main_mswin.c;h=b4d1bc9c4479a4c20c1aa5ca64fd55db8ec373dc;hb=25f8968aacfa2038bc34be17ccaf05cae52c1110;hp=81013d36f2fc1eef24c970d56762e63ba9678d68;hpb=6ff4a7eb4780b498d9630d343d6302b76af8e8c5;p=freeglut diff --git a/src/mswin/freeglut_main_mswin.c b/src/mswin/freeglut_main_mswin.c index 81013d3..b4d1bc9 100644 --- a/src/mswin/freeglut_main_mswin.c +++ b/src/mswin/freeglut_main_mswin.c @@ -26,13 +26,32 @@ */ #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 ); -void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height ) +#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 ) { RECT windowRect; @@ -80,7 +99,7 @@ void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height ) } -void fghcbPlatformDisplayWindow ( SFG_Window *window ) +void fgPlatformDisplayWindow ( SFG_Window *window ) { RedrawWindow( window->Window.Handle, NULL, NULL, @@ -89,13 +108,13 @@ void fghcbPlatformDisplayWindow ( SFG_Window *window ) } -void fghPlatformSleepForEvents( long msec ) +void fgPlatformSleepForEvents( long msec ) { MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT ); } -void fghProcessSingleEvent ( void ) +void fgPlatformProcessSingleEvent ( void ) { MSG stMsg; @@ -123,7 +142,7 @@ void fghProcessSingleEvent ( void ) -void fghMainLoopPreliminaryWork ( void ) +void fgPlatformMainLoopPreliminaryWork ( void ) { SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; @@ -154,7 +173,7 @@ void fghMainLoopPreliminaryWork ( void ) /* * Determine a GLUT modifer mask based on MS-WINDOWS system info. */ -static int fghGetModifiers (void) +static int fgPlatformGetModifiers (void) { return ( ( ( GetKeyState( VK_LSHIFT ) < 0 ) || @@ -168,8 +187,8 @@ static int fghGetModifiers (void) /* * The window procedure for handling Win32 events */ -LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, - LPARAM lParam ) +LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, + LPARAM lParam ) { static unsigned char lControl = 0, rControl = 0, lShift = 0, rShift = 0, lAlt = 0, rAlt = 0; @@ -307,7 +326,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, /* The window structure is passed as the creation structure parameter... */ window = (SFG_Window *) (((LPCREATESTRUCT) lParam)->lpCreateParams); FREEGLUT_INTERNAL_ERROR_EXIT ( ( window != NULL ), "Cannot create window", - "fgWindowProc" ); + "fgPlatformWindowProc" ); window->Window.Handle = hWnd; window->Window.Device = GetDC( hWnd ); @@ -497,7 +516,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, } SetFocus(window->Window.Handle); - fgState.Modifiers = fghGetModifiers( ); + fgState.Modifiers = fgPlatformGetModifiers( ); if( ( wParam & MK_LBUTTON ) || ( wParam & MK_MBUTTON ) || @@ -607,7 +626,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, break; fgSetWindow( window ); - fgState.Modifiers = fghGetModifiers( ); + fgState.Modifiers = fgPlatformGetModifiers( ); INVOKE_WCB( *window, Mouse, @@ -641,7 +660,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, break; fgSetWindow( window ); - fgState.Modifiers = fghGetModifiers( ); + fgState.Modifiers = fgPlatformGetModifiers( ); /* * XXX Should use WHEEL_DELTA instead of 120 @@ -702,7 +721,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, * Remember the current modifiers state. This is done here in order * to make sure the VK_DELETE keyboard callback is executed properly. */ - fgState.Modifiers = fghGetModifiers( ); + fgState.Modifiers = fgPlatformGetModifiers( ); GetCursorPos( &mouse_pos ); ScreenToClient( window->Window.Handle, &mouse_pos ); @@ -792,7 +811,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, * Remember the current modifiers state. This is done here in order * to make sure the VK_DELETE keyboard callback is executed properly. */ - fgState.Modifiers = fghGetModifiers( ); + fgState.Modifiers = fgPlatformGetModifiers( ); GetCursorPos( &mouse_pos ); ScreenToClient( window->Window.Handle, &mouse_pos ); @@ -877,7 +896,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if( (fgState.KeyRepeat==GLUT_KEY_REPEAT_OFF || window->State.IgnoreKeyRepeat==GL_TRUE) && (HIWORD(lParam) & KF_REPEAT) ) break; - fgState.Modifiers = fghGetModifiers( ); + fgState.Modifiers = fgPlatformGetModifiers( ); INVOKE_WCB( *window, Keyboard, ( (char)wParam, window->State.MouseX, window->State.MouseY )