From cef996c3fac108d491a7b05c616ccc04c6851cd0 Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Wed, 4 May 2005 13:19:38 +0000 Subject: [PATCH] Changing hard-coded constant (number of mouse buttons = 3) to a \"glutDeviceGet\" call in two places under X11 git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@597 7f0cb862-5218-0410-a997-914c9d46530a --- src/freeglut_main.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 36faaf9..da5bcfe 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -777,12 +777,8 @@ void FGAPIENTRY glutMainLoopEvent( void ) fgState.Modifiers = fghGetXModifiers( &event ); - /* - * Finally execute the mouse or mouse wheel callback - * - * XXX Use a symbolic constant, *not* "4"! ("3, sire!") - */ - if( ( button < 3 ) || ( ! FETCH_WCB( *window, MouseWheel ) ) ) + /* Finally execute the mouse or mouse wheel callback */ + if( ( button < glutDeviceGet ( GLUT_NUM_MOUSE_BUTTONS ) ) || ( ! FETCH_WCB( *window, MouseWheel ) ) ) INVOKE_WCB( *window, Mouse, ( button, pressed ? GLUT_DOWN : GLUT_UP, event.xbutton.x, @@ -802,7 +798,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) * XXX Note that {button} has already been decremeted * XXX in mapping from X button numbering to GLUT. */ - int wheel_number = (button - 3) / 2; + int wheel_number = (button - glutDeviceGet ( GLUT_NUM_MOUSE_BUTTONS )) / 2; int direction = -1; if( button % 2 ) direction = 1; -- 1.7.10.4