From: Takeshi N. <tak...@us...> - 2005-05-26 09:13:15
|
Is button numbering of mouse wheel correct? In X11, freeglut maps -1 to 4, +1 to 3. In Windows, it maps -1 to 4, +1 to 5. Of cource this depends on environments, but I think there is no Windows environment acting like X11. Here is a patch to act like X11 with a little typo fix. -- Takeshi Nishimura *** freeglut-2.4.0-rc4/src/freeglut_main.c.dist 2005-05-26 02:05:22.000000000 +0000 --- freeglut-2.4.0-rc4/src/freeglut_main.c 2005-05-26 02:05:22.000000001 +0000 *************** LRESULT CALLBACK fgWindowProc( HWND hWnd *** 1475,1497 **** ) ); else /* No mouse wheel, call the mouse button callback twice */ { /* * XXX The below assumes that you have no more than 3 mouse * XXX buttons. Sorry. */ ! int button = wheel_number*2 + 4; ! if( direction > 0 ) ++button; INVOKE_WCB( *window, Mouse, ( button, GLUT_DOWN, window->State.MouseX, window->State.MouseY ) ); INVOKE_WCB( *window, Mouse, ( button, GLUT_UP, ! window->State.MouseX, window->State.MouseX ) ); } fgState.Modifiers = 0xffffffff; } --- 1475,1500 ---- ) ); else /* No mouse wheel, call the mouse button callback twice */ { /* + * Map wheel zero to button 3 and 4; +1 to 3, -1 to 4 + * " " one +1 to 5, -1 to 6, ... + * * XXX The below assumes that you have no more than 3 mouse * XXX buttons. Sorry. */ ! int button = wheel_number*2 + 3; ! if( direction < 0 ) ++button; INVOKE_WCB( *window, Mouse, ( button, GLUT_DOWN, window->State.MouseX, window->State.MouseY ) ); INVOKE_WCB( *window, Mouse, ( button, GLUT_UP, ! window->State.MouseX, window->State.MouseY ) ); } fgState.Modifiers = 0xffffffff; } |