Fixing 'glutGet' processing for 'GLUT_BORDERLESS' on Windows per e-mail from Eero...
[freeglut] / src / freeglut_spaceball.c
index a36008e..7c9d073 100644 (file)
@@ -10,6 +10,8 @@
 #include <GL/freeglut.h>\r
 #include "freeglut_internal.h"\r
 \r
+/* -- PRIVATE FUNCTIONS --------------------------------------------------- */\r
+\r
 #if TARGET_HOST_POSIX_X11\r
 #include <X11/Xlib.h>\r
 \r
@@ -143,11 +145,13 @@ int fgIsSpaceballXEvent(const XEvent *xev)
 {\r
     spnav_event sev;\r
 \r
+    if(spnav_win != fgStructure.CurrentWindow) {\r
+        /* this will also initialize spaceball if needed (first call) */\r
+        fgSpaceballSetWindow(fgStructure.CurrentWindow);\r
+    }\r
+\r
     if(!sball_initialized) {\r
-        fgInitialiseSpaceball();\r
-        if(!sball_initialized) {\r
-            return 0;\r
-        }\r
+        return 0;\r
     }\r
 \r
     return spnav_x11_event(xev, &sev);\r
@@ -215,7 +219,10 @@ OF SUCH DAMAGE.
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
+\r
+#ifdef HAVE_ERRNO_H\r
 #include <errno.h>\r
+#endif\r
 \r
 #include <X11/Xlib.h>\r
 #include <X11/Xutil.h>\r