X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_main.c;h=3a6de788ddb99927cdc236a0a9d0fab459e5e610;hb=e9ebb8053106d2504605c70a1fd777a52f1d9da4;hp=2189c41ad0610a0d5161648eae465975a99e7fb2;hpb=71968c367fd725119878eb2d2225171a647002e8;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 2189c41..3a6de78 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -308,7 +308,7 @@ static void fghCheckTimers( void ) * 32-bit, where the GLUT API return value is also overflowed. */ unsigned long fgSystemTime(void) { -#if TARGET_HOST_POSIX_X11 +#if TARGET_HOST_SOLARIS || HAVE_GETTIMEOFDAY struct timeval now; gettimeofday( &now, NULL ); return now.tv_usec/1000 + now.tv_sec*1000; @@ -1159,15 +1159,15 @@ void FGAPIENTRY glutMainLoopEvent( void ) * XXX track ButtonPress/ButtonRelease events in our own * XXX bit-mask? */ - fgState.Modifiers = fghGetXModifiers( event.xmotion.state ); + fgState.Modifiers = fghGetXModifiers( event.xmotion.state ); if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) { INVOKE_WCB( *window, Motion, ( event.xmotion.x, event.xmotion.y ) ); } else { INVOKE_WCB( *window, Passive, ( event.xmotion.x, event.xmotion.y ) ); - } - fgState.Modifiers = INVALID_MODIFIERS; + } + fgState.Modifiers = INVALID_MODIFIERS; } break; @@ -1290,7 +1290,10 @@ void FGAPIENTRY glutMainLoopEvent( void ) /* Cease processing this event if it is auto repeated */ if (window->State.KeyRepeating) + { + if (event.type == KeyPress) window->State.KeyRepeating = GL_FALSE; break; + } if( event.type == KeyPress ) { @@ -1353,9 +1356,13 @@ void FGAPIENTRY glutMainLoopEvent( void ) case XK_F11: special = GLUT_KEY_F11; break; case XK_F12: special = GLUT_KEY_F12; break; + case XK_KP_Left: case XK_Left: special = GLUT_KEY_LEFT; break; + case XK_KP_Right: case XK_Right: special = GLUT_KEY_RIGHT; break; + case XK_KP_Up: case XK_Up: special = GLUT_KEY_UP; break; + case XK_KP_Down: case XK_Down: special = GLUT_KEY_DOWN; break; case XK_KP_Prior: @@ -1368,6 +1375,10 @@ void FGAPIENTRY glutMainLoopEvent( void ) case XK_End: special = GLUT_KEY_END; break; case XK_KP_Insert: case XK_Insert: special = GLUT_KEY_INSERT; break; + + case XK_Num_Lock : special = GLUT_KEY_NUM_LOCK; break; + case XK_KP_Begin : special = GLUT_KEY_BEGIN; break; + case XK_KP_Delete: special = GLUT_KEY_DELETE; break; } /* @@ -1389,6 +1400,10 @@ void FGAPIENTRY glutMainLoopEvent( void ) case ReparentNotify: break; /* XXX Should disable this event */ + /* Not handled */ + case GravityNotify: + break; + default: fgWarning ("Unknown X event type: %d\n", event.type); break; @@ -1545,7 +1560,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, { SFG_Window* window; PAINTSTRUCT ps; - LONG lRet = 1; + LRESULT lRet = 1; FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED ( "Event Handler" ) ; @@ -1606,11 +1621,22 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, window->Window.Context = wglCreateContext( window->Window.Device ); } + +#if !defined(_WIN32_WCE) + fgNewWGLCreateContext( window ); +#endif } window->State.NeedToResize = GL_TRUE; - window->State.Width = fgState.Size.X; - window->State.Height = fgState.Size.Y; + if( ( window->State.Width < 0 ) || ( window->State.Height < 0 ) ) + { + SFG_Window *current_window = fgStructure.CurrentWindow; + + fgSetWindow( window ); + window->State.Width = glutGet( GLUT_WINDOW_WIDTH ); + window->State.Height = glutGet( GLUT_WINDOW_HEIGHT ); + fgSetWindow( current_window ); + } ReleaseDC( window->Window.Handle, window->Window.Device ); @@ -2078,7 +2104,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, GetKeyboardState( state ); - if( ToAscii( wParam, 0, state, code, 0 ) == 1 ) + if( ToAscii( (UINT)wParam, 0, state, code, 0 ) == 1 ) wParam=code[ 0 ]; INVOKE_WCB( *window, KeyboardUp, @@ -2226,6 +2252,17 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, case SC_HOTKEY : break ; +#if(WINVER >= 0x0400) + case SC_DEFAULT : + break ; + + case SC_MONITORPOWER : + break ; + + case SC_CONTEXTHELP : + break ; +#endif /* WINVER >= 0x0400 */ + default: #if _DEBUG fgWarning( "Unknown wParam type 0x%x", wParam );