fixed spaceball button callback (x11) compatibility with original GLUT: button
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 29 Sep 2018 06:05:26 +0000 (06:05 +0000)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 29 Sep 2018 06:05:26 +0000 (06:05 +0000)
numbers should start from 1, not 0.

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1843 7f0cb862-5218-0410-a997-914c9d46530a

src/x11/fg_spaceball_x11.c

index e6eabb2..e8c328a 100644 (file)
@@ -136,7 +136,8 @@ void fgSpaceballHandleXEvent(const XEvent *xev)
             break;
 
         case SPNAV_EVENT_BUTTON:
-            INVOKE_WCB(*spnav_win, SpaceButton, (sev.button.bnum, sev.button.press ? GLUT_DOWN : GLUT_UP));
+            /* button numbers are 1-based in glutSpaceballButtonFunc */
+            INVOKE_WCB(*spnav_win, SpaceButton, (sev.button.bnum + 1, sev.button.press ? GLUT_DOWN : GLUT_UP));
             break;
 
         default: