X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_main.c;h=3e6ad68ae801ffbb56d7034ec3664681aa93452d;hb=3c7c46e5846a39dde8be85c131e69cab1d8cb1ec;hp=3a6de788ddb99927cdc236a0a9d0fab459e5e610;hpb=cee42b093ecb1b342236464ba5d051f08904a36e;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 3a6de78..3e6ad68 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -27,11 +27,13 @@ #include #include "freeglut_internal.h" -#include +#ifdef HAVE_ERRNO_H +# include +#endif #include -#if HAVE_VPRINTF +#ifdef HAVE_VFPRINTF # define VFPRINTF(s,f,a) vfprintf((s),(f),(a)) -#elif HAVE_DOPRNT +#elif defined(HAVE__DOPRNT) # define VFPRINTF(s,f,a) _doprnt((f),(a),(s)) #else # define VFPRINTF(s,f,a) @@ -57,7 +59,7 @@ struct GXKeyList gxKeyList; * Try to get the maximum value allowed for ints, falling back to the minimum * guaranteed by ISO C99 if there is no suitable header. */ -#if HAVE_LIMITS_H +#ifdef HAVE_LIMITS_H # include #endif #ifndef INT_MAX @@ -471,8 +473,10 @@ static void fghSleepForEvents( void ) wait.tv_usec = (msec % 1000) * 1000; err = select( socket+1, &fdset, NULL, NULL, &wait ); +#ifdef HAVE_ERRNO_H if( ( -1 == err ) && ( errno != EINTR ) ) fgWarning ( "freeglut select() error: %d", errno ); +#endif } #elif TARGET_HOST_MS_WINDOWS MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT ); @@ -976,6 +980,10 @@ void FGAPIENTRY glutMainLoopEvent( void ) switch( event.type ) { case ClientMessage: + if(fgIsSpaceballXEvent(&event)) { + fgSpaceballHandleXEvent(&event); + break; + } /* Destroy the window when the WM_DELETE_WINDOW message arrives */ if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.DeleteWindow ) { @@ -1379,6 +1387,13 @@ void FGAPIENTRY glutMainLoopEvent( void ) 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; + + case XK_Shift_L: special = GLUT_KEY_SHIFT_L; break; + case XK_Shift_R: special = GLUT_KEY_SHIFT_R; break; + case XK_Control_L: special = GLUT_KEY_CTRL_L; break; + case XK_Control_R: special = GLUT_KEY_CTRL_R; break; + case XK_Alt_L: special = GLUT_KEY_ALT_L; break; + case XK_Alt_R: special = GLUT_KEY_ALT_R; break; } /* @@ -1678,12 +1693,25 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, } break; -#if 0 + case WM_SETFOCUS: /* printf("WM_SETFOCUS: %p\n", window ); */ lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); + INVOKE_WCB( *window, Entry, ( GLUT_ENTERED ) ); + break; + + case WM_KILLFOCUS: +/* printf("WM_KILLFOCUS: %p\n", window ); */ + lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); + INVOKE_WCB( *window, Entry, ( GLUT_LEFT ) ); + + if( window->IsMenu && + window->ActiveMenu && window->ActiveMenu->IsActive ) + fgUpdateMenuHighlight( window->ActiveMenu ); + break; +#if 0 case WM_ACTIVATE: if (LOWORD(wParam) != WA_INACTIVE) { @@ -1729,20 +1757,6 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, */ return 0; - /* XXX For a future patch: we need a mouse entry event. Unfortunately Windows - * XXX doesn't give us one, so we will probably need a "MouseInWindow" flag in - * XXX the SFG_Window structure. Set it to true to begin with and then have the - * XXX WM_MOUSELEAVE code set it to false. Then when we get a WM_MOUSEMOVE event, - * XXX if the flag is false we invoke the Entry callback and set the flag to true. - */ - case 0x02a2: /* This is the message we get when the mouse is leaving the window */ - if( window->IsMenu && - window->ActiveMenu && window->ActiveMenu->IsActive ) - fgUpdateMenuHighlight( window->ActiveMenu ); - - INVOKE_WCB( *window, Entry, ( GLUT_LEFT ) ); - break ; - case WM_MOUSEMOVE: { #if defined(_WIN32_WCE)