Standard and reliable mouse-reporting with GLUT
- by Victor
Hello! I'm trying to use GLUT (freeglut) in my OpenGL application, and I need to register some callbacks for mouse wheel events. I managed to dig out a fairly undocumented function:
api documentation
But the man page and the API entry for this function both state the same thing:
Note: Due to lack of information about
the mouse, it is impossible to
implement this correctly on X at this
time. Use of this function limits the
portability of your application. (This
feature does work on X, just not
reliably.) You are encouraged to use
the standard, reliable mouse-button
reporting, rather than wheel events.
Fair enough, but how do I use this standard, reliable mouse-reporting? And how do I know which is the standard? Do I just use glutMouseFunc() and use button values like 4 and 5 for the scroll up and down values respectively, say if 1, 2 and 3 are the left, middle and right buttons? Is this the reliable method?
Bonus question: it seems the `xev' tool is reporting different values for my buttons. My mouse buttons are numbered from 1 to 5 with xev, but glut is reporting buttons from 0 to 4, i.e. an off-by-one. Is this common?