Minor fix to allow for multiple ticks to be received at one time by the

WIN32 code.  Take abs(direction) as the number of ticks, and count it
down.

<stdlib.h> *should* be included by freeglut_internal.h, I think, so it
should be okay; otherwise add a suitable #include.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@268 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-10-30 03:20:24 +00:00
parent c2f23f0bb2
commit df711af72f

View File

@ -1461,6 +1461,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
/* THIS IS SPECULATIVE -- John Fay, 10/2/03 */ /* THIS IS SPECULATIVE -- John Fay, 10/2/03 */
int direction = HIWORD ( lParam ) / 120 ; int direction = HIWORD ( lParam ) / 120 ;
/* Should be WHEEL_DELTA instead of 120 */ /* Should be WHEEL_DELTA instead of 120 */
int ticks = abs( direction );
/* /*
* The mouse cursor has moved. Remember the new mouse cursor's position * The mouse cursor has moved. Remember the new mouse cursor's position
@ -1483,28 +1484,29 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
( ( (GetKeyState( VK_LMENU ) < 0 ) || ( ( (GetKeyState( VK_LMENU ) < 0 ) ||
( GetKeyState( VK_RMENU ) < 0 )) ? GLUT_ACTIVE_ALT : 0 ); ( GetKeyState( VK_RMENU ) < 0 )) ? GLUT_ACTIVE_ALT : 0 );
if ( window->Callbacks.MouseWheel ) while( ticks-- )
window->Callbacks.MouseWheel( if ( window->Callbacks.MouseWheel )
wheel_number, window->Callbacks.MouseWheel(
direction, wheel_number,
window->State.MouseX, direction,
window->State.MouseY window->State.MouseX,
) ; window->State.MouseY
else /* No mouse wheel, call the mouse button callback twice */ ) ;
{ else /* No mouse wheel, call the mouse button callback twice */
int button = wheel_number * 2 + 4; {
/* /*
* XXX The above assumes that you have no more than 3 mouse * XXX The below assumes that you have no more than 3 mouse
* XXX buttons. Sorry. * XXX buttons. Sorry.
*/ */
button += (1 + direction)/2; int button = wheel_number * 2 + 4;
window->Callbacks.Mouse ( button, GLUT_DOWN, button += (1 + direction)/2;
window->State.MouseX, window->Callbacks.Mouse ( button, GLUT_DOWN,
window->State.MouseY ) ; window->State.MouseX,
window->Callbacks.Mouse ( button, GLUT_UP, window->State.MouseY ) ;
window->State.MouseX, window->Callbacks.Mouse ( button, GLUT_UP,
window->State.MouseY ) ; window->State.MouseX,
} window->State.MouseY ) ;
}
fgStructure.Window->State.Modifiers = 0xffffffff; fgStructure.Window->State.Modifiers = 0xffffffff;
} }