X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffreeglut_main.c;h=6d2ec75d906f283b7256e422be4ee1ad508b87c2;hb=d3f260238533f3e30cfa730f61f5726158618bde;hp=92f86f5cfabcacee18365c660e356f1c36cc6c90;hpb=2e5dc871b7c1df472978af9811d0e97b6684707c;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 92f86f5..6d2ec75 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -653,10 +653,14 @@ void FGAPIENTRY glutMainLoopEvent( void ) event.xmotion.y ); } } - else if( window->Callbacks.Passive ) + else { - fgSetWindow ( window ) ; - window->Callbacks.Passive( event.xmotion.x, event.xmotion.y ); + if( window->Callbacks.Passive ) + { + fgSetWindow( window ); + window->Callbacks.Passive( event.xmotion.x, + event.xmotion.y ); + } } } break; @@ -790,43 +794,40 @@ void FGAPIENTRY glutMainLoopEvent( void ) if( window->Callbacks.Mouse ) fgStructure.Window->Callbacks.Mouse( button, - event.type == ButtonPress ? GLUT_DOWN : GLUT_UP, + pressed ? GLUT_DOWN : GLUT_UP, event.xbutton.x, event.xbutton.y ); } else { - if( ( button >= 4 ) && window->Callbacks.MouseWheel ) - { - /* - * Map 4 and 5 to wheel zero; EVEN to +1, ODD to -1 - * " 6 and 7 " " one; ... - * - * XXX This *should* be behind some variables/macros, - * XXX since the order and numbering isn't certain - * XXX See XFree86 configuration docs (even back in the - * XXX 3.x days, and especially with 4.x). - */ - int wheel_number = (button - 4) / 2; - int direction = (button & 1)*2 - 1; - - if( ButtonPress ) - fgStructure.Window->Callbacks.MouseWheel( - wheel_number, - direction, - event.xbutton.x, - event.xbutton.y - ); - } + /* + * Map 4 and 5 to wheel zero; EVEN to +1, ODD to -1 + * " 6 and 7 " " one; ... + * + * XXX This *should* be behind some variables/macros, + * XXX since the order and numbering isn't certain + * XXX See XFree86 configuration docs (even back in the + * XXX 3.x days, and especially with 4.x). + */ + int wheel_number = (button - 4) / 2; + int direction = (button & 1)*2 - 1; + + if( pressed ) + fgStructure.Window->Callbacks.MouseWheel( + wheel_number, + direction, + event.xbutton.x, + event.xbutton.y + ); } /* * Trash the modifiers state */ fgStructure.Window->State.Modifiers = 0xffffffff; - break; } + break; case KeyRelease: case KeyPress: @@ -1018,7 +1019,7 @@ void FGAPIENTRY glutMainLoop( void ) } { - fgExecutionState execState = fgState.ActionOnWindowClose; + fgExecutionState execState = fgState.ExecState; /* * When this loop terminates, destroy the display, state and structure @@ -1381,7 +1382,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, break; } - if ( ( window->Menu[ button ] != NULL ) && ( pressed == TRUE ) ) + if ( ( window->Menu[ button ] ) && ( pressed == TRUE ) ) { window->State.Redisplay = TRUE; fgSetWindow( window ); @@ -1410,9 +1411,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, case 0x020a: /* Should be WM_MOUSEWHEEL but my compiler doesn't recognize it */ { - int wheel_number = LOWORD( lParam ); + int wheel_number = LOWORD( wParam ); /* THIS IS SPECULATIVE -- John Fay, 10/2/03 */ - int ticks = HIWORD( lParam ) / 120; + short ticks = HIWORD( lParam ) / 120; /* Should be WHEEL_DELTA instead of 120 */ int direction = 1;